static void focus_cycle_destroy_notify (ObClient *client, gpointer data);
static gboolean focus_target_has_siblings (ObClient *ft,
+ gboolean iconic_windows,
gboolean all_desktops);
static ObClient *focus_find_directional (ObClient *c,
ObDirection dir,
/*! Returns if a focus target has valid group siblings that can be cycled
to in its place */
-static gboolean focus_target_has_siblings(ObClient *ft, gboolean all_desktops)
+static gboolean focus_target_has_siblings(ObClient *ft,
+ gboolean iconic_windows,
+ gboolean all_desktops)
{
GSList *it;
ObClient *c = it->data;
/* check that it's not a helper window to avoid infinite recursion */
if (c != ft && !client_helper(c) &&
- focus_cycle_target_valid(c, all_desktops, FALSE, FALSE))
+ focus_cycle_target_valid(c, iconic_windows, all_desktops, FALSE,
+ FALSE))
{
return TRUE;
}
}
gboolean focus_cycle_target_valid(ObClient *ft,
+ gboolean iconic_windows,
gboolean all_desktops,
gboolean dock_windows,
gboolean desktop_windows)
/* the window can receive focus somehow */
ok = ok && (ft->can_focus || ft->focus_notify);
+ /* the window is not iconic, or we're allowed to go to iconic ones */
+ ok = ok && (iconic_windows || !ft->iconic);
+
/* it's the right type of window */
if (dock_windows || desktop_windows)
ok = ok && ((dock_windows && ft->type == OB_CLIENT_TYPE_DOCK) ||
((focus_client && ft->group == focus_client->group) ||
/* ... or if there are no other windows in its group
that can be cycled to instead */
- !focus_target_has_siblings(ft, all_desktops))));
+ !focus_target_has_siblings(ft, iconic_windows, all_desktops))));
/* it's not set to skip the taskbar (unless it is a type that would be
expected to set this hint */
if (it == NULL) it = g_list_last(list);
}
ft = it->data;
- if (focus_cycle_target_valid(ft, all_desktops, dock_windows,
+ if (focus_cycle_target_valid(ft, TRUE,
+ all_desktops, dock_windows,
desktop_windows))
{
if (interactive) {
}
if (dialog)
/* same arguments as focus_target_valid */
- focus_cycle_popup_show(ft, all_desktops, dock_windows,
+ focus_cycle_popup_show(ft, TRUE,
+ all_desktops, dock_windows,
desktop_windows);
return;
} else if (ft != focus_cycle_target) {
/* the currently selected window isn't interesting */
if(cur == c)
continue;
- if (cur->type == OB_CLIENT_TYPE_DOCK && !dock_windows)
- continue;
- if (cur->type == OB_CLIENT_TYPE_DESKTOP && !desktop_windows)
- continue;
- if (!client_normal(cur) &&
- cur->type != OB_CLIENT_TYPE_DOCK &&
- cur->type != OB_CLIENT_TYPE_DESKTOP)
- continue;
- /* using c->desktop instead of screen_desktop doesn't work if the
- * current window was omnipresent, hope this doesn't have any other
- * side effects */
- if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
- continue;
- if(cur->iconic)
- continue;
- if(!(client_focus_target(cur) == cur &&
- client_can_focus(cur)))
+ if (!focus_cycle_target_valid(it->data, FALSE, FALSE, dock_windows,
+ desktop_windows))
continue;
/* find the centre coords of this window, from the
GList *it;
for (it = focus_order; it; it = g_list_next(it))
- if (focus_cycle_target_valid(it->data, FALSE, dock_windows,
+ if (focus_cycle_target_valid(it->data, FALSE, FALSE, dock_windows,
desktop_windows))
ft = it->data;
}
}
if (focus_cycle_target && dialog) {
/* same arguments as focus_target_valid */
- focus_cycle_popup_show(focus_cycle_target, FALSE, dock_windows,
+ focus_cycle_popup_show(focus_cycle_target, FALSE, FALSE, dock_windows,
desktop_windows);
return;
}
static ObFocusCyclePopup popup;
static gchar *popup_get_name (ObClient *c);
-static void popup_setup (ObFocusCyclePopup *p,gboolean all_desktops,
- gboolean dock_windows, gboolean desktop_windows);
-static void popup_render (ObFocusCyclePopup *p, const ObClient *c);
+static void popup_setup (ObFocusCyclePopup *p,
+ gboolean iconic_windows,
+ gboolean all_desktops,
+ gboolean dock_windows,
+ gboolean desktop_windows);
+static void popup_render (ObFocusCyclePopup *p,
+ const ObClient *c);
static Window create_window(Window parent, guint bwidth, gulong mask,
XSetWindowAttributes *attr)
RrAppearanceFree(popup.a_bg);
}
-static void popup_setup(ObFocusCyclePopup *p,gboolean all_desktops,
+static void popup_setup(ObFocusCyclePopup *p,
+ gboolean iconic_windows, gboolean all_desktops,
gboolean dock_windows, gboolean desktop_windows)
{
gint maxwidth, n;
ObClient *ft = it->data;
if (focus_cycle_target_valid(ft,
+ iconic_windows,
all_desktops,
dock_windows,
desktop_windows))
p->last_target = newtarget;
}
-void focus_cycle_popup_show(ObClient *c,
+void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows,
gboolean all_desktops, gboolean dock_windows,
gboolean desktop_windows)
{
/* do this stuff only when the dialog is first showing */
if (!popup.mapped)
- popup_setup(&popup, all_desktops, dock_windows, desktop_windows);
+ popup_setup(&popup, iconic_windows, all_desktops,
+ dock_windows, desktop_windows);
g_assert(popup.targets != NULL);
popup_render(&popup, c);