wayland: Use wl_seat_get_version()
authorBenjamin Otte <otte@redhat.com>
Sat, 1 Apr 2023 00:21:47 +0000 (02:21 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 1 Apr 2023 00:22:21 +0000 (02:22 +0200)
gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkdisplay-wayland.h
gdk/wayland/gdkseat-wayland.c

index 5209f006a67bfd58f45355f05d489bc6666ff0e9..5a5533badbd807c90493ce23c579a238f55ef61e 100644 (file)
@@ -235,10 +235,9 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
 {
   struct wl_seat *seat;
 
-  display_wayland->seat_version = MIN (version, 8);
   seat = wl_registry_bind (display_wayland->wl_registry,
                            id, &wl_seat_interface,
-                           display_wayland->seat_version);
+                           MIN (version, 8));
   _gdk_wayland_display_create_seat (display_wayland, id, seat);
   _gdk_wayland_display_async_roundtrip (display_wayland);
 }
index 2ab79b18ce65724e792a1390f4e367035ad8f691..332e30259d2f2e46348c77d81202412244524e3d 100644 (file)
@@ -133,8 +133,6 @@ struct _GdkWaylandDisplay
 
   GSource *event_source;
 
-  int seat_version;
-
   uint32_t server_decoration_mode;
 
   struct xkb_context *xkb_context;
index eb3c0cfb33952b0b2ae498cf16a1396dd3f2d970..dcef036ea975006ffc1c29ee7cbc9165a58e4cfb 100644 (file)
@@ -523,7 +523,6 @@ flush_discrete_scroll_event (GdkWaylandSeat     *seat,
                              gint                value120_x,
                              gint                value120_y)
 {
-  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
   GdkEvent *event = NULL;
   GdkDevice *source;
   GdkScrollDirection direction;
@@ -539,7 +538,7 @@ flush_discrete_scroll_event (GdkWaylandSeat     *seat,
 
   source = get_scroll_device (seat, seat->pointer_info.frame.source);
 
-  if (display_wayland->seat_version >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION)
+  if (wl_seat_get_version (seat->wl_seat) >= WL_POINTER_AXIS_VALUE120_SINCE_VERSION)
     {
       event = gdk_scroll_event_new_value120 (seat->pointer_info.focus,
                                              source,
@@ -668,7 +667,6 @@ pointer_handle_enter (void              *data,
 {
   GdkWaylandSeat *seat = data;
   GdkEvent *event;
-  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
 
   if (!surface)
     return;
@@ -702,7 +700,7 @@ pointer_handle_enter (void              *data,
                   "enter, seat %p surface %p",
                   seat, seat->pointer_info.focus);
 
-  if (display_wayland->seat_version < WL_POINTER_HAS_FRAME)
+  if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
     gdk_wayland_seat_flush_frame_event (seat);
 }
 
@@ -714,7 +712,6 @@ pointer_handle_leave (void              *data,
 {
   GdkWaylandSeat *seat = data;
   GdkEvent *event;
-  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
   GdkDeviceGrabInfo *grab;
 
   if (!seat->pointer_info.focus)
@@ -758,7 +755,7 @@ pointer_handle_leave (void              *data,
   if (seat->cursor)
     gdk_wayland_seat_stop_cursor_animation (seat, &seat->pointer_info);
 
-  if (display_wayland->seat_version < WL_POINTER_HAS_FRAME)
+  if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
     gdk_wayland_seat_flush_frame_event (seat);
 }
 
@@ -770,7 +767,6 @@ pointer_handle_motion (void              *data,
                        wl_fixed_t         sy)
 {
   GdkWaylandSeat *seat = data;
-  GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
   GdkEvent *event;
 
   if (!seat->pointer_info.focus)
@@ -798,7 +794,7 @@ pointer_handle_motion (void              *data,
                  x, y, seat, gdk_event_get_modifier_state (event));
     }
 
-  if (display->seat_version < WL_POINTER_HAS_FRAME)
+  if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
     gdk_wayland_seat_flush_frame_event (seat);
 }
 
@@ -811,7 +807,6 @@ pointer_handle_button (void              *data,
                        uint32_t           state)
 {
   GdkWaylandSeat *seat = data;
-  GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
   GdkEvent *event;
   uint32_t modifier;
   int gdk_button;
@@ -878,7 +873,7 @@ pointer_handle_button (void              *data,
                   seat,
                   gdk_event_get_modifier_state (event));
 
-  if (display->seat_version < WL_POINTER_HAS_FRAME)
+  if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
     gdk_wayland_seat_flush_frame_event (seat);
 }
 
@@ -909,7 +904,6 @@ pointer_handle_axis (void              *data,
 {
   GdkWaylandSeat *seat = data;
   GdkWaylandPointerFrameData *pointer_frame = &seat->pointer_info.frame;
-  GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
 
   if (!seat->pointer_info.focus)
     return;
@@ -934,7 +928,7 @@ pointer_handle_axis (void              *data,
                   get_axis_name (axis), wl_fixed_to_double (value),
                   seat);
 
-  if (display->seat_version < WL_POINTER_HAS_FRAME)
+  if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
     gdk_wayland_seat_flush_frame_event (seat);
 }