compositor: Use helper functions for input events

This commit is contained in:
Carlos Garnacho 2011-06-11 18:51:51 +02:00
parent 36e237cf1e
commit 5819e74c22

View File

@ -18,6 +18,7 @@
#include "meta-background-actor.h" #include "meta-background-actor.h"
#include "window-private.h" /* to check window->hidden */ #include "window-private.h" /* to check window->hidden */
#include "display-private.h" /* for meta_display_lookup_x_window() */ #include "display-private.h" /* for meta_display_lookup_x_window() */
#include "input-events.h"
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
@ -658,9 +659,15 @@ meta_compositor_set_updates (MetaCompositor *compositor,
} }
static gboolean static gboolean
is_grabbed_event (XEvent *event) is_grabbed_event (MetaDisplay *display,
XEvent *event)
{ {
switch (event->xany.type) guint evtype;
if (!meta_input_event_get_type (display, event, &evtype))
return FALSE;
switch (evtype)
{ {
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
@ -683,7 +690,8 @@ meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event, XEvent *event,
MetaWindow *window) MetaWindow *window)
{ {
if (compositor->modal_plugin && is_grabbed_event (event)) if (compositor->modal_plugin &&
is_grabbed_event (compositor->display, event))
{ {
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (compositor->modal_plugin); MetaPluginClass *klass = META_PLUGIN_GET_CLASS (compositor->modal_plugin);