Merge pull request #5209 from akallabeth/wayland_protocol_update_and_keyboard_inhibit

Wayland protocol update and keyboard inhibit support
This commit is contained in:
David Fort
2019-01-23 10:02:07 +01:00
committed by GitHub
12 changed files with 1402 additions and 358 deletions

View File

@@ -307,6 +307,8 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display)
break;
case UWAC_EVENT_KEYBOARD_ENTER:
if (instance->context->settings->GrabKeyboard)
UwacSeatInhibitShortcuts(event.keyboard_enter_leave.seat, true);
if (!wlf_keyboard_enter(instance, &event.keyboard_enter_leave))
return FALSE;

View File

@@ -494,6 +494,16 @@ UWAC_API const char *UwacSeatGetName(const UwacSeat *seat);
*/
UWAC_API UwacSeatId UwacSeatGetId(const UwacSeat *seat);
/**
* Inhibits or restores keyboard shortcuts.
*
* @param seat The UwacSeat to inhibit the shortcuts for
* @param inhibit Inhibit or restore keyboard shortcuts
*
* @return UWAC_SUCCESS or an appropriate error code.
*/
UWAC_API UwacReturnCode UwacSeatInhibitShortcuts(UwacSeat* seat, bool inhibit);
#ifdef __cplusplus
}
#endif

View File

@@ -31,14 +31,17 @@ macro(generate_protocol_file PROTO)
COMMAND ${WAYLAND_SCANNER} client-header < ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-client-protocol.h
DEPENDS ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml
)
list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-client-protocol.h)
list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-protocol.c)
endmacro()
generate_protocol_file(xdg-shell)
generate_protocol_file(xdg-decoration-unstable-v1)
generate_protocol_file(server-decoration)
generate_protocol_file(ivi-application)
generate_protocol_file(fullscreen-shell)
generate_protocol_file(fullscreen-shell-unstable-v1)
generate_protocol_file(keyboard-shortcuts-inhibit-unstable-v1)
if(FREEBSD)
include_directories(${EPOLLSHIM_INCLUDE_DIR})
@@ -61,7 +64,7 @@ set(${MODULE_PREFIX}_SRCS
uwac-priv.h
uwac-tools.c
uwac-utils.c
uwac-window.c)
uwac-window.c)
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

View File

@@ -103,23 +103,26 @@ struct wl_shm_listener shm_listener =
cb_shm_format
};
static void xdg_shell_ping(void* data, struct xdg_shell* shell, uint32_t serial)
static void xdg_shell_ping(void *data,
struct xdg_wm_base *xdg_wm_base,
uint32_t serial)
{
xdg_shell_pong(shell, serial);
xdg_wm_base_pong(xdg_wm_base, serial);
}
static const struct xdg_shell_listener xdg_shell_listener =
static const struct xdg_wm_base_listener xdg_wm_base_listener =
{
xdg_shell_ping,
};
#ifdef BUILD_FULLSCREEN_SHELL
static void fullscreen_capability(void* data, struct _wl_fullscreen_shell* _wl_fullscreen_shell,
uint32_t capabilty)
static void fullscreen_capability(void *data,
struct zwp_fullscreen_shell_v1 *zwp_fullscreen_shell_v1,
uint32_t capability)
{
}
static const struct _wl_fullscreen_shell_listener fullscreen_shell_listener =
static const struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener =
{
fullscreen_capability,
};
@@ -208,26 +211,37 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
d->shell = wl_registry_bind(registry, id, &wl_shell_interface, min(TARGET_SHELL_INTERFACE,
version));
}
else if (strcmp(interface, "xdg_shell") == 0)
else if (strcmp(interface, "xdg_wm_base") == 0)
{
d->xdg_shell = wl_registry_bind(registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(d->xdg_shell, TARGET_XDG_VERSION);
xdg_shell_add_listener(d->xdg_shell, &xdg_shell_listener, d);
#if BUILD_IVI
d->xdg_base = wl_registry_bind(registry, id, &xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(d->xdg_base, &xdg_wm_base_listener, d);
}
else if (strcmp(interface, "zwp_keyboard_shortcuts_inhibit_manager_v1") == 0)
{
d->keyboard_inhibit_manager = wl_registry_bind(registry, id, &zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1);
}
else if (strcmp(interface, "zxdg_decoration_manager_v1") == 0)
{
d->deco_manager = wl_registry_bind(registry, id, &zxdg_decoration_manager_v1_interface, 1);
}
else if (strcmp(interface, "org_kde_kwin_server_decoration_manager") == 0)
{
d->kde_deco_manager = wl_registry_bind(registry, id, &org_kde_kwin_server_decoration_manager_interface, 1);
}
#if BUILD_IVI
else if (strcmp(interface, "ivi_application") == 0)
{
d->ivi_application = wl_registry_bind(registry, id, &ivi_application_interface, 1);
}
#endif
#if BUILD_FULLSCREEN_SHELL
}
else if (strcmp(interface, "_wl_fullscreen_shell") == 0)
else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0)
{
d->fullscreen_shell = wl_registry_bind(registry, id, &_wl_fullscreen_shell_interface, 1);
_wl_fullscreen_shell_add_listener(d->fullscreen_shell, &fullscreen_shell_listener, d);
d->fullscreen_shell = wl_registry_bind(registry, id, &zwp_fullscreen_shell_v1_interface, 1);
zwp_fullscreen_shell_v1_add_listener(d->fullscreen_shell, &fullscreen_shell_listener, d);
}
#endif
#if 0
}
else if (strcmp(interface, "text_cursor_position") == 0)
{
d->text_cursor_position = wl_registry_bind(registry, id, &text_cursor_position_interface, 1);
@@ -240,7 +254,6 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
{
d->subcompositor = wl_registry_bind(registry, id, &wl_subcompositor_interface, 1);
#endif
}
}
static void registry_handle_global_remove(void* data, struct wl_registry* registry, uint32_t name)
@@ -510,10 +523,19 @@ UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
if (display->compositor)
wl_compositor_destroy(display->compositor);
if (display->keyboard_inhibit_manager)
zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(display->keyboard_inhibit_manager);
if (display->deco_manager)
zxdg_decoration_manager_v1_destroy(display->deco_manager);
if (display->kde_deco_manager)
org_kde_kwin_server_decoration_manager_destroy(display->kde_deco_manager);
#ifdef BUILD_FULLSCREEN_SHELL
if (display->fullscreen_shell)
_wl_fullscreen_shell_destroy(display->fullscreen_shell);
zwp_fullscreen_shell_v1_destroy(display->fullscreen_shell);
#endif
#ifdef BUILD_IVI
@@ -523,8 +545,11 @@ UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
#endif
if (display->xdg_shell)
xdg_shell_destroy(display->xdg_shell);
if (display->xdg_toplevel)
xdg_toplevel_destroy(display->xdg_toplevel);
if (display->xdg_base)
xdg_wm_base_destroy(display->xdg_base);
if (display->shell)
wl_shell_destroy(display->shell);

View File

@@ -130,6 +130,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint
return;
event->window = input->keyboard_focus = (UwacWindow *)wl_surface_get_user_data(surface);
event->seat = input;
/* look for keys that have been released */
found = false;
@@ -819,6 +820,7 @@ error_xkb_context:
}
void UwacSeatDestroy(UwacSeat *s) {
UwacSeatInhibitShortcuts(s, false);
if (s->seat) {
#ifdef WL_SEAT_RELEASE_SINCE_VERSION
if (s->seat_version >= WL_SEAT_RELEASE_SINCE_VERSION)
@@ -873,3 +875,19 @@ const char *UwacSeatGetName(const UwacSeat *seat) {
UwacSeatId UwacSeatGetId(const UwacSeat *seat) {
return seat->seat_id;
}
UwacReturnCode UwacSeatInhibitShortcuts(UwacSeat* s, bool inhibit)
{
if (!s)
return UWAC_ERROR_CLOSED;
if (s->keyboard_inhibitor)
zwp_keyboard_shortcuts_inhibitor_v1_destroy(s->keyboard_inhibitor);
if (inhibit && s->display && s->display->keyboard_inhibit_manager)
s->keyboard_inhibitor = zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(s->display->keyboard_inhibit_manager,
s->keyboard_focus->surface, s->seat);
if (!s->keyboard_inhibitor)
return UWAC_ERROR_INTERNAL;
return UWAC_SUCCESS;
}

View File

@@ -28,11 +28,15 @@
#include <stdbool.h>
#include <wayland-client.h>
#include "xdg-shell-client-protocol.h"
#include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h"
#include "xdg-decoration-unstable-v1-client-protocol.h"
#include "server-decoration-client-protocol.h"
#ifdef BUILD_IVI
#include "ivi-application-client-protocol.h"
#endif
#ifdef BUILD_FULLSCREEN_SHELL
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#endif
#ifdef HAVE_PIXMAN_REGION
@@ -84,12 +88,16 @@ struct uwac_display {
struct wl_compositor *compositor;
struct wl_subcompositor *subcompositor;
struct wl_shell *shell;
struct xdg_shell *xdg_shell;
struct xdg_toplevel *xdg_toplevel;
struct xdg_wm_base *xdg_base;
struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_inhibit_manager;
struct zxdg_decoration_manager_v1 *deco_manager;
struct org_kde_kwin_server_decoration_manager *kde_deco_manager;
#ifdef BUILD_IVI
struct ivi_application *ivi_application;
#endif
#ifdef BUILD_FULLSCREEN_SHELL
struct _wl_fullscreen_shell *fullscreen_shell;
struct zwp_fullscreen_shell_v1 *fullscreen_shell;
#endif
struct wl_shm *shm;
@@ -150,6 +158,7 @@ struct uwac_seat {
struct wl_keyboard *keyboard;
struct wl_touch *touch;
struct xkb_context *xkb_context;
struct zwp_keyboard_shortcuts_inhibitor_v1 *keyboard_inhibitor;
struct {
struct xkb_keymap *keymap;
@@ -210,6 +219,9 @@ struct uwac_window {
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_decoration_v1 *deco;
struct org_kde_kwin_server_decoration *kde_deco;
#ifdef BUILD_IVI
struct ivi_surface *ivi_surface;
#endif

View File

@@ -82,32 +82,34 @@ void UwacWindowDestroyBuffers(UwacWindow* w)
int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32_t width,
uint32_t height, enum wl_shm_format format);
static void xdg_handle_configure(void* data, struct xdg_surface* surface,
int32_t width, int32_t height,
struct wl_array* states, uint32_t serial)
static void xdg_handle_configure(void *data,
struct xdg_toplevel *xdg_toplevel,
int32_t width,
int32_t height,
struct wl_array *states)
{
UwacWindow* window = (UwacWindow*)data;
UwacConfigureEvent* event;
int ret, surfaceState;
enum xdg_surface_state* state;
enum xdg_toplevel_state* state;
surfaceState = 0;
wl_array_for_each(state, states)
{
switch (*state)
{
case XDG_SURFACE_STATE_MAXIMIZED:
case XDG_TOPLEVEL_STATE_MAXIMIZED:
surfaceState |= UWAC_WINDOW_MAXIMIZED;
break;
case XDG_SURFACE_STATE_FULLSCREEN:
case XDG_TOPLEVEL_STATE_FULLSCREEN:
surfaceState |= UWAC_WINDOW_FULLSCREEN;
break;
case XDG_SURFACE_STATE_ACTIVATED:
case XDG_TOPLEVEL_STATE_ACTIVATED:
surfaceState |= UWAC_WINDOW_ACTIVATED;
break;
case XDG_SURFACE_STATE_RESIZING:
case XDG_TOPLEVEL_STATE_RESIZING:
surfaceState |= UWAC_WINDOW_RESIZING;
break;
@@ -122,7 +124,7 @@ static void xdg_handle_configure(void* data, struct xdg_surface* surface,
{
assert(uwacErrorHandler(window->display, UWAC_ERROR_NOMEMORY,
"failed to allocate a configure event\n"));
goto ack;
return;
}
event->window = window;
@@ -143,7 +145,7 @@ static void xdg_handle_configure(void* data, struct xdg_surface* surface,
{
assert(uwacErrorHandler(window->display, ret, "failed to reallocate a wayland buffers\n"));
window->drawingBuffer = window->pendingBuffer = NULL;
goto ack;
return;
}
window->drawingBuffer = window->pendingBuffer = &window->buffers[0];
@@ -153,12 +155,10 @@ static void xdg_handle_configure(void* data, struct xdg_surface* surface,
event->width = window->width;
event->height = window->height;
}
ack:
xdg_surface_ack_configure(surface, serial);
}
static void xdg_handle_close(void* data, struct xdg_surface* xdg_surface)
static void xdg_handle_close(void *data,
struct xdg_toplevel *xdg_toplevel)
{
UwacCloseEvent* event;
UwacWindow* window = (UwacWindow*)data;
@@ -174,12 +174,11 @@ static void xdg_handle_close(void* data, struct xdg_surface* xdg_surface)
event->window = window;
}
static const struct xdg_surface_listener xdg_surface_listener =
static const struct xdg_toplevel_listener xdg_toplevel_listener =
{
xdg_handle_configure,
xdg_handle_close,
};
#if BUILD_IVI
static void ivi_handle_configure(void* data, struct ivi_surface* surface,
@@ -382,6 +381,30 @@ UwacBuffer* UwacWindowFindFreeBuffer(UwacWindow* w)
return &w->buffers[i];
}
static UwacReturnCode UwacWindowSetDecorations(UwacWindow *w)
{
if (!w || !w->display)
return UWAC_ERROR_INTERNAL;
if (w->display->deco_manager) {
w->deco = zxdg_decoration_manager_v1_get_toplevel_decoration(
w->display->deco_manager, w->xdg_toplevel);
if (!w->deco) {
uwacErrorHandler(w->display, UWAC_NOT_FOUND, "Current window manager does not allow decorating with SSD");
}
else
zxdg_toplevel_decoration_v1_set_mode(w->deco, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
else if (w->display->kde_deco_manager) {
w->kde_deco = org_kde_kwin_server_decoration_manager_create(w->display->kde_deco_manager, w->surface);
if (!w->kde_deco) {
uwacErrorHandler(w->display, UWAC_NOT_FOUND, "Current window manager does not allow decorating with SSD");
}
else
org_kde_kwin_server_decoration_request_mode(w->kde_deco, ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER);
}
return UWAC_SUCCESS;
}
UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
enum wl_shm_format format)
@@ -428,9 +451,9 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
wl_surface_set_user_data(w->surface, w);
if (display->xdg_shell)
if (display->xdg_base)
{
w->xdg_surface = xdg_shell_get_xdg_surface(display->xdg_shell, w->surface);
w->xdg_surface = xdg_wm_base_get_xdg_surface(display->xdg_base, w->surface);
if (!w->xdg_surface)
{
@@ -438,24 +461,31 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
goto out_error_shell;
}
w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
if (!w->xdg_toplevel)
{
display->last_error = UWAC_ERROR_NOMEMORY;
goto out_error_shell;
}
assert(w->xdg_surface);
xdg_surface_add_listener(w->xdg_surface, &xdg_surface_listener, w);
#if BUILD_IVI
xdg_toplevel_add_listener(w->xdg_toplevel, &xdg_toplevel_listener, w);
}
#if BUILD_IVI
else if (display->ivi_application)
{
w->ivi_surface = ivi_application_surface_create(display->ivi_application, 1, w->surface);
assert(w->ivi_surface);
ivi_surface_add_listener(w->ivi_surface, &ivi_surface_listener, w);
}
#endif
#if BUILD_FULLSCREEN_SHELL
}
else if (display->fullscreen_shell)
{
_wl_fullscreen_shell_present_surface(display->fullscreen_shell, w->surface,
_WL_FULLSCREEN_SHELL_PRESENT_METHOD_CENTER, NULL);
#endif
zwp_fullscreen_shell_v1_present_surface(display->fullscreen_shell, w->surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER, NULL);
}
#endif
else
{
w->shell_surface = wl_shell_get_shell_surface(display->shell, w->surface);
@@ -466,6 +496,7 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
wl_list_insert(display->windows.prev, &w->link);
display->last_error = UWAC_SUCCESS;
UwacWindowSetDecorations(w);
return w;
out_error_shell:
wl_surface_destroy(w->surface);
@@ -487,6 +518,12 @@ UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
if (w->frame_callback)
wl_callback_destroy(w->frame_callback);
if (w->deco)
zxdg_toplevel_decoration_v1_destroy(w->deco);
if (w->kde_deco)
org_kde_kwin_server_decoration_destroy(w->kde_deco);
if (w->xdg_surface)
xdg_surface_destroy(w->xdg_surface);
@@ -674,15 +711,15 @@ UwacReturnCode UwacWindowGetGeometry(UwacWindow* window, UwacSize* geometry)
UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* output,
bool isFullscreen)
{
if (window->xdg_surface)
if (window->xdg_toplevel)
{
if (isFullscreen)
{
xdg_surface_set_fullscreen(window->xdg_surface, output ? output->output : NULL);
xdg_toplevel_set_fullscreen(window->xdg_toplevel, output ? output->output : NULL);
}
else
{
xdg_surface_unset_fullscreen(window->xdg_surface);
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
}
}
else if (window->shell_surface)
@@ -705,8 +742,8 @@ UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* outp
void UwacWindowSetTitle(UwacWindow* window, const char* name)
{
if (window->xdg_surface)
xdg_surface_set_title(window->xdg_surface, name);
if (window->xdg_toplevel)
xdg_toplevel_set_title(window->xdg_toplevel, name);
else if (window->shell_surface)
wl_shell_surface_set_title(window->shell_surface, name);
}

View File

@@ -1,6 +1,8 @@
<protocol name="fullscreen_shell">
<interface name="_wl_fullscreen_shell" version="1">
<description summary="Displays a single surface per output">
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="fullscreen_shell_unstable_v1">
<interface name="zwp_fullscreen_shell_v1" version="1">
<description summary="displays a single surface per output">
Displays a single surface per output.
This interface provides a mechanism for a single client to display
@@ -14,7 +16,7 @@
details about scaling and mode switches.
The client can have at most one surface per output at any time.
Requesting a surface be presented on an output that already has a
Requesting a surface to be presented on an output that already has a
surface replaces the previously presented surface. Presenting a null
surface removes its content and effectively disables the output.
Exactly what happens when an output is "disabled" is
@@ -25,11 +27,20 @@
until either the client removes it or the compositor destroys the
output. This way, the client can update the output's contents by
simply attaching a new buffer.
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.
</description>
<request name="release" type="destructor">
<description summary="release the wl_fullscreen_shell interface">
Release the binding from the wl_fullscreen_shell interface
Release the binding from the wl_fullscreen_shell interface.
This destroys the server-side object and frees this binding. If
the client binds to wl_fullscreen_shell multiple times, it may wish
@@ -43,7 +54,7 @@
are advertised one-at-a-time when the wl_fullscreen_shell interface is
bound. See the wl_fullscreen_shell.capability event for more details.
ARBITRARY_MODE:
ARBITRARY_MODES:
This is a hint to the client that indicates that the compositor is
capable of setting practically any mode on its outputs. If this
capability is provided, wl_fullscreen_shell.present_surface_for_mode
@@ -76,7 +87,7 @@
wl_display.sync request immediately after binding to ensure that they
receive all the capability events.
</description>
<arg name="capabilty" type="uint"/>
<arg name="capability" type="uint"/>
</event>
<enum name="present_method">
@@ -160,18 +171,18 @@
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="output" type="object" interface="wl_output"/>
<arg name="framerate" type="int"/>
<arg name="feedback" type="new_id" interface="_wl_fullscreen_shell_mode_feedback"/>
<arg name="feedback" type="new_id" interface="zwp_fullscreen_shell_mode_feedback_v1"/>
</request>
<enum name="error">
<description summary="wl_fullscreen_shell error values">
These errors can be emitted in response to wl_fullscreen_shell requests
These errors can be emitted in response to wl_fullscreen_shell requests.
</description>
<entry name="invalid_method" value="0" summary="present_method is not known"/>
</enum>
</interface>
<interface name="_wl_fullscreen_shell_mode_feedback" version="1">
<interface name="zwp_fullscreen_shell_mode_feedback_v1" version="1">
<event name="mode_successful">
<description summary="mode switch succeeded">
This event indicates that the attempted mode switch operation was
@@ -182,16 +193,18 @@
wl_fullscreen_shell_mode_feedback object.
</description>
</event>
<event name="mode_failed">
<description summary="mode switch failed">
This event indicates that the attempted mode switch operation
failed. This may be because the requested output mode is not
failed. This may be because the requested output mode is not
possible or it may mean that the compositor does not want to allow it.
Upon receiving this event, the client should destroy the
wl_fullscreen_shell_mode_feedback object.
</description>
</event>
<event name="present_cancelled">
<description summary="mode switch cancelled">
This event indicates that the attempted mode switch operation was
@@ -203,4 +216,5 @@
</description>
</event>
</interface>
</protocol>

View File

@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="keyboard_shortcuts_inhibit_unstable_v1">
<copyright>
Copyright © 2017 Red Hat Inc.
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.
</copyright>
<description summary="Protocol for inhibiting the compositor keyboard shortcuts">
This protocol specifies a way for a client to request the compositor
to ignore its own keyboard shortcuts for a given seat, so that all
key events from that seat get forwarded to a surface.
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.
</description>
<interface name="zwp_keyboard_shortcuts_inhibit_manager_v1" version="1">
<description summary="context object for keyboard grab_manager">
A global interface used for inhibiting the compositor keyboard shortcuts.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the keyboard shortcuts inhibitor object">
Destroy the keyboard shortcuts inhibitor manager.
</description>
</request>
<request name="inhibit_shortcuts">
<description summary="create a new keyboard shortcuts inhibitor object">
Create a new keyboard shortcuts inhibitor object associated with
the given surface for the given seat.
If shortcuts are already inhibited for the specified seat and surface,
a protocol error "already_inhibited" is raised by the compositor.
</description>
<arg name="id" type="new_id" interface="zwp_keyboard_shortcuts_inhibitor_v1"/>
<arg name="surface" type="object" interface="wl_surface"
summary="the surface that inhibits the keyboard shortcuts behavior"/>
<arg name="seat" type="object" interface="wl_seat"
summary="the wl_seat for which keyboard shortcuts should be disabled"/>
</request>
<enum name="error">
<entry name="already_inhibited"
value="0"
summary="the shortcuts are already inhibited for this surface"/>
</enum>
</interface>
<interface name="zwp_keyboard_shortcuts_inhibitor_v1" version="1">
<description summary="context object for keyboard shortcuts inhibitor">
A keyboard shortcuts inhibitor instructs the compositor to ignore
its own keyboard shortcuts when the associated surface has keyboard
focus. As a result, when the surface has keyboard focus on the given
seat, it will receive all key events originating from the specified
seat, even those which would normally be caught by the compositor for
its own shortcuts.
The Wayland compositor is however under no obligation to disable
all of its shortcuts, and may keep some special key combo for its own
use, including but not limited to one allowing the user to forcibly
restore normal keyboard events routing in the case of an unwilling
client. The compositor may also use the same key combo to reactivate
an existing shortcut inhibitor that was previously deactivated on
user request.
When the compositor restores its own keyboard shortcuts, an
"inactive" event is emitted to notify the client that the keyboard
shortcuts inhibitor is not effectively active for the surface and
seat any more, and the client should not expect to receive all
keyboard events.
When the keyboard shortcuts inhibitor is inactive, the client has
no way to forcibly reactivate the keyboard shortcuts inhibitor.
The user can chose to re-enable a previously deactivated keyboard
shortcuts inhibitor using any mechanism the compositor may offer,
in which case the compositor will send an "active" event to notify
the client.
If the surface is destroyed, unmapped, or loses the seat's keyboard
focus, the keyboard shortcuts inhibitor becomes irrelevant and the
compositor will restore its own keyboard shortcuts but no "inactive"
event is emitted in this case.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the keyboard shortcuts inhibitor object">
Remove the keyboard shortcuts inhibitor from the associated wl_surface.
</description>
</request>
<event name="active">
<description summary="shortcuts are inhibited">
This event indicates that the shortcut inhibitor is active.
The compositor sends this event every time compositor shortcuts
are inhibited on behalf of the surface. When active, the client
may receive input events normally reserved by the compositor
(see zwp_keyboard_shortcuts_inhibitor_v1).
This occurs typically when the initial request "inhibit_shortcuts"
first becomes active or when the user instructs the compositor to
re-enable and existing shortcuts inhibitor using any mechanism
offered by the compositor.
</description>
</event>
<event name="inactive">
<description summary="shortcuts are restored">
This event indicates that the shortcuts inhibitor is inactive,
normal shortcuts processing is restored by the compositor.
</description>
</event>
</interface>
</protocol>

View File

@@ -0,0 +1,96 @@
<?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.
Use in conjunction with zxdg_decoration_manager_v1 is undefined.
</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

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="xdg_decoration_unstable_v1">
<copyright>
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.
</copyright>
<interface name="zxdg_decoration_manager_v1" version="1">
<description summary="window decoration manager">
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.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the decoration manager object">
Destroy the decoration manager. This doesn't destroy objects created
with the manager.
</description>
</request>
<request name="get_toplevel_decoration">
<description summary="create a new toplevel decoration object">
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.
</description>
<arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
</request>
</interface>
<interface name="zxdg_toplevel_decoration_v1" version="1">
<description summary="decoration object for a toplevel surface">
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.
</description>
<enum name="error">
<entry name="unconfigured_buffer" value="0"
summary="xdg_toplevel has a buffer attached before configure"/>
<entry name="already_constructed" value="1"
summary="xdg_toplevel already has a decoration object"/>
<entry name="orphaned" value="2"
summary="xdg_toplevel destroyed before the decoration object"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the decoration object">
Switch back to a mode without any server-side decorations at the next
commit.
</description>
</request>
<enum name="mode">
<description summary="window decoration modes">
These values describe window decoration modes.
</description>
<entry name="client_side" value="1"
summary="no server-side window decoration"/>
<entry name="server_side" value="2"
summary="server-side window decoration"/>
</enum>
<request name="set_mode">
<description summary="set the decoration mode">
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.
</description>
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
</request>
<request name="unset_mode">
<description summary="unset the decoration mode">
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.
</description>
</request>
<event name="configure">
<description summary="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.
</description>
<arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
</event>
</interface>
</protocol>

File diff suppressed because it is too large Load Diff