aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-07-05 08:09:22 -0400
committerGitHub <noreply@github.com>2016-07-05 08:09:22 -0400
commit58804a044f782a397302173deb1416e47b3c3357 (patch)
tree9e155febd82e37ba6cb7b9e1b8ee7fda044d5147 /sway
parentc3373c6815b5c8cff8f48d1acb46be08b9654331 (diff)
parentd9bcea381a69ebc6367aede7816b8e27d5fc9417 (diff)
Merge pull request #738 from deklov/panel-as-shell-02
Make swaybar and swaybg shell surfaces, take 2
Diffstat (limited to 'sway')
-rw-r--r--sway/extensions.c2
-rw-r--r--sway/handlers.c26
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
}
sway_log(L_DEBUG, "Setting surface %p as background for output %d", surface, (int)output);
struct background_config *config = malloc(sizeof(struct background_config));
+ config->client = client;
config->output = output;
config->surface = wlc_resource_from_wl_surface_resource(surface);
config->wl_surface_res = surface;
@@ -91,6 +92,7 @@ static void set_panel(struct wl_client *client, struct wl_resource *resource,
sway_log(L_DEBUG, "Setting surface %p as panel for output %d (wl_resource: %p)", surface, (int)output, resource);
struct panel_config *config = find_or_create_panel_config(resource);
config->output = output;
+ config->client = client;
config->surface = wlc_resource_from_wl_surface_resource(surface);
config->wl_surface_res = surface;
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) {
}
}
+static bool client_is_background(struct wl_client *client) {
+ int i;
+ for (i = 0; i < desktop_shell.backgrounds->length; i++) {
+ struct background_config *config = desktop_shell.backgrounds->items[i];
+ if (config->client == client) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool client_is_panel(struct wl_client *client) {
+ int i;
+ for (i = 0; i < desktop_shell.panels->length; i++) {
+ struct panel_config *config = desktop_shell.panels->items[i];
+ if (config->client == client) {
+ return true;
+ }
+ }
+ return false;
+}
+
static bool handle_view_created(wlc_handle handle) {
// if view is child of another view, the use that as focused container
wlc_handle parent = wlc_view_get_parent(handle);
@@ -186,6 +208,10 @@ static bool handle_view_created(wlc_handle handle) {
struct wl_client *client = wlc_view_get_wl_client(handle);
pid_t pid;
+ if (client_is_background(client) || client_is_panel(client)) {
+ return true;
+ }
+
// Get parent container, to add view in
if (parent) {
focused = swayc_by_handle(parent);