Compare commits

...

1 Commits

Author SHA1 Message Date
Jamie Murphy
6b89425f72 wayland: Update to xdg-decoration protocol
Currently gtk uses the out of date and non-standardized
server-decoration protocol from KDE. This commit replaces the
implementation of this old server-decoration protocol with an
implementation of the xdg-decoration protocol standardized in the
wayland-protocols repository.

Co-authored-by: Lleyton Gray <lleyton@fyralabs.com>
2024-04-03 23:58:20 -07:00
7 changed files with 194 additions and 175 deletions

View File

@@ -56,7 +56,7 @@
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
#include <wayland/xdg-foreign-unstable-v1-client-protocol.h>
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
#include <wayland/server-decoration-client-protocol.h>
#include <wayland/xdg-decoration-unstable-v1-client-protocol.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "presentation-time-client-protocol.h"
@@ -371,26 +371,6 @@ static const struct zwp_linux_dmabuf_feedback_v1_listener linux_dmabuf_feedback_
linux_dmabuf_tranche_flags,
};
static void
server_decoration_manager_default_mode (void *data,
struct org_kde_kwin_server_decoration_manager *manager,
uint32_t mode)
{
g_assert (mode <= ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
const char *modes[] = {
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE] = "none",
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT] = "client",
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER] = "server",
};
GdkWaylandDisplay *display_wayland = data;
GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), MISC, "Compositor prefers decoration mode '%s'", modes[mode]);
display_wayland->server_decoration_mode = mode;
}
static const struct org_kde_kwin_server_decoration_manager_listener server_decoration_listener = {
.default_mode = server_decoration_manager_default_mode
};
/*
* gdk_wayland_display_prefers_ssd:
* @display: (type GdkWaylandDisplay): a `GdkDisplay`
@@ -399,14 +379,16 @@ static const struct org_kde_kwin_server_decoration_manager_listener server_decor
* decorations or if it leaves decorations to the application.
*
* Returns: %TRUE if the compositor prefers server-side decorations
*
* Deprecated: 4.13
*/
gboolean
gdk_wayland_display_prefers_ssd (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
if (display_wayland->server_decoration_manager)
return display_wayland->server_decoration_mode == ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER;
/* If the server doesn't implement xdg-decoration, we will just client-side
* decorate. If the server does implement xdg-decoration, we will initially
* client-side decorate and possibly negotiate a change to server-side
* decorations. This function is deprecated as it is no longer useful. */
return FALSE;
}
@@ -557,14 +539,11 @@ gdk_registry_handle_global (void *data,
wl_registry_bind (display_wayland->wl_registry, id,
&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1);
}
else if (strcmp (interface, "org_kde_kwin_server_decoration_manager") == 0)
else if (strcmp (interface, "zxdg_decoration_manager_v1") == 0)
{
display_wayland->server_decoration_manager =
wl_registry_bind (display_wayland->wl_registry, id,
&org_kde_kwin_server_decoration_manager_interface, 1);
org_kde_kwin_server_decoration_manager_add_listener (display_wayland->server_decoration_manager,
&server_decoration_listener,
display_wayland);
&zxdg_decoration_manager_v1_interface, 1);
}
else if (strcmp(interface, "zxdg_output_manager_v1") == 0)
{
@@ -810,7 +789,7 @@ gdk_wayland_display_dispose (GObject *object)
g_clear_pointer (&display_wayland->xdg_importer, zxdg_importer_v1_destroy);
g_clear_pointer (&display_wayland->xdg_importer_v2, zxdg_importer_v2_destroy);
g_clear_pointer (&display_wayland->keyboard_shortcuts_inhibit, zwp_keyboard_shortcuts_inhibit_manager_v1_destroy);
g_clear_pointer (&display_wayland->server_decoration_manager, org_kde_kwin_server_decoration_manager_destroy);
g_clear_pointer (&display_wayland->server_decoration_manager, zxdg_decoration_manager_v1_destroy);
g_clear_pointer (&display_wayland->xdg_output_manager, zxdg_output_manager_v1_destroy);
g_clear_pointer (&display_wayland->idle_inhibit_manager, zwp_idle_inhibit_manager_v1_destroy);
g_clear_pointer (&display_wayland->xdg_activation, xdg_activation_v1_destroy);

View File

@@ -32,7 +32,7 @@
#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>
#include <gdk/wayland/server-decoration-client-protocol.h>
#include <gdk/wayland/xdg-decoration-unstable-v1-client-protocol.h>
#include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
#include <gdk/wayland/idle-inhibit-unstable-v1-client-protocol.h>
#include <gdk/wayland/primary-selection-unstable-v1-client-protocol.h>
@@ -120,7 +120,7 @@ struct _GdkWaylandDisplay
struct zxdg_importer_v1 *xdg_importer;
struct zxdg_importer_v2 *xdg_importer_v2;
struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
struct zxdg_decoration_manager_v1 *server_decoration_manager;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
struct xdg_activation_v1 *xdg_activation;
@@ -149,8 +149,6 @@ struct _GdkWaylandDisplay
GSource *event_source;
uint32_t server_decoration_mode;
struct xkb_context *xkb_context;
GListStore *monitors;

View File

@@ -17,7 +17,6 @@
#pragma once
void gdk_wayland_toplevel_set_geometry_hints (GdkWaylandToplevel *toplevel,
const GdkGeometry *geometry,
GdkSurfaceHints geom_mask);
@@ -33,8 +32,8 @@ void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_object_path,
const char *unique_bus_name);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_request_csd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_request_ssd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);

View File

@@ -84,11 +84,13 @@ struct _GdkWaylandToplevel
struct gtk_surface1 *gtk_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
} display_server;
gboolean ssd;
GdkWaylandToplevel *transient_for;
struct org_kde_kwin_server_decoration *server_decoration;
GList *exported;
struct {
@@ -154,6 +156,16 @@ typedef struct
GdkWaylandSurfaceClass parent_class;
} GdkWaylandToplevelClass;
enum {
PROP_0,
PROP_IS_SSD,
LAST_PROP
};
static GParamSpec *properties[LAST_PROP] = { NULL, };
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
@@ -215,6 +227,7 @@ gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
g_clear_pointer (&toplevel->display_server.xdg_toplevel_decoration, zxdg_toplevel_decoration_v1_destroy);
if (toplevel->display_server.gtk_surface)
{
@@ -735,6 +748,59 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_wm_capabilities,
};
static void
xdg_toplevel_decoration_configure (void *data,
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
uint32_t mode)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE)
{
if (!toplevel->ssd)
{
toplevel->ssd = TRUE;
g_object_notify_by_pspec (G_OBJECT (toplevel), properties[PROP_IS_SSD]);
}
}
else if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE)
{
if (toplevel->ssd)
{
toplevel->ssd = FALSE;
g_object_notify_by_pspec (G_OBJECT (toplevel), properties[PROP_IS_SSD]);
}
}
else
{
g_assert_not_reached ();
}
}
static const struct zxdg_toplevel_decoration_v1_listener xdg_toplevel_decoration_listener = {
xdg_toplevel_decoration_configure,
};
static void
create_xdg_toplevel_decoration (GdkWaylandToplevel *toplevel)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
if (display_wayland->server_decoration_manager)
{
toplevel->display_server.xdg_toplevel_decoration =
zxdg_decoration_manager_v1_get_toplevel_decoration (display_wayland->server_decoration_manager,
toplevel->display_server.xdg_toplevel);
zxdg_toplevel_decoration_v1_add_listener (toplevel->display_server.xdg_toplevel_decoration,
&xdg_toplevel_decoration_listener,
toplevel);
zxdg_toplevel_decoration_v1_unset_mode (toplevel->display_server.xdg_toplevel_decoration);
}
}
static void
create_xdg_toplevel_resources (GdkWaylandToplevel *toplevel)
{
@@ -745,6 +811,8 @@ create_xdg_toplevel_resources (GdkWaylandToplevel *toplevel)
xdg_toplevel_add_listener (toplevel->display_server.xdg_toplevel,
&xdg_toplevel_listener,
toplevel);
create_xdg_toplevel_decoration (toplevel);
}
static void
@@ -1221,8 +1289,6 @@ gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
gdk_wayland_toplevel_sync_parent (toplevel);
}
#define LAST_PROP 1
static void
gdk_wayland_toplevel_set_property (GObject *object,
guint prop_id,
@@ -1288,6 +1354,10 @@ gdk_wayland_toplevel_get_property (GObject *object,
switch (prop_id)
{
case PROP_IS_SSD:
g_value_set_boolean (value, toplevel->ssd);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STATE:
g_value_set_flags (value, surface->state);
break;
@@ -1386,7 +1456,21 @@ gdk_wayland_toplevel_class_init (GdkWaylandToplevelClass *class)
wayland_surface_class->handle_configure = gdk_wayland_toplevel_handle_configure;
wayland_surface_class->hide_surface = gdk_wayland_toplevel_hide_surface;
gdk_toplevel_install_properties (object_class, 1);
/**
* GdkWaylandToplevel:is-ssd:
*
* Whether to use Server-Side decorations or not.
*/
properties[PROP_IS_SSD] =
g_param_spec_boolean ("is-ssd", NULL, NULL,
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class,
LAST_PROP,
properties);
gdk_toplevel_install_properties (object_class, LAST_PROP);
}
static void
@@ -2419,7 +2503,7 @@ gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
}
void
gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel)
gdk_wayland_toplevel_request_csd (GdkToplevel *toplevel)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
GdkWaylandToplevel *toplevel_wayland;
@@ -2429,16 +2513,19 @@ gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel)
if (!display_wayland->server_decoration_manager)
return;
toplevel_wayland->server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
if (toplevel_wayland->server_decoration)
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
g_clear_pointer (&toplevel_wayland->display_server.xdg_toplevel_decoration,
zxdg_toplevel_decoration_v1_destroy);
if (toplevel_wayland->ssd)
{
toplevel_wayland->ssd = FALSE;
g_object_notify_by_pspec (G_OBJECT (toplevel), properties[PROP_IS_SSD]);
}
}
void
gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel)
gdk_wayland_toplevel_request_ssd (GdkToplevel *toplevel)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (toplevel)));
GdkWaylandToplevel *toplevel_wayland;
@@ -2448,12 +2535,12 @@ gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel)
if (!display_wayland->server_decoration_manager)
return;
toplevel_wayland->server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
gdk_wayland_surface_get_wl_surface (GDK_SURFACE (toplevel_wayland)));
if (toplevel_wayland->server_decoration)
org_kde_kwin_server_decoration_request_mode (toplevel_wayland->server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
if (!toplevel_wayland->display_server.xdg_toplevel_decoration)
create_xdg_toplevel_decoration (toplevel_wayland);
zxdg_toplevel_decoration_v1_set_mode (toplevel_wayland->display_server.xdg_toplevel_decoration,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
gboolean

View File

@@ -64,7 +64,7 @@ proto_sources = [
['xdg-foreign', 'unstable', 'v2', ],
['tablet', 'unstable', 'v2', ],
['keyboard-shortcuts-inhibit', 'unstable', 'v1', ],
['server-decoration', 'private' ],
['xdg-decoration', 'unstable', 'v1', ],
['xdg-output', 'unstable', 'v1', ],
['idle-inhibit', 'unstable', 'v1', ],
['xdg-activation', 'staging', 'v1', ],

View File

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="server_decoration">
<copyright><![CDATA[
Copyright (C) 2015 Martin Gräßlin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]></copyright>
<interface name="org_kde_kwin_server_decoration_manager" version="1">
<description summary="Server side window decoration manager">
This interface allows to coordinate whether the server should create
a server-side window decoration around a wl_surface representing a
shell surface (wl_shell_surface or similar). By announcing support
for this interface the server indicates that it supports server
side decorations.
</description>
<request name="create">
<description summary="Create a server-side decoration object for a given surface">
When a client creates a server-side decoration object it indicates
that it supports the protocol. The client is supposed to tell the
server whether it wants server-side decorations or will provide
client-side decorations.
If the client does not create a server-side decoration object for
a surface the server interprets this as lack of support for this
protocol and considers it as client-side decorated. Nevertheless a
client-side decorated surface should use this protocol to indicate
to the server that it does not want a server-side deco.
</description>
<arg name="id" type="new_id" interface="org_kde_kwin_server_decoration"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
<enum name="mode">
<description summary="Possible values to use in request_mode and the event mode."/>
<entry name="None" value="0" summary="Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated."/>
<entry name="Client" value="1" summary="Client-side decoration: The decoration is part of the surface and the client."/>
<entry name="Server" value="2" summary="Server-side decoration: The server embeds the surface into a decoration frame."/>
</enum>
<event name="default_mode">
<description summary="The default mode used on the server">
This event is emitted directly after binding the interface. It contains
the default mode for the decoration. When a new server decoration object
is created this new object will be in the default mode until the first
request_mode is requested.
The server may change the default mode at any time.
</description>
<arg name="mode" type="uint" summary="The default decoration mode applied to newly created server decorations."/>
</event>
</interface>
<interface name="org_kde_kwin_server_decoration" version="1">
<request name="release" type="destructor">
<description summary="release the server decoration object"/>
</request>
<enum name="mode">
<description summary="Possible values to use in request_mode and the event mode."/>
<entry name="None" value="0" summary="Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated."/>
<entry name="Client" value="1" summary="Client-side decoration: The decoration is part of the surface and the client."/>
<entry name="Server" value="2" summary="Server-side decoration: The server embeds the surface into a decoration frame."/>
</enum>
<request name="request_mode">
<description summary="The decoration mode the surface wants to use."/>
<arg name="mode" type="uint" summary="The mode this surface wants to use."/>
</request>
<event name="mode">
<description summary="The new decoration mode applied by the server">
This event is emitted directly after the decoration is created and
represents the base decoration policy by the server. E.g. a server
which wants all surfaces to be client-side decorated will send Client,
a server which wants server-side decoration will send Server.
The client can request a different mode through the decoration request.
The server will acknowledge this by another event with the same mode. So
even if a server prefers server-side decoration it's possible to force a
client-side decoration.
The server may emit this event at any time. In this case the client can
again request a different mode. It's the responsibility of the server to
prevent a feedback loop.
</description>
<arg name="mode" type="uint" summary="The decoration mode applied to the surface by the server."/>
</event>
</interface>
</protocol>

View File

@@ -2971,6 +2971,20 @@ gtk_window_supports_client_shadow (GtkWindow *window)
return gdk_display_supports_shadow_width (display);
}
static void
gtk_window_reset_csd (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *widget = GTK_WIDGET (window);
if (priv->use_client_shadow)
gtk_widget_remove_css_class (widget, "csd");
else
gtk_widget_remove_css_class (widget, "solid-csd");
priv->client_decorated = FALSE;
}
static void
gtk_window_enable_csd (GtkWindow *window)
{
@@ -3036,10 +3050,7 @@ gtk_window_set_titlebar (GtkWindow *window,
if (titlebar == NULL)
{
/* these are updated in realize() */
priv->client_decorated = FALSE;
gtk_widget_remove_css_class (widget, "csd");
gtk_widget_remove_css_class (widget, "solid-csd");
gtk_window_reset_csd (window);
}
else
{
@@ -3602,7 +3613,7 @@ gtk_window_set_default_size_internal (GtkWindow *window,
* Sets the default size of a window.
*
* The default size of a window is the size that will be used if no other constraints apply.
*
*
* The default size will be updated whenever the window is resized
* to reflect the new size, unless the window is forced to a size,
* like when it is maximized or fullscreened.
@@ -3767,7 +3778,7 @@ update_csd_visibility (GtkWindow *window)
return FALSE;
visible = !priv->fullscreen &&
priv->decorated;
priv->client_decorated;
gtk_widget_set_child_visible (priv->title_box, visible);
@@ -3799,7 +3810,8 @@ _gtk_window_request_csd (GtkWindow *window)
}
static gboolean
gtk_window_should_use_csd (GtkWindow *window)
gtk_window_should_use_csd (GtkWindow *window,
gboolean toplevel_is_ssd)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
const char *csd_env;
@@ -3818,11 +3830,7 @@ gtk_window_should_use_csd (GtkWindow *window)
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
{
GdkDisplay *gdk_display = gtk_widget_get_display (GTK_WIDGET (window));
return !gdk_wayland_display_prefers_ssd (gdk_display);
}
return toplevel_is_ssd;
#endif
#ifdef GDK_WINDOWING_WIN32
@@ -4075,9 +4083,6 @@ update_realized_window_properties (GtkWindow *window)
update_opaque_region (window);
if (!priv->client_decorated || !priv->use_client_shadow)
return;
gtk_native_get_surface_transform (GTK_NATIVE (window), &native_x, &native_y);
/* update the input shape, which makes it so that clicks
@@ -4288,15 +4293,13 @@ toplevel_compute_size (GdkToplevel *toplevel,
}
static void
gtk_window_realize (GtkWidget *widget)
create_default_titlebar (GtkWindow *window,
gboolean toplevel_is_ssd)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GdkSurface *surface;
GdkFrameClock *frame_clock;
/* Create default title bar */
if (!priv->client_decorated && gtk_window_should_use_csd (window))
if (!priv->client_decorated && gtk_window_should_use_csd (window, toplevel_is_ssd))
{
if (gtk_window_is_composited (window))
{
@@ -4309,7 +4312,7 @@ gtk_window_realize (GtkWidget *widget)
gtk_widget_add_css_class (priv->title_box, "titlebar");
gtk_widget_add_css_class (priv->title_box, "default-decoration");
gtk_widget_insert_before (priv->title_box, widget, NULL);
gtk_widget_insert_before (priv->title_box, GTK_WIDGET (window), NULL);
}
update_window_actions (window);
@@ -4317,6 +4320,46 @@ gtk_window_realize (GtkWidget *widget)
else
priv->use_client_shadow = FALSE;
}
}
#ifdef GDK_WINDOWING_WAYLAND
static void
wayland_handle_decoration (GdkToplevel *toplevel,
GParamSpec *pspec,
GtkWindow *window)
{
gboolean ssd;
g_object_get (toplevel, "is-ssd", &ssd, NULL);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
create_default_titlebar (window, ssd);
gdk_toplevel_set_decorated (toplevel, priv->decorated && !priv->client_decorated);
if (priv->client_decorated && ssd)
{
priv->use_client_shadow = FALSE;
gtk_window_reset_csd (window);
}
else if (!priv->client_decorated && !ssd)
{
gtk_window_enable_csd (window);
}
update_window_actions (window);
gtk_widget_queue_resize (GTK_WIDGET (window));
}
#endif
static void
gtk_window_realize (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GdkSurface *surface;
GdkFrameClock *frame_clock;
surface = gdk_surface_new_toplevel (gtk_widget_get_display (widget));
priv->surface = surface;
@@ -4348,17 +4391,24 @@ gtk_window_realize (GtkWidget *widget)
if (priv->title)
gdk_toplevel_set_title (GDK_TOPLEVEL (surface), priv->title);
gdk_toplevel_set_decorated (GDK_TOPLEVEL (surface), priv->decorated && !priv->client_decorated);
gdk_toplevel_set_deletable (GDK_TOPLEVEL (surface), priv->deletable);
#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_SURFACE (surface))
{
g_signal_connect (GDK_WAYLAND_TOPLEVEL (surface), "notify::is-ssd",
G_CALLBACK (wayland_handle_decoration),
surface);
if (priv->client_decorated)
gdk_wayland_toplevel_announce_csd (GDK_TOPLEVEL (surface));
gdk_wayland_toplevel_request_csd (GDK_TOPLEVEL (surface));
else
gdk_wayland_toplevel_announce_ssd (GDK_TOPLEVEL (surface));
gdk_wayland_toplevel_request_ssd (GDK_TOPLEVEL (surface));
}
#else
create_default_titlebar (window, FALSE);
gdk_toplevel_set_decorated (GDK_TOPLEVEL (surface), priv->decorated && !priv->client_decorated);
#endif
gdk_toplevel_set_modal (GDK_TOPLEVEL (surface), priv->modal);