Add initial layer shell skeleton

This commit is contained in:
Jente Hidskes 2020-02-23 22:20:25 +01:00
parent 1262e1b55e
commit 1ea91900d9
5 changed files with 46 additions and 1 deletions

8
cage.c
View file

@ -1,7 +1,7 @@
/*
* Cage: A Wayland kiosk.
*
* Copyright (C) 2018-2020 Jente Hidskes
* Copyright (C) 2018-2021 Jente Hidskes
*
* See the LICENSE file accompanying this file.
*/
@ -27,6 +27,7 @@
#include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/types/wlr_scene.h>
@ -45,6 +46,7 @@
#endif
#include "idle_inhibit_v1.h"
#include "layer_shell_v1.h"
#include "output.h"
#include "seat.h"
#include "server.h"
@ -431,6 +433,10 @@ main(int argc, char *argv[])
}
wlr_scene_set_presentation(server.scene, presentation);
server.layer_shell_v1 = wlr_layer_shell_v1_create(server.wl_display);
wl_signal_add(&server.layer_shell_v1->events.new_surface, &server.new_layer_shell_v1_surface);
server.new_layer_shell_v1_surface.notify = handle_layer_shell_v1_surface_new;
export_dmabuf_manager = wlr_export_dmabuf_manager_v1_create(server.wl_display);
if (!export_dmabuf_manager) {
wlr_log(WLR_ERROR, "Unable to create the export DMABUF manager");

27
layer_shell_v1.c Normal file
View file

@ -0,0 +1,27 @@
/*
* Cage: A Wayland kiosk.
*
* Copyright (C) 2021 Jente Hidskes
*
* See the LICENSE file accompanying this file.
*/
#include "layer_shell_v1.h"
#include "server.h"
#include <wayland-server-core.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/util/log.h>
void
handle_layer_shell_v1_surface_new(struct wl_listener *listener, void *data)
{
struct cg_server *server = wl_container_of(listener, server, new_layer_shell_v1_surface);
struct wlr_layer_surface_v1 *layer_surface = data;
wlr_log(WLR_DEBUG, "New layer shell surface: namespace %s layer %d anchor %d size %dx%d margin %d,%d,%d,%d",
layer_surface->namespace, layer_surface->pending.layer, layer_surface->pending.anchor,
layer_surface->pending.desired_width, layer_surface->pending.desired_height,
layer_surface->pending.margin.top, layer_surface->pending.margin.right,
layer_surface->pending.margin.bottom, layer_surface->pending.margin.left);
}

8
layer_shell_v1.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef CG_LAYER_SHELL_V1_H
#define CG_LAYER_SHELL_V1_H
#include <wayland-server-core.h>
void handle_layer_shell_v1_surface_new(struct wl_listener *listener, void *data);
#endif

View file

@ -100,6 +100,7 @@ endif
cage_sources = [
'cage.c',
'idle_inhibit_v1.c',
'layer_shell_v1.c',
'output.c',
'seat.c',
'util.c',
@ -112,6 +113,7 @@ cage_headers = [
output: 'config.h',
configuration: conf_data),
'idle_inhibit_v1.h',
'layer_shell_v1.h',
'output.h',
'seat.h',
'server.h',

View file

@ -44,6 +44,8 @@ struct cg_server {
struct wl_listener xdg_toplevel_decoration;
struct wl_listener new_xdg_shell_surface;
struct wlr_layer_shell_v1 *layer_shell_v1;
struct wl_listener new_layer_shell_v1_surface;
#if CAGE_HAS_XWAYLAND
struct wl_listener new_xwayland_surface;
#endif