summaryrefslogtreecommitdiffstats
path: root/twin
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2023-12-05 15:01:38 +0200
committerMavridis Philippe <mavridisf@gmail.com>2023-12-21 19:53:03 +0200
commit6b30fb07918385ab02a97c27df5e3e2954f03487 (patch)
tree4f086664593630f9e99a94395b90918f42db4907 /twin
parent6c0d9ec42e6c08afe9235995f6b19c4c72606aa8 (diff)
downloadtdebase-6b30fb07918385ab02a97c27df5e3e2954f03487.tar.gz
tdebase-6b30fb07918385ab02a97c27df5e3e2954f03487.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 <mavridisf@gmail.com>
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 )