mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
Filter out events handled before the plugin before they get GTK+
Fix a problem where GTK+ was warning 'gdk_window_set_user_time called on non-toplevel' for every button press and click on the mutter stage by excluding such events from GTK+ processing. Add a boolean return value to meta_compositor_process_event that indicates whether the event has been handled and should be filtered out of the event stream and for mutter, base that on the return value of the plugin's xevent_filter vfunc.
This commit is contained in:
parent
e5fc168a46
commit
e083742426
@ -39,9 +39,9 @@ struct _MetaCompositor
|
||||
void (*set_updates) (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
gboolean update);
|
||||
void (*process_event) (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window);
|
||||
gboolean (*process_event) (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window);
|
||||
Pixmap (*get_window_pixmap) (MetaCompositor *compositor,
|
||||
MetaWindow *window);
|
||||
void (*set_active_window) (MetaCompositor *compositor,
|
||||
|
@ -2391,14 +2391,14 @@ process_destroy (MetaCompositorXRender *compositor,
|
||||
destroy_win (compositor->display, event->window, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
process_damage (MetaCompositorXRender *compositor,
|
||||
XDamageNotifyEvent *event)
|
||||
{
|
||||
MetaCompWindow *cw = find_window_in_display (compositor->display,
|
||||
event->drawable);
|
||||
if (cw == NULL)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
repair_win (cw);
|
||||
|
||||
@ -2406,6 +2406,8 @@ process_damage (MetaCompositorXRender *compositor,
|
||||
if (event->more == FALSE)
|
||||
add_repair (compositor->display);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2737,7 +2739,7 @@ xrender_free_window (MetaCompositor *compositor,
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
xrender_process_event (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window)
|
||||
@ -2798,7 +2800,7 @@ xrender_process_event (MetaCompositor *compositor,
|
||||
else
|
||||
{
|
||||
meta_error_trap_pop (xrc->display, FALSE);
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2808,7 +2810,7 @@ xrender_process_event (MetaCompositor *compositor,
|
||||
repair_display (xrc->display);
|
||||
#endif
|
||||
|
||||
return;
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -106,14 +106,16 @@ meta_compositor_set_updates (MetaCompositor *compositor,
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
meta_compositor_process_event (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window)
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
if (compositor && compositor->process_event)
|
||||
compositor->process_event (compositor, event, window);
|
||||
return compositor->process_event (compositor, event, window);
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1748,7 +1748,7 @@ clutter_cmp_set_updates (MetaCompositor *compositor,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
clutter_cmp_process_event (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window)
|
||||
@ -1764,11 +1764,10 @@ clutter_cmp_process_event (MetaCompositor *compositor,
|
||||
screen = meta_window_get_screen (window);
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (mutter_plugin_manager_xevent_filter (info->plugin_mgr,
|
||||
event) == TRUE)
|
||||
if (mutter_plugin_manager_xevent_filter (info->plugin_mgr, event))
|
||||
{
|
||||
DEBUG_TRACE ("clutter_cmp_process_event (filtered,window==NULL)\n");
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1785,11 +1784,10 @@ clutter_cmp_process_event (MetaCompositor *compositor,
|
||||
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (mutter_plugin_manager_xevent_filter (info->plugin_mgr,
|
||||
event) == TRUE)
|
||||
if (mutter_plugin_manager_xevent_filter (info->plugin_mgr, event))
|
||||
{
|
||||
DEBUG_TRACE ("clutter_cmp_process_event (filtered,window==NULL)\n");
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
l = l->next;
|
||||
@ -1828,6 +1826,11 @@ clutter_cmp_process_event (MetaCompositor *compositor,
|
||||
|
||||
meta_error_trap_pop (xrc->display, FALSE);
|
||||
|
||||
/* The above handling is basically just "observing" the events, so we return
|
||||
* FALSE to indicate that the event should not be filtered out; if we have
|
||||
* GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
|
||||
*/
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2424,9 +2424,10 @@ event_callback (XEvent *event,
|
||||
|
||||
if (display->compositor)
|
||||
{
|
||||
meta_compositor_process_event (display->compositor,
|
||||
event,
|
||||
window);
|
||||
if (meta_compositor_process_event (display->compositor,
|
||||
event,
|
||||
window))
|
||||
filter_out_event = TRUE;
|
||||
}
|
||||
|
||||
display->current_time = CurrentTime;
|
||||
|
@ -73,9 +73,9 @@ void meta_compositor_set_updates (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
gboolean updates);
|
||||
|
||||
void meta_compositor_process_event (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window);
|
||||
gboolean meta_compositor_process_event (MetaCompositor *compositor,
|
||||
XEvent *event,
|
||||
MetaWindow *window);
|
||||
Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor,
|
||||
MetaWindow *window);
|
||||
void meta_compositor_set_active_window (MetaCompositor *compositor,
|
||||
|
Loading…
Reference in New Issue
Block a user