Use xdg decoration for server-side decorations

This commit is contained in:
Deve 2018-07-05 21:54:39 +02:00
parent b69216f242
commit e6081e64b2
7 changed files with 463 additions and 409 deletions

View File

@ -582,7 +582,7 @@ include/vector3d.h
if(ENABLE_WAYLAND_DEVICE)
set(IRRLICHT_SOURCES
${IRRLICHT_SOURCES}
source/Irrlicht/server_decoration_client_protocol.c
source/Irrlicht/xdg_decoration_unstable_v1_protocol.c
source/Irrlicht/xdg_shell_protocol.c)
endif()

View File

@ -606,12 +606,12 @@ public:
wl_output_add_listener(device->m_output, &output_listener, device);
}
else if (interface_str == "org_kde_kwin_server_decoration_manager")
else if (interface_str == "zxdg_decoration_manager_v1")
{
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_cast<zxdg_decoration_manager_v1*>(
wl_registry_bind(registry, name,
&zxdg_decoration_manager_v1_interface, 1));
}
else if (interface_str == "xdg_wm_base")
{
@ -804,10 +804,10 @@ CIrrDeviceWayland::~CIrrDeviceWayland()
delete m_egl_context;
if (m_decoration)
org_kde_kwin_server_decoration_destroy(m_decoration);
zxdg_toplevel_decoration_v1_destroy(m_decoration);
if (m_decoration_manager)
org_kde_kwin_server_decoration_manager_destroy(m_decoration_manager);
zxdg_decoration_manager_v1_destroy(m_decoration_manager);
if (m_keyboard)
wl_keyboard_destroy(m_keyboard);
@ -1031,6 +1031,18 @@ bool CIrrDeviceWayland::createWindow()
wl_display_dispatch(m_display);
usleep(1000);
}
if (m_decoration_manager != NULL)
{
m_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
m_decoration_manager, m_xdg_toplevel);
}
if (m_decoration != NULL)
{
zxdg_toplevel_decoration_v1_set_mode(m_decoration,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
}
else if (m_shell != NULL)
{
@ -1056,18 +1068,6 @@ bool CIrrDeviceWayland::createWindow()
return false;
}
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_region* region = wl_compositor_create_region(m_compositor);
wl_region_add(region, 0, 0, m_width, m_height);
wl_surface_set_opaque_region(m_surface, region);

View File

@ -26,7 +26,7 @@
#include "CIrrDeviceStub.h"
#include "IImagePresenter.h"
#include "ICursorControl.h"
#include "server_decoration_client_protocol.h"
#include "xdg_decoration_unstable_v1_client_protocol.h"
#include "xdg_shell_client_protocol.h"
#include <wayland-client.h>
@ -190,8 +190,8 @@ namespace irr
bool m_surface_configured;
uint32_t m_xdg_wm_base_name;
org_kde_kwin_server_decoration_manager* m_decoration_manager;
org_kde_kwin_server_decoration* m_decoration;
zxdg_decoration_manager_v1* m_decoration_manager;
zxdg_toplevel_decoration_v1* m_decoration;
xkb_context* m_xkb_context;
xkb_compose_table* m_xkb_compose_table;

View File

@ -1,61 +0,0 @@
/* 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,
};

View File

@ -1,326 +0,0 @@
/* 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

View File

@ -0,0 +1,376 @@
/* Generated by wayland-scanner 1.14.0 */
#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
#define XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @page page_xdg_decoration_unstable_v1 The xdg_decoration_unstable_v1 protocol
* @section page_ifaces_xdg_decoration_unstable_v1 Interfaces
* - @subpage page_iface_zxdg_decoration_manager_v1 - window decoration manager
* - @subpage page_iface_zxdg_toplevel_decoration_v1 - decoration object for a toplevel surface
* @section page_copyright_xdg_decoration_unstable_v1 Copyright
* <pre>
*
* Copyright © 2018 Simon Ser
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct xdg_toplevel;
struct zxdg_decoration_manager_v1;
struct zxdg_toplevel_decoration_v1;
/**
* @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1
* @section page_iface_zxdg_decoration_manager_v1_desc Description
*
* This interface allows a compositor to announce support for server-side
* decorations.
*
* A window decoration is a set of window controls as deemed appropriate by
* the party managing them, such as user interface components used to move,
* resize and change a window's state.
*
* A client can use this protocol to request being decorated by a supporting
* compositor.
*
* If compositor and client do not negotiate the use of a server-side
* decoration using this protocol, clients continue to self-decorate as they
* see fit.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible changes
* may be added together with the corresponding interface version bump.
* Backward incompatible changes are done by bumping the version number in
* the protocol and interface names and resetting the interface version.
* Once the protocol is to be declared stable, the 'z' prefix and the
* version number in the protocol and interface names are removed and the
* interface version number is reset.
* @section page_iface_zxdg_decoration_manager_v1_api API
* See @ref iface_zxdg_decoration_manager_v1.
*/
/**
* @defgroup iface_zxdg_decoration_manager_v1 The zxdg_decoration_manager_v1 interface
*
* This interface allows a compositor to announce support for server-side
* decorations.
*
* A window decoration is a set of window controls as deemed appropriate by
* the party managing them, such as user interface components used to move,
* resize and change a window's state.
*
* A client can use this protocol to request being decorated by a supporting
* compositor.
*
* If compositor and client do not negotiate the use of a server-side
* decoration using this protocol, clients continue to self-decorate as they
* see fit.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible changes
* may be added together with the corresponding interface version bump.
* Backward incompatible changes are done by bumping the version number in
* the protocol and interface names and resetting the interface version.
* Once the protocol is to be declared stable, the 'z' prefix and the
* version number in the protocol and interface names are removed and the
* interface version number is reset.
*/
extern const struct wl_interface zxdg_decoration_manager_v1_interface;
/**
* @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1
* @section page_iface_zxdg_toplevel_decoration_v1_desc Description
*
* The decoration object allows the compositor to toggle server-side window
* decorations for a toplevel surface. The client can request to switch to
* another mode.
*
* The xdg_toplevel_decoration object must be destroyed before its
* xdg_toplevel.
* @section page_iface_zxdg_toplevel_decoration_v1_api API
* See @ref iface_zxdg_toplevel_decoration_v1.
*/
/**
* @defgroup iface_zxdg_toplevel_decoration_v1 The zxdg_toplevel_decoration_v1 interface
*
* The decoration object allows the compositor to toggle server-side window
* decorations for a toplevel surface. The client can request to switch to
* another mode.
*
* The xdg_toplevel_decoration object must be destroyed before its
* xdg_toplevel.
*/
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
#define ZXDG_DECORATION_MANAGER_V1_DESTROY 0
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1
/**
* @ingroup iface_zxdg_decoration_manager_v1
*/
#define ZXDG_DECORATION_MANAGER_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_zxdg_decoration_manager_v1
*/
#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION_SINCE_VERSION 1
/** @ingroup iface_zxdg_decoration_manager_v1 */
static inline void
zxdg_decoration_manager_v1_set_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) zxdg_decoration_manager_v1, user_data);
}
/** @ingroup iface_zxdg_decoration_manager_v1 */
static inline void *
zxdg_decoration_manager_v1_get_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
{
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_decoration_manager_v1);
}
static inline uint32_t
zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
{
return wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1);
}
/**
* @ingroup iface_zxdg_decoration_manager_v1
*
* Destroy the decoration manager. This doesn't destroy objects created
* with the manager.
*/
static inline void
zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
{
wl_proxy_marshal((struct wl_proxy *) zxdg_decoration_manager_v1,
ZXDG_DECORATION_MANAGER_V1_DESTROY);
wl_proxy_destroy((struct wl_proxy *) zxdg_decoration_manager_v1);
}
/**
* @ingroup iface_zxdg_decoration_manager_v1
*
* Create a new decoration object associated with the given toplevel.
*
* Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
* buffer attached or committed is a client error, and any attempts by a
* client to attach or manipulate a buffer prior to the first
* xdg_toplevel_decoration.configure event must also be treated as
* errors.
*/
static inline struct zxdg_toplevel_decoration_v1 *
zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel)
{
struct wl_proxy *id;
id = wl_proxy_marshal_constructor((struct wl_proxy *) zxdg_decoration_manager_v1,
ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, NULL, toplevel);
return (struct zxdg_toplevel_decoration_v1 *) id;
}
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
#define ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
enum zxdg_toplevel_decoration_v1_error {
/**
* xdg_toplevel has a buffer attached before configure
*/
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0,
/**
* xdg_toplevel already has a decoration object
*/
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1,
/**
* xdg_toplevel destroyed before the decoration object
*/
ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2,
};
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM */
#ifndef ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
#define ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
* window decoration modes
*
* These values describe window decoration modes.
*/
enum zxdg_toplevel_decoration_v1_mode {
/**
* no server-side window decoration
*/
ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1,
/**
* server-side window decoration
*/
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2,
};
#endif /* ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM */
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
* @struct zxdg_toplevel_decoration_v1_listener
*/
struct zxdg_toplevel_decoration_v1_listener {
/**
* suggest a surface change
*
* The configure event asks the client to change its decoration
* mode. The configured state should not be applied immediately.
* Clients must send an ack_configure in response to this event.
* See xdg_surface.configure and xdg_surface.ack_configure for
* details.
*
* A configure event can be sent at any time. The specified mode
* must be obeyed by the client.
* @param mode the decoration mode
*/
void (*configure)(void *data,
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
uint32_t mode);
};
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*/
static inline int
zxdg_toplevel_decoration_v1_add_listener(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
const struct zxdg_toplevel_decoration_v1_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_decoration_v1,
(void (**)(void)) listener, data);
}
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY 0
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE 1
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE 2
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*/
#define ZXDG_TOPLEVEL_DECORATION_V1_CONFIGURE_SINCE_VERSION 1
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*/
#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*/
#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE_SINCE_VERSION 1
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*/
#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE_SINCE_VERSION 1
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
static inline void
zxdg_toplevel_decoration_v1_set_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1, user_data);
}
/** @ingroup iface_zxdg_toplevel_decoration_v1 */
static inline void *
zxdg_toplevel_decoration_v1_get_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
{
return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1);
}
static inline uint32_t
zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
{
return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1);
}
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*
* Switch back to a mode without any server-side decorations at the next
* commit.
*/
static inline void
zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
{
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
ZXDG_TOPLEVEL_DECORATION_V1_DESTROY);
wl_proxy_destroy((struct wl_proxy *) zxdg_toplevel_decoration_v1);
}
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*
* Set the toplevel surface decoration mode. This informs the compositor
* that the client prefers the provided decoration mode.
*
* After requesting a decoration mode, the compositor will respond by
* emitting a xdg_surface.configure event. The client should then update
* its content, drawing it without decorations if the received mode is
* server-side decorations. The client must also acknowledge the configure
* when committing the new content (see xdg_surface.ack_configure).
*
* The compositor can decide not to use the client's mode and enforce a
* different mode instead.
*
* Clients whose decoration mode depend on the xdg_toplevel state may send
* a set_mode request in response to a xdg_surface.configure event and wait
* for the next xdg_surface.configure event to prevent unwanted state.
* Such clients are responsible for preventing configure loops and must
* make sure not to send multiple successive set_mode requests with the
* same decoration mode.
*/
static inline void
zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
{
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, mode);
}
/**
* @ingroup iface_zxdg_toplevel_decoration_v1
*
* Unset the toplevel surface decoration mode. This informs the compositor
* that the client doesn't prefer a particular decoration mode.
*
* This request has the same semantics as set_mode.
*/
static inline void
zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
{
wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,65 @@
/* Generated by wayland-scanner 1.14.0 */
/*
* Copyright © 2018 Simon Ser
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
extern const struct wl_interface xdg_toplevel_interface;
extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
static const struct wl_interface *types[] = {
NULL,
&zxdg_toplevel_decoration_v1_interface,
&xdg_toplevel_interface,
};
static const struct wl_message zxdg_decoration_manager_v1_requests[] = {
{ "destroy", "", types + 0 },
{ "get_toplevel_decoration", "no", types + 1 },
};
WL_EXPORT const struct wl_interface zxdg_decoration_manager_v1_interface = {
"zxdg_decoration_manager_v1", 1,
2, zxdg_decoration_manager_v1_requests,
0, NULL,
};
static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = {
{ "destroy", "", types + 0 },
{ "set_mode", "u", types + 0 },
{ "unset_mode", "", types + 0 },
};
static const struct wl_message zxdg_toplevel_decoration_v1_events[] = {
{ "configure", "u", types + 0 },
};
WL_EXPORT const struct wl_interface zxdg_toplevel_decoration_v1_interface = {
"zxdg_toplevel_decoration_v1", 1,
3, zxdg_toplevel_decoration_v1_requests,
1, zxdg_toplevel_decoration_v1_events,
};