WIP wlr_layer_shell
This commit is contained in:
parent
72a53cb6c8
commit
29a8910556
3 changed files with 19 additions and 2 deletions
|
|
@ -36,10 +36,13 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
// xdg toplevel window (window) or wlr_layer_shell window (layer)
|
// xdg toplevel window (window) or wlr_layer_shell window (layer)
|
||||||
if (strcmp(argv[2], "window")) {
|
if (strcmp(argv[2], "window") == 0) {
|
||||||
output_type = OUTPUT_WINDOW;
|
output_type = OUTPUT_WINDOW;
|
||||||
} else if (strcmp(argv[2], "layer")) {
|
} else if (strcmp(argv[2], "layer") == 0) {
|
||||||
output_type = OUTPUT_LAYER;
|
output_type = OUTPUT_LAYER;
|
||||||
|
} else {
|
||||||
|
printf("argument 2 is either 'window' or 'layer' 🍰\n");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
wayland.c
13
wayland.c
|
|
@ -54,6 +54,17 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||||
.close = xdg_toplevel_close,
|
.close = xdg_toplevel_close,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void zwlr_layer_surface_v1_configure(void *data, struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial, uint32_t width, uint32_t height) {
|
||||||
|
struct client_state *state = data;
|
||||||
|
state->width = width;
|
||||||
|
state->height = height;
|
||||||
|
wl_egl_window_resize(state->egl_window, width, height, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct zwlr_layer_surface_v1_listener zwlr_layer_surface_v1_listener = {
|
||||||
|
.configure = zwlr_layer_surface_v1_configure,
|
||||||
|
};
|
||||||
|
|
||||||
static void registry_handle_global(
|
static void registry_handle_global(
|
||||||
void *data,
|
void *data,
|
||||||
struct wl_registry *registry,
|
struct wl_registry *registry,
|
||||||
|
|
@ -87,6 +98,8 @@ static void registry_handle_global(
|
||||||
}
|
}
|
||||||
if ((strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) && (state->output_type == OUTPUT_LAYER)) {
|
if ((strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) && (state->output_type == OUTPUT_LAYER)) {
|
||||||
state->zwlr_layer_shell_v1 = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 4);
|
state->zwlr_layer_shell_v1 = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 4);
|
||||||
|
int layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND;
|
||||||
|
state->zwlr_layer_surface_v1 = zwlr_layer_shell_v1_get_layer_surface(state->zwlr_layer_shell_v1, state->wl_surface, NULL, layer, "wallpaper");
|
||||||
}
|
}
|
||||||
if (strcmp(interface, wl_output_interface.name) == 0) {
|
if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||||
state->wl_output = wl_registry_bind(
|
state->wl_output = wl_registry_bind(
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ struct client_state {
|
||||||
|
|
||||||
// wlr_layer_shell
|
// wlr_layer_shell
|
||||||
struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1;
|
struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1;
|
||||||
|
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1;
|
||||||
struct wl_output *wl_output;
|
struct wl_output *wl_output;
|
||||||
|
|
||||||
EGLDisplay egl_display;
|
EGLDisplay egl_display;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue