soem changes to desktop actions.
instead of having *wrap actions, just default to having wrap on, and let it be optionally placed into the rc to disable it. instead of next/prev desktop, just have actions for desktop to the right/left/up/down. this applies to sendtodesktop actions too.
This commit is contained in:
parent
26ebe251a9
commit
e483257007
2 changed files with 165 additions and 166 deletions
291
openbox/action.c
291
openbox/action.c
|
@ -84,26 +84,15 @@ void setup_action_send_to_desktop(Action *a)
|
||||||
a->data.sendto.follow = TRUE;
|
a->data.sendto.follow = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_action_send_to_np_desktop(Action *a)
|
void setup_action_send_to_desktop_direction(Action *a)
|
||||||
{
|
{
|
||||||
a->data.sendtonextprev.wrap = FALSE;
|
a->data.sendtodir.wrap = TRUE;
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
a->data.sendtodir.follow = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_action_send_to_np_desktop_wrap(Action *a)
|
void setup_action_desktop_direction(Action *a)
|
||||||
{
|
{
|
||||||
a->data.sendtonextprev.wrap = TRUE;
|
a->data.desktopdir.wrap = TRUE;
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup_action_np_desktop(Action *a)
|
|
||||||
{
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup_action_np_desktop_wrap(Action *a)
|
|
||||||
{
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_action_move_keyboard(Action *a)
|
void setup_action_move_keyboard(Action *a)
|
||||||
|
@ -373,24 +362,24 @@ ActionString actionstrings[] =
|
||||||
setup_action_send_to_desktop
|
setup_action_send_to_desktop
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sendtonextdesktop",
|
"sendtodesktopright",
|
||||||
action_send_to_next_desktop,
|
action_send_to_desktop_right,
|
||||||
setup_action_send_to_np_desktop
|
setup_action_send_to_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sendtonextdesktopwrap",
|
"sendtodesktopleft",
|
||||||
action_send_to_next_desktop,
|
action_send_to_desktop_left,
|
||||||
setup_action_send_to_np_desktop_wrap
|
setup_action_send_to_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sendtopreviousdesktop",
|
"sendtodesktopup",
|
||||||
action_send_to_previous_desktop,
|
action_send_to_desktop_up,
|
||||||
setup_action_send_to_np_desktop
|
setup_action_send_to_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sendtopreviousdesktopwrap",
|
"sendtodesktopdown",
|
||||||
action_send_to_previous_desktop,
|
action_send_to_desktop_down,
|
||||||
setup_action_send_to_np_desktop_wrap
|
setup_action_send_to_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desktop",
|
"desktop",
|
||||||
|
@ -398,64 +387,24 @@ ActionString actionstrings[] =
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nextdesktop",
|
"desktopright",
|
||||||
action_next_desktop,
|
action_desktop_right,
|
||||||
setup_action_np_desktop
|
setup_action_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nextdesktopwrap",
|
"desktopleft",
|
||||||
action_next_desktop,
|
action_desktop_left,
|
||||||
setup_action_np_desktop_wrap
|
setup_action_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"previousdesktop",
|
"desktopup",
|
||||||
action_previous_desktop,
|
action_desktop_up,
|
||||||
setup_action_np_desktop
|
setup_action_desktop_direction
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"previousdesktopwrap",
|
"desktopdown",
|
||||||
action_previous_desktop,
|
action_desktop_down,
|
||||||
setup_action_np_desktop_wrap
|
setup_action_desktop_direction
|
||||||
},
|
|
||||||
{
|
|
||||||
"nextdesktopcolumn",
|
|
||||||
action_next_desktop_column,
|
|
||||||
setup_action_np_desktop
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nextdesktopcolumnwrap",
|
|
||||||
action_next_desktop_column,
|
|
||||||
setup_action_np_desktop_wrap
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"previousdesktopcolumn",
|
|
||||||
action_previous_desktop_column,
|
|
||||||
setup_action_np_desktop
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"previousdesktopcolumnwrap",
|
|
||||||
action_previous_desktop_column,
|
|
||||||
setup_action_np_desktop_wrap
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nextdesktoprow",
|
|
||||||
action_next_desktop_row,
|
|
||||||
setup_action_np_desktop
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nextdesktoprowwrap",
|
|
||||||
action_next_desktop_row,
|
|
||||||
setup_action_np_desktop_wrap
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"previousdesktoprow",
|
|
||||||
action_previous_desktop_row,
|
|
||||||
setup_action_np_desktop
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"previousdesktoprowwrap",
|
|
||||||
action_previous_desktop_row,
|
|
||||||
setup_action_np_desktop_wrap
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"toggledecorations",
|
"toggledecorations",
|
||||||
|
@ -797,36 +746,6 @@ void action_send_to_desktop(union ActionData *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_send_to_next_desktop(union ActionData *data)
|
|
||||||
{
|
|
||||||
guint d;
|
|
||||||
|
|
||||||
if (!data->sendtonextprev.c) return;
|
|
||||||
|
|
||||||
d = screen_desktop + 1;
|
|
||||||
if (d >= screen_num_desktops) {
|
|
||||||
if (!data->sendtonextprev.wrap) return;
|
|
||||||
d = 0;
|
|
||||||
}
|
|
||||||
client_set_desktop(data->sendtonextprev.c, d, data->sendtonextprev.follow);
|
|
||||||
if (data->sendtonextprev.follow) screen_set_desktop(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
void action_send_to_previous_desktop(union ActionData *data)
|
|
||||||
{
|
|
||||||
guint d;
|
|
||||||
|
|
||||||
if (!data->sendtonextprev.c) return;
|
|
||||||
|
|
||||||
d = screen_desktop - 1;
|
|
||||||
if (d >= screen_num_desktops) {
|
|
||||||
if (!data->sendtonextprev.wrap) return;
|
|
||||||
d = screen_num_desktops - 1;
|
|
||||||
}
|
|
||||||
client_set_desktop(data->sendtonextprev.c, d, data->sendtonextprev.follow);
|
|
||||||
if (data->sendtonextprev.follow) screen_set_desktop(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
void action_desktop(union ActionData *data)
|
void action_desktop(union ActionData *data)
|
||||||
{
|
{
|
||||||
if (data->desktop.desk < screen_num_desktops ||
|
if (data->desktop.desk < screen_num_desktops ||
|
||||||
|
@ -834,30 +753,6 @@ void action_desktop(union ActionData *data)
|
||||||
screen_set_desktop(data->desktop.desk);
|
screen_set_desktop(data->desktop.desk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_next_desktop(union ActionData *data)
|
|
||||||
{
|
|
||||||
guint d;
|
|
||||||
|
|
||||||
d = screen_desktop + 1;
|
|
||||||
if (d >= screen_num_desktops) {
|
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
|
||||||
d = 0;
|
|
||||||
}
|
|
||||||
screen_set_desktop(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
void action_previous_desktop(union ActionData *data)
|
|
||||||
{
|
|
||||||
guint d;
|
|
||||||
|
|
||||||
d = screen_desktop - 1;
|
|
||||||
if (d >= screen_num_desktops) {
|
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
|
||||||
d = screen_num_desktops - 1;
|
|
||||||
}
|
|
||||||
screen_set_desktop(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cur_row_col(guint *r, guint *c)
|
static void cur_row_col(guint *r, guint *c)
|
||||||
{
|
{
|
||||||
switch (screen_desktop_layout.orientation) {
|
switch (screen_desktop_layout.orientation) {
|
||||||
|
@ -966,17 +861,19 @@ static guint translate_row_col(guint r, guint c)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_next_desktop_column(union ActionData *data)
|
void action_desktop_right(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint r, c, d;
|
guint r, c, d;
|
||||||
|
|
||||||
cur_row_col(&r, &c);
|
cur_row_col(&r, &c);
|
||||||
++c;
|
++c;
|
||||||
if (c >= screen_desktop_layout.columns)
|
if (c >= screen_desktop_layout.columns) {
|
||||||
|
if (!data->desktopdir.wrap) return;
|
||||||
c = 0;
|
c = 0;
|
||||||
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
if (!data->desktopdir.wrap) return;
|
||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
|
@ -984,17 +881,43 @@ void action_next_desktop_column(union ActionData *data)
|
||||||
screen_set_desktop(d);
|
screen_set_desktop(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_previous_desktop_column(union ActionData *data)
|
void action_send_to_desktop_right(union ActionData *data)
|
||||||
|
{
|
||||||
|
guint r, c, d;
|
||||||
|
|
||||||
|
if (data->sendtodir.c) {
|
||||||
|
cur_row_col(&r, &c);
|
||||||
|
++c;
|
||||||
|
if (c >= screen_desktop_layout.columns) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
c = 0;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d >= screen_num_desktops) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d < screen_num_desktops) {
|
||||||
|
client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
|
||||||
|
if (data->sendtodir.follow) screen_set_desktop(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void action_desktop_left(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint r, c, d;
|
guint r, c, d;
|
||||||
|
|
||||||
cur_row_col(&r, &c);
|
cur_row_col(&r, &c);
|
||||||
--c;
|
--c;
|
||||||
if (c >= screen_desktop_layout.columns)
|
if (c >= screen_desktop_layout.columns) {
|
||||||
|
if (!data->desktopdir.wrap) return;
|
||||||
c = screen_desktop_layout.columns - 1;
|
c = screen_desktop_layout.columns - 1;
|
||||||
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
if (!data->desktopdir.wrap) return;
|
||||||
--c;
|
--c;
|
||||||
}
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
|
@ -1002,17 +925,43 @@ void action_previous_desktop_column(union ActionData *data)
|
||||||
screen_set_desktop(d);
|
screen_set_desktop(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_next_desktop_row(union ActionData *data)
|
void action_send_to_desktop_left(union ActionData *data)
|
||||||
|
{
|
||||||
|
guint r, c, d;
|
||||||
|
|
||||||
|
if (data->sendtodir.c) {
|
||||||
|
cur_row_col(&r, &c);
|
||||||
|
--c;
|
||||||
|
if (c >= screen_desktop_layout.columns) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
c = screen_desktop_layout.columns - 1;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d >= screen_num_desktops) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
--c;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d < screen_num_desktops) {
|
||||||
|
client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
|
||||||
|
if (data->sendtodir.follow) screen_set_desktop(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void action_desktop_down(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint r, c, d;
|
guint r, c, d;
|
||||||
|
|
||||||
cur_row_col(&r, &c);
|
cur_row_col(&r, &c);
|
||||||
++r;
|
++r;
|
||||||
if (r >= screen_desktop_layout.rows)
|
if (r >= screen_desktop_layout.rows) {
|
||||||
|
if (!data->desktopdir.wrap) return;
|
||||||
r = 0;
|
r = 0;
|
||||||
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
if (!data->desktopdir.wrap) return;
|
||||||
++r;
|
++r;
|
||||||
}
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
|
@ -1020,17 +969,43 @@ void action_next_desktop_row(union ActionData *data)
|
||||||
screen_set_desktop(d);
|
screen_set_desktop(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_previous_desktop_row(union ActionData *data)
|
void action_send_to_desktop_down(union ActionData *data)
|
||||||
|
{
|
||||||
|
guint r, c, d;
|
||||||
|
|
||||||
|
if (data->sendtodir.c) {
|
||||||
|
cur_row_col(&r, &c);
|
||||||
|
++r;
|
||||||
|
if (r >= screen_desktop_layout.rows) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d >= screen_num_desktops) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
++r;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d < screen_num_desktops) {
|
||||||
|
client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
|
||||||
|
if (data->sendtodir.follow) screen_set_desktop(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void action_desktop_up(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint r, c, d;
|
guint r, c, d;
|
||||||
|
|
||||||
cur_row_col(&r, &c);
|
cur_row_col(&r, &c);
|
||||||
--r;
|
--r;
|
||||||
if (r >= screen_desktop_layout.rows)
|
if (r >= screen_desktop_layout.rows) {
|
||||||
|
if (!data->desktopdir.wrap) return;
|
||||||
r = screen_desktop_layout.rows - 1;
|
r = screen_desktop_layout.rows - 1;
|
||||||
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->nextprevdesktop.wrap) return;
|
if (!data->desktopdir.wrap) return;
|
||||||
--r;
|
--r;
|
||||||
}
|
}
|
||||||
d = translate_row_col(r, c);
|
d = translate_row_col(r, c);
|
||||||
|
@ -1038,6 +1013,30 @@ void action_previous_desktop_row(union ActionData *data)
|
||||||
screen_set_desktop(d);
|
screen_set_desktop(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void action_send_to_desktop_up(union ActionData *data)
|
||||||
|
{
|
||||||
|
guint r, c, d;
|
||||||
|
|
||||||
|
if (data->sendtodir.c) {
|
||||||
|
cur_row_col(&r, &c);
|
||||||
|
--r;
|
||||||
|
if (r >= screen_desktop_layout.rows) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
r = screen_desktop_layout.rows - 1;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d >= screen_num_desktops) {
|
||||||
|
if (!data->sendtodir.wrap) return;
|
||||||
|
--r;
|
||||||
|
}
|
||||||
|
d = translate_row_col(r, c);
|
||||||
|
if (d < screen_num_desktops) {
|
||||||
|
client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
|
||||||
|
if (data->sendtodir.follow) screen_set_desktop(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void action_toggle_decorations(union ActionData *data)
|
void action_toggle_decorations(union ActionData *data)
|
||||||
{
|
{
|
||||||
Client *c = data->client.c;;
|
Client *c = data->client.c;;
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct SendToDesktop {
|
||||||
gboolean follow;
|
gboolean follow;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SendToNextPreviousDesktop {
|
struct SendToDesktopDirection {
|
||||||
Client *c;
|
Client *c;
|
||||||
gboolean wrap;
|
gboolean wrap;
|
||||||
gboolean follow;
|
gboolean follow;
|
||||||
|
@ -53,7 +53,7 @@ struct Layer {
|
||||||
int layer; /* < 0 = below, 0 = normal, > 0 = above */
|
int layer; /* < 0 = below, 0 = normal, > 0 = above */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NextPreviousDesktop {
|
struct DesktopDirection {
|
||||||
Client *c;
|
Client *c;
|
||||||
gboolean wrap;
|
gboolean wrap;
|
||||||
};
|
};
|
||||||
|
@ -88,9 +88,9 @@ union ActionData {
|
||||||
struct ClientAction client;
|
struct ClientAction client;
|
||||||
struct MoveResizeRelative relative;
|
struct MoveResizeRelative relative;
|
||||||
struct SendToDesktop sendto;
|
struct SendToDesktop sendto;
|
||||||
struct SendToNextPreviousDesktop sendtonextprev;
|
struct SendToDesktopDirection sendtodir;
|
||||||
struct Desktop desktop;
|
struct Desktop desktop;
|
||||||
struct NextPreviousDesktop nextprevdesktop;
|
struct DesktopDirection desktopdir;
|
||||||
struct MoveResize moveresize;
|
struct MoveResize moveresize;
|
||||||
struct ShowMenu showmenu;
|
struct ShowMenu showmenu;
|
||||||
struct CycleWindows cycle;
|
struct CycleWindows cycle;
|
||||||
|
@ -180,24 +180,24 @@ void action_unmaximize_vert(union ActionData *data);
|
||||||
void action_toggle_maximize_vert(union ActionData *data);
|
void action_toggle_maximize_vert(union ActionData *data);
|
||||||
/* SendToDesktop */
|
/* SendToDesktop */
|
||||||
void action_send_to_desktop(union ActionData *data);
|
void action_send_to_desktop(union ActionData *data);
|
||||||
/* SendToNextPreviousDesktop */
|
/* SendToDesktopDirection */
|
||||||
void action_send_to_next_desktop(union ActionData *data);
|
void action_send_to_desktop_right(union ActionData *data);
|
||||||
/* SendToNextPreviousDesktop */
|
/* SendToDesktopDirection */
|
||||||
void action_send_to_previous_desktop(union ActionData *data);
|
void action_send_to_desktop_left(union ActionData *data);
|
||||||
|
/* SendToDesktopDirection */
|
||||||
|
void action_send_to_desktop_up(union ActionData *data);
|
||||||
|
/* SendToDesktopDirection */
|
||||||
|
void action_send_to_desktop_down(union ActionData *data);
|
||||||
/* Desktop */
|
/* Desktop */
|
||||||
void action_desktop(union ActionData *data);
|
void action_desktop(union ActionData *data);
|
||||||
/* NextPreviousDesktop */
|
/* DesktopDirection */
|
||||||
void action_next_desktop(union ActionData *data);
|
void action_desktop_right(union ActionData *data);
|
||||||
/* NextPreviousDesktop */
|
/* DesktopDirection */
|
||||||
void action_previous_desktop(union ActionData *data);
|
void action_desktop_left(union ActionData *data);
|
||||||
/* NextPreviousDesktop */
|
/* DesktopDirection */
|
||||||
void action_next_desktop_column(union ActionData *data);
|
void action_desktop_up(union ActionData *data);
|
||||||
/* NextPreviousDesktop */
|
/* DesktopDirection */
|
||||||
void action_previous_desktop_column(union ActionData *data);
|
void action_desktop_down(union ActionData *data);
|
||||||
/* NextPreviousDesktop */
|
|
||||||
void action_next_desktop_row(union ActionData *data);
|
|
||||||
/* NextPreviousDesktop */
|
|
||||||
void action_previous_desktop_row(union ActionData *data);
|
|
||||||
/* ClientAction */
|
/* ClientAction */
|
||||||
void action_toggle_decorations(union ActionData *data);
|
void action_toggle_decorations(union ActionData *data);
|
||||||
/* MoveResize */
|
/* MoveResize */
|
||||||
|
|
Loading…
Reference in a new issue