aboutsummaryrefslogtreecommitdiff
path: root/sway/handlers.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-11-29 12:03:13 -0500
committerDrew DeVault <sir@cmpwn.com>2015-11-29 12:03:13 -0500
commite59cffcea2a881f16de3716c6b24d93aceb8c79a (patch)
treea09447b6eb903573edb598c7b80ac7c3c492dee5 /sway/handlers.c
parent60e76cf932e7b4d240af1f994a868e9f587c056d (diff)
Support desktop shell panels in compositor
Diffstat (limited to 'sway/handlers.c')
-rw-r--r--sway/handlers.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/sway/handlers.c b/sway/handlers.c
index 267a8f3a..2029ae84 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -72,11 +72,43 @@ static void handle_output_destroyed(wlc_handle output) {
}
static void handle_output_pre_render(wlc_handle output) {
+ struct wlc_size resolution = *wlc_output_get_resolution(output);
+
int i;
for (i = 0; i < desktop_shell.backgrounds->length; ++i) {
struct background_config *config = desktop_shell.backgrounds->items[i];
if (config->output == output) {
- wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, *wlc_output_get_resolution(output) });
+ wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, resolution });
+ break;
+ }
+ }
+
+ for (i = 0; i < desktop_shell.panels->length; ++i) {
+ struct panel_config *config = desktop_shell.panels->items[i];
+ if (config->output == output) {
+ struct wlc_size size = *wlc_surface_get_size(config->surface);
+ struct wlc_geometry geo = {
+ .size = size
+ };
+ switch (desktop_shell.panel_position) {
+ case DESKTOP_SHELL_PANEL_POSITION_TOP:
+ geo.origin = (struct wlc_origin){ 0, 0 };
+ break;
+ case DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
+ geo.origin = (struct wlc_origin){ 0, resolution.h - size.h };
+ break;
+ case DESKTOP_SHELL_PANEL_POSITION_LEFT:
+ geo.origin = (struct wlc_origin){ 0, 0 };
+ break;
+ case DESKTOP_SHELL_PANEL_POSITION_RIGHT:
+ geo.origin = (struct wlc_origin){ resolution.w - size.w, 0 };
+ break;
+ }
+ wlc_surface_render(config->surface, &geo);
+ if (size.w != desktop_shell.panel_size.w || size.h != desktop_shell.panel_size.h) {
+ desktop_shell.panel_size = size;
+ arrange_windows(&root_container, -1, -1);
+ }
break;
}
}