X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fclient.c;h=374ad4042dedc4a0b8fcadecdc823a8d28743836;hb=6cd5f7ea380e155dbd7b29f01dd3fcfb5858ad61;hp=c18139fbde72bd8c918889e9beecbc90b326de73;hpb=eac3a64917cc769e152f16a65a83e1b7d55629cb;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index c18139fb..374ad404 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -90,6 +90,9 @@ static void client_update_transient_tree(ObClient *self, ObClient* oldparent, ObClient *newparent); static void client_present(ObClient *self, gboolean here, gboolean raise); +static GSList *client_search_all_top_parents_internal(ObClient *self, + gboolean bylayer, + ObStackingLayer layer); void client_startup(gboolean reconfig) { @@ -609,6 +612,7 @@ void client_unmanage(ObClient *self) g_free(self->icons[j].data); if (self->nicons > 0) g_free(self->icons); + g_free(self->wm_command); g_free(self->title); g_free(self->icon_title); g_free(self->name); @@ -635,13 +639,13 @@ static ObAppSettings *client_get_settings_state(ObClient *self) || (app->class && app->name && !strcmp(app->class, self->class) && !strcmp(app->name, self->name))) { - ob_debug("Window matching: %s\n", app->name); /* Match if no role was specified in the per app setting, or if the * string matches the beginning of the role, since apps like to set * the role to things like browser-window-23c4b2f */ if (!app->role || !strncmp(app->role, self->role, strlen(app->role))) { + ob_debug("Window matching: %s\n", app->name); /* use this one */ settings = app; break; @@ -991,6 +995,7 @@ static void client_get_all(ObClient *self) client_update_title(self); client_update_class(self); client_update_sm_client_id(self); + client_update_command(self); client_update_strut(self); client_update_icons(self); client_update_user_time(self); @@ -2180,15 +2185,22 @@ static ObStackingLayer calc_layer(ObClient *self) { ObStackingLayer l; - if (self->fullscreen && - (client_focused(self) || client_search_focus_tree(self))) - l = OB_STACKING_LAYER_FULLSCREEN; - else if (self->type == OB_CLIENT_TYPE_DESKTOP) + if (self->type == OB_CLIENT_TYPE_DESKTOP) l = OB_STACKING_LAYER_DESKTOP; else if (self->type == OB_CLIENT_TYPE_DOCK) { if (self->below) l = OB_STACKING_LAYER_NORMAL; else l = OB_STACKING_LAYER_ABOVE; } + else if ((self->fullscreen || + /* no decorations and fills the monitor = oldskool fullscreen */ + (self->frame != NULL && + (self->frame->size.right == 0 && self->frame->size.left == 0 && + self->frame->size.bottom == 0 && self->frame->size.top == 0 && + RECT_EQUAL(self->area, + *screen_physical_area_monitor + (client_monitor(self)))))) && + (client_focused(self) || client_search_focus_tree(self))) + l = OB_STACKING_LAYER_FULLSCREEN; else if (self->above) l = OB_STACKING_LAYER_ABOVE; else if (self->below) l = OB_STACKING_LAYER_BELOW; else l = OB_STACKING_LAYER_NORMAL; @@ -2765,7 +2777,7 @@ static void client_iconify_recursive(ObClient *self, void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk) { /* move up the transient chain as far as possible first */ - self = client_search_top_parent(self); + self = client_search_top_normal_parent(self); client_iconify_recursive(self, iconic, curdesk); } @@ -2960,7 +2972,7 @@ void client_set_desktop_recursive(ObClient *self, void client_set_desktop(ObClient *self, guint target, gboolean donthide) { - self = client_search_top_parent(self); + self = client_search_top_normal_parent(self); client_set_desktop_recursive(self, target, donthide); } @@ -3297,7 +3309,7 @@ static void client_present(ObClient *self, gboolean here, gboolean raise) if (here) client_set_desktop(self, screen_desktop, FALSE); else - screen_set_desktop(self->desktop); + screen_set_desktop(self->desktop, FALSE); } else if (!self->frame->visible) /* if its not visible for other reasons, then don't mess with it */ @@ -3451,20 +3463,24 @@ guint client_monitor(ObClient *self) return screen_find_monitor(&self->frame->area); } -ObClient *client_search_top_parent(ObClient *self) +ObClient *client_search_top_normal_parent(ObClient *self) { while (self->transient_for && self->transient_for != OB_TRAN_GROUP && - client_normal(self)) + client_normal(self->transient_for)) self = self->transient_for; return self; } -GSList *client_search_all_top_parents(ObClient *self) +static GSList *client_search_all_top_parents_internal(ObClient *self, + gboolean bylayer, + ObStackingLayer layer) { GSList *ret = NULL; - + /* move up the direct transient chain as far as possible */ - while (self->transient_for && self->transient_for != OB_TRAN_GROUP) + while (self->transient_for && self->transient_for != OB_TRAN_GROUP && + (!bylayer || self->transient_for->layer == layer) && + client_normal(self->transient_for)) self = self->transient_for; if (!self->transient_for) @@ -3477,8 +3493,11 @@ GSList *client_search_all_top_parents(ObClient *self) for (it = self->group->members; it; it = g_slist_next(it)) { ObClient *c = it->data; - if (!c->transient_for && client_normal(c)) + if (!c->transient_for && client_normal(c) && + (!bylayer || c->layer == layer)) + { ret = g_slist_prepend(ret, c); + } } if (ret == NULL) /* no group parents */ @@ -3488,6 +3507,16 @@ GSList *client_search_all_top_parents(ObClient *self) return ret; } +GSList *client_search_all_top_parents(ObClient *self) +{ + return client_search_all_top_parents_internal(self, FALSE, 0); +} + +GSList *client_search_all_top_parents_layer(ObClient *self) +{ + return client_search_all_top_parents_internal(self, TRUE, self->layer); +} + ObClient *client_search_focus_parent(ObClient *self) { if (self->transient_for) { @@ -3552,20 +3581,36 @@ void client_update_sm_client_id(ObClient *self) g_free(self->sm_client_id); self->sm_client_id = NULL; - if (!PROP_GETS(self->window, sm_client_id, locale, &self->sm_client_id) && - self->group) { - ob_debug_type(OB_DEBUG_SM, "Client %s does not have session id\n", - self->title); - if (!PROP_GETS(self->group->leader, sm_client_id, locale, - &self->sm_client_id)) { - ob_debug_type(OB_DEBUG_SM, "Client %s does not have session id on " - "group window\n", self->title); - } else - ob_debug_type(OB_DEBUG_SM, "Client %s has session id on " - "group window\n", self->title); - } else - ob_debug_type(OB_DEBUG_SM, "Client %s has session id\n", - self->title); + if (!PROP_GETS(self->window, sm_client_id, locale, &self->sm_client_id)) + if (self->group) + PROP_GETS(self->group->leader, sm_client_id, locale, + &self->sm_client_id); +} + +void client_update_command(ObClient *self) +{ + gchar **data; + + g_free(self->wm_command); + self->wm_command = NULL; + + if (PROP_GETSS(self->window, wm_command, locale, &data)) { + /* merge/mash them all together */ + gchar *merge = NULL; + gint i; + + for (i = 0; data[i]; ++i) { + gchar *tmp = merge; + if (merge) + merge = g_strconcat(merge, data[i], NULL); + else + merge = g_strconcat(data[i], NULL); + g_free(tmp); + } + g_strfreev(data); + + self->wm_command = merge; + } } #define WANT_EDGE(cur, c) \