summaryrefslogtreecommitdiffstats
path: root/twin
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2023-12-05 15:01:38 +0200
committerMavridis Philippe <[email protected]>2023-12-21 19:55:29 +0200
commit8447a9a65c165b4ad998e5d80529174e6f73903d (patch)
tree2fbb95303a4ce07dfea3d8840e80c7ddfa4a4e26 /twin
parente67f30eb1f9c033d765fbae20eacc30d60ed4095 (diff)
downloadtdebase-8447a9a65c165b4ad998e5d80529174e6f73903d.tar.gz
tdebase-8447a9a65c165b4ad998e5d80529174e6f73903d.zip
TWin showWindowMenu: add support for negative coordinates
Negative coordinates change the popup menu origins: * Negative X: origin is right edge instead of left; * Negative Y: origin is bottom edge instead of top. Signed-off-by: Mavridis Philippe <[email protected]> (cherry picked from commit 6b30fb07918385ab02a97c27df5e3e2954f03487)
Diffstat (limited to 'twin')
-rw-r--r--twin/useractions.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/twin/useractions.cpp b/twin/useractions.cpp
index 2c6bc0a7a..1bcd2dafa 100644
--- a/twin/useractions.cpp
+++ b/twin/useractions.cpp
@@ -652,7 +652,6 @@ void Workspace::showWindowMenuAt( unsigned long window, int x, int y )
Client *client;
if ((client = findClient(WindowMatchPredicate((WId)window))))
showWindowMenu( x, y, client );
-
}
void Workspace::slotActivateAttentionWindow()
@@ -1072,17 +1071,21 @@ void Workspace::showWindowMenu( const TQRect &pos, Client* cl )
active_popup = p;
int x = pos.left();
int y = pos.bottom();
- if (y == pos.top())
- p->exec( TQPoint( x, y ) );
+ clientPopupAboutToShow(); // needed for sizeHint() to be correct :-/
+
+ TQRect area = clientArea(ScreenArea, TQPoint(x, y), currentDesktop());
+ TQSize hint = p->sizeHint();
+ if (x < 0) x = area.right() - hint.width() + x;
+ if (y < 0) y = area.bottom() - hint.height() + y;
+
+ if (pos.bottom() == pos.top())
+ p->exec( TQPoint( x, y ) );
else
{
- TQRect area = clientArea(ScreenArea, TQPoint(x, y), currentDesktop());
- clientPopupAboutToShow(); // needed for sizeHint() to be correct :-/
- int popupHeight = p->sizeHint().height();
- if (y + popupHeight < area.height())
- p->exec( TQPoint( x, y ) );
- else
- p->exec( TQPoint( x, pos.top() - popupHeight ) );
+ if (y + hint.height() < area.height())
+ p->exec( TQPoint( x, y ) );
+ else
+ p->exec( TQPoint( x, pos.top() - hint.height() ) );
}
// active popup may be already changed (e.g. the window shortcut dialog)
if( active_popup == p )