wayland: Pass most recent button press serial to set_popup_surface

This commit is contained in:
Kristian Høgsberg 2013-03-27 13:21:54 -04:00
parent 9cc64579c2
commit fc713dffb3
3 changed files with 15 additions and 6 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);
}