diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-18 15:09:37 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-03-27 18:50:09 -0400 |
commit | b31ce4220cea6acede2ae2af1b19a3a7d4b81fc6 (patch) | |
tree | 53d07ebecc27cbe9c521b5f3843d656bce330045 /rootston | |
parent | 88eec637a44ede8b521c2aa44d0196c99dd5a0e3 (diff) |
Add broken test client and rootston stubs
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 4 | ||||
-rw-r--r-- | rootston/layer_shell.c | 54 | ||||
-rw-r--r-- | rootston/meson.build | 1 |
3 files changed, 58 insertions, 1 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index dcf0b7b2..015a8215 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -716,7 +716,9 @@ struct roots_desktop *desktop_create(struct roots_server *server, desktop->wl_shell_surface.notify = handle_wl_shell_surface; desktop->layer_shell = wlr_layer_shell_create(server->wl_display); - // TODO: Pick up new surfaces + wl_signal_add(&desktop->layer_shell->events.new_surface, + &desktop->layer_shell_surface); + desktop->layer_shell_surface.notify = handle_layer_shell_surface; #ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c new file mode 100644 index 00000000..50bf6466 --- /dev/null +++ b/rootston/layer_shell.c @@ -0,0 +1,54 @@ +#include <assert.h> +#include <stdbool.h> +#include <stdlib.h> +#include <wayland-server.h> +#include <wlr/types/wlr_box.h> +#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_layer_shell.h> +#include <wlr/util/log.h> +#include "rootston/desktop.h" +#include "rootston/layers.h" +#include "rootston/server.h" + +static void handle_destroy(struct wl_listener *listener, void *data) { + // TODO +} + +static void handle_surface_commit(struct wl_listener *listener, void *data) { + // TODO +} + +static void handle_map(struct wl_listener *listener, void *data) { + // TODO +} + +static void handle_unmap(struct wl_listener *listener, void *data) { + // TODO +} + +void handle_layer_shell_surface(struct wl_listener *listener, void *data) { + struct wlr_layer_surface *layer_surface = data; + struct roots_desktop *desktop = + wl_container_of(listener, desktop, layer_shell_surface); + wlr_log(L_DEBUG, "new layer surface: namespace %s layer %d", + layer_surface->namespace, layer_surface->layer); + + struct roots_layer_surface *roots_surface = + calloc(1, sizeof(struct roots_layer_surface)); + if (!roots_surface) { + return; + } + roots_surface->surface_commit.notify = handle_surface_commit; + wl_signal_add(&layer_surface->surface->events.commit, + &roots_surface->surface_commit); + roots_surface->destroy.notify = handle_destroy; + wl_signal_add(&layer_surface->events.destroy, &roots_surface->destroy); + roots_surface->map.notify = handle_map; + wl_signal_add(&layer_surface->events.map, &roots_surface->map); + roots_surface->unmap.notify = handle_unmap; + wl_signal_add(&layer_surface->events.unmap, &roots_surface->unmap); + + roots_surface->layer_surface = layer_surface; + + wl_list_insert(&desktop->layers[layer_surface->layer], &roots_surface->link); +} diff --git a/rootston/meson.build b/rootston/meson.build index 9dbe37c2..1b78c7c8 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -5,6 +5,7 @@ sources = [ 'ini.c', 'input.c', 'keyboard.c', + 'layer_shell.c', 'main.c', 'output.c', 'seat.c', |