summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-09 11:25:39 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-12 19:13:35 +0100
commit888dc5f5c5456d2721f87f01dd1b10d47c6f439e (patch)
tree95078c6b836c201eb4c525ea6c6da66fcc1ae0f1 /src
parent768dcf2c11146d47f8a79a3d020e2cc0aa91c05b (diff)
Have libdecor-gtk implement the "GTK Shell" protocol
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/Makefile1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx4
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx3
4 files changed, 18 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ea4f89cc1..0db9631be 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -688,6 +688,17 @@ if (UNIX AND OPTION_USE_WAYLAND)
)
list (APPEND STATIC_FILES "xdg-decoration-protocol.c")
list (APPEND SHARED_FILES "xdg-decoration-protocol.c")
+ if (GTK_FOUND AND OPTION_ALLOW_GTK_PLUGIN)
+ add_custom_command(
+ OUTPUT gtk-shell-protocol.c gtk-shell-client-protocol.h
+ COMMAND wayland-scanner private-code ${CMAKE_CURRENT_SOURCE_DIR}/../libdecor/build/gtk-shell.xml gtk-shell-protocol.c
+ COMMAND wayland-scanner client-header ${CMAKE_CURRENT_SOURCE_DIR}/../libdecor/build/gtk-shell.xml gtk-shell-client-protocol.h
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../libdecor/build/gtk-shell.xml
+ VERBATIM
+ )
+ list (APPEND STATIC_FILES "gtk-shell-protocol.c")
+ list (APPEND SHARED_FILES "gtk-shell-protocol.c")
+ endif (GTK_FOUND AND OPTION_ALLOW_GTK_PLUGIN)
endif (NOT OPTION_USE_SYSTEM_LIBDECOR)
add_custom_command(
OUTPUT text-input-protocol.c text-input-client-protocol.h
diff --git a/src/Makefile b/src/Makefile
index de1174e16..a8468e3b3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -424,6 +424,7 @@ CFILES_WAYLANDX11 = $(WLCFILES)
EXTRA_OBJECTS_WAYLAND = ../libdecor/build/fl_libdecor.o ../libdecor/build/libdecor-cairo-blur.o \
../libdecor/build/fl_libdecor-plugins.o \
xdg-decoration-protocol.o xdg-shell-protocol.o text-input-protocol.o \
+ gtk-shell-protocol.o \
../libdecor/build/cursor-settings.o ../libdecor/build/os-compatibility.o
EXTRA_OBJECTS_WAYLANDX11 = $(EXTRA_OBJECTS_WAYLAND)
EXTRA_CXXFLAGS_WAYLAND = -I.
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 35a253c38..5b4d97cf2 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -46,6 +46,7 @@
#include <string.h> // for strerror()
extern "C" {
bool libdecor_get_cursor_settings(char **theme, int *size);
+ void bind_to_gtk_shell(struct wl_registry *, uint32_t);
}
@@ -1146,6 +1147,9 @@ 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) {
+ bind_to_gtk_shell(wl_registry, id);
+ }
} 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");
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 1c04bf575..6b5b2f8ab 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -45,6 +45,7 @@ struct cursor_image { // as in wayland-cursor.c of the Wayland project source co
extern "C" {
# include "../../../libdecor/src/libdecor-plugin.h"
uchar *fl_libdecor_titlebar_buffer(struct libdecor_frame *frame, int *w, int *h, int *stride);
+ void use_FLTK_pointer_button(struct libdecor_frame *);
}
#define fl_max(a,b) ((a) > (b) ? (a) : (b))
@@ -853,7 +854,7 @@ static void handle_configure(struct libdecor_frame *frame,
#ifdef LIBDECOR_MR131
if (is_1st_run) use_FLTK_toplevel_configure_cb(frame);
#endif
-
+ use_FLTK_pointer_button(frame);
struct wl_output *wl_output = NULL;
if (window->fl_win->fullscreen_active()) {
if (!(window->state & LIBDECOR_WINDOW_STATE_FULLSCREEN)) {