diff --git a/configure.ac b/configure.ac index 870d483a5d..90e162ac05 100644 --- a/configure.ac +++ b/configure.ac @@ -404,6 +404,12 @@ if test "x$enable_wayland_backend" = "xyes"; then #define GDK_WINDOWING_WAYLAND" DISABLE_ON_WAYLAND='%' WAYLAND_PACKAGES="wayland-client >= 1.1.90 xkbcommon >= 0.2.0 wayland-cursor" + + AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no]) + AS_IF([test "x$WAYLAND_SCANNER" = "xno"], + AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols])) + AC_SUBST([WAYLAND_SCANNER]) + AM_CONDITIONAL(USE_WAYLAND, true) else AM_CONDITIONAL(USE_WAYLAND, false) diff --git a/gdk/wayland/Makefile.am b/gdk/wayland/Makefile.am index eed33ad2a5..be32a74083 100644 --- a/gdk/wayland/Makefile.am +++ b/gdk/wayland/Makefile.am @@ -19,7 +19,12 @@ LDADDS = $(GDK_DEP_LIBS) noinst_LTLIBRARIES = \ libgdk-wayland.la +BUILT_SOURCES = \ + gtk-shell-client-protocol.h \ + gtk-shell-protocol.c + libgdk_wayland_la_SOURCES = \ + $(BUILT_SOURCES) \ gdkapplaunchcontext-wayland.c \ gdkcursor-wayland.c \ gdkdevice-wayland.c \ @@ -43,4 +48,13 @@ libgdkwaylandinclude_HEADERS = \ gdkwaylandselection.h \ gdkwaylandwindow.h +%-protocol.c : protocol/%.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ +%-server-protocol.h : protocol/%.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@ +%-client-protocol.h : protocol/%.xml + $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ + +EXTRA_DIST += protocol/gtk-shell.xml + -include $(top_srcdir)/git.mk diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 219c7e68d6..d0d12e277d 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -167,6 +167,9 @@ gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id } else if (strcmp(interface, "wl_shell") == 0) { display_wayland->shell = wl_registry_bind(display_wayland->wl_registry, id, &wl_shell_interface, 1); + } else if (strcmp(interface, "gtk_shell") == 0) { + display_wayland->gtk_shell = + wl_registry_bind(display_wayland->wl_registry, id, >k_shell_interface, 1); } else if (strcmp(interface, "wl_output") == 0) { output = wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2)); diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h index 50f41fa6f7..42f363c9d0 100644 --- a/gdk/wayland/gdkdisplay-wayland.h +++ b/gdk/wayland/gdkdisplay-wayland.h @@ -26,6 +26,7 @@ #include #include #include +#include "gtk-shell-client-protocol.h" #include #include @@ -58,6 +59,7 @@ struct _GdkWaylandDisplay struct wl_compositor *compositor; struct wl_shm *shm; struct wl_shell *shell; + struct gtk_shell *gtk_shell; struct wl_input_device *input_device; struct wl_data_device_manager *data_device_manager; diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 3d62ddfe96..0fcad36b1c 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -102,6 +102,7 @@ struct _GdkWindowImplWayland struct wl_surface *surface; struct wl_shell_surface *shell_surface; + struct gtk_surface *gtk_surface; unsigned int mapped : 1; GdkWindow *transient_for; GdkWindowTypeHint hint; @@ -1030,6 +1031,10 @@ gdk_wayland_window_create_surface (GdkWindow *window) wl_surface_set_user_data(impl->surface, window); wl_surface_add_listener(impl->surface, &surface_listener, window); + + if (display_wayland->gtk_shell) + impl->gtk_surface = gtk_shell_get_gtk_surface (display_wayland->gtk_shell, + impl->surface); } static void @@ -1091,6 +1096,10 @@ gdk_wayland_window_hide_surface (GdkWindow *window, } else if (impl->surface) { + if (impl->gtk_surface) + gtk_surface_destroy(impl->gtk_surface); + impl->gtk_surface = NULL; + wl_surface_destroy(impl->surface); impl->surface = NULL; diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml new file mode 100644 index 0000000000..785d380b64 --- /dev/null +++ b/gdk/wayland/protocol/gtk-shell.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + +