From f6a09ef1a9b0a4f283be7bf52a7628c9aed199e1 Mon Sep 17 00:00:00 2001
From: David Edmundson <[EMAIL REDACTED]>
Date: Wed, 7 Apr 2021 16:16:23 +0100
Subject: [PATCH] wayland: Drop support for kwin specific decoration management
KWin has supported the shared and formalised zxdg_decoration since
Plasma 5.16 which came out mid 2019.
Whilst it made sense to support them both for a while, it should not be
needed for future SDL releases.
---
src/video/wayland/SDL_waylandvideo.c | 3 -
src/video/wayland/SDL_waylandvideo.h | 1 -
src/video/wayland/SDL_waylandwindow.c | 15 ---
src/video/wayland/SDL_waylandwindow.h | 1 -
...org-kde-kwin-server-decoration-manager.xml | 94 -------------------
5 files changed, 114 deletions(-)
delete mode 100644 wayland-protocols/org-kde-kwin-server-decoration-manager.xml
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 12203111e..b3b4691ac 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -49,7 +49,6 @@
#include "xdg-shell-client-protocol.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
#include "xdg-decoration-unstable-v1-client-protocol.h"
-#include "org-kde-kwin-server-decoration-manager-client-protocol.h"
#include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
@@ -427,8 +426,6 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, SDL_min(3, version));
} else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1);
- } else if (strcmp(interface, "org_kde_kwin_server_decoration_manager") == 0) {
- d->kwin_server_decoration_manager = wl_registry_bind(d->registry, id, &org_kde_kwin_server_decoration_manager_interface, 1);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
} else if (strcmp(interface, "qt_touch_extension") == 0) {
diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h
index 867422440..7f5a60ae1 100644
--- a/src/video/wayland/SDL_waylandvideo.h
+++ b/src/video/wayland/SDL_waylandvideo.h
@@ -68,7 +68,6 @@ typedef struct {
struct zwp_pointer_constraints_v1 *pointer_constraints;
struct wl_data_device_manager *data_device_manager;
struct zxdg_decoration_manager_v1 *decoration_manager;
- struct org_kde_kwin_server_decoration_manager *kwin_server_decoration_manager;
struct zwp_keyboard_shortcuts_inhibit_manager_v1 *key_inhibitor_manager;
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager;
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index e92aa4410..7f9031081 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -36,7 +36,6 @@
#include "xdg-shell-client-protocol.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
#include "xdg-decoration-unstable-v1-client-protocol.h"
-#include "org-kde-kwin-server-decoration-manager-client-protocol.h"
#include "idle-inhibit-unstable-v1-client-protocol.h"
static float get_window_scale_factor(SDL_Window *window) {
@@ -673,9 +672,6 @@ Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
if ((viddata->decoration_manager) && (wind->server_decoration)) {
const enum zxdg_toplevel_decoration_v1_mode mode = bordered ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
zxdg_toplevel_decoration_v1_set_mode(wind->server_decoration, mode);
- } else if ((viddata->kwin_server_decoration_manager) && (wind->kwin_server_decoration)) {
- const enum org_kde_kwin_server_decoration_manager_mode mode = bordered ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER : ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
- org_kde_kwin_server_decoration_request_mode(wind->kwin_server_decoration, mode);
}
}
@@ -866,13 +862,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
const enum zxdg_toplevel_decoration_v1_mode mode = bordered ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
zxdg_toplevel_decoration_v1_set_mode(data->server_decoration, mode);
}
- } else if (c->kwin_server_decoration_manager) {
- data->kwin_server_decoration = org_kde_kwin_server_decoration_manager_create(c->kwin_server_decoration_manager, data->surface);
- if (data->kwin_server_decoration) {
- const SDL_bool bordered = (window->flags & SDL_WINDOW_BORDERLESS) == 0;
- const enum org_kde_kwin_server_decoration_manager_mode mode = bordered ? ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER : ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
- org_kde_kwin_server_decoration_request_mode(data->kwin_server_decoration, mode);
- }
}
region = wl_compositor_create_region(c->compositor);
@@ -1054,10 +1043,6 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
zxdg_toplevel_decoration_v1_destroy(wind->server_decoration);
}
- if (wind->kwin_server_decoration) {
- org_kde_kwin_server_decoration_release(wind->kwin_server_decoration);
- }
-
if (wind->idle_inhibitor) {
zwp_idle_inhibitor_v1_destroy(wind->idle_inhibitor);
}
diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h
index 1545655a4..892be167a 100644
--- a/src/video/wayland/SDL_waylandwindow.h
+++ b/src/video/wayland/SDL_waylandwindow.h
@@ -64,7 +64,6 @@ typedef struct {
EGLSurface egl_surface;
struct zwp_locked_pointer_v1 *locked_pointer;
struct zxdg_toplevel_decoration_v1 *server_decoration;
- struct org_kde_kwin_server_decoration *kwin_server_decoration;
struct zwp_keyboard_shortcuts_inhibitor_v1 *key_inhibitor;
struct zwp_idle_inhibitor_v1 *idle_inhibitor;
diff --git a/wayland-protocols/org-kde-kwin-server-decoration-manager.xml b/wayland-protocols/org-kde-kwin-server-decoration-manager.xml
deleted file mode 100644
index 8bc106c7c..000000000
--- a/wayland-protocols/org-kde-kwin-server-decoration-manager.xml
+++ /dev/null
@@ -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>