wayland: Explicitly request mode for both CSD and SSD modes

According to the spec compositors were to assume surfaces are CSD until
told otherwise. This means we need to send
org_kde_kwin_server_decoration_request_mode in both cases.

This fixes libreoffice under kwin, which would remove it's own headers
as per the manager's request but not inform kwin leaving it in the even
more broken state of having none.
This commit is contained in:
David Edmundson 2018-06-25 17:06:33 +01:00
parent e7bb83988f
commit 32ae97f13a
3 changed files with 49 additions and 9 deletions

View File

@ -80,6 +80,9 @@ gboolean gdk_wayland_window_set_transient_for_exported (GdkWindo
GDK_AVAILABLE_IN_3_22
void gdk_wayland_window_announce_csd (GdkWindow *window);
GDK_AVAILABLE_IN_3_24
void gdk_wayland_window_announce_ssd (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_WAYLAND_WINDOW_H__ */

View File

@ -145,6 +145,7 @@ struct _GdkWindowImplWayland
unsigned int pending_buffer_attached : 1;
unsigned int pending_commit : 1;
unsigned int awaiting_frame : 1;
unsigned int using_csd : 1;
GdkWindowTypeHint hint;
GdkWindow *transient_for;
GdkWindow *popup_parent;
@ -388,6 +389,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
G_GNUC_END_IGNORE_DEPRECATIONS
impl->using_csd = TRUE;
/* logical 1x1 fake buffer */
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
@ -691,6 +694,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window);
impl->shortcuts_inhibitors = g_hash_table_new (NULL, NULL);
impl->using_csd = TRUE;
if (window->width > 65535)
{
@ -2064,19 +2068,47 @@ window_anchor_to_gravity_legacy (GdkGravity rect_anchor)
}
}
void
gdk_wayland_window_announce_csd (GdkWindow *window)
static void
gdk_wayland_window_announce_decoration_mode (GdkWindow *window)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!display_wayland->server_decoration_manager)
return;
impl->display_server.server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
impl->display_server.wl_surface);
if (!impl->display_server.server_decoration)
impl->display_server.server_decoration =
org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
impl->display_server.wl_surface);
if (impl->display_server.server_decoration)
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
{
if (impl->using_csd)
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
else
org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
}
}
void
gdk_wayland_window_announce_csd (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->using_csd = TRUE;
if (impl->mapped)
gdk_wayland_window_announce_decoration_mode (window);
}
void
gdk_wayland_window_announce_ssd (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->using_csd = FALSE;
if (impl->mapped)
gdk_wayland_window_announce_decoration_mode (window);
}
static GdkWindow *

View File

@ -7489,8 +7489,13 @@ gtk_window_realize (GtkWidget *widget)
gdk_window_set_decorations (gdk_window, 0);
#ifdef GDK_WINDOWING_WAYLAND
if (priv->client_decorated && GDK_IS_WAYLAND_WINDOW (gdk_window))
gdk_wayland_window_announce_csd (gdk_window);
if (GDK_IS_WAYLAND_WINDOW (gdk_window))
{
if (priv->client_decorated)
gdk_wayland_window_announce_csd (gdk_window);
else
gdk_wayland_window_announce_ssd (gdk_window);
}
#endif
if (!priv->deletable)