gdk/wayland: Improve readability of wl_output binding code
authorVlad Zahorodnii <vlad.zahorodnii@kde.org>
Tue, 22 Nov 2022 12:46:05 +0000 (14:46 +0200)
committerVlad Zahorodnii <vlad.zahorodnii@kde.org>
Wed, 23 Nov 2022 20:53:00 +0000 (22:53 +0200)
Provide OUTPUT_VERSION macro to indicate the implemented version of
wl_output in gtk rather than use a magical number.

gdk/wayland/gdkdisplay-wayland.c

index bfda69ce822b6ad49cc1429e0926951708bb1941..ff6334904f6c83521f5fca747d0a34acce11c9bd 100644 (file)
@@ -93,6 +93,7 @@
 #define OUTPUT_VERSION_WITH_DONE 2
 #define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
 #define XDG_ACTIVATION_VERSION   1
+#define OUTPUT_VERSION           3
 
 static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
 
@@ -397,8 +398,10 @@ gdk_registry_handle_global (void               *data,
   else if (strcmp (interface, "wl_output") == 0)
     {
       output =
-       wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 3));
-      gdk_wayland_display_add_output (display_wayland, id, output, MIN (version, 3));
+       wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface,
+                         MIN (version, OUTPUT_VERSION));
+      gdk_wayland_display_add_output (display_wayland, id, output,
+                                      MIN (version, OUTPUT_VERSION));
       _gdk_wayland_display_async_roundtrip (display_wayland);
     }
   else if (strcmp (interface, "wl_seat") == 0)