4 #include "moveresize.h"
16 typedef struct ActionString {
18 void (*func)(union ActionData *);
19 void (*setup)(ObAction *);
22 ObAction *action_new(void (*func)(union ActionData *data))
24 ObAction *a = g_new0(ObAction, 1);
30 void action_free(ObAction *a)
32 if (a == NULL) return;
34 /* deal with pointers */
35 if (a->func == action_execute || a->func == action_restart)
36 g_free(a->data.execute.path);
37 else if (a->func == action_showmenu)
38 g_free(a->data.showmenu.name);
43 void setup_action_directional_focus_north(ObAction *a)
45 a->data.diraction.direction = OB_DIRECTION_NORTH;
48 void setup_action_directional_focus_east(ObAction *a)
50 a->data.diraction.direction = OB_DIRECTION_EAST;
53 void setup_action_directional_focus_south(ObAction *a)
55 a->data.diraction.direction = OB_DIRECTION_SOUTH;
58 void setup_action_directional_focus_west(ObAction *a)
60 a->data.diraction.direction = OB_DIRECTION_WEST;
63 void setup_action_directional_focus_northeast(ObAction *a)
65 a->data.diraction.direction = OB_DIRECTION_NORTHEAST;
68 void setup_action_directional_focus_southeast(ObAction *a)
70 a->data.diraction.direction = OB_DIRECTION_SOUTHEAST;
73 void setup_action_directional_focus_southwest(ObAction *a)
75 a->data.diraction.direction = OB_DIRECTION_SOUTHWEST;
78 void setup_action_directional_focus_northwest(ObAction *a)
80 a->data.diraction.direction = OB_DIRECTION_NORTHWEST;
83 void setup_action_send_to_desktop(ObAction *a)
87 void setup_action_send_to_desktop_prev(ObAction *a)
89 a->data.sendtodir.dir = OB_DIRECTION_WEST;
90 a->data.sendtodir.linear = TRUE;
91 a->data.sendtodir.wrap = TRUE;
94 void setup_action_send_to_desktop_next(ObAction *a)
96 a->data.sendtodir.dir = OB_DIRECTION_EAST;
97 a->data.sendtodir.linear = TRUE;
98 a->data.sendtodir.wrap = TRUE;
101 void setup_action_send_to_desktop_left(ObAction *a)
103 a->data.sendtodir.dir = OB_DIRECTION_WEST;
104 a->data.sendtodir.linear = FALSE;
105 a->data.sendtodir.wrap = TRUE;
108 void setup_action_send_to_desktop_right(ObAction *a)
110 a->data.sendtodir.dir = OB_DIRECTION_EAST;
111 a->data.sendtodir.linear = FALSE;
112 a->data.sendtodir.wrap = TRUE;
115 void setup_action_send_to_desktop_up(ObAction *a)
117 a->data.sendtodir.dir = OB_DIRECTION_NORTH;
118 a->data.sendtodir.linear = FALSE;
119 a->data.sendtodir.wrap = TRUE;
122 void setup_action_send_to_desktop_down(ObAction *a)
124 a->data.sendtodir.dir = OB_DIRECTION_SOUTH;
125 a->data.sendtodir.linear = FALSE;
126 a->data.sendtodir.wrap = TRUE;
129 void setup_action_desktop_prev(ObAction *a)
131 a->data.desktopdir.dir = OB_DIRECTION_WEST;
132 a->data.desktopdir.linear = TRUE;
133 a->data.desktopdir.wrap = TRUE;
136 void setup_action_desktop_next(ObAction *a)
138 a->data.desktopdir.dir = OB_DIRECTION_EAST;
139 a->data.desktopdir.linear = TRUE;
140 a->data.desktopdir.wrap = TRUE;
143 void setup_action_desktop_left(ObAction *a)
145 a->data.desktopdir.dir = OB_DIRECTION_WEST;
146 a->data.desktopdir.linear = FALSE;
147 a->data.desktopdir.wrap = TRUE;
150 void setup_action_desktop_right(ObAction *a)
152 a->data.desktopdir.dir = OB_DIRECTION_EAST;
153 a->data.desktopdir.linear = FALSE;
154 a->data.desktopdir.wrap = TRUE;
157 void setup_action_desktop_up(ObAction *a)
159 a->data.desktopdir.dir = OB_DIRECTION_NORTH;
160 a->data.desktopdir.linear = FALSE;
161 a->data.desktopdir.wrap = TRUE;
164 void setup_action_desktop_down(ObAction *a)
166 a->data.desktopdir.dir = OB_DIRECTION_SOUTH;
167 a->data.desktopdir.linear = FALSE;
168 a->data.desktopdir.wrap = TRUE;
171 void setup_action_move_keyboard(ObAction *a)
173 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move_keyboard;
176 void setup_action_move(ObAction *a)
178 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move;
181 void setup_action_resize(ObAction *a)
183 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_topleft;
186 void setup_action_resize_keyboard(ObAction *a)
188 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_keyboard;
191 void setup_action_cycle_windows_linear_next(ObAction *a)
193 a->data.cycle.linear = TRUE;
194 a->data.cycle.forward = TRUE;
197 void setup_action_cycle_windows_linear_previous(ObAction *a)
199 a->data.cycle.linear = TRUE;
200 a->data.cycle.forward = FALSE;
203 void setup_action_cycle_windows_next(ObAction *a)
205 a->data.cycle.linear = FALSE;
206 a->data.cycle.forward = TRUE;
209 void setup_action_cycle_windows_previous(ObAction *a)
211 a->data.cycle.linear = FALSE;
212 a->data.cycle.forward = FALSE;
215 void setup_action_movetoedge_north(ObAction *a)
217 a->data.diraction.direction = OB_DIRECTION_NORTH;
220 void setup_action_movetoedge_south(ObAction *a)
222 a->data.diraction.direction = OB_DIRECTION_SOUTH;
225 void setup_action_movetoedge_east(ObAction *a)
227 a->data.diraction.direction = OB_DIRECTION_EAST;
230 void setup_action_movetoedge_west(ObAction *a)
232 a->data.diraction.direction = OB_DIRECTION_WEST;
235 void setup_action_growtoedge_north(ObAction *a)
237 a->data.diraction.direction = OB_DIRECTION_NORTH;
240 void setup_action_growtoedge_south(ObAction *a)
242 a->data.diraction.direction = OB_DIRECTION_SOUTH;
245 void setup_action_growtoedge_east(ObAction *a)
247 a->data.diraction.direction = OB_DIRECTION_EAST;
250 void setup_action_growtoedge_west(ObAction *a)
252 a->data.diraction.direction = OB_DIRECTION_WEST;
255 void setup_action_top_layer(ObAction *a)
257 a->data.layer.layer = 1;
260 void setup_action_normal_layer(ObAction *a)
262 a->data.layer.layer = 0;
265 void setup_action_bottom_layer(ObAction *a)
267 a->data.layer.layer = -1;
270 ActionString actionstrings[] =
278 "directionalfocusnorth",
279 action_directional_focus,
280 setup_action_directional_focus_north
283 "directionalfocuseast",
284 action_directional_focus,
285 setup_action_directional_focus_east
288 "directionalfocussouth",
289 action_directional_focus,
290 setup_action_directional_focus_south
293 "directionalfocuswest",
294 action_directional_focus,
295 setup_action_directional_focus_west
298 "directionalfocusnortheast",
299 action_directional_focus,
300 setup_action_directional_focus_northeast
303 "directionalfocussoutheast",
304 action_directional_focus,
305 setup_action_directional_focus_southeast
308 "directionalfocussouthwest",
309 action_directional_focus,
310 setup_action_directional_focus_southwest
313 "directionalfocusnorthwest",
314 action_directional_focus,
315 setup_action_directional_focus_northwest
379 action_toggle_omnipresent,
384 action_move_relative_horz,
389 action_move_relative_vert,
393 "resizerelativehorz",
394 action_resize_relative_horz,
398 "resizerelativevert",
399 action_resize_relative_vert,
404 action_maximize_full,
409 action_unmaximize_full,
413 "togglemaximizefull",
414 action_toggle_maximize_full,
419 action_maximize_horz,
424 action_unmaximize_horz,
428 "togglemaximizehorz",
429 action_toggle_maximize_horz,
434 action_maximize_vert,
439 action_unmaximize_vert,
443 "togglemaximizevert",
444 action_toggle_maximize_vert,
449 action_send_to_desktop,
450 setup_action_send_to_desktop
454 action_send_to_desktop_dir,
455 setup_action_send_to_desktop_next
458 "sendtodesktopprevious",
459 action_send_to_desktop_dir,
460 setup_action_send_to_desktop_prev
463 "sendtodesktopright",
464 action_send_to_desktop_dir,
465 setup_action_send_to_desktop_right
469 action_send_to_desktop_dir,
470 setup_action_send_to_desktop_left
474 action_send_to_desktop_dir,
475 setup_action_send_to_desktop_up
479 action_send_to_desktop_dir,
480 setup_action_send_to_desktop_down
490 setup_action_desktop_next
495 setup_action_desktop_prev
500 setup_action_desktop_right
505 setup_action_desktop_left
510 setup_action_desktop_up
515 setup_action_desktop_down
519 action_toggle_decorations,
525 setup_action_move_keyboard
540 setup_action_resize_keyboard
544 action_toggle_show_desktop,
554 action_unshow_desktop,
574 action_send_to_layer,
575 setup_action_top_layer
580 setup_action_top_layer
584 action_send_to_layer,
585 setup_action_normal_layer
589 action_send_to_layer,
590 setup_action_bottom_layer
593 "togglealwaysonbottom",
595 setup_action_bottom_layer
599 action_cycle_windows,
600 setup_action_cycle_windows_linear_next
603 "previouswindowlinear",
604 action_cycle_windows,
605 setup_action_cycle_windows_linear_previous
609 action_cycle_windows,
610 setup_action_cycle_windows_next
614 action_cycle_windows,
615 setup_action_cycle_windows_previous
620 setup_action_movetoedge_north
625 setup_action_movetoedge_south
630 setup_action_movetoedge_west
635 setup_action_movetoedge_east
640 setup_action_growtoedge_north
645 setup_action_growtoedge_south
650 setup_action_growtoedge_west
655 setup_action_growtoedge_east
664 ObAction *action_from_string(char *name)
669 for (i = 0; actionstrings[i].name; i++)
670 if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
671 a = action_new(actionstrings[i].func);
672 if (actionstrings[i].setup)
673 actionstrings[i].setup(a);
679 ObAction *action_parse(xmlDocPtr doc, xmlNodePtr node)
682 ObAction *act = NULL;
685 if (parse_attr_string("name", node, &actname)) {
686 if ((act = action_from_string(actname))) {
687 if (act->func == action_execute || act->func == action_restart) {
688 if ((n = parse_find_node("execute", node->xmlChildrenNode)))
689 act->data.execute.path = parse_string(doc, n);
690 } else if (act->func == action_showmenu) {
691 if ((n = parse_find_node("menu", node->xmlChildrenNode)))
692 act->data.showmenu.name = parse_string(doc, n);
693 } else if (act->func == action_desktop) {
694 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
695 act->data.desktop.desk = parse_int(doc, n);
696 if (act->data.desktop.desk > 0) act->data.desktop.desk--;
697 } else if (act->func == action_send_to_desktop) {
698 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
699 act->data.sendto.desk = parse_int(doc, n);
700 if (act->data.sendto.desk > 0) act->data.sendto.desk--;
701 } else if (act->func == action_move_relative_horz ||
702 act->func == action_move_relative_vert ||
703 act->func == action_resize_relative_horz ||
704 act->func == action_resize_relative_vert) {
705 if ((n = parse_find_node("delta", node->xmlChildrenNode)))
706 act->data.relative.delta = parse_int(doc, n);
707 } else if (act->func == action_desktop_dir) {
708 if ((n = parse_find_node("wrap", node->xmlChildrenNode))) {
709 act->data.desktopdir.wrap = parse_bool(doc, n);
711 } else if (act->func == action_send_to_desktop_dir) {
712 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
713 act->data.sendtodir.wrap = parse_bool(doc, n);
721 void action_execute(union ActionData *data)
725 if (data->execute.path) {
726 cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
728 if (!g_spawn_command_line_async(cmd, &e)) {
729 g_warning("failed to execute '%s': %s",
733 g_warning("failed to convert '%s' from utf8", data->execute.path);
738 void action_focus(union ActionData *data)
741 client_focus(data->client.c);
744 void action_unfocus (union ActionData *data)
747 client_unfocus(data->client.c);
750 void action_iconify(union ActionData *data)
753 client_iconify(data->client.c, TRUE, TRUE);
756 void action_raise(union ActionData *data)
759 stacking_raise(CLIENT_AS_WINDOW(data->client.c));
762 void action_unshaderaise(union ActionData *data)
764 if (data->client.c) {
765 if (data->client.c->shaded)
766 client_shade(data->client.c, FALSE);
768 stacking_raise(CLIENT_AS_WINDOW(data->client.c));
772 void action_shadelower(union ActionData *data)
774 if (data->client.c) {
775 if (data->client.c->shaded)
776 stacking_lower(CLIENT_AS_WINDOW(data->client.c));
778 client_shade(data->client.c, TRUE);
782 void action_lower(union ActionData *data)
785 stacking_lower(CLIENT_AS_WINDOW(data->client.c));
788 void action_close(union ActionData *data)
791 client_close(data->client.c);
794 void action_kill(union ActionData *data)
797 client_kill(data->client.c);
800 void action_shade(union ActionData *data)
803 client_shade(data->client.c, TRUE);
806 void action_unshade(union ActionData *data)
809 client_shade(data->client.c, FALSE);
812 void action_toggle_shade(union ActionData *data)
815 client_shade(data->client.c, !data->client.c->shaded);
818 void action_toggle_omnipresent(union ActionData *data)
821 client_set_desktop(data->client.c,
822 data->client.c->desktop == DESKTOP_ALL ?
823 screen_desktop : DESKTOP_ALL, FALSE);
826 void action_move_relative_horz(union ActionData *data)
828 ObClient *c = data->relative.c;
830 client_configure(c, OB_CORNER_TOPLEFT,
831 c->area.x + data->relative.delta, c->area.y,
832 c->area.width, c->area.height, TRUE, TRUE);
835 void action_move_relative_vert(union ActionData *data)
837 ObClient *c = data->relative.c;
839 client_configure(c, OB_CORNER_TOPLEFT,
840 c->area.x, c->area.y + data->relative.delta,
841 c->area.width, c->area.height, TRUE, TRUE);
844 void action_resize_relative_horz(union ActionData *data)
846 ObClient *c = data->relative.c;
848 client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
850 data->relative.delta * c->size_inc.width,
851 c->area.height, TRUE, TRUE);
854 void action_resize_relative_vert(union ActionData *data)
856 ObClient *c = data->relative.c;
858 client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
859 c->area.width, c->area.height +
860 data->relative.delta * c->size_inc.height,
864 void action_maximize_full(union ActionData *data)
867 client_maximize(data->client.c, TRUE, 0, TRUE);
870 void action_unmaximize_full(union ActionData *data)
873 client_maximize(data->client.c, FALSE, 0, TRUE);
876 void action_toggle_maximize_full(union ActionData *data)
879 client_maximize(data->client.c,
880 !(data->client.c->max_horz ||
881 data->client.c->max_vert),
885 void action_maximize_horz(union ActionData *data)
888 client_maximize(data->client.c, TRUE, 1, TRUE);
891 void action_unmaximize_horz(union ActionData *data)
894 client_maximize(data->client.c, FALSE, 1, TRUE);
897 void action_toggle_maximize_horz(union ActionData *data)
900 client_maximize(data->client.c, !data->client.c->max_horz, 1, TRUE);
903 void action_maximize_vert(union ActionData *data)
906 client_maximize(data->client.c, TRUE, 2, TRUE);
909 void action_unmaximize_vert(union ActionData *data)
912 client_maximize(data->client.c, FALSE, 2, TRUE);
915 void action_toggle_maximize_vert(union ActionData *data)
918 client_maximize(data->client.c, !data->client.c->max_vert, 2, TRUE);
921 void action_send_to_desktop(union ActionData *data)
923 ObClient *c = data->sendto.c;
925 if (!c || !client_normal(c)) return;
927 if (data->sendto.desk < screen_num_desktops ||
928 data->sendto.desk == DESKTOP_ALL) {
929 client_set_desktop(c, data->sendto.desk, TRUE);
930 screen_set_desktop(data->sendto.desk);
934 void action_desktop(union ActionData *data)
936 if (data->desktop.desk < screen_num_desktops ||
937 data->desktop.desk == DESKTOP_ALL)
938 screen_set_desktop(data->desktop.desk);
941 void action_desktop_dir(union ActionData *data)
945 d = screen_cycle_desktop(data->desktopdir.dir, data->desktopdir.wrap,
946 data->sendtodir.linear,
947 data->desktopdir.final, data->desktopdir.cancel);
948 screen_set_desktop(d);
951 void action_send_to_desktop_dir(union ActionData *data)
953 ObClient *c = data->sendtodir.c;
956 if (!c || !client_normal(c)) return;
958 d = screen_cycle_desktop(data->sendtodir.dir, data->sendtodir.wrap,
959 data->sendtodir.linear,
960 data->sendtodir.final, data->sendtodir.cancel);
961 client_set_desktop(c, d, TRUE);
962 screen_set_desktop(d);
966 void action_desktop_right(union ActionData *data)
972 if (c >= screen_desktop_layout.columns) {
973 if (!data->desktopdir.wrap) return;
976 d = translate_row_col(r, c);
977 if (d >= screen_num_desktops) {
978 if (!data->desktopdir.wrap) return;
981 d = translate_row_col(r, c);
982 if (d < screen_num_desktops)
983 screen_cycle_desktop(d, data->desktopdir.final,
984 data->desktopdir.cancel);
987 void action_send_to_desktop_right(union ActionData *data)
989 ObClient *cl = data->sendto.c;
992 if (!cl || !client_normal(cl)) return;
996 if (c >= screen_desktop_layout.columns) {
997 if (!data->sendtodir.wrap) return;
1000 d = translate_row_col(r, c);
1001 if (d >= screen_num_desktops) {
1002 if (!data->sendtodir.wrap) return;
1005 d = translate_row_col(r, c);
1006 if (d < screen_num_desktops) {
1007 client_set_desktop(cl, d, data->sendtodir.follow);
1008 if (data->sendtodir.follow)
1009 screen_cycle_desktop(d, data->desktopdir.final,
1010 data->desktopdir.cancel);
1014 void action_desktop_left(union ActionData *data)
1018 cur_row_col(&r, &c);
1020 if (c >= screen_desktop_layout.columns) {
1021 if (!data->desktopdir.wrap) return;
1022 c = screen_desktop_layout.columns - 1;
1024 d = translate_row_col(r, c);
1025 if (d >= screen_num_desktops) {
1026 if (!data->desktopdir.wrap) return;
1029 d = translate_row_col(r, c);
1030 if (d < screen_num_desktops)
1031 screen_cycle_desktop(d, data->desktopdir.final,
1032 data->desktopdir.cancel);
1035 void action_send_to_desktop_left(union ActionData *data)
1037 ObClient *cl = data->sendto.c;
1040 if (!cl || !client_normal(cl)) return;
1042 cur_row_col(&r, &c);
1044 if (c >= screen_desktop_layout.columns) {
1045 if (!data->sendtodir.wrap) return;
1046 c = screen_desktop_layout.columns - 1;
1048 d = translate_row_col(r, c);
1049 if (d >= screen_num_desktops) {
1050 if (!data->sendtodir.wrap) return;
1053 d = translate_row_col(r, c);
1054 if (d < screen_num_desktops) {
1055 client_set_desktop(cl, d, data->sendtodir.follow);
1056 if (data->sendtodir.follow)
1057 screen_cycle_desktop(d, data->desktopdir.final,
1058 data->desktopdir.cancel);
1062 void action_desktop_down(union ActionData *data)
1066 cur_row_col(&r, &c);
1068 if (r >= screen_desktop_layout.rows) {
1069 if (!data->desktopdir.wrap) return;
1072 d = translate_row_col(r, c);
1073 if (d >= screen_num_desktops) {
1074 if (!data->desktopdir.wrap) return;
1077 d = translate_row_col(r, c);
1078 if (d < screen_num_desktops)
1079 screen_cycle_desktop(d, data->desktopdir.final,
1080 data->desktopdir.cancel);
1083 void action_send_to_desktop_down(union ActionData *data)
1087 if (data->sendtodir.c) {
1088 cur_row_col(&r, &c);
1090 if (r >= screen_desktop_layout.rows) {
1091 if (!data->sendtodir.wrap) return;
1094 d = translate_row_col(r, c);
1095 if (d >= screen_num_desktops) {
1096 if (!data->sendtodir.wrap) return;
1099 d = translate_row_col(r, c);
1100 if (d < screen_num_desktops) {
1101 client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
1102 if (data->sendtodir.follow)
1103 screen_cycle_desktop(d, data->desktopdir.final,
1104 data->desktopdir.cancel);
1109 void action_desktop_up(union ActionData *data)
1113 cur_row_col(&r, &c);
1115 if (r >= screen_desktop_layout.rows) {
1116 if (!data->desktopdir.wrap) return;
1117 r = screen_desktop_layout.rows - 1;
1119 d = translate_row_col(r, c);
1120 if (d >= screen_num_desktops) {
1121 if (!data->desktopdir.wrap) return;
1124 d = translate_row_col(r, c);
1125 if (d < screen_num_desktops)
1126 screen_cycle_desktop(d, data->desktopdir.final,
1127 data->desktopdir.cancel);
1130 void action_send_to_desktop_up(union ActionData *data)
1134 if (data->sendtodir.c) {
1135 cur_row_col(&r, &c);
1137 if (r >= screen_desktop_layout.rows) {
1138 if (!data->sendtodir.wrap) return;
1139 r = screen_desktop_layout.rows - 1;
1141 d = translate_row_col(r, c);
1142 if (d >= screen_num_desktops) {
1143 if (!data->sendtodir.wrap) return;
1146 d = translate_row_col(r, c);
1147 if (d < screen_num_desktops) {
1148 client_set_desktop(data->sendtodir.c, d, data->sendtodir.follow);
1149 if (data->sendtodir.follow)
1150 screen_cycle_desktop(d, data->desktopdir.final,
1151 data->desktopdir.cancel);
1157 void action_toggle_decorations(union ActionData *data)
1159 ObClient *c = data->client.c;;
1163 c->decorate = !c->decorate;
1164 client_setup_decor_and_functions(c);
1167 void action_moveresize(union ActionData *data)
1169 ObClient *c = data->moveresize.c;
1171 if (!c || !client_normal(c)) return;
1173 moveresize_start(c, data->moveresize.x, data->moveresize.y,
1174 data->moveresize.button, data->moveresize.corner);
1177 void action_restart(union ActionData *data)
1179 ob_restart_other(data->execute.path);
1182 void action_exit(union ActionData *data)
1187 void action_showmenu(union ActionData *data)
1189 if (data->showmenu.name) {
1190 menu_show(data->showmenu.name, data->showmenu.x, data->showmenu.y,
1195 void action_cycle_windows(union ActionData *data)
1199 c = focus_cycle(data->cycle.forward, data->cycle.linear, data->cycle.final,
1200 data->cycle.cancel);
1203 void action_directional_focus(union ActionData *data)
1207 if (!data->diraction.c)
1209 if ((nf = client_find_directional(data->diraction.c,
1210 data->diraction.direction)))
1211 client_activate(nf);
1214 void action_movetoedge(union ActionData *data)
1217 ObClient *c = data->diraction.c;
1221 x = c->frame->area.x;
1222 y = c->frame->area.y;
1224 switch(data->diraction.direction) {
1225 case OB_DIRECTION_NORTH:
1226 y = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1228 case OB_DIRECTION_WEST:
1229 x = client_directional_edge_search(c, OB_DIRECTION_WEST);
1231 case OB_DIRECTION_SOUTH:
1232 y = client_directional_edge_search(c, OB_DIRECTION_SOUTH) -
1233 c->frame->area.height;
1235 case OB_DIRECTION_EAST:
1236 x = client_directional_edge_search(c, OB_DIRECTION_EAST) -
1237 c->frame->area.width;
1240 g_assert_not_reached();
1242 frame_frame_gravity(c->frame, &x, &y);
1243 client_configure(c, OB_CORNER_TOPLEFT,
1244 x, y, c->area.width, c->area.height, TRUE, TRUE);
1248 void action_growtoedge(union ActionData *data)
1250 int x, y, width, height, dest;
1251 ObClient *c = data->diraction.c;
1252 Rect *a = screen_area(c->desktop);
1257 x = c->frame->area.x;
1258 y = c->frame->area.y;
1259 width = c->frame->area.width;
1260 height = c->frame->area.height;
1262 switch(data->diraction.direction) {
1263 case OB_DIRECTION_NORTH:
1264 dest = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1266 height = c->frame->area.height / 2;
1268 height = c->frame->area.y + c->frame->area.height - dest;
1272 case OB_DIRECTION_WEST:
1273 dest = client_directional_edge_search(c, OB_DIRECTION_WEST);
1275 width = c->frame->area.width / 2;
1277 width = c->frame->area.x + c->frame->area.width - dest;
1281 case OB_DIRECTION_SOUTH:
1282 dest = client_directional_edge_search(c, OB_DIRECTION_SOUTH);
1283 if (a->y + a->height == y + c->frame->area.height) {
1284 height = c->frame->area.height / 2;
1285 y = a->y + a->height - height;
1287 height = dest - c->frame->area.y;
1288 y += (height - c->frame->area.height) % c->size_inc.height;
1289 height -= (height - c->frame->area.height) % c->size_inc.height;
1291 case OB_DIRECTION_EAST:
1292 dest = client_directional_edge_search(c, OB_DIRECTION_EAST);
1293 if (a->x + a->width == x + c->frame->area.width) {
1294 width = c->frame->area.width / 2;
1295 x = a->x + a->width - width;
1297 width = dest - c->frame->area.x;
1298 x += (width - c->frame->area.width) % c->size_inc.width;
1299 width -= (width - c->frame->area.width) % c->size_inc.width;
1302 g_assert_not_reached();
1304 frame_frame_gravity(c->frame, &x, &y);
1305 width -= c->frame->size.left + c->frame->size.right;
1306 height -= c->frame->size.top + c->frame->size.bottom;
1307 client_configure(c, OB_CORNER_TOPLEFT, x, y, width, height, TRUE, TRUE);
1310 void action_send_to_layer(union ActionData *data)
1313 client_set_layer(data->layer.c, data->layer.layer);
1316 void action_toggle_layer(union ActionData *data)
1318 ObClient *c = data->layer.c;
1321 if (data->layer.layer < 0)
1322 client_set_layer(c, c->below ? 0 : -1);
1323 else if (data->layer.layer > 0)
1324 client_set_layer(c, c->above ? 0 : 1);
1328 void action_toggle_show_desktop(union ActionData *data)
1330 screen_show_desktop(!screen_showing_desktop);
1333 void action_show_desktop(union ActionData *data)
1335 screen_show_desktop(TRUE);
1338 void action_unshow_desktop(union ActionData *data)
1340 screen_show_desktop(FALSE);