Use server-side decorations for KDE wayland for now
This commit is contained in:
parent
f7654d3867
commit
b17920cf4c
@ -561,6 +561,12 @@ include/vector2d.h
|
||||
include/vector3d.h
|
||||
)
|
||||
|
||||
if(ENABLE_WAYLAND_DEVICE)
|
||||
set(IRRLICHT_SOURCES
|
||||
${IRRLICHT_SOURCES}
|
||||
source/Irrlicht/server_decoration_client_protocol.c)
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(IRRLICHT_SOURCES
|
||||
|
@ -550,6 +550,13 @@ public:
|
||||
name, &wl_output_interface, 2));
|
||||
wl_output_add_listener(device->m_output, &output_listener, device);
|
||||
}
|
||||
else if (interface_str == "org_kde_kwin_server_decoration_manager")
|
||||
{
|
||||
device->m_decoration_manager =
|
||||
static_cast<org_kde_kwin_server_decoration_manager*>(
|
||||
wl_registry_bind(registry, name,
|
||||
&org_kde_kwin_server_decoration_manager_interface, 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void registry_global_remove(void* data, wl_registry* registry,
|
||||
@ -645,6 +652,9 @@ CIrrDeviceWayland::CIrrDeviceWayland(const SIrrlichtCreationParameters& params)
|
||||
m_surface = NULL;
|
||||
m_enter_serial = 0;
|
||||
|
||||
m_decoration_manager = NULL;
|
||||
m_decoration = NULL;
|
||||
|
||||
m_xkb_context = NULL;
|
||||
m_xkb_compose_table = NULL;
|
||||
m_xkb_compose_state = NULL;
|
||||
@ -715,6 +725,12 @@ CIrrDeviceWayland::~CIrrDeviceWayland()
|
||||
{
|
||||
delete m_egl_context;
|
||||
|
||||
if (m_decoration)
|
||||
org_kde_kwin_server_decoration_destroy(m_decoration);
|
||||
|
||||
if (m_decoration_manager)
|
||||
org_kde_kwin_server_decoration_manager_destroy(m_decoration_manager);
|
||||
|
||||
if (m_egl_window)
|
||||
wl_egl_window_destroy(m_egl_window);
|
||||
|
||||
@ -840,6 +856,18 @@ bool CIrrDeviceWayland::createWindow()
|
||||
wl_shell_surface_set_toplevel(m_shell_surface);
|
||||
}
|
||||
|
||||
if (m_decoration_manager != NULL)
|
||||
{
|
||||
m_decoration = org_kde_kwin_server_decoration_manager_create(
|
||||
m_decoration_manager, m_surface);
|
||||
}
|
||||
|
||||
if (m_decoration != NULL)
|
||||
{
|
||||
org_kde_kwin_server_decoration_request_mode(m_decoration,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER);
|
||||
}
|
||||
|
||||
wl_display_flush(m_display);
|
||||
|
||||
bool success = initEGL();
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "CIrrDeviceStub.h"
|
||||
#include "IImagePresenter.h"
|
||||
#include "ICursorControl.h"
|
||||
#include "server_decoration_client_protocol.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-cursor.h>
|
||||
@ -178,6 +179,9 @@ namespace irr
|
||||
wl_surface* m_surface;
|
||||
uint32_t m_enter_serial;
|
||||
|
||||
org_kde_kwin_server_decoration_manager* m_decoration_manager;
|
||||
org_kde_kwin_server_decoration* m_decoration;
|
||||
|
||||
xkb_context* m_xkb_context;
|
||||
xkb_compose_table* m_xkb_compose_table;
|
||||
xkb_compose_state* m_xkb_compose_state;
|
||||
|
@ -0,0 +1,61 @@
|
||||
/* Generated by wayland-scanner 1.12.0 */
|
||||
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
extern const struct wl_interface org_kde_kwin_server_decoration_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *types[] = {
|
||||
NULL,
|
||||
&org_kde_kwin_server_decoration_interface,
|
||||
&wl_surface_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message org_kde_kwin_server_decoration_manager_requests[] = {
|
||||
{ "create", "no", types + 1 },
|
||||
};
|
||||
|
||||
static const struct wl_message org_kde_kwin_server_decoration_manager_events[] = {
|
||||
{ "default_mode", "u", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface org_kde_kwin_server_decoration_manager_interface = {
|
||||
"org_kde_kwin_server_decoration_manager", 1,
|
||||
1, org_kde_kwin_server_decoration_manager_requests,
|
||||
1, org_kde_kwin_server_decoration_manager_events,
|
||||
};
|
||||
|
||||
static const struct wl_message org_kde_kwin_server_decoration_requests[] = {
|
||||
{ "release", "", types + 0 },
|
||||
{ "request_mode", "u", types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message org_kde_kwin_server_decoration_events[] = {
|
||||
{ "mode", "u", types + 0 },
|
||||
};
|
||||
|
||||
WL_EXPORT const struct wl_interface org_kde_kwin_server_decoration_interface = {
|
||||
"org_kde_kwin_server_decoration", 1,
|
||||
2, org_kde_kwin_server_decoration_requests,
|
||||
1, org_kde_kwin_server_decoration_events,
|
||||
};
|
||||
|
326
lib/irrlicht/source/Irrlicht/server_decoration_client_protocol.h
Normal file
326
lib/irrlicht/source/Irrlicht/server_decoration_client_protocol.h
Normal file
@ -0,0 +1,326 @@
|
||||
/* Generated by wayland-scanner 1.12.0 */
|
||||
|
||||
#ifndef SERVER_DECORATION_CLIENT_PROTOCOL_H
|
||||
#define SERVER_DECORATION_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_server_decoration The server_decoration protocol
|
||||
* @section page_ifaces_server_decoration Interfaces
|
||||
* - @subpage page_iface_org_kde_kwin_server_decoration_manager - Server side window decoration manager
|
||||
* - @subpage page_iface_org_kde_kwin_server_decoration -
|
||||
* @section page_copyright_server_decoration Copyright
|
||||
* <pre>
|
||||
*
|
||||
* 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/>.
|
||||
* </pre>
|
||||
*/
|
||||
struct org_kde_kwin_server_decoration;
|
||||
struct org_kde_kwin_server_decoration_manager;
|
||||
struct wl_surface;
|
||||
|
||||
/**
|
||||
* @page page_iface_org_kde_kwin_server_decoration_manager org_kde_kwin_server_decoration_manager
|
||||
* @section page_iface_org_kde_kwin_server_decoration_manager_desc Description
|
||||
*
|
||||
* 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.
|
||||
* @section page_iface_org_kde_kwin_server_decoration_manager_api API
|
||||
* See @ref iface_org_kde_kwin_server_decoration_manager.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_org_kde_kwin_server_decoration_manager The org_kde_kwin_server_decoration_manager interface
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
extern const struct wl_interface org_kde_kwin_server_decoration_manager_interface;
|
||||
/**
|
||||
* @page page_iface_org_kde_kwin_server_decoration org_kde_kwin_server_decoration
|
||||
* @section page_iface_org_kde_kwin_server_decoration_api API
|
||||
* See @ref iface_org_kde_kwin_server_decoration.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_org_kde_kwin_server_decoration The org_kde_kwin_server_decoration interface
|
||||
*/
|
||||
extern const struct wl_interface org_kde_kwin_server_decoration_interface;
|
||||
|
||||
#ifndef ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_ENUM
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_ENUM
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration_manager
|
||||
* Possible values to use in request_mode and the event mode.
|
||||
*/
|
||||
enum org_kde_kwin_server_decoration_manager_mode {
|
||||
/**
|
||||
* Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE = 0,
|
||||
/**
|
||||
* Client-side decoration: The decoration is part of the surface and the client.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT = 1,
|
||||
/**
|
||||
* Server-side decoration: The server embeds the surface into a decoration frame.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER = 2,
|
||||
};
|
||||
#endif /* ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration_manager
|
||||
* @struct org_kde_kwin_server_decoration_manager_listener
|
||||
*/
|
||||
struct org_kde_kwin_server_decoration_manager_listener {
|
||||
/**
|
||||
* 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.
|
||||
* @param mode The default decoration mode applied to newly created server decorations.
|
||||
*/
|
||||
void (*default_mode)(void *data,
|
||||
struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager,
|
||||
uint32_t mode);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup org_kde_kwin_server_decoration_manager_iface
|
||||
*/
|
||||
static inline int
|
||||
org_kde_kwin_server_decoration_manager_add_listener(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager,
|
||||
const struct org_kde_kwin_server_decoration_manager_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) org_kde_kwin_server_decoration_manager,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_CREATE 0
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration_manager
|
||||
*/
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_DEFAULT_MODE_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration_manager
|
||||
*/
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_CREATE_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration_manager */
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_manager_set_user_data(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) org_kde_kwin_server_decoration_manager, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration_manager */
|
||||
static inline void *
|
||||
org_kde_kwin_server_decoration_manager_get_user_data(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) org_kde_kwin_server_decoration_manager);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
org_kde_kwin_server_decoration_manager_get_version(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) org_kde_kwin_server_decoration_manager);
|
||||
}
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration_manager */
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_manager_destroy(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) org_kde_kwin_server_decoration_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration_manager
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
static inline struct org_kde_kwin_server_decoration *
|
||||
org_kde_kwin_server_decoration_manager_create(struct org_kde_kwin_server_decoration_manager *org_kde_kwin_server_decoration_manager, struct wl_surface *surface)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) org_kde_kwin_server_decoration_manager,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_CREATE, &org_kde_kwin_server_decoration_interface, NULL, surface);
|
||||
|
||||
return (struct org_kde_kwin_server_decoration *) id;
|
||||
}
|
||||
|
||||
#ifndef ORG_KDE_KWIN_SERVER_DECORATION_MODE_ENUM
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MODE_ENUM
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
* Possible values to use in request_mode and the event mode.
|
||||
*/
|
||||
enum org_kde_kwin_server_decoration_mode {
|
||||
/**
|
||||
* Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MODE_NONE = 0,
|
||||
/**
|
||||
* Client-side decoration: The decoration is part of the surface and the client.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MODE_CLIENT = 1,
|
||||
/**
|
||||
* Server-side decoration: The server embeds the surface into a decoration frame.
|
||||
*/
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER = 2,
|
||||
};
|
||||
#endif /* ORG_KDE_KWIN_SERVER_DECORATION_MODE_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
* @struct org_kde_kwin_server_decoration_listener
|
||||
*/
|
||||
struct org_kde_kwin_server_decoration_listener {
|
||||
/**
|
||||
* 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.
|
||||
* @param mode The decoration mode applied to the surface by the server.
|
||||
*/
|
||||
void (*mode)(void *data,
|
||||
struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration,
|
||||
uint32_t mode);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup org_kde_kwin_server_decoration_iface
|
||||
*/
|
||||
static inline int
|
||||
org_kde_kwin_server_decoration_add_listener(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration,
|
||||
const struct org_kde_kwin_server_decoration_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) org_kde_kwin_server_decoration,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_RELEASE 0
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_REQUEST_MODE 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
*/
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_MODE_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
*/
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_RELEASE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
*/
|
||||
#define ORG_KDE_KWIN_SERVER_DECORATION_REQUEST_MODE_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration */
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_set_user_data(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) org_kde_kwin_server_decoration, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration */
|
||||
static inline void *
|
||||
org_kde_kwin_server_decoration_get_user_data(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) org_kde_kwin_server_decoration);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
org_kde_kwin_server_decoration_get_version(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) org_kde_kwin_server_decoration);
|
||||
}
|
||||
|
||||
/** @ingroup iface_org_kde_kwin_server_decoration */
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_destroy(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration)
|
||||
{
|
||||
wl_proxy_destroy((struct wl_proxy *) org_kde_kwin_server_decoration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
*/
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_release(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) org_kde_kwin_server_decoration,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_RELEASE);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) org_kde_kwin_server_decoration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_org_kde_kwin_server_decoration
|
||||
*/
|
||||
static inline void
|
||||
org_kde_kwin_server_decoration_request_mode(struct org_kde_kwin_server_decoration *org_kde_kwin_server_decoration, uint32_t mode)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) org_kde_kwin_server_decoration,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_REQUEST_MODE, mode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user