X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Faction.c;h=d59c55143a6e85435ca455c3861cee56d9489150;hb=62f1473c651a564391e53548e0cb7daa5303776d;hp=cb3233252a4232f86a13934a800583ffe16dbbf3;hpb=2477a38d2f3063b697e44bf3690cf280fb26ca8a;p=chaz%2Fopenbox diff --git a/openbox/action.c b/openbox/action.c index cb323325..d59c5514 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1,3 +1,4 @@ +#include "debug.h" #include "client.h" #include "focus.h" #include "moveresize.h" @@ -576,7 +577,6 @@ Action *action_parse(xmlDocPtr doc, xmlNodePtr node) act->func == action_desktop_up || act->func == action_desktop_down) { if ((n = parse_find_node("wrap", node->xmlChildrenNode))) { - g_message("WRAP %d", parse_bool(doc, n)); act->data.desktopdir.wrap = parse_bool(doc, n); } } else if (act->func == action_send_to_desktop_right || @@ -589,6 +589,7 @@ Action *action_parse(xmlDocPtr doc, xmlNodePtr node) act->data.sendtodir.follow = parse_bool(doc, n); } } + g_free(actname); } return act; } @@ -795,13 +796,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 +944,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 +989,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); } } @@ -1102,7 +1106,7 @@ void action_toggle_decorations(union ActionData *data) if (!c) return; - c->disabled_decorations = c->disabled_decorations ? 0 : ~0; + c->decorate = !c->decorate; client_setup_decor_and_functions(c); } @@ -1118,13 +1122,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)