summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Gorodnichev <[email protected]>2014-10-27 13:26:39 +0100
committerinfirit <[email protected]>2014-10-27 13:26:39 +0100
commite2f29ace20f74e1e62e80ba13d8d6bbe36d65212 (patch)
tree9ab3a153ca960f9e4820f2972f281bb53b95256a
parentaaa378feaff4331c8c78afb390f99d867ddf9b88 (diff)
downloadmarco-e2f29ace20f74e1e62e80ba13d8d6bbe36d65212.tar.bz2
marco-e2f29ace20f74e1e62e80ba13d8d6bbe36d65212.tar.xz
Fixup Gtk3 Gdk device handling
-rw-r--r--src/core/display.c15
-rw-r--r--src/ui/frames.c10
-rw-r--r--src/ui/ui.c15
3 files changed, 32 insertions, 8 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 76408930..68569f3a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -82,9 +82,10 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>
#include <gtk/gtk.h>
- #include <gdk/gdkx.h>
#endif
+#include <gdk/gdkx.h>
+
#include <string.h>
#define GRAB_OP_IS_WINDOW_SWITCH(g) \
@@ -1469,15 +1470,17 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent)
* (client-side) subwindow for individual menu items.
*/
- if (gdk_display_pointer_is_grabbed(gdk_display))
- {
- return FALSE;
- }
-
#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *device_manager = gdk_display_get_device_manager (gdk_display);
GdkDevice *device = gdk_device_manager_get_client_pointer (device_manager);
+
+ if (gdk_display_device_is_grabbed(gdk_display, device))
+#else
+ if (gdk_display_pointer_is_grabbed(gdk_display))
#endif
+ {
+ return FALSE;
+ }
switch (xevent->type)
{
diff --git a/src/ui/frames.c b/src/ui/frames.c
index d9c7ea1c..e4db182d 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -2027,7 +2027,12 @@ meta_frames_motion_notify_event (GtkWidget *widget,
MetaFrameControl control;
int x, y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_device_position (frame->window, event->device,
+ &x, &y, NULL);
+#else
gdk_window_get_pointer (frame->window, &x, &y, NULL);
+#endif
/* Control is set to none unless it matches
* the current grab
@@ -2072,7 +2077,12 @@ meta_frames_motion_notify_event (GtkWidget *widget,
MetaFrameControl control;
int x, y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_window_get_device_position (frame->window, event->device,
+ &x, &y, NULL);
+#else
gdk_window_get_pointer (frame->window, &x, &y, NULL);
+#endif
control = get_control (frames, frame, x, y);
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 3c015f0c..b187f8cb 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -95,6 +95,7 @@ maybe_redirect_mouse_event (XEvent *xevent)
MetaUI *ui;
#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *gmanager;
+ GdkDevice *gdevice;
GdkEvent *gevent;
#else
GdkEvent gevent;
@@ -132,11 +133,20 @@ maybe_redirect_mouse_event (XEvent *xevent)
if (gdk_window == NULL)
return FALSE;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gmanager = gdk_display_get_device_manager (gdisplay);
+ gdevice = gdk_device_manager_get_client_pointer (gmanager);
+#endif
+
/* If GDK already thinks it has a grab, we better let it see events; this
* is the menu-navigation case and events need to get sent to the appropriate
* (client-side) subwindow for individual menu items.
*/
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (gdk_display_device_is_grabbed (gdisplay, gdevice))
+#else
if (gdk_display_pointer_is_grabbed (gdisplay))
+#endif
return FALSE;
#if !GTK_CHECK_VERSION (3, 0, 0)
@@ -245,8 +255,7 @@ maybe_redirect_mouse_event (XEvent *xevent)
/* If we've gotten here, we've filled in the gdk_event and should send it on */
#if GTK_CHECK_VERSION (3, 0, 0)
- gmanager = gdk_display_get_device_manager (gdisplay);
- gdk_event_set_device (gevent, gdk_device_manager_get_client_pointer (gmanager)); gtk_main_do_event (gevent);
+ gdk_event_set_device (gevent, gdevice);
gdk_event_free (gevent);
#else
gtk_main_do_event (&gevent);
@@ -464,6 +473,7 @@ meta_ui_map_frame (MetaUI *ui,
GdkWindow *window;
GdkDisplay *display;
+
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
@@ -478,6 +488,7 @@ meta_ui_unmap_frame (MetaUI *ui,
GdkWindow *window;
GdkDisplay *display;
+
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);