diff options
author | Stefano Karapetsas <[email protected]> | 2014-03-22 16:31:41 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-03-22 16:31:41 +0100 |
commit | d07a3960e9b81aaf9864902e5398eadf801a531b (patch) | |
tree | 79698da2771e4a5b3f0031ccc7cfc640f4821b6e /src/core/display.c | |
parent | a152b0ec9d2e58a303f94de7765b0febcc9e5f94 (diff) | |
download | marco-d07a3960e9b81aaf9864902e5398eadf801a531b.tar.bz2 marco-d07a3960e9b81aaf9864902e5398eadf801a531b.tar.xz |
Revert "gtk3: set event device"
This reverts commit b6ee7f8d6cb49b7b87c073695f50a0576f42a599.
Diffstat (limited to 'src/core/display.c')
-rw-r--r-- | src/core/display.c | 82 |
1 files changed, 20 insertions, 62 deletions
diff --git a/src/core/display.c b/src/core/display.c index 2fdf6bfd..d950e7ea 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1429,7 +1429,7 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent) { /* We're always using the default display */ GdkDisplay* gdk_display = gdk_display_get_default(); - GdkEvent* gdk_event = NULL; + GdkEvent gdk_event; GdkWindow* gdk_window; Window window; @@ -1475,10 +1475,7 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent) 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); -#endif + memset(&gdk_event, 0, sizeof(gdk_event)); switch (xevent->type) { @@ -1505,12 +1502,13 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent) ABS(xevent->xbutton.x - display->button_click_x) <= double_click_distance && ABS (xevent->xbutton.y - display->button_click_y) <= double_click_distance) { - gdk_event = gdk_event_new(GDK_2BUTTON_PRESS); + + gdk_event.button.type = GDK_2BUTTON_PRESS; display->button_click_number = 0; } else { - gdk_event = gdk_event_new(GDK_BUTTON_PRESS); + gdk_event.button.type = GDK_BUTTON_PRESS; display->button_click_number = xevent->xbutton.button; display->button_click_window = xevent->xbutton.window; display->button_click_time = xevent->xbutton.time; @@ -1520,80 +1518,40 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent) } else { - gdk_event = gdk_event_new(GDK_BUTTON_RELEASE); + gdk_event.button.type = GDK_BUTTON_RELEASE; } -#if GTK_CHECK_VERSION (3, 0, 0) - gdk_event->button.window = g_object_ref(gdk_window); -#else - gdk_event->button.window = gdk_window; -#endif - gdk_event->button.send_event = 0; - gdk_event->button.axes = NULL; - gdk_event->button.state = 0; - gdk_event->button.device = NULL; - gdk_event->button.button = xevent->xbutton.button; - gdk_event->button.time = xevent->xbutton.time; - gdk_event->button.x = xevent->xbutton.x; - gdk_event->button.y = xevent->xbutton.y; - gdk_event->button.x_root = xevent->xbutton.x_root; - gdk_event->button.y_root = xevent->xbutton.y_root; + gdk_event.button.window = gdk_window; + gdk_event.button.button = xevent->xbutton.button; + gdk_event.button.time = xevent->xbutton.time; + gdk_event.button.x = xevent->xbutton.x; + gdk_event.button.y = xevent->xbutton.y; + gdk_event.button.x_root = xevent->xbutton.x_root; + gdk_event.button.y_root = xevent->xbutton.y_root; break; case MotionNotify: - gdk_event = gdk_event_new(GDK_MOTION_NOTIFY); -#if GTK_CHECK_VERSION (3, 0, 0) - gdk_event->motion.window = g_object_ref(gdk_window); -#else - gdk_event->motion.window = gdk_window; -#endif - gdk_event->motion.send_event = FALSE; - gdk_event->motion.time = 0; - gdk_event->motion.x = 0; - gdk_event->motion.y = 0; - gdk_event->motion.axes = NULL; - gdk_event->motion.state = 0; - gdk_event->motion.is_hint = 0; - gdk_event->motion.device = NULL; - gdk_event->motion.x_root = 0; - gdk_event->motion.y_root = 0; + gdk_event.motion.type = GDK_MOTION_NOTIFY; + gdk_event.motion.window = gdk_window; break; case EnterNotify: case LeaveNotify: - gdk_event = gdk_event_new(xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY); -#if GTK_CHECK_VERSION(3, 0, 0) - gdk_event->crossing.window = g_object_ref(gdk_window); -#else - gdk_event->crossing.window = gdk_window; -#endif - gdk_event->crossing.send_event = 0; - gdk_event->crossing.subwindow = NULL; - gdk_event->crossing.time = 0; - gdk_event->crossing.x = xevent->xcrossing.x; - gdk_event->crossing.y = xevent->xcrossing.y; - gdk_event->crossing.x_root = 0; - gdk_event->crossing.y_root = 0; - gdk_event->crossing.mode = 0; - gdk_event->crossing.detail = 0; - gdk_event->crossing.focus = FALSE; - gdk_event->crossing.state = 0; + gdk_event.crossing.type = xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY; + gdk_event.crossing.window = gdk_window; + gdk_event.crossing.x = xevent->xcrossing.x; + gdk_event.crossing.y = xevent->xcrossing.y; break; default: g_assert_not_reached(); break; } -#if GTK_CHECK_VERSION (3, 0, 0) - gdk_event_set_device (gdk_event, device); -#endif /* If we've gotten here, we've filled in the gdk_event and should send it on */ - gtk_main_do_event(gdk_event); - - gdk_event_free(gdk_event); + gtk_main_do_event(&gdk_event); return TRUE; } |