Added wayland server side decorations.

This commit is contained in:
Armin Novak 2019-01-22 15:45:15 +01:00
parent 81f1fb934c
commit afd4baf4dd
4 changed files with 22 additions and 1 deletions

View File

@ -37,6 +37,7 @@ macro(generate_protocol_file PROTO)
endmacro()
generate_protocol_file(xdg-shell)
generate_protocol_file(xdg-decoration-unstable-v1)
generate_protocol_file(ivi-application)
generate_protocol_file(fullscreen-shell-unstable-v1)
generate_protocol_file(keyboard-shortcuts-inhibit-unstable-v1)
@ -62,7 +63,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

@ -220,6 +220,10 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin
{
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);
}
#if BUILD_IVI
else if (strcmp(interface, "ivi_application") == 0)
{
@ -518,6 +522,9 @@ UwacReturnCode UwacCloseDisplay(UwacDisplay** pdisplay)
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);
#ifdef BUILD_FULLSCREEN_SHELL
if (display->fullscreen_shell)

View File

@ -29,6 +29,7 @@
#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"
#ifdef BUILD_IVI
#include "ivi-application-client-protocol.h"
@ -89,6 +90,7 @@ struct uwac_display {
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;
#ifdef BUILD_IVI
struct ivi_application *ivi_application;
#endif
@ -216,6 +218,7 @@ struct uwac_window {
struct wl_shell_surface *shell_surface;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_decoration_v1 *deco;
#ifdef BUILD_IVI
struct ivi_surface *ivi_surface;
#endif

View File

@ -447,6 +447,13 @@ UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t h
goto out_error_shell;
}
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");
}
}
assert(w->xdg_surface);
xdg_toplevel_add_listener(w->xdg_toplevel, &xdg_toplevel_listener, w);
}
@ -496,6 +503,9 @@ 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->xdg_surface)
xdg_surface_destroy(w->xdg_surface);