Enable backgrounds and panels to be shell surfaces

Prior to this commit all windows (e.g. shell surfaces) were handled the same
way in handle_view_created. Since backgrounds and panels have to be treated
differently, they could not be shell surfaces. This changes checks whether
a client is a background or a panel in handle_view_created and exists to
let them be dealt with elsewhere.
This commit is contained in:
David Eklov 2016-07-04 16:53:03 -05:00
parent 2f54057623
commit 51204b33c1
3 changed files with 32 additions and 0 deletions

View file

@ -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);