diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 34 |
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) { | |||
72 | } | 72 | } |
73 | 73 | ||
74 | static void handle_output_pre_render(wlc_handle output) { | 74 | static void handle_output_pre_render(wlc_handle output) { |
75 | struct wlc_size resolution = *wlc_output_get_resolution(output); | ||
76 | |||
75 | int i; | 77 | int i; |
76 | for (i = 0; i < desktop_shell.backgrounds->length; ++i) { | 78 | for (i = 0; i < desktop_shell.backgrounds->length; ++i) { |
77 | struct background_config *config = desktop_shell.backgrounds->items[i]; | 79 | struct background_config *config = desktop_shell.backgrounds->items[i]; |
78 | if (config->output == output) { | 80 | if (config->output == output) { |
79 | wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, *wlc_output_get_resolution(output) }); | 81 | wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, resolution }); |
82 | break; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | for (i = 0; i < desktop_shell.panels->length; ++i) { | ||
87 | struct panel_config *config = desktop_shell.panels->items[i]; | ||
88 | if (config->output == output) { | ||
89 | struct wlc_size size = *wlc_surface_get_size(config->surface); | ||
90 | struct wlc_geometry geo = { | ||
91 | .size = size | ||
92 | }; | ||
93 | switch (desktop_shell.panel_position) { | ||
94 | case DESKTOP_SHELL_PANEL_POSITION_TOP: | ||
95 | geo.origin = (struct wlc_origin){ 0, 0 }; | ||
96 | break; | ||
97 | case DESKTOP_SHELL_PANEL_POSITION_BOTTOM: | ||
98 | geo.origin = (struct wlc_origin){ 0, resolution.h - size.h }; | ||
99 | break; | ||
100 | case DESKTOP_SHELL_PANEL_POSITION_LEFT: | ||
101 | geo.origin = (struct wlc_origin){ 0, 0 }; | ||
102 | break; | ||
103 | case DESKTOP_SHELL_PANEL_POSITION_RIGHT: | ||
104 | geo.origin = (struct wlc_origin){ resolution.w - size.w, 0 }; | ||
105 | break; | ||
106 | } | ||
107 | wlc_surface_render(config->surface, &geo); | ||
108 | if (size.w != desktop_shell.panel_size.w || size.h != desktop_shell.panel_size.h) { | ||
109 | desktop_shell.panel_size = size; | ||
110 | arrange_windows(&root_container, -1, -1); | ||
111 | } | ||
80 | break; | 112 | break; |
81 | } | 113 | } |
82 | } | 114 | } |