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 <[email protected]>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user