Wayland: accept diverse versions of the GTK Shell protocol

This commit is contained in:
ManoloFLTK
2024-05-19 17:34:39 +02:00
parent 642ec5b74b
commit 3d6bcda157
@@ -205,8 +205,10 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se
struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) {
struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data;
Fl_Window *win = event_coords_from_surface(surface, surface_x, surface_y);
static bool using_GTK = true;
if (!win && seat->gtk_shell && using_GTK) { // check whether surface is the headerbar of a GTK-decorated window
static bool using_GTK = seat->gtk_shell &&
(gtk_shell1_get_version(seat->gtk_shell) >= GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION);
if (!win && using_GTK) {
// check whether surface is the headerbar of a GTK-decorated window
Fl_X *xp = Fl_X::first;
while (xp && using_GTK) { // all mapped windows
struct wld_window *xid = (struct wld_window*)xp->xid;
@@ -1257,10 +1259,8 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
} else if (strcmp(interface, "gtk_shell1") == 0) {
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::MUTTER;
//fprintf(stderr, "Running the Mutter compositor\n");
if ( version >= 5) {
scr_driver->seat->gtk_shell = (struct gtk_shell1*)wl_registry_bind(wl_registry, id,
&gtk_shell1_interface, 5);
}
scr_driver->seat->gtk_shell = (struct gtk_shell1*)wl_registry_bind(wl_registry, id,
&gtk_shell1_interface, version);
} else if (strcmp(interface, "weston_desktop_shell") == 0) {
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::WESTON;
//fprintf(stderr, "Running the Weston compositor\n");