[gtk+] wayland: Pass most recent button press serial to set_popup_surface



commit fc713dffb3c66bdf61f6c68b14c4655477b8e924
Author: Kristian Høgsberg <krh bitplanet net>
Date:   Wed Mar 27 13:21:54 2013 -0400

    wayland: Pass most recent button press serial to set_popup_surface

 gdk/wayland/gdkdevice-wayland.c  |   11 +++++++++--
 gdk/wayland/gdkprivate-wayland.h |    3 +++
 gdk/wayland/gdkwindow-wayland.c  |    7 +++----
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 31e47d0..2c14bc1 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -37,8 +37,6 @@
 #include <sys/time.h>
 #include <sys/mman.h>
 
-typedef struct _GdkWaylandDeviceData GdkWaylandDeviceData;
-
 typedef struct _DataOffer DataOffer;
 
 typedef struct _GdkWaylandSelectionOffer GdkWaylandSelectionOffer;
@@ -65,6 +63,7 @@ struct _GdkWaylandDeviceData
   double surface_x, surface_y;
   uint32_t time;
   uint32_t enter_serial;
+  uint32_t button_press_serial;
   GdkWindow *pointer_grab_window;
   uint32_t pointer_grab_time;
   guint32 repeat_timer;
@@ -696,6 +695,8 @@ pointer_handle_button (void              *data,
   }
 
   device->time = time;
+  if (state)
+    device->button_press_serial = serial;
 
   event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
   event->button.window = g_object_ref (device->pointer_focus);
@@ -1351,6 +1352,12 @@ _gdk_wayland_device_manager_new (GdkDisplay *display)
                        NULL);
 }
 
+uint32_t
+_gdk_wayland_device_get_button_press_serial(GdkWaylandDeviceData *device)
+{
+  return device->button_press_serial;
+}
+
 gint
 gdk_wayland_device_get_selection_type_atoms (GdkDevice  *gdk_device,
                                              GdkAtom   **atoms_out)
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 5ed4ce4..4dcc80c 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -138,7 +138,10 @@ void              _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device
 void              _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *device_manager,
                                                            guint32           id);
 
+typedef struct _GdkWaylandDeviceData GdkWaylandDeviceData;
+
 GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
+uint32_t _gdk_wayland_device_get_button_press_serial(GdkWaylandDeviceData *device);
 
 void     _gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event);
 GSource *_gdk_wayland_display_event_source_new (GdkDisplay *display);
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 8f824ed..fbf873d 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -563,8 +563,6 @@ gdk_wayland_window_map (GdkWindow *window)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
   GdkWindowImplWayland *parent;
-  GdkWaylandDisplay *wayland_display =
-    GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
   GdkWindow *transient_for;
 
   if (!impl->mapped && !impl->use_custom_surface)
@@ -591,6 +589,7 @@ gdk_wayland_window_map (GdkWindow *window)
         {
           struct wl_seat *grab_input_seat = NULL;
           GdkWindowImplWayland *tmp_impl;
+          GdkWaylandDeviceData *device;
 
           parent = GDK_WINDOW_IMPL_WAYLAND (transient_for->impl);
 
@@ -616,10 +615,10 @@ gdk_wayland_window_map (GdkWindow *window)
                impl->hint == GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU ||
                impl->hint == GDK_WINDOW_TYPE_HINT_COMBO))
             {
-
+              device = wl_seat_get_user_data(grab_input_seat);
               wl_shell_surface_set_popup (impl->shell_surface,
                                           grab_input_seat,
-                                          _gdk_wayland_display_get_serial (wayland_display),
+                                          _gdk_wayland_device_get_button_press_serial(device),
                                           parent->surface,
                                           window->x, window->y, 0);
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]