mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
frames: Fix pressed state of window menu buttons
Since window menus have been moved to the compositor, the pressed state of the corresponding window buttons is messed up, as it is reset immediately when getting a LeaveNotify event due to the compositor taking a grab. Fix this by ignoring that particular event. https://bugzilla.gnome.org/show_bug.cgi?id=731058
This commit is contained in:
parent
b64548ee1f
commit
e2105dc721
@ -1238,6 +1238,11 @@ meta_frames_button_press_event (GtkWidget *widget,
|
||||
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
||||
: META_WINDOW_MENU_APP;
|
||||
|
||||
/* if the compositor takes a grab for showing the menu, we will
|
||||
* get a LeaveNotify event we want to ignore, to keep the pressed
|
||||
* button state while the menu is open
|
||||
*/
|
||||
frame->maybe_ignore_leave_notify = TRUE;
|
||||
meta_core_show_window_menu_for_rect (display,
|
||||
frame->xwindow,
|
||||
menu,
|
||||
@ -1933,6 +1938,8 @@ meta_frames_enter_notify_event (GtkWidget *widget,
|
||||
if (frame == NULL)
|
||||
return FALSE;
|
||||
|
||||
frame->maybe_ignore_leave_notify = FALSE;
|
||||
|
||||
control = get_control (frames, frame, event->x, event->y);
|
||||
meta_frames_update_prelit_control (frames, frame, control);
|
||||
|
||||
@ -1945,6 +1952,8 @@ meta_frames_leave_notify_event (GtkWidget *widget,
|
||||
{
|
||||
MetaUIFrame *frame;
|
||||
MetaFrames *frames;
|
||||
Display *display;
|
||||
MetaGrabOp grab_op;
|
||||
|
||||
frames = META_FRAMES (widget);
|
||||
|
||||
@ -1952,6 +1961,18 @@ meta_frames_leave_notify_event (GtkWidget *widget,
|
||||
if (frame == NULL)
|
||||
return FALSE;
|
||||
|
||||
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
grab_op = meta_core_get_grab_op (display);
|
||||
|
||||
/* ignore the first LeaveNotify event after opening a window menu
|
||||
* if it is the result of a compositor grab
|
||||
*/
|
||||
frame->maybe_ignore_leave_notify = frame->maybe_ignore_leave_notify &&
|
||||
grab_op == META_GRAB_OP_COMPOSITOR;
|
||||
|
||||
if (frame->maybe_ignore_leave_notify)
|
||||
return FALSE;
|
||||
|
||||
meta_frames_update_prelit_control (frames, frame, META_FRAME_CONTROL_NONE);
|
||||
|
||||
return TRUE;
|
||||
|
@ -80,6 +80,7 @@ struct _MetaUIFrame
|
||||
int text_height;
|
||||
char *title; /* NULL once we have a layout */
|
||||
guint shape_applied : 1;
|
||||
guint maybe_ignore_leave_notify : 1;
|
||||
|
||||
/* FIXME get rid of this, it can just be in the MetaFrames struct */
|
||||
MetaFrameControl prelit_control;
|
||||
|
Loading…
Reference in New Issue
Block a user