mirror of
https://github.com/brl/mutter.git
synced 2025-07-03 09:43:18 +00:00
Pass button_rect when opening window menu from button
When opening the window menu without an associated control - e.g. by right-clicking the titlebar or by keyboard - using coordinates for the menu position is appropriate. However when the menu is associated with a window button, the expected behavior in the shell can be implemented much easier with the full button geometry: the menu will point to the center of the button's bottom edge rather than align to the left/right side of the titlebar as it does now, and the clickable area where a release event does not dismiss the menu will match the actual clickable area in mutter. So add an additional show_window_menu_for_rect() function and use it when opening the menu from a button. https://bugzilla.gnome.org/show_bug.cgi?id=731058
This commit is contained in:
@ -1218,30 +1218,31 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
{
|
||||
MetaFrameGeometry fgeom;
|
||||
GdkRectangle *rect;
|
||||
MetaRectangle root_rect;
|
||||
MetaWindowMenuType menu;
|
||||
int dx, dy;
|
||||
int win_x, win_y;
|
||||
|
||||
meta_frames_calc_geometry (frames, frame, &fgeom);
|
||||
|
||||
rect = control_rect (control, &fgeom);
|
||||
|
||||
/* get delta to convert to root coords */
|
||||
dx = event->x_root - event->x;
|
||||
dy = event->y_root - event->y;
|
||||
/* convert to root coords */
|
||||
win_x = event->x_root - event->x;
|
||||
win_y = event->y_root - event->y;
|
||||
|
||||
/* Align to the right end of the menu rectangle if RTL */
|
||||
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||
dx += rect->width;
|
||||
root_rect.x = win_x + rect->x;
|
||||
root_rect.y = win_y + rect->y;
|
||||
root_rect.width = rect->width;
|
||||
root_rect.height = rect->height;
|
||||
|
||||
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
||||
: META_WINDOW_MENU_APP;
|
||||
|
||||
meta_core_show_window_menu (display,
|
||||
frame->xwindow,
|
||||
menu,
|
||||
rect->x + dx,
|
||||
rect->y + rect->height + dy,
|
||||
event->time);
|
||||
meta_core_show_window_menu_for_rect (display,
|
||||
frame->xwindow,
|
||||
menu,
|
||||
&root_rect,
|
||||
event->time);
|
||||
}
|
||||
}
|
||||
else if (event->button == 1 &&
|
||||
|
Reference in New Issue
Block a user