[gtk+] wayland: add support for a private gtk-shell protocol
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: add support for a private gtk-shell protocol
- Date: Tue, 3 Sep 2013 15:04:03 +0000 (UTC)
commit d34335e51c98efebe010bd4a202fe2a4b2fb7d06
Author: Giovanni Campagna <gcampagn redhat com>
Date: Fri Aug 30 13:55:37 2013 +0200
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
configure.ac | 6 ++++++
gdk/wayland/Makefile.am | 14 ++++++++++++++
gdk/wayland/gdkdisplay-wayland.c | 3 +++
gdk/wayland/gdkdisplay-wayland.h | 2 ++
gdk/wayland/gdkwindow-wayland.c | 9 +++++++++
gdk/wayland/protocol/gtk-shell.xml | 21 +++++++++++++++++++++
6 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 870d483..90e162a 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 eed33ad..be32a74 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 219c7e6..d0d12e2 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 50f41fa..42f363c 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -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;
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 3d62ddf..0fcad36 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 0000000..785d380
--- /dev/null
+++ b/gdk/wayland/protocol/gtk-shell.xml
@@ -0,0 +1,21 @@
+<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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]