diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-07-09 16:51:17 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-07-09 16:51:17 +0200 |
| commit | 83565dd880a9fcd7d6b974622ccd86dc39b764f7 (patch) | |
| tree | cba6cd3e4708265dd3ec7c945b1b68a15668b3bb /src | |
| parent | 5a574e8d9d4a9d697eddc477f5971a5bb8c05862 (diff) | |
Wayland: account for new Wayfire compositor
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 16 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H index b2e4db77e..7dbf9314f 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H @@ -38,7 +38,7 @@ private: static bool insertion_point_location_is_valid; public: // type definitions - typedef enum {unspecified, MUTTER, WESTON, KWIN, OWL} compositor_name; + typedef enum {unspecified, MUTTER, WESTON, KWIN, OWL, WAYFIRE} compositor_name; struct seat { struct wl_seat *wl_seat; struct wl_pointer *wl_pointer; diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 0b3732879..7c01a6b8b 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -1159,6 +1159,12 @@ static struct wl_output_listener output_listener = { }; +struct pair_bool { + bool found_gtk_shell; + bool found_wf_shell; +}; + + // Notice: adding use of unstable protocol "XDG output" would allow FLTK to be notified // in real time of changes to the relative location of multiple displays; // with the present code, that information is received at startup only. @@ -1274,8 +1280,10 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis scr_driver->xdg_wm_base = (struct xdg_wm_base *)wl_registry_bind(wl_registry, id, &xdg_wm_base_interface, 1); xdg_wm_base_add_listener(scr_driver->xdg_wm_base, &xdg_wm_base_listener, NULL); + } else if (strstr(interface, "wf_shell_manager")) { + ((pair_bool*)user_data)->found_wf_shell = true; } else if (strcmp(interface, "gtk_shell1") == 0) { - Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::MUTTER; + ((pair_bool*)user_data)->found_gtk_shell = true; //fprintf(stderr, "Running the Mutter compositor\n"); scr_driver->seat->gtk_shell = (struct gtk_shell1*)wl_registry_bind(wl_registry, id, >k_shell1_interface, version); @@ -1413,10 +1421,14 @@ void Fl_Wayland_Screen_Driver::open_display_platform() { wl_list_init(&outputs); wl_registry = wl_display_get_registry(wl_display); - wl_registry_add_listener(wl_registry, ®istry_listener, NULL); + struct pair_bool pair = {false, false}; + wl_registry_add_listener(wl_registry, ®istry_listener, &pair); struct wl_callback *registry_cb = wl_display_sync(wl_display); wl_callback_add_listener(registry_cb, &sync_listener, ®istry_cb); while (registry_cb) wl_display_dispatch(wl_display); + if (pair.found_gtk_shell) { + Fl_Wayland_Screen_Driver::compositor = (pair.found_wf_shell ? WAYFIRE : MUTTER); + } Fl::add_fd(wl_display_get_fd(wl_display), FL_READ, (Fl_FD_Handler)wayland_socket_callback, wl_display); fl_create_print_window(); |
