wayland: Make the function to get the last serial a seat one
This will be useful for primary selection. https://bugzilla.gnome.org/show_bug.cgi?id=762561
This commit is contained in:
		@ -3021,20 +3021,22 @@ _gdk_wayland_device_get_implicit_grab_serial (GdkWaylandDevice *device,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t
 | 
			
		||||
_gdk_wayland_device_get_last_implicit_grab_serial (GdkWaylandDevice  *device,
 | 
			
		||||
                                                   GdkEventSequence **sequence)
 | 
			
		||||
_gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat           *seat,
 | 
			
		||||
                                                 GdkEventSequence **sequence)
 | 
			
		||||
{
 | 
			
		||||
  GdkWaylandSeat *wayland_seat;
 | 
			
		||||
  GdkWaylandTouchData *touch;
 | 
			
		||||
  GHashTableIter iter;
 | 
			
		||||
  uint32_t serial = 0;
 | 
			
		||||
 | 
			
		||||
  g_hash_table_iter_init (&iter, device->device->touches);
 | 
			
		||||
  wayland_seat = GDK_WAYLAND_SEAT (seat);
 | 
			
		||||
  g_hash_table_iter_init (&iter, wayland_seat->touches);
 | 
			
		||||
 | 
			
		||||
  if (sequence)
 | 
			
		||||
    *sequence = NULL;
 | 
			
		||||
 | 
			
		||||
  if (device->device->button_press_serial > serial)
 | 
			
		||||
    serial = device->device->button_press_serial;
 | 
			
		||||
  if (wayland_seat->button_press_serial > serial)
 | 
			
		||||
    serial = wayland_seat->button_press_serial;
 | 
			
		||||
 | 
			
		||||
  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -184,8 +184,8 @@ void              _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *dev
 | 
			
		||||
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
 | 
			
		||||
uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
 | 
			
		||||
                                                      const GdkEvent   *event);
 | 
			
		||||
uint32_t _gdk_wayland_device_get_last_implicit_grab_serial (GdkWaylandDevice  *device,
 | 
			
		||||
                                                            GdkEventSequence **seqence);
 | 
			
		||||
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat           *seat,
 | 
			
		||||
                                                          GdkEventSequence **seqence);
 | 
			
		||||
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
 | 
			
		||||
void gdk_wayland_device_set_selection (GdkDevice             *gdk_device,
 | 
			
		||||
                                       struct wl_data_source *source);
 | 
			
		||||
 | 
			
		||||
@ -1316,8 +1316,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow      *window,
 | 
			
		||||
  GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
 | 
			
		||||
  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
 | 
			
		||||
  GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
 | 
			
		||||
  GdkWaylandDevice *device;
 | 
			
		||||
  GdkSeat *gdk_seat;
 | 
			
		||||
  guint32 serial;
 | 
			
		||||
  int x, y;
 | 
			
		||||
  int parent_x, parent_y;
 | 
			
		||||
 | 
			
		||||
@ -1328,18 +1328,16 @@ gdk_wayland_window_create_xdg_popup (GdkWindow      *window,
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
 | 
			
		||||
  device = GDK_WAYLAND_DEVICE (gdk_seat_get_pointer (gdk_seat));
 | 
			
		||||
 | 
			
		||||
  gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);
 | 
			
		||||
 | 
			
		||||
  x = window->x - parent_x;
 | 
			
		||||
  y = window->y - parent_y;
 | 
			
		||||
  serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_seat, NULL);
 | 
			
		||||
 | 
			
		||||
  impl->display_server.xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
 | 
			
		||||
                                             impl->display_server.wl_surface,
 | 
			
		||||
                                             parent_impl->display_server.wl_surface,
 | 
			
		||||
                                             seat,
 | 
			
		||||
                                             _gdk_wayland_device_get_last_implicit_grab_serial (device, NULL),
 | 
			
		||||
                                             seat, serial,
 | 
			
		||||
                                             x, y);
 | 
			
		||||
 | 
			
		||||
  xdg_popup_add_listener (impl->display_server.xdg_popup, &xdg_popup_listener, window);
 | 
			
		||||
@ -2455,8 +2453,8 @@ gdk_wayland_window_begin_resize_drag (GdkWindow     *window,
 | 
			
		||||
  if (!impl->display_server.xdg_surface)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device),
 | 
			
		||||
                                                              &sequence);
 | 
			
		||||
  serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_device_get_seat (device),
 | 
			
		||||
                                                            &sequence);
 | 
			
		||||
 | 
			
		||||
  xdg_surface_resize (impl->display_server.xdg_surface,
 | 
			
		||||
                      gdk_wayland_device_get_wl_seat (device),
 | 
			
		||||
@ -2492,8 +2490,8 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
 | 
			
		||||
  if (!impl->display_server.xdg_surface)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  serial = _gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device),
 | 
			
		||||
                                                              &sequence);
 | 
			
		||||
  serial = _gdk_wayland_seat_get_last_implicit_grab_serial (gdk_device_get_seat (device),
 | 
			
		||||
                                                            &sequence);
 | 
			
		||||
  xdg_surface_move (impl->display_server.xdg_surface,
 | 
			
		||||
                    gdk_wayland_device_get_wl_seat (device),
 | 
			
		||||
                    serial);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user