summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/extensions.h3
-rw-r--r--sway/extensions.c9
-rw-r--r--sway/handlers.c1
3 files changed, 6 insertions, 7 deletions
diff --git a/include/extensions.h b/include/extensions.h
index 3e2d1cde..2fca23c1 100644
--- a/include/extensions.h
+++ b/include/extensions.h
@@ -2,10 +2,11 @@
2#define _SWAY_EXTENSIONS_H 2#define _SWAY_EXTENSIONS_H
3 3
4#include "list.h" 4#include "list.h"
5#include "wlc/wlc-wayland.h"
5 6
6struct background_config { 7struct background_config {
7 wlc_handle output; 8 wlc_handle output;
8 wlc_handle surface; 9 wlc_resource surface;
9}; 10};
10 11
11struct desktop_shell_state { 12struct desktop_shell_state {
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 }