mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05: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
|
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
||||||
: META_WINDOW_MENU_APP;
|
: 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,
|
meta_core_show_window_menu_for_rect (display,
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
menu,
|
menu,
|
||||||
@ -1933,6 +1938,8 @@ meta_frames_enter_notify_event (GtkWidget *widget,
|
|||||||
if (frame == NULL)
|
if (frame == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
frame->maybe_ignore_leave_notify = FALSE;
|
||||||
|
|
||||||
control = get_control (frames, frame, event->x, event->y);
|
control = get_control (frames, frame, event->x, event->y);
|
||||||
meta_frames_update_prelit_control (frames, frame, control);
|
meta_frames_update_prelit_control (frames, frame, control);
|
||||||
|
|
||||||
@ -1945,6 +1952,8 @@ meta_frames_leave_notify_event (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
MetaUIFrame *frame;
|
MetaUIFrame *frame;
|
||||||
MetaFrames *frames;
|
MetaFrames *frames;
|
||||||
|
Display *display;
|
||||||
|
MetaGrabOp grab_op;
|
||||||
|
|
||||||
frames = META_FRAMES (widget);
|
frames = META_FRAMES (widget);
|
||||||
|
|
||||||
@ -1952,6 +1961,18 @@ meta_frames_leave_notify_event (GtkWidget *widget,
|
|||||||
if (frame == NULL)
|
if (frame == NULL)
|
||||||
return FALSE;
|
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);
|
meta_frames_update_prelit_control (frames, frame, META_FRAME_CONTROL_NONE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -80,6 +80,7 @@ struct _MetaUIFrame
|
|||||||
int text_height;
|
int text_height;
|
||||||
char *title; /* NULL once we have a layout */
|
char *title; /* NULL once we have a layout */
|
||||||
guint shape_applied : 1;
|
guint shape_applied : 1;
|
||||||
|
guint maybe_ignore_leave_notify : 1;
|
||||||
|
|
||||||
/* FIXME get rid of this, it can just be in the MetaFrames struct */
|
/* FIXME get rid of this, it can just be in the MetaFrames struct */
|
||||||
MetaFrameControl prelit_control;
|
MetaFrameControl prelit_control;
|
||||||
|
Loading…
Reference in New Issue
Block a user