aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
Diffstat (limited to 'rootston')
-rw-r--r--rootston/desktop.c42
-rw-r--r--rootston/layer_shell.c339
-rw-r--r--rootston/meson.build1
-rw-r--r--rootston/output.c83
-rw-r--r--rootston/xdg_shell.c6
-rw-r--r--rootston/xdg_shell_v6.c6
6 files changed, 448 insertions, 29 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 65d9a280..15e0e336 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -9,9 +9,10 @@
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_idle.h>
+#include <wlr/types/wlr_idle_inhibit_v1.h>
+#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output_layout.h>
-#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_wl_shell.h>
@@ -187,6 +188,25 @@ static struct wlr_output *view_get_output(struct roots_view *view) {
output_y);
}
+void view_arrange_maximized(struct roots_view *view) {
+ struct wlr_box view_box;
+ view_get_box(view, &view_box);
+
+ struct wlr_output *output = view_get_output(view);
+ struct roots_output *roots_output = output->data;
+ struct wlr_box *output_box =
+ wlr_output_layout_get_box(view->desktop->layout, output);
+ struct wlr_box usable_area;
+ memcpy(&usable_area, &roots_output->usable_area,
+ sizeof(struct wlr_box));
+ usable_area.x += output_box->x;
+ usable_area.y += output_box->y;
+
+ view_move_resize(view, usable_area.x, usable_area.y,
+ usable_area.width, usable_area.height);
+ view_rotate(view, 0);
+}
+
void view_maximize(struct roots_view *view, bool maximized) {
if (view->maximized == maximized) {
return;
@@ -197,23 +217,14 @@ void view_maximize(struct roots_view *view, bool maximized) {
}
if (!view->maximized && maximized) {
- struct wlr_box view_box;
- view_get_box(view, &view_box);
-
view->maximized = true;
view->saved.x = view->x;
view->saved.y = view->y;
view->saved.rotation = view->rotation;
- view->saved.width = view_box.width;
- view->saved.height = view_box.height;
-
- struct wlr_output *output = view_get_output(view);
- struct wlr_box *output_box =
- wlr_output_layout_get_box(view->desktop->layout, output);
+ view->saved.width = view->width;
+ view->saved.height = view->height;
- view_move_resize(view, output_box->x, output_box->y, output_box->width,
- output_box->height);
- view_rotate(view, 0);
+ view_arrange_maximized(view);
}
if (view->maximized && !maximized) {
@@ -714,6 +725,11 @@ struct roots_desktop *desktop_create(struct roots_server *server,
&desktop->wl_shell_surface);
desktop->wl_shell_surface.notify = handle_wl_shell_surface;
+ desktop->layer_shell = wlr_layer_shell_create(server->wl_display);
+ 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;
const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c
new file mode 100644
index 00000000..06ab15c3
--- /dev/null
+++ b/rootston/layer_shell.c
@@ -0,0 +1,339 @@
+#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/output.h"
+#include "rootston/server.h"
+
+static void apply_exclusive(struct wlr_box *usable_area,
+ uint32_t anchor, int32_t exclusive,
+ int32_t margin_top, int32_t margin_right,
+ int32_t margin_bottom, int32_t margin_left) {
+ if (exclusive <= 0) {
+ return;
+ }
+ struct {
+ uint32_t anchors;
+ int *positive_axis;
+ int *negative_axis;
+ int margin;
+ } edges[] = {
+ {
+ .anchors =
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP,
+ .positive_axis = &usable_area->y,
+ .negative_axis = &usable_area->height,
+ .margin = margin_top,
+ },
+ {
+ .anchors =
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
+ .positive_axis = NULL,
+ .negative_axis = &usable_area->height,
+ .margin = margin_bottom,
+ },
+ {
+ .anchors =
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
+ .positive_axis = &usable_area->x,
+ .negative_axis = &usable_area->width,
+ .margin = margin_left,
+ },
+ {
+ .anchors =
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |
+ ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM,
+ .positive_axis = NULL,
+ .negative_axis = &usable_area->width,
+ .margin = margin_right,
+ },
+ };
+ for (size_t i = 0; i < sizeof(edges) / sizeof(edges[0]); ++i) {
+ if ((anchor & edges[i].anchors) == edges[i].anchors) {
+ if (edges[i].positive_axis) {
+ *edges[i].positive_axis += exclusive + edges[i].margin;
+ }
+ if (edges[i].negative_axis) {
+ *edges[i].negative_axis -= exclusive + edges[i].margin;
+ }
+ }
+ }
+}
+
+static void arrange_layer(struct wlr_output *output, struct wl_list *list,
+ struct wlr_box *usable_area, bool exclusive) {
+ struct roots_layer_surface *roots_surface;
+ struct wlr_box full_area = { 0 };
+ wlr_output_effective_resolution(output,
+ &full_area.width, &full_area.height);
+ wl_list_for_each(roots_surface, list, link) {
+ struct wlr_layer_surface *layer = roots_surface->layer_surface;
+ struct wlr_layer_surface_state *state = &layer->current;
+ if (exclusive != (state->exclusive_zone >0)) {
+ continue;
+ }
+ struct wlr_box bounds;
+ if (state->exclusive_zone == -1) {
+ bounds = full_area;
+ } else {
+ bounds = *usable_area;
+ }
+ struct wlr_box box = {
+ .width = state->desired_width,
+ .height = state->desired_height
+ };
+ // Horizontal axis
+ const uint32_t both_horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
+ | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
+ if ((state->anchor & both_horiz) && box.width == 0) {
+ box.x = bounds.x;
+ box.width = bounds.width;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
+ box.x = bounds.x;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) {
+ box.x = bounds.x + (bounds.width - box.width);
+ } else {
+ box.x = bounds.x + ((bounds.width / 2) - (box.width / 2));
+ }
+ // Vertical axis
+ const uint32_t both_vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP
+ | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
+ if ((state->anchor & both_vert) && box.height == 0) {
+ box.y = bounds.y;
+ box.height = bounds.height;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
+ box.y = bounds.y;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) {
+ box.y = bounds.y + (bounds.height - box.height);
+ } else {
+ box.y = bounds.y + ((bounds.height / 2) - (box.height / 2));
+ }
+ // Margin
+ if ((state->anchor & both_horiz) == both_horiz) {
+ box.x += state->margin.left;
+ box.width -= state->margin.left + state->margin.right;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT)) {
+ box.x += state->margin.left;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT)) {
+ box.x -= state->margin.right;
+ }
+ if ((state->anchor & both_vert) == both_vert) {
+ box.y += state->margin.top;
+ box.height -= state->margin.top + state->margin.bottom;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP)) {
+ box.y += state->margin.top;
+ } else if ((state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM)) {
+ box.y -= state->margin.bottom;
+ }
+ if (box.width < 0 || box.height < 0) {
+ // TODO: Bubble up a protocol error?
+ wlr_layer_surface_close(layer);
+ continue;
+ }
+ // Apply
+ roots_surface->geo = box;
+ apply_exclusive(usable_area, state->anchor, state->exclusive_zone,
+ state->margin.top, state->margin.right,
+ state->margin.bottom, state->margin.left);
+ wlr_layer_surface_configure(layer, box.width, box.height);
+ }
+}
+
+static void arrange_layers(struct wlr_output *_output) {
+ struct roots_output *output = _output->data;
+
+ struct wlr_box usable_area = { 0 };
+ wlr_output_effective_resolution(output->wlr_output,
+ &usable_area.width, &usable_area.height);
+
+ // Arrange exclusive surfaces from top->bottom
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
+ &usable_area, true);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
+ &usable_area, true);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
+ &usable_area, true);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
+ &usable_area, true);
+ memcpy(&output->usable_area, &usable_area, sizeof(struct wlr_box));
+
+ struct roots_view *view;
+ wl_list_for_each(view, &output->desktop->views, link) {
+ if (view->maximized) {
+ view_arrange_maximized(view);
+ }
+ }
+
+ // Arrange non-exlusive surfaces from top->bottom
+ usable_area.x = usable_area.y = 0;
+ wlr_output_effective_resolution(output->wlr_output,
+ &usable_area.width, &usable_area.height);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
+ &usable_area, false);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
+ &usable_area, false);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
+ &usable_area, false);
+ arrange_layer(output->wlr_output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
+ &usable_area, false);
+}
+
+static void handle_output_destroy(struct wl_listener *listener, void *data) {
+ struct roots_layer_surface *layer =
+ wl_container_of(listener, layer, output_destroy);
+ layer->layer_surface->output = NULL;
+ wl_list_remove(&layer->output_destroy.link);
+ wl_list_remove(&layer->output_mode.link);
+ wlr_layer_surface_close(layer->layer_surface);
+}
+
+static void handle_output_mode(struct wl_listener *listener, void *data) {
+ arrange_layers((struct wlr_output *)data);
+}
+
+static void handle_output_transform(struct wl_listener *listener, void *data) {
+ arrange_layers((struct wlr_output *)data);
+}
+
+static void handle_surface_commit(struct wl_listener *listener, void *data) {
+ struct roots_layer_surface *layer =
+ wl_container_of(listener, layer, surface_commit);
+ struct wlr_layer_surface *layer_surface = layer->layer_surface;
+ struct wlr_output *wlr_output = layer_surface->output;
+ if (wlr_output != NULL) {
+ struct roots_output *output = wlr_output->data;
+ struct wlr_box old_geo = layer->geo;
+ arrange_layers(wlr_output);
+ if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) {
+ output_damage_whole_local_surface(output, layer_surface->surface,
+ old_geo.x, old_geo.y, 0);
+ output_damage_whole_local_surface(output, layer_surface->surface,
+ layer->geo.x, layer->geo.y, 0);
+ } else {
+ output_damage_from_local_surface(output, layer_surface->surface,
+ layer->geo.x, layer->geo.y, 0);
+ }
+ }
+}
+
+static void unmap(struct wlr_layer_surface *layer_surface) {
+ struct roots_layer_surface *layer = layer_surface->data;
+ struct wlr_output *wlr_output = layer_surface->output;
+ if (wlr_output != NULL) {
+ struct roots_output *output = wlr_output->data;
+ wlr_output_damage_add_box(output->damage, &layer->geo);
+ }
+}
+
+static void handle_destroy(struct wl_listener *listener, void *data) {
+ struct roots_layer_surface *layer = wl_container_of(
+ listener, layer, destroy);
+ if (layer->layer_surface->mapped) {
+ unmap(layer->layer_surface);
+ }
+ wl_list_remove(&layer->link);
+ wl_list_remove(&layer->destroy.link);
+ wl_list_remove(&layer->map.link);
+ wl_list_remove(&layer->unmap.link);
+ wl_list_remove(&layer->surface_commit.link);
+ wl_list_remove(&layer->output_destroy.link);
+ wl_list_remove(&layer->output_mode.link);
+ wl_list_remove(&layer->output_transform.link);
+ arrange_layers(layer->layer_surface->output);
+ free(layer);
+}
+
+static void handle_map(struct wl_listener *listener, void *data) {
+ struct wlr_layer_surface *layer_surface = data;
+ struct roots_layer_surface *layer = layer_surface->data;
+ struct wlr_output *wlr_output = layer_surface->output;
+ struct roots_output *output = wlr_output->data;
+ wlr_output_damage_add_box(output->damage, &layer->geo);
+}
+
+static void handle_unmap(struct wl_listener *listener, void *data) {
+ struct roots_layer_surface *layer = wl_container_of(
+ listener, layer, unmap);
+ unmap(layer->layer_surface);
+}
+
+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 anchor %d "
+ "size %dx%d margin %d,%d,%d,%d",
+ layer_surface->namespace, layer_surface->layer, layer_surface->layer,
+ layer_surface->client_pending.desired_width,
+ layer_surface->client_pending.desired_height,
+ layer_surface->client_pending.margin.top,
+ layer_surface->client_pending.margin.right,
+ layer_surface->client_pending.margin.bottom,
+ layer_surface->client_pending.margin.left);
+
+ 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->output_destroy.notify = handle_output_destroy;
+ wl_signal_add(&layer_surface->output->events.destroy,
+ &roots_surface->output_destroy);
+
+ roots_surface->output_mode.notify = handle_output_mode;
+ wl_signal_add(&layer_surface->output->events.mode,
+ &roots_surface->output_mode);
+
+ roots_surface->output_transform.notify = handle_output_transform;
+ wl_signal_add(&layer_surface->output->events.transform,
+ &roots_surface->output_transform);
+
+ 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);
+ // TODO: Listen for subsurfaces
+
+ roots_surface->layer_surface = layer_surface;
+ layer_surface->data = roots_surface;
+
+ struct roots_output *output = layer_surface->output->data;
+ wl_list_insert(&output->layers[layer_surface->layer], &roots_surface->link);
+
+ // Temporarily set the layer's current state to client_pending
+ // So that we can easily arrange it
+ struct wlr_layer_surface_state old_state = layer_surface->current;
+ layer_surface->current = layer_surface->client_pending;
+
+ arrange_layers(output->wlr_output);
+
+ layer_surface->current = old_state;
+}
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',
diff --git a/rootston/output.c b/rootston/output.c
index 52ece54d..d903963e 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -13,6 +13,7 @@
#include <wlr/util/log.h>
#include <wlr/util/region.h>
#include "rootston/config.h"
+#include "rootston/layers.h"
#include "rootston/output.h"
#include "rootston/server.h"
@@ -417,6 +418,33 @@ static void surface_send_frame_done(struct wlr_surface *surface, double lx,
wlr_surface_send_frame_done(surface, when);
}
+static void render_layer(
+ struct roots_output *output,
+ const struct wlr_box *output_layout_box,
+ struct render_data *data,
+ struct wl_list *layer) {
+ struct roots_layer_surface *roots_surface;
+ wl_list_for_each(roots_surface, layer, link) {
+ struct wlr_layer_surface *layer = roots_surface->layer_surface;
+ render_surface(layer->surface,
+ roots_surface->geo.x + output_layout_box->x,
+ roots_surface->geo.y + output_layout_box->y,
+ 0, data);
+ }
+}
+
+static void layers_send_done(
+ struct roots_output *output, struct timespec *when) {
+ size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
+ for (size_t i = 0; i < len; ++i) {
+ struct roots_layer_surface *roots_surface;
+ wl_list_for_each(roots_surface, &output->layers[i], link) {
+ struct wlr_layer_surface *layer = roots_surface->layer_surface;
+ wlr_surface_send_frame_done(layer->surface, when);
+ }
+ }
+}
+
static void render_output(struct roots_output *output) {
struct wlr_output *wlr_output = output->wlr_output;
struct roots_desktop *desktop = output->desktop;
@@ -433,14 +461,15 @@ static void render_output(struct roots_output *output) {
float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
+ const struct wlr_box *output_box =
+ wlr_output_layout_get_box(desktop->layout, wlr_output);
+
// Check if we can delegate the fullscreen surface to the output
if (output->fullscreen_view != NULL &&
output->fullscreen_view->wlr_surface != NULL) {
struct roots_view *view = output->fullscreen_view;
// Make sure the view is centered on screen
- const struct wlr_box *output_box =
- wlr_output_layout_get_box(desktop->layout, wlr_output);
struct wlr_box view_box;
view_get_box(view, &view_box);
double view_x = (double)(output_box->width - view_box.width) / 2 +
@@ -498,6 +527,11 @@ static void render_output(struct roots_output *output) {
wlr_renderer_clear(renderer, clear_color);
}
+ render_layer(output, output_box, &data,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND]);
+ render_layer(output, output_box, &data,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]);
+
// If a view is fullscreen on this output, render it
if (output->fullscreen_view != NULL) {
struct roots_view *view = output->fullscreen_view;
@@ -520,20 +554,24 @@ static void render_output(struct roots_output *output) {
render_surface, &data);
}
#endif
-
- goto renderer_end;
- }
-
- // Render all views
- struct roots_view *view;
- wl_list_for_each_reverse(view, &desktop->views, link) {
- render_view(view, &data);
+ } else {
+ // Render all views
+ struct roots_view *view;
+ wl_list_for_each_reverse(view, &desktop->views, link) {
+ render_view(view, &data);
+ }
+ // Render top layer above shell views
+ render_layer(output, output_box, &data,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]);
}
// Render drag icons
data.alpha = 1.0;
drag_icons_for_each_surface(server->input, render_surface, &data);
+ render_layer(output, output_box, &data,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]);
+
renderer_end:
wlr_renderer_scissor(renderer, NULL);
wlr_renderer_end(renderer);
@@ -570,6 +608,7 @@ damage_finish:
drag_icons_for_each_surface(server->input, surface_send_frame_done,
&data);
}
+ layers_send_done(output, data.when);
}
void output_damage_whole(struct roots_output *output) {
@@ -626,6 +665,15 @@ static void damage_whole_surface(struct wlr_surface *surface,
wlr_output_damage_add_box(output->damage, &box);
}
+void output_damage_whole_local_surface(struct roots_output *output,
+ struct wlr_surface *surface, double ox, double oy, float rotation) {
+ struct wlr_output_layout_output *layout = wlr_output_layout_get(
+ output->desktop->layout, output->wlr_output);
+ damage_whole_surface(surface, ox + layout->x, oy + layout->y,
+ rotation, output);
+ // TODO: subsurfaces
+}
+
static void damage_whole_decoration(struct roots_view *view,
struct roots_output *output) {
if (!view->decorated || view->wlr_surface == NULL) {
@@ -691,6 +739,15 @@ static void damage_from_surface(struct wlr_surface *surface,
pixman_region32_fini(&damage);
}
+void output_damage_from_local_surface(struct roots_output *output,
+ struct wlr_surface *surface, double ox, double oy, float rotation) {
+ struct wlr_output_layout_output *layout = wlr_output_layout_get(
+ output->desktop->layout, output->wlr_output);
+ damage_from_surface(surface, ox + layout->x, oy + layout->y,
+ rotation, output);
+ // TODO: Subsurfaces
+}
+
void output_damage_from_view(struct roots_output *output,
struct roots_view *view) {
if (!view_accept_damage(output, view)) {
@@ -781,6 +838,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
clock_gettime(CLOCK_MONOTONIC, &output->last_frame);
output->desktop = desktop;
output->wlr_output = wlr_output;
+ wlr_output->data = output;
wl_list_insert(&desktop->outputs, &output->link);
output->damage = wlr_output_damage_create(wlr_output);
@@ -792,6 +850,11 @@ void handle_new_output(struct wl_listener *listener, void *data) {
output->damage_destroy.notify = output_damage_handle_destroy;
wl_signal_add(&output->damage->events.destroy, &output->damage_destroy);
+ size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
+ for (size_t i = 0; i < len; ++i) {
+ wl_list_init(&output->layers[i]);
+ }
+
struct roots_output_config *output_config =
roots_config_get_output(config, wlr_output);
if (output_config) {
diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c
index 62b57641..927bd018 100644
--- a/rootston/xdg_shell.c
+++ b/rootston/xdg_shell.c
@@ -252,7 +252,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
return;
}
- view_maximize(view, surface->toplevel->next.maximized);
+ view_maximize(view, surface->toplevel->client_pending.maximized);
}
static void handle_request_fullscreen(struct wl_listener *listener,
@@ -403,10 +403,10 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
view->destroy = destroy;
roots_surface->view = view;
- if (surface->toplevel->next.maximized) {
+ if (surface->toplevel->client_pending.maximized) {
view_maximize(view, true);
}
- if (surface->toplevel->next.fullscreen) {
+ if (surface->toplevel->client_pending.fullscreen) {
view_set_fullscreen(view, true, NULL);
}
}
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index 11bc0180..ad33c4b0 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -254,7 +254,7 @@ static void handle_request_maximize(struct wl_listener *listener, void *data) {
return;
}
- view_maximize(view, surface->toplevel->next.maximized);
+ view_maximize(view, surface->toplevel->client_pending.maximized);
}
static void handle_request_fullscreen(struct wl_listener *listener,
@@ -405,10 +405,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
view->destroy = destroy;
roots_surface->view = view;
- if (surface->toplevel->next.maximized) {
+ if (surface->toplevel->client_pending.maximized) {
view_maximize(view, true);
}
- if (surface->toplevel->next.fullscreen) {
+ if (surface->toplevel->client_pending.fullscreen) {
view_set_fullscreen(view, true, NULL);
}
}