diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/extensions.c | 2 | ||||
-rw-r--r-- | sway/handlers.c | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sway/extensions.c b/sway/extensions.c index 7bc9bbe4..1fe15ac5 100644 --- a/sway/extensions.c +++ b/sway/extensions.c | |||
@@ -73,6 +73,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc | |||
73 | } | 73 | } |
74 | sway_log(L_DEBUG, "Setting surface %p as background for output %d", surface, (int)output); | 74 | sway_log(L_DEBUG, "Setting surface %p as background for output %d", surface, (int)output); |
75 | struct background_config *config = malloc(sizeof(struct background_config)); | 75 | struct background_config *config = malloc(sizeof(struct background_config)); |
76 | config->client = client; | ||
76 | config->output = output; | 77 | config->output = output; |
77 | config->surface = wlc_resource_from_wl_surface_resource(surface); | 78 | config->surface = wlc_resource_from_wl_surface_resource(surface); |
78 | config->wl_surface_res = surface; | 79 | config->wl_surface_res = surface; |
@@ -91,6 +92,7 @@ static void set_panel(struct wl_client *client, struct wl_resource *resource, | |||
91 | sway_log(L_DEBUG, "Setting surface %p as panel for output %d (wl_resource: %p)", surface, (int)output, resource); | 92 | sway_log(L_DEBUG, "Setting surface %p as panel for output %d (wl_resource: %p)", surface, (int)output, resource); |
92 | struct panel_config *config = find_or_create_panel_config(resource); | 93 | struct panel_config *config = find_or_create_panel_config(resource); |
93 | config->output = output; | 94 | config->output = output; |
95 | config->client = client; | ||
94 | config->surface = wlc_resource_from_wl_surface_resource(surface); | 96 | config->surface = wlc_resource_from_wl_surface_resource(surface); |
95 | config->wl_surface_res = surface; | 97 | config->wl_surface_res = surface; |
96 | wl_resource_set_destructor(surface, panel_surface_destructor); | 98 | wl_resource_set_destructor(surface, panel_surface_destructor); |
diff --git a/sway/handlers.c b/sway/handlers.c index b7bb1fde..8f2f8a21 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -176,6 +176,28 @@ static void handle_output_focused(wlc_handle output, bool focus) { | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | static bool client_is_background(struct wl_client *client) { | ||
180 | int i; | ||
181 | for (i = 0; i < desktop_shell.backgrounds->length; i++) { | ||
182 | struct background_config *config = desktop_shell.backgrounds->items[i]; | ||
183 | if (config->client == client) { | ||
184 | return true; | ||
185 | } | ||
186 | } | ||
187 | return false; | ||
188 | } | ||
189 | |||
190 | static bool client_is_panel(struct wl_client *client) { | ||
191 | int i; | ||
192 | for (i = 0; i < desktop_shell.panels->length; i++) { | ||
193 | struct panel_config *config = desktop_shell.panels->items[i]; | ||
194 | if (config->client == client) { | ||
195 | return true; | ||
196 | } | ||
197 | } | ||
198 | return false; | ||
199 | } | ||
200 | |||
179 | static bool handle_view_created(wlc_handle handle) { | 201 | static bool handle_view_created(wlc_handle handle) { |
180 | // if view is child of another view, the use that as focused container | 202 | // if view is child of another view, the use that as focused container |
181 | wlc_handle parent = wlc_view_get_parent(handle); | 203 | wlc_handle parent = wlc_view_get_parent(handle); |
@@ -186,6 +208,10 @@ static bool handle_view_created(wlc_handle handle) { | |||
186 | struct wl_client *client = wlc_view_get_wl_client(handle); | 208 | struct wl_client *client = wlc_view_get_wl_client(handle); |
187 | pid_t pid; | 209 | pid_t pid; |
188 | 210 | ||
211 | if (client_is_background(client) || client_is_panel(client)) { | ||
212 | return true; | ||
213 | } | ||
214 | |||
189 | // Get parent container, to add view in | 215 | // Get parent container, to add view in |
190 | if (parent) { | 216 | if (parent) { |
191 | focused = swayc_by_handle(parent); | 217 | focused = swayc_by_handle(parent); |