add AddDesktopLast RemoveDesktopLast AddDesktopCurrent RemoveDesktopCurrent

This commit is contained in:
Dana Jansens 2007-06-13 15:01:27 +00:00
parent 338798a408
commit 1443e17317
2 changed files with 74 additions and 0 deletions

View file

@ -470,6 +470,16 @@ void setup_action_showmenu(ObAction **a, ObUserAction uact)
}
}
void setup_action_addremove_desktop_current(ObAction **a, ObUserAction uact)
{
(*a)->data.addremovedesktop.current = TRUE;
}
void setup_action_addremove_desktop_last(ObAction **a, ObUserAction uact)
{
(*a)->data.addremovedesktop.current = FALSE;
}
void setup_action_focus(ObAction **a, ObUserAction uact)
{
(*a)->data.any.client_action = OB_CLIENT_ACTION_OPTIONAL;
@ -927,6 +937,26 @@ ActionString actionstrings[] =
action_break_chroot,
NULL
},
{
"adddesktoplast",
action_add_desktop,
setup_action_addremove_desktop_last
},
{
"removedesktoplast",
action_remove_desktop,
setup_action_addremove_desktop_last
},
{
"adddesktopcurrent",
action_add_desktop,
setup_action_addremove_desktop_current
},
{
"removedesktopcurrent",
action_remove_desktop,
setup_action_addremove_desktop_current
},
{
NULL,
NULL,
@ -2003,3 +2033,37 @@ void action_break_chroot(union ActionData *data)
/* break out of one chroot */
keyboard_reset_chains(1);
}
void action_add_desktop(union ActionData *data)
{
screen_set_num_desktops(screen_num_desktops+1);
/* move all the clients over */
if (data->addremovedesktop.current) {
GList *it;
for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data;
if (c->desktop != DESKTOP_ALL && c->desktop >= screen_desktop)
client_set_desktop(c, c->desktop+1, FALSE);
}
}
}
void action_remove_desktop(union ActionData *data)
{
if (screen_num_desktops < 2) return;
/* move all the clients over */
if (data->addremovedesktop.current) {
GList *it;
for (it = client_list; it; it = g_list_next(it)) {
ObClient *c = it->data;
if (c->desktop != DESKTOP_ALL && c->desktop > screen_desktop)
client_set_desktop(c, c->desktop-1, FALSE);
}
}
screen_set_num_desktops(screen_num_desktops-1);
}

View file

@ -142,6 +142,11 @@ struct ShowMenu {
gchar *name;
};
struct AddRemoveDesktop {
struct AnyAction any;
gboolean current;
};
struct CycleWindows {
struct InteractiveAction inter;
gboolean linear;
@ -175,6 +180,7 @@ union ActionData {
struct CycleWindows cycle;
struct Layer layer;
struct Stacking stacking;
struct AddRemoveDesktop addremovedesktop;
};
struct _ObAction {
@ -356,5 +362,9 @@ void action_show_desktop(union ActionData *data);
void action_unshow_desktop(union ActionData *data);
/* Any */
void action_break_chroot(union ActionData *data);
/* AddRemoveDesktop */
void action_add_desktop(union ActionData *data);
/* AddRemoveDesktop */
void action_remove_desktop(union ActionData *data);
#endif