Commit d34335e5 authored by Giovanni Campagna's avatar Giovanni Campagna

wayland: add support for a private gtk-shell protocol

This protocol will be used by mutter-wayland and gtk to replace
the _GTK X11 properties for DBus names/paths.

https://bugzilla.gnome.org/show_bug.cgi?id=707129
parent e000ba46
......@@ -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)
......
......@@ -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
......@@ -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, &gtk_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));
......
......@@ -26,6 +26,7 @@
#include <stdint.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include "gtk-shell-client-protocol.h"
#include <glib.h>
#include <gdk/gdkkeys.h>
......@@ -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;
......
......@@ -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;
......
<protocol name="gtk">
<interface name="gtk_shell" version="1">
<request name="get_gtk_surface">
<arg name="gtk_surface" type="new_id" interface="gtk_surface"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
</interface>
<interface name="gtk_surface" version="1">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
<arg name="menubar_path" type="string" allow-null="true"/>
<arg name="window_object_path" type="string" allow-null="true"/>
<arg name="application_object_path" type="string" allow-null="true"/>
<arg name="unique_bus_name" type="string" allow-null="true"/>
</request>
</interface>
</protocol>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment