X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=787f84c234fab21a095a3f111e20f8380ae4af5f;hb=cb444e37d21009b0e32705901836f77b08f4c5aa;hp=7fca4796bbdb838c6060ed79774b60701c84f327;hpb=63b0c5616ffe67aa021234abe6635adb9c91879b;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 7fca4796..787f84c2 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -10,6 +10,7 @@ #include "stacking.h" #include "dispatch.h" #include "group.h" +#include "config.h" #include #include @@ -138,7 +139,7 @@ void client_manage_all() client_startup_stack_order = NULL; client_startup_stack_size = 0; - if (focus_new) + if (config_focus_new) focus_fallback(Fallback_NoFocus); } @@ -237,8 +238,25 @@ void client_manage(Window window) dispatch_client(Event_Client_Mapped, self, 0, 0); - if (ob_state != State_Starting && focus_new) - client_focus(self); + /* focus the new window? */ + if (ob_state != State_Starting) { + if (config_focus_new) + client_focus(self); + else if (self->transient_for) { + if (self->transient_for != TRAN_GROUP) {/* transient of a window */ + if (focus_client == self->transient_for) + client_focus(self); + } else { /* transient of a group */ + GSList *it; + + for (it = self->group->members; it; it = it->next) + if (focus_client == it->data) { + client_focus(self); + break; + } + } + } + } /* update the list hints */ client_set_list(); @@ -1811,13 +1829,13 @@ void client_set_desktop(Client *self, guint target, gboolean donthide) focus_order[old] = g_list_remove(focus_order[old], self); if (target == DESKTOP_ALL) { for (i = 0; i < screen_num_desktops; ++i) { - if (focus_new) + if (config_focus_new) focus_order[i] = g_list_prepend(focus_order[i], self); else focus_order[i] = g_list_append(focus_order[i], self); } } else { - if (focus_new) + if (config_focus_new) focus_order[target] = g_list_prepend(focus_order[target], self); else focus_order[target] = g_list_append(focus_order[target], self);