X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=23ebf31c8c0ba116abacdea289c73e55f19fcd2b;hb=00bf97aecd14d58b5dc29519d1bc41dce392d1c8;hp=34ae4d868f5e770e7e58592f1ccd05cdb8967246;hpb=9c19d7f677e17b458f7fad1cdd220ffb2ac51ba1;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 34ae4d86..23ebf31c 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -381,8 +381,10 @@ void client_manage(Window window) focus_client->user_time : CurrentTime; /* This is focus stealing prevention */ - ob_debug("Want to focus new window 0x%x with time %u (last time %u)\n", - self->window, self->user_time, last_time); + ob_debug_type(OB_DEBUG_FOCUS, + "Want to focus new window 0x%x with time %u " + "(last time %u)\n", + self->window, self->user_time, last_time); /* if it's on another desktop */ if (!(self->desktop == screen_desktop || self->desktop == DESKTOP_ALL) @@ -391,31 +393,38 @@ void client_manage(Window window) !event_time_after(self->user_time, screen_desktop_user_time)) { activate = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because its on another " + "desktop\n"); } - /* If nothing is focused, or a parent was focused, then focus this - always - */ - else if (!focus_client || client_search_focus_parent(self) != NULL) - activate = TRUE; - else + /* If something is focused, and it's not our parent... */ + else if (focus_client && client_search_focus_parent(self) == NULL) { /* If time stamp is old, don't steal focus */ if (self->user_time && last_time && !event_time_after(self->user_time, last_time)) { activate = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because the time is " + "too old\n"); } /* Don't steal focus from globally active clients. I stole this idea from KWin. It seems nice. */ - if (!(focus_client->can_focus || focus_client->focus_notify)) + if (!(focus_client->can_focus || focus_client->focus_notify)) { activate = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because a globally " + "active client has focus\n"); + } } if (!activate) { - ob_debug("Focus stealing prevention activated for %s with time %u " - "(last time %u)\n", - self->title, self->user_time, last_time); + ob_debug_type(OB_DEBUG_FOCUS, + "Focus stealing prevention activated for %s with " + "time %u (last time %u)\n", + self->title, self->user_time, last_time); /* if the client isn't focused, then hilite it so the user knows it is there */ client_hilite(self, TRUE); @@ -2198,6 +2207,12 @@ gboolean client_normal(ObClient *self) { self->type == OB_CLIENT_TYPE_SPLASH); } +gboolean client_application(ObClient *self) +{ + return (self->type == OB_CLIENT_TYPE_NORMAL || + self->type == OB_CLIENT_TYPE_DIALOG); +} + static void client_apply_startup_state(ObClient *self, gint x, gint y) { gboolean pos = FALSE; /* has the window's position been configured? */ @@ -3633,3 +3648,17 @@ gboolean client_has_group_siblings(ObClient *self) { return self->group && self->group->members->next; } + +gboolean client_has_application_group_siblings(ObClient *self) +{ + GSList *it; + + if (!self->group) return FALSE; + + for (it = self->group->members; it; it = g_slist_next(it)) { + ObClient *c = it->data; + if (c != self && client_application(c)) + return TRUE; + } + return FALSE; +}