summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 07:23:11 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-19 07:23:11 -0500
commit4a1584be535a2d851250854d46a3563e222fe953 (patch)
tree0e4b20ccca782bf68d0a12a200df1997b5f547ee /sway
parentAdd background handling (diff)
downloadsway-4a1584be535a2d851250854d46a3563e222fe953.tar.gz
sway-4a1584be535a2d851250854d46a3563e222fe953.tar.zst
sway-4a1584be535a2d851250854d46a3563e222fe953.zip
Fix background extensions
Thanks @Cloudef, it works great
Diffstat (limited to 'sway')
-rw-r--r--sway/extensions.c9
-rw-r--r--sway/handlers.c1
2 files changed, 4 insertions, 6 deletions
diff --git a/sway/extensions.c b/sway/extensions.c
index 5ef8a0ff..35a2632e 100644
--- a/sway/extensions.c
+++ b/sway/extensions.c
@@ -7,16 +7,15 @@
7struct desktop_shell_state desktop_shell; 7struct desktop_shell_state desktop_shell;
8 8
9static void set_background(struct wl_client *client, struct wl_resource *resource, 9static void set_background(struct wl_client *client, struct wl_resource *resource,
10 struct wl_resource *_output, struct wl_resource *_surface) { 10 struct wl_resource *_output, struct wl_resource *surface) {
11 wlc_handle output = wlc_handle_from_wl_output_resource(_output); 11 wlc_handle output = wlc_handle_from_wl_output_resource(_output);
12 wlc_handle surface = wlc_handle_from_wl_surface_resource(_surface); 12 if (!output) {
13 sway_log(L_DEBUG, "Setting surface %d as background for output %d", (int)surface, (int)output);
14 if (!output || !surface) {
15 return; 13 return;
16 } 14 }
15 sway_log(L_DEBUG, "Setting surface %p as background for output %d", surface, (int)output);
17 struct background_config *config = malloc(sizeof(struct background_config)); 16 struct background_config *config = malloc(sizeof(struct background_config));
18 config->output = output; 17 config->output = output;
19 config->surface = surface; 18 config->surface = wlc_resource_from_wl_surface_resource(surface);
20 list_add(desktop_shell.backgrounds, config); 19 list_add(desktop_shell.backgrounds, config);
21} 20}
22 21
diff --git a/sway/handlers.c b/sway/handlers.c
index 9e98cffe..dde9b88b 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -70,7 +70,6 @@ static void handle_output_pre_render(wlc_handle output) {
70 for (i = 0; i < desktop_shell.backgrounds->length; ++i) { 70 for (i = 0; i < desktop_shell.backgrounds->length; ++i) {
71 struct background_config *config = desktop_shell.backgrounds->items[i]; 71 struct background_config *config = desktop_shell.backgrounds->items[i];
72 if (config->output == output) { 72 if (config->output == output) {
73 sway_log(L_DEBUG, "Rendering background surface %d", (int)config->surface);
74 wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, *wlc_output_get_resolution(output) }); 73 wlc_surface_render(config->surface, &(struct wlc_geometry){ wlc_origin_zero, *wlc_output_get_resolution(output) });
75 break; 74 break;
76 } 75 }