mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 12:40:10 +00:00
Merge branch 'wip/xdg-shell-gtk-3-22' into 'gtk-3-22'
xdg shell (stable; gtk 3 22) See merge request GNOME/gtk!36
This commit is contained in:
commit
5c8bb51a58
@ -60,7 +60,7 @@ m4_define([cairo_required_version], [1.14.0])
|
||||
m4_define([gdk_pixbuf_required_version], [2.30.0])
|
||||
m4_define([introspection_required_version], [1.39.0])
|
||||
m4_define([wayland_required_version], [1.9.91])
|
||||
m4_define([wayland_protocols_required_version], [1.9])
|
||||
m4_define([wayland_protocols_required_version], [1.12])
|
||||
m4_define([mirclient_required_version], [0.22.0])
|
||||
m4_define([mircookie_required_version], [0.17.0])
|
||||
m4_define([epoxy_required_version], [1.0])
|
||||
|
@ -23,6 +23,8 @@ noinst_LTLIBRARIES = \
|
||||
BUILT_SOURCES = \
|
||||
pointer-gestures-unstable-v1-client-protocol.h \
|
||||
pointer-gestures-unstable-v1-protocol.c \
|
||||
xdg-shell-client-protocol.h \
|
||||
xdg-shell-protocol.c \
|
||||
xdg-shell-unstable-v6-client-protocol.h \
|
||||
xdg-shell-unstable-v6-protocol.c \
|
||||
xdg-foreign-unstable-v1-client-protocol.h \
|
||||
@ -80,7 +82,7 @@ libgdkwaylandinclude_HEADERS = \
|
||||
.SECONDEXPANSION:
|
||||
|
||||
define protostability
|
||||
$(shell echo $1 | sed 's/.*-\(\(un\)\{0,1\}stable\)-.*/\1/')
|
||||
$(if $(findstring unstable,$1),unstable,stable)
|
||||
endef
|
||||
|
||||
define protoname
|
||||
|
@ -119,9 +119,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;
|
||||
|
||||
@ -133,8 +152,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
|
||||
@ -388,14 +407,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)
|
||||
{
|
||||
@ -603,11 +621,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;
|
||||
|
@ -29,6 +29,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>
|
||||
@ -53,6 +54,12 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkWaylandSelection GdkWaylandSelection;
|
||||
|
||||
typedef enum _GdkWaylandShellVariant
|
||||
{
|
||||
GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL,
|
||||
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6,
|
||||
} GdkWaylandShellVariant;
|
||||
|
||||
struct _GdkWaylandDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
@ -64,12 +71,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
Loading…
Reference in New Issue
Block a user