mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 20:51:07 +00:00
Merge branch 'wayland-xdg-surface-setup' into 'master'
wayland: Don't duplicate xdg_surface setup code See merge request GNOME/gtk!3191
This commit is contained in:
commit
05af726446
@ -1721,6 +1721,52 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
||||
xdg_surface_configure,
|
||||
};
|
||||
|
||||
static void
|
||||
zxdg_surface_v6_configure (void *data,
|
||||
struct zxdg_surface_v6 *xdg_surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
|
||||
gdk_wayland_surface_handle_configure (surface, serial);
|
||||
}
|
||||
|
||||
static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
|
||||
zxdg_surface_v6_configure,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_create_xdg_surface_resources (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandDisplay *display =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
switch (display->shell_variant)
|
||||
{
|
||||
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
|
||||
impl->display_server.xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface (display->xdg_wm_base,
|
||||
impl->display_server.wl_surface);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
|
||||
impl->event_queue);
|
||||
xdg_surface_add_listener (impl->display_server.xdg_surface,
|
||||
&xdg_surface_listener,
|
||||
surface);
|
||||
break;
|
||||
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
|
||||
impl->display_server.zxdg_surface_v6 =
|
||||
zxdg_shell_v6_get_xdg_surface (display->zxdg_shell_v6,
|
||||
impl->display_server.wl_surface);
|
||||
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
|
||||
&zxdg_surface_v6_listener,
|
||||
surface);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_configure (void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
@ -1780,19 +1826,8 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||
static void
|
||||
create_xdg_toplevel_resources (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->display_server.xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface (display_wayland->xdg_wm_base,
|
||||
impl->display_server.wl_surface);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
|
||||
impl->event_queue);
|
||||
xdg_surface_add_listener (impl->display_server.xdg_surface,
|
||||
&xdg_surface_listener,
|
||||
surface);
|
||||
|
||||
impl->display_server.xdg_toplevel =
|
||||
xdg_surface_get_toplevel (impl->display_server.xdg_surface);
|
||||
xdg_toplevel_add_listener (impl->display_server.xdg_toplevel,
|
||||
@ -1800,20 +1835,6 @@ create_xdg_toplevel_resources (GdkSurface *surface)
|
||||
surface);
|
||||
}
|
||||
|
||||
static void
|
||||
zxdg_surface_v6_configure (void *data,
|
||||
struct zxdg_surface_v6 *xdg_surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
|
||||
gdk_wayland_surface_handle_configure (surface, serial);
|
||||
}
|
||||
|
||||
static const struct zxdg_surface_v6_listener zxdg_surface_v6_listener = {
|
||||
zxdg_surface_v6_configure,
|
||||
};
|
||||
|
||||
static void
|
||||
zxdg_toplevel_v6_configure (void *data,
|
||||
struct zxdg_toplevel_v6 *xdg_toplevel,
|
||||
@ -1873,17 +1894,8 @@ static const struct zxdg_toplevel_v6_listener zxdg_toplevel_v6_listener = {
|
||||
static void
|
||||
create_zxdg_toplevel_v6_resources (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->display_server.zxdg_surface_v6 =
|
||||
zxdg_shell_v6_get_xdg_surface (display_wayland->zxdg_shell_v6,
|
||||
impl->display_server.wl_surface);
|
||||
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
|
||||
&zxdg_surface_v6_listener,
|
||||
surface);
|
||||
|
||||
impl->display_server.zxdg_toplevel_v6 =
|
||||
zxdg_surface_v6_get_toplevel (impl->display_server.zxdg_surface_v6);
|
||||
zxdg_toplevel_v6_add_listener (impl->display_server.zxdg_toplevel_v6,
|
||||
@ -1942,6 +1954,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
|
||||
const char *app_id;
|
||||
|
||||
gdk_surface_freeze_updates (surface);
|
||||
gdk_wayland_surface_create_xdg_surface_resources (surface);
|
||||
|
||||
switch (display_wayland->shell_variant)
|
||||
{
|
||||
@ -2712,19 +2725,11 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
positioner = create_dynamic_positioner (surface, width, height, layout, FALSE);
|
||||
gdk_wayland_surface_create_xdg_surface_resources (surface);
|
||||
|
||||
switch (display->shell_variant)
|
||||
{
|
||||
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
|
||||
impl->display_server.xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface (display->xdg_wm_base,
|
||||
impl->display_server.wl_surface);
|
||||
|
||||
wl_proxy_set_queue ((struct wl_proxy *) impl->display_server.xdg_surface,
|
||||
impl->event_queue);
|
||||
xdg_surface_add_listener (impl->display_server.xdg_surface,
|
||||
&xdg_surface_listener,
|
||||
surface);
|
||||
impl->display_server.xdg_popup =
|
||||
xdg_surface_get_popup (impl->display_server.xdg_surface,
|
||||
parent_impl->display_server.xdg_surface,
|
||||
@ -2735,12 +2740,6 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
|
||||
xdg_positioner_destroy (positioner);
|
||||
break;
|
||||
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
|
||||
impl->display_server.zxdg_surface_v6 =
|
||||
zxdg_shell_v6_get_xdg_surface (display->zxdg_shell_v6,
|
||||
impl->display_server.wl_surface);
|
||||
zxdg_surface_v6_add_listener (impl->display_server.zxdg_surface_v6,
|
||||
&zxdg_surface_v6_listener,
|
||||
surface);
|
||||
impl->display_server.zxdg_popup_v6 =
|
||||
zxdg_surface_v6_get_popup (impl->display_server.zxdg_surface_v6,
|
||||
parent_impl->display_server.zxdg_surface_v6,
|
||||
|
Loading…
Reference in New Issue
Block a user