X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Faction.c;h=6e06d374360764e5afb7a197c5e61bae137d45fc;hb=a46b4ee4341dcf5c86b9182b5b970825f2e11692;hp=cb3233252a4232f86a13934a800583ffe16dbbf3;hpb=2477a38d2f3063b697e44bf3690cf280fb26ca8a;p=chaz%2Fopenbox diff --git a/openbox/action.c b/openbox/action.c index cb323325..6e06d374 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -795,13 +795,14 @@ void action_toggle_maximize_vert(union ActionData *data) void action_send_to_desktop(union ActionData *data) { - if (data->sendto.c) { - if (data->sendto.desk < screen_num_desktops || - data->sendto.desk == DESKTOP_ALL) { - client_set_desktop(data->desktop.c, - data->sendto.desk, data->sendto.follow); - if (data->sendto.follow) screen_set_desktop(data->sendto.desk); - } + ObClient *c = data->sendto.c; + + if (!c || !client_normal(c)) return; + + if (data->sendto.desk < screen_num_desktops || + 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); } } @@ -942,25 +943,26 @@ void action_desktop_right(union ActionData *data) void action_send_to_desktop_right(union ActionData *data) { + ObClient *cl = data->sendto.c; guint r, c, d; - if (data->sendtodir.c) { - cur_row_col(&r, &c); + if (!cl || !client_normal(cl)) return; + + 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; - 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); - } + } + d = translate_row_col(r, c); + if (d < screen_num_desktops) { + client_set_desktop(cl, d, data->sendtodir.follow); + if (data->sendtodir.follow) screen_set_desktop(d); } } @@ -986,25 +988,26 @@ void action_desktop_left(union ActionData *data) void action_send_to_desktop_left(union ActionData *data) { + ObClient *cl = data->sendto.c; guint r, c, d; - if (data->sendtodir.c) { - cur_row_col(&r, &c); + if (!cl || !client_normal(cl)) return; + + 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; - 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); - } + } + d = translate_row_col(r, c); + if (d < screen_num_desktops) { + client_set_desktop(cl, d, data->sendtodir.follow); + if (data->sendtodir.follow) screen_set_desktop(d); } } @@ -1118,13 +1121,12 @@ void action_moveresize(union ActionData *data) void action_restart(union ActionData *data) { - ob_restart_path = g_strdup(data->execute.path); - ob_shutdown = ob_restart = TRUE; + ob_restart_other(data->execute.path); } void action_exit(union ActionData *data) { - ob_shutdown = TRUE; + ob_exit(); } void action_showmenu(union ActionData *data)