hrev53463 adds 1 changeset to branch 'master'
old head: 39ba92c8bb298f9bac7cc0c7b891dbc592260a6b
new head: 857799062053e8d56356d9c38d9088244bd6d04f
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=857799062053+%5E39ba92c8bb29
----------------------------------------------------------------------------
857799062053: Mail: Better placement of signature menu
When clicking the "Signature" button in the toolbar, no mouse
coordinates are available. The current hack is to open the menu
in the center of the tool bar, which is normally no way near
where the user has clicked the button. Not nice.
Change that to find the button coordinates and place the menu a bit
to the left of its center (so chances are the menu pops up already
under the mouse).
Fall back to the old hack, if the signature button wasn't found for
some reason...
Change-Id: I8fb5dbe4e2d394768a685fda0dc71d3cb2c5961d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1836
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ Humdinger <humdingerb@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53463
Commit: 857799062053e8d56356d9c38d9088244bd6d04f
URL: https://git.haiku-os.org/haiku/commit/?id=857799062053
Author: Humdinger <humdingerb@xxxxxxxxx>
Date: Thu Sep 5 13:04:58 2019 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Sep 7 15:03:50 2019 UTC
----------------------------------------------------------------------------
1 file changed, 10 insertions(+), 4 deletions(-)
src/apps/mail/MailWindow.cpp | 14 ++++++++++----
----------------------------------------------------------------------------
diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index d76369255d..c41c5087e7 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -1522,10 +1522,16 @@ TMailWindow::MessageReceived(BMessage* msg)
BPoint where;
if (msg->FindPoint("where", &where) != B_OK) {
- BRect bounds = fToolBar->Bounds();
- where = fToolBar->ConvertToScreen(BPoint(
- (bounds.right - bounds.left) / 2,
- (bounds.bottom - bounds.top) / 2));
+ BRect rect;
+ BButton* button =
fToolBar->FindButton(M_SIG_MENU);
+ if (button != NULL)
+ rect = button->Frame();
+ else
+ rect = fToolBar->Bounds();
+
+ where = button->ConvertToScreen(BPoint(
+ ((rect.right - rect.left) / 2) - 16,
+ (rect.bottom - rect.top) / 2));
}
if ((item = menu->Go(where, false, true)) != NULL) {