summaryrefslogtreecommitdiff
path: root/src/core/display.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/display.c')
-rw-r--r--src/core/display.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 6f111825d..1aec6eec9 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1868,10 +1868,9 @@ get_input_event (MetaDisplay *display,
}
/**
- * event_callback:
+ * meta_display_handle_event:
+ * @display: The MetaDisplay that events are coming from
* @event: The event that just happened
- * @data: The #MetaDisplay that events are coming from, cast to a gpointer
- * so that it can be sent to a callback
*
* This is the most important function in the whole program. It is the heart,
* it is the nexus, it is the Grand Central Station of Mutter's world.
@@ -1881,21 +1880,18 @@ get_input_event (MetaDisplay *display,
* busy around here. Most of this function is a ginormous switch statement
* dealing with all the kinds of events that might turn up.
*/
-static gboolean
-event_callback (XEvent *event,
- gpointer data)
+gboolean
+meta_display_handle_event (MetaDisplay *display,
+ XEvent *event)
{
MetaWindow *window;
MetaWindow *property_for_window;
- MetaDisplay *display;
Window modified;
gboolean frame_was_receiver;
gboolean bypass_compositor;
gboolean filter_out_event;
XIEvent *input_event;
- display = data;
-
#ifdef WITH_VERBOSE_MODE
if (dump_events)
meta_spew_event (display, event);
@@ -2392,6 +2388,14 @@ event_callback (XEvent *event,
}
break;
case XI_FocusIn:
+#ifdef HAVE_WAYLAND
+ {
+ MetaWaylandCompositor *compositor =
+ meta_wayland_compositor_get_default ();
+ meta_wayland_compositor_set_input_focus (compositor, window);
+ }
+#endif
+ /* fall through */
case XI_FocusOut:
if (window)
{
@@ -2967,6 +2971,30 @@ event_callback (XEvent *event,
return filter_out_event;
}
+static gboolean
+event_callback (XEvent *event,
+ gpointer data)
+{
+ MetaDisplay *display = data;
+
+ /* Under Wayland we want to filter out mouse motion events so we can
+ synthesize them from the Clutter events instead. This is
+ necessary because the position in the mouse events is passed to
+ the X server relative to the position of the surface. The X
+ server then translates these back to screen coordinates based on
+ the window position. If we rely on this translatation when
+ dragging a window around then the window will jump around
+ erratically because of the lag between updating the window
+ position from the surface position. Instead we bypass the
+ translation altogether by directly using the Clutter events */
+#ifdef HAVE_WAYLAND
+ if (event->type == MotionNotify)
+ return FALSE;
+#endif
+
+ return meta_display_handle_event (display, event);
+}
+
/* Return the window this has to do with, if any, rather
* than the frame or root window that was selecting
* for substructure