forked from AuroraMiddleware/gtk
wayland: Add support for xdg-shell stable
This commit adds support the stable version of the xdg-shell protocol. Support for the last version of the unstable series is left intact, but will not receive new features. The stable version is prioritized above the older version. https://bugzilla.gnome.org/show_bug.cgi?id=791939
This commit is contained in:
parent
2cf55c1686
commit
a40923b03a
@ -126,9 +126,28 @@ _gdk_wayland_display_async_roundtrip (GdkWaylandDisplay *display_wayland)
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_shell_ping (void *data,
|
||||
struct zxdg_shell_v6 *xdg_shell,
|
||||
uint32_t serial)
|
||||
xdg_wm_base_ping (void *data,
|
||||
struct xdg_wm_base *xdg_wm_base,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("ping, shell %p, serial %u\n", xdg_wm_base, serial));
|
||||
|
||||
xdg_wm_base_pong (xdg_wm_base, serial);
|
||||
}
|
||||
|
||||
static const struct xdg_wm_base_listener xdg_wm_base_listener = {
|
||||
xdg_wm_base_ping,
|
||||
};
|
||||
|
||||
static void
|
||||
zxdg_shell_v6_ping (void *data,
|
||||
struct zxdg_shell_v6 *xdg_shell,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
|
||||
@ -140,8 +159,8 @@ xdg_shell_ping (void *data,
|
||||
zxdg_shell_v6_pong (xdg_shell, serial);
|
||||
}
|
||||
|
||||
static const struct zxdg_shell_v6_listener xdg_shell_listener = {
|
||||
xdg_shell_ping,
|
||||
static const struct zxdg_shell_v6_listener zxdg_shell_v6_listener = {
|
||||
zxdg_shell_v6_ping,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
@ -401,14 +420,13 @@ gdk_registry_handle_global (void *data,
|
||||
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
|
||||
wl_shm_add_listener (display_wayland->shm, &wl_shm_listener, display_wayland);
|
||||
}
|
||||
else if (strcmp (interface, "xdg_wm_base") == 0)
|
||||
{
|
||||
display_wayland->xdg_wm_base_id = id;
|
||||
}
|
||||
else if (strcmp (interface, "zxdg_shell_v6") == 0)
|
||||
{
|
||||
display_wayland->xdg_shell =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&zxdg_shell_v6_interface, 1);
|
||||
zxdg_shell_v6_add_listener (display_wayland->xdg_shell,
|
||||
&xdg_shell_listener,
|
||||
display_wayland);
|
||||
display_wayland->zxdg_shell_v6_id = id;
|
||||
}
|
||||
else if (strcmp (interface, "gtk_shell1") == 0)
|
||||
{
|
||||
@ -617,11 +635,32 @@ _gdk_wayland_display_open (const gchar *display_name)
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we have xdg_shell at least */
|
||||
if (display_wayland->xdg_shell == NULL)
|
||||
if (display_wayland->xdg_wm_base_id)
|
||||
{
|
||||
g_warning ("Wayland compositor does not support xdg_shell interface,"
|
||||
" not using Wayland display");
|
||||
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL;
|
||||
display_wayland->xdg_wm_base =
|
||||
wl_registry_bind (display_wayland->wl_registry,
|
||||
display_wayland->xdg_wm_base_id,
|
||||
&xdg_wm_base_interface, 1);
|
||||
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
||||
&xdg_wm_base_listener,
|
||||
display_wayland);
|
||||
}
|
||||
else if (display_wayland->zxdg_shell_v6_id)
|
||||
{
|
||||
display_wayland->shell_variant = GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6;
|
||||
display_wayland->zxdg_shell_v6 =
|
||||
wl_registry_bind (display_wayland->wl_registry,
|
||||
display_wayland->zxdg_shell_v6_id,
|
||||
&zxdg_shell_v6_interface, 1);
|
||||
zxdg_shell_v6_add_listener (display_wayland->zxdg_shell_v6,
|
||||
&zxdg_shell_v6_listener,
|
||||
display_wayland);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("The Wayland compositor does not provide any supported shell interface, "
|
||||
"not using Wayland display");
|
||||
g_object_unref (display);
|
||||
|
||||
return NULL;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <wayland-egl.h>
|
||||
#include <gdk/wayland/tablet-unstable-v2-client-protocol.h>
|
||||
#include <gdk/wayland/gtk-shell-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-shell-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-shell-unstable-v6-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-foreign-unstable-v1-client-protocol.h>
|
||||
#include <gdk/wayland/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h>
|
||||
@ -63,6 +64,12 @@ typedef struct {
|
||||
const gchar *hintstyle;
|
||||
} GsdXftSettings;
|
||||
|
||||
typedef enum _GdkWaylandShellVariant
|
||||
{
|
||||
GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL,
|
||||
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
||||
} GdkWaylandShellVariant;
|
||||
|
||||
struct _GdkWaylandDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
@ -79,12 +86,17 @@ struct _GdkWaylandDisplay
|
||||
/* Most recent serial */
|
||||
guint32 serial;
|
||||
|
||||
uint32_t xdg_wm_base_id;
|
||||
uint32_t zxdg_shell_v6_id;
|
||||
GdkWaylandShellVariant shell_variant;
|
||||
|
||||
/* Wayland fields below */
|
||||
struct wl_display *wl_display;
|
||||
struct wl_registry *wl_registry;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_shm *shm;
|
||||
struct zxdg_shell_v6 *xdg_shell;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||
struct gtk_shell1 *gtk_shell;
|
||||
struct wl_input_device *input_device;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,17 +45,18 @@ wayland_scanner = find_program('wayland-scanner')
|
||||
|
||||
# Format:
|
||||
# - protocol name
|
||||
# - protocol stability ('stable' or 'unstable')
|
||||
# - protocol stability ('private', 'stable' or 'unstable')
|
||||
# - protocol version (if stability is 'unstable')
|
||||
proto_sources = [
|
||||
['gtk-shell', 'stable', ],
|
||||
['gtk-primary-selection', 'stable', ],
|
||||
['gtk-shell', 'private', ],
|
||||
['gtk-primary-selection', 'private', ],
|
||||
['pointer-gestures', 'unstable', 'v1', ],
|
||||
['xdg-shell', 'unstable', 'v6', ],
|
||||
['xdg-shell', 'stable', ],
|
||||
['xdg-foreign', 'unstable', 'v1', ],
|
||||
['tablet', 'unstable', 'v2', ],
|
||||
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
|
||||
['server-decoration', 'stable' ],
|
||||
['server-decoration', 'private' ],
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
@ -65,6 +66,9 @@ foreach p: proto_sources
|
||||
proto_stability = p.get(1)
|
||||
|
||||
if proto_stability == 'stable'
|
||||
output_base = proto_name
|
||||
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
elif proto_stability == 'private'
|
||||
output_base = proto_name
|
||||
input = 'protocol/@0@.xml'.format(proto_name)
|
||||
else
|
||||
|
@ -32,7 +32,7 @@ atk_req = '>= 2.15.1'
|
||||
cairo_req = '>= 1.14.0'
|
||||
gdk_pixbuf_req = '>= 2.30.0'
|
||||
introspection_req = '>= 1.39.0'
|
||||
wayland_proto_req = '>= 1.9'
|
||||
wayland_proto_req = '>= 1.12'
|
||||
wayland_req = '>= 1.14.91'
|
||||
graphene_req = '>= 1.5.1'
|
||||
epoxy_req = '>= 1.4'
|
||||
|
Loading…
Reference in New Issue
Block a user