add an allDesktops option to Next/PreviousWindow to alt-tab across all desktops.
This commit is contained in:
parent
857245960e
commit
a7f65a818c
8 changed files with 36 additions and 23 deletions
|
@ -293,6 +293,7 @@ void setup_action_cycle_windows_next(ObAction **a, ObUserAction uact)
|
|||
(*a)->data.cycle.forward = TRUE;
|
||||
(*a)->data.cycle.dialog = TRUE;
|
||||
(*a)->data.cycle.dock_windows = FALSE;
|
||||
(*a)->data.cycle.all_desktops = FALSE;
|
||||
}
|
||||
|
||||
void setup_action_cycle_windows_previous(ObAction **a, ObUserAction uact)
|
||||
|
@ -302,6 +303,7 @@ void setup_action_cycle_windows_previous(ObAction **a, ObUserAction uact)
|
|||
(*a)->data.cycle.forward = FALSE;
|
||||
(*a)->data.cycle.dialog = TRUE;
|
||||
(*a)->data.cycle.dock_windows = FALSE;
|
||||
(*a)->data.cycle.all_desktops = FALSE;
|
||||
}
|
||||
|
||||
void setup_action_movefromedge_north(ObAction **a, ObUserAction uact)
|
||||
|
@ -1009,6 +1011,9 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
|||
act->data.cycle.dialog = parse_bool(doc, n);
|
||||
if ((n = parse_find_node("panels", node->xmlChildrenNode)))
|
||||
act->data.cycle.dock_windows = parse_bool(doc, n);
|
||||
if ((n = parse_find_node("allDesktops",
|
||||
node->xmlChildrenNode)))
|
||||
act->data.cycle.all_desktops = parse_bool(doc, n);
|
||||
} else if (act->func == action_directional_focus) {
|
||||
if ((n = parse_find_node("dialog", node->xmlChildrenNode)))
|
||||
act->data.interdiraction.dialog = parse_bool(doc, n);
|
||||
|
@ -1512,7 +1517,7 @@ void action_send_to_desktop(union ActionData *data)
|
|||
data->sendto.desk == DESKTOP_ALL) {
|
||||
client_set_desktop(c, data->sendto.desk, data->sendto.follow);
|
||||
if (data->sendto.follow)
|
||||
screen_set_desktop(data->sendto.desk);
|
||||
screen_set_desktop(data->sendto.desk, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1529,12 +1534,12 @@ void action_desktop(union ActionData *data)
|
|||
if (data->desktop.desk < screen_num_desktops ||
|
||||
data->desktop.desk == DESKTOP_ALL)
|
||||
{
|
||||
screen_set_desktop(data->desktop.desk);
|
||||
screen_set_desktop(data->desktop.desk, TRUE);
|
||||
if (data->inter.any.interactive)
|
||||
screen_desktop_popup(data->desktop.desk, TRUE);
|
||||
}
|
||||
} else if (data->inter.cancel) {
|
||||
screen_set_desktop(first);
|
||||
screen_set_desktop(first, TRUE);
|
||||
}
|
||||
|
||||
if (!data->inter.any.interactive || data->inter.final) {
|
||||
|
@ -1557,7 +1562,7 @@ void action_desktop_dir(union ActionData *data)
|
|||
!data->sendtodir.inter.final ||
|
||||
data->sendtodir.inter.cancel)
|
||||
{
|
||||
screen_set_desktop(d);
|
||||
screen_set_desktop(d, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1579,13 +1584,13 @@ void action_send_to_desktop_dir(union ActionData *data)
|
|||
{
|
||||
client_set_desktop(c, d, data->sendtodir.follow);
|
||||
if (data->sendtodir.follow)
|
||||
screen_set_desktop(d);
|
||||
screen_set_desktop(d, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void action_desktop_last(union ActionData *data)
|
||||
{
|
||||
screen_set_desktop(screen_last_desktop);
|
||||
screen_set_desktop(screen_last_desktop, TRUE);
|
||||
}
|
||||
|
||||
void action_toggle_decorations(union ActionData *data)
|
||||
|
@ -1771,6 +1776,7 @@ void action_cycle_windows(union ActionData *data)
|
|||
event_halt_focus_delay();
|
||||
|
||||
focus_cycle(data->cycle.forward,
|
||||
data->cycle.all_desktops,
|
||||
data->cycle.dock_windows,
|
||||
data->cycle.linear, data->any.interactive,
|
||||
data->cycle.dialog,
|
||||
|
|
|
@ -143,6 +143,7 @@ struct CycleWindows {
|
|||
gboolean forward;
|
||||
gboolean dialog;
|
||||
gboolean dock_windows;
|
||||
gboolean all_desktops;
|
||||
};
|
||||
|
||||
struct Stacking {
|
||||
|
|
|
@ -3297,7 +3297,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 */
|
||||
|
|
|
@ -591,7 +591,7 @@ static void event_handle_root(XEvent *e)
|
|||
ob_debug_type(OB_DEBUG_APP_BUGS,
|
||||
"_NET_CURRENT_DESKTOP message is missing "
|
||||
"a timestamp\n");
|
||||
screen_set_desktop(d);
|
||||
screen_set_desktop(d, TRUE);
|
||||
}
|
||||
} else if (msgtype == prop_atoms.net_number_of_desktops) {
|
||||
guint d = e->xclient.data.l[0];
|
||||
|
|
|
@ -61,7 +61,7 @@ static void focus_cycle_destructor(ObClient *client, gpointer data)
|
|||
be used
|
||||
*/
|
||||
if (focus_cycle_target == client)
|
||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
}
|
||||
|
||||
static Window createWindow(Window parent, gulong mask,
|
||||
|
@ -170,7 +170,7 @@ void focus_set_client(ObClient *client)
|
|||
be used.
|
||||
*/
|
||||
if (focus_cycle_target)
|
||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||
|
||||
focus_client = client;
|
||||
|
||||
|
@ -457,7 +457,9 @@ void focus_cycle_draw_indicator()
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean valid_focus_target(ObClient *ft, gboolean dock_windows)
|
||||
static gboolean valid_focus_target(ObClient *ft,
|
||||
gboolean all_desktops,
|
||||
gboolean dock_windows)
|
||||
{
|
||||
gboolean ok = FALSE;
|
||||
/* we don't use client_can_focus here, because that doesn't let you
|
||||
|
@ -483,7 +485,9 @@ static gboolean valid_focus_target(ObClient *ft, gboolean dock_windows)
|
|||
ft->type == OB_CLIENT_TYPE_MENU || /* being allowed to target */
|
||||
ft->type == OB_CLIENT_TYPE_UTILITY)) /* one of these, don't let */
|
||||
ok = ok && !ft->skip_taskbar; /* skip taskbar stop us */
|
||||
ok = ok && (ft->desktop == screen_desktop || ft->desktop == DESKTOP_ALL);
|
||||
if (!all_desktops)
|
||||
ok = ok && (ft->desktop == screen_desktop ||
|
||||
ft->desktop == DESKTOP_ALL);
|
||||
ok = ok && ft == client_focus_target(ft);
|
||||
return ok;
|
||||
/*
|
||||
|
@ -501,7 +505,8 @@ static gboolean valid_focus_target(ObClient *ft, gboolean dock_windows)
|
|||
*/
|
||||
}
|
||||
|
||||
void focus_cycle(gboolean forward, gboolean dock_windows,
|
||||
void focus_cycle(gboolean forward, gboolean all_desktops,
|
||||
gboolean dock_windows,
|
||||
gboolean linear, gboolean interactive,
|
||||
gboolean dialog, gboolean done, gboolean cancel)
|
||||
{
|
||||
|
@ -546,7 +551,7 @@ void focus_cycle(gboolean forward, gboolean dock_windows,
|
|||
if (it == NULL) it = g_list_last(list);
|
||||
}
|
||||
ft = it->data;
|
||||
if (valid_focus_target(ft, dock_windows)) {
|
||||
if (valid_focus_target(ft, all_desktops, dock_windows)) {
|
||||
if (interactive) {
|
||||
if (ft != focus_cycle_target) { /* prevents flicker */
|
||||
focus_cycle_target = ft;
|
||||
|
@ -712,7 +717,7 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
|
|||
GList *it;
|
||||
|
||||
for (it = focus_order; it; it = g_list_next(it))
|
||||
if (valid_focus_target(it->data, dock_windows))
|
||||
if (valid_focus_target(it->data, FALSE, dock_windows))
|
||||
ft = it->data;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ struct _ObClient* focus_fallback_target(gboolean allow_refocus,
|
|||
void focus_fallback(gboolean allow_refocus);
|
||||
|
||||
/*! Cycle focus amongst windows. */
|
||||
void focus_cycle(gboolean forward, gboolean dock_windows,
|
||||
void focus_cycle(gboolean forward, gboolean all_desktops,
|
||||
gboolean dock_windows,
|
||||
gboolean linear, gboolean interactive,
|
||||
gboolean dialog, gboolean done, gboolean cancel);
|
||||
void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
|
||||
|
|
|
@ -328,13 +328,13 @@ void screen_startup(gboolean reconfig)
|
|||
net_current_desktop, cardinal, &d) &&
|
||||
d < screen_num_desktops)
|
||||
{
|
||||
screen_set_desktop(d);
|
||||
screen_set_desktop(d, FALSE);
|
||||
} else if (session_desktop >= 0)
|
||||
screen_set_desktop(MIN((guint)session_desktop,
|
||||
screen_num_desktops));
|
||||
screen_num_desktops), FALSE);
|
||||
else
|
||||
screen_set_desktop(MIN(config_screen_firstdesk,
|
||||
screen_num_desktops) - 1);
|
||||
screen_num_desktops) - 1, FALSE);
|
||||
|
||||
/* don't start in showing-desktop mode */
|
||||
screen_showing_desktop = FALSE;
|
||||
|
@ -442,10 +442,10 @@ void screen_set_num_desktops(guint num)
|
|||
|
||||
/* change our desktop if we're on one that no longer exists! */
|
||||
if (screen_desktop >= screen_num_desktops)
|
||||
screen_set_desktop(num - 1);
|
||||
screen_set_desktop(num - 1, TRUE);
|
||||
}
|
||||
|
||||
void screen_set_desktop(guint num)
|
||||
void screen_set_desktop(guint num, gboolean dofocus)
|
||||
{
|
||||
ObClient *c;
|
||||
GList *it;
|
||||
|
@ -487,7 +487,7 @@ void screen_set_desktop(guint num)
|
|||
|
||||
/* have to try focus here because when you leave an empty desktop
|
||||
there is no focus out to watch for */
|
||||
if ((c = focus_fallback_target(TRUE, focus_client))) {
|
||||
if (dofocus && (c = focus_fallback_target(TRUE, focus_client))) {
|
||||
/* reduce flicker by hiliting now rather than waiting for the server
|
||||
FocusIn event */
|
||||
frame_adjust_focus(c->frame, TRUE);
|
||||
|
|
|
@ -66,7 +66,7 @@ void screen_resize();
|
|||
/*! Change the number of available desktops */
|
||||
void screen_set_num_desktops(guint num);
|
||||
/*! Change the current desktop */
|
||||
void screen_set_desktop(guint num);
|
||||
void screen_set_desktop(guint num, gboolean dofocus);
|
||||
/*! Interactively change desktops */
|
||||
guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
|
||||
gboolean dialog, gboolean done, gboolean cancel);
|
||||
|
|
Loading…
Reference in a new issue