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.interdiraction.inter.any.interactive = TRUE;
46 a->data.interdiraction.direction = OB_DIRECTION_NORTH;
49 void setup_action_directional_focus_east(ObAction *a)
51 a->data.interdiraction.inter.any.interactive = TRUE;
52 a->data.interdiraction.direction = OB_DIRECTION_EAST;
55 void setup_action_directional_focus_south(ObAction *a)
57 a->data.interdiraction.inter.any.interactive = TRUE;
58 a->data.interdiraction.direction = OB_DIRECTION_SOUTH;
61 void setup_action_directional_focus_west(ObAction *a)
63 a->data.interdiraction.inter.any.interactive = TRUE;
64 a->data.interdiraction.direction = OB_DIRECTION_WEST;
67 void setup_action_directional_focus_northeast(ObAction *a)
69 a->data.interdiraction.inter.any.interactive = TRUE;
70 a->data.interdiraction.direction = OB_DIRECTION_NORTHEAST;
73 void setup_action_directional_focus_southeast(ObAction *a)
75 a->data.interdiraction.inter.any.interactive = TRUE;
76 a->data.interdiraction.direction = OB_DIRECTION_SOUTHEAST;
79 void setup_action_directional_focus_southwest(ObAction *a)
81 a->data.interdiraction.inter.any.interactive = TRUE;
82 a->data.interdiraction.direction = OB_DIRECTION_SOUTHWEST;
85 void setup_action_directional_focus_northwest(ObAction *a)
87 a->data.interdiraction.inter.any.interactive = TRUE;
88 a->data.interdiraction.direction = OB_DIRECTION_NORTHWEST;
91 void setup_action_send_to_desktop(ObAction *a)
93 a->data.sendto.follow = TRUE;
96 void setup_action_send_to_desktop_prev(ObAction *a)
98 a->data.sendtodir.inter.any.interactive = TRUE;
99 a->data.sendtodir.dir = OB_DIRECTION_WEST;
100 a->data.sendtodir.linear = TRUE;
101 a->data.sendtodir.wrap = TRUE;
102 a->data.sendtodir.follow = TRUE;
105 void setup_action_send_to_desktop_next(ObAction *a)
107 a->data.sendtodir.inter.any.interactive = TRUE;
108 a->data.sendtodir.dir = OB_DIRECTION_EAST;
109 a->data.sendtodir.linear = TRUE;
110 a->data.sendtodir.wrap = TRUE;
111 a->data.sendtodir.follow = TRUE;
114 void setup_action_send_to_desktop_left(ObAction *a)
116 a->data.sendtodir.inter.any.interactive = TRUE;
117 a->data.sendtodir.dir = OB_DIRECTION_WEST;
118 a->data.sendtodir.linear = FALSE;
119 a->data.sendtodir.wrap = TRUE;
120 a->data.sendtodir.follow = TRUE;
123 void setup_action_send_to_desktop_right(ObAction *a)
125 a->data.sendtodir.inter.any.interactive = TRUE;
126 a->data.sendtodir.dir = OB_DIRECTION_EAST;
127 a->data.sendtodir.linear = FALSE;
128 a->data.sendtodir.wrap = TRUE;
129 a->data.sendtodir.follow = TRUE;
132 void setup_action_send_to_desktop_up(ObAction *a)
134 a->data.sendtodir.inter.any.interactive = TRUE;
135 a->data.sendtodir.dir = OB_DIRECTION_NORTH;
136 a->data.sendtodir.linear = FALSE;
137 a->data.sendtodir.wrap = TRUE;
138 a->data.sendtodir.follow = TRUE;
141 void setup_action_send_to_desktop_down(ObAction *a)
143 a->data.sendtodir.inter.any.interactive = TRUE;
144 a->data.sendtodir.dir = OB_DIRECTION_SOUTH;
145 a->data.sendtodir.linear = FALSE;
146 a->data.sendtodir.wrap = TRUE;
147 a->data.sendtodir.follow = TRUE;
150 void setup_action_desktop_prev(ObAction *a)
152 a->data.desktopdir.inter.any.interactive = TRUE;
153 a->data.desktopdir.dir = OB_DIRECTION_WEST;
154 a->data.desktopdir.linear = TRUE;
155 a->data.desktopdir.wrap = TRUE;
158 void setup_action_desktop_next(ObAction *a)
160 a->data.desktopdir.inter.any.interactive = TRUE;
161 a->data.desktopdir.dir = OB_DIRECTION_EAST;
162 a->data.desktopdir.linear = TRUE;
163 a->data.desktopdir.wrap = TRUE;
166 void setup_action_desktop_left(ObAction *a)
168 a->data.desktopdir.inter.any.interactive = TRUE;
169 a->data.desktopdir.dir = OB_DIRECTION_WEST;
170 a->data.desktopdir.linear = FALSE;
171 a->data.desktopdir.wrap = TRUE;
174 void setup_action_desktop_right(ObAction *a)
176 a->data.desktopdir.inter.any.interactive = TRUE;
177 a->data.desktopdir.dir = OB_DIRECTION_EAST;
178 a->data.desktopdir.linear = FALSE;
179 a->data.desktopdir.wrap = TRUE;
182 void setup_action_desktop_up(ObAction *a)
184 a->data.desktopdir.inter.any.interactive = TRUE;
185 a->data.desktopdir.dir = OB_DIRECTION_NORTH;
186 a->data.desktopdir.linear = FALSE;
187 a->data.desktopdir.wrap = TRUE;
190 void setup_action_desktop_down(ObAction *a)
192 a->data.desktopdir.inter.any.interactive = TRUE;
193 a->data.desktopdir.dir = OB_DIRECTION_SOUTH;
194 a->data.desktopdir.linear = FALSE;
195 a->data.desktopdir.wrap = TRUE;
198 void setup_action_move_keyboard(ObAction *a)
200 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move_keyboard;
203 void setup_action_move(ObAction *a)
205 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move;
208 void setup_action_resize(ObAction *a)
210 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_topleft;
213 void setup_action_resize_keyboard(ObAction *a)
215 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_keyboard;
218 void setup_action_cycle_windows_linear_next(ObAction *a)
220 a->data.cycle.inter.any.interactive = TRUE;
221 a->data.cycle.linear = TRUE;
222 a->data.cycle.forward = TRUE;
225 void setup_action_cycle_windows_linear_previous(ObAction *a)
227 a->data.cycle.inter.any.interactive = TRUE;
228 a->data.cycle.linear = TRUE;
229 a->data.cycle.forward = FALSE;
232 void setup_action_cycle_windows_next(ObAction *a)
234 a->data.cycle.inter.any.interactive = TRUE;
235 a->data.cycle.linear = FALSE;
236 a->data.cycle.forward = TRUE;
239 void setup_action_cycle_windows_previous(ObAction *a)
241 a->data.cycle.inter.any.interactive = TRUE;
242 a->data.cycle.linear = FALSE;
243 a->data.cycle.forward = FALSE;
246 void setup_action_movetoedge_north(ObAction *a)
248 a->data.diraction.direction = OB_DIRECTION_NORTH;
251 void setup_action_movetoedge_south(ObAction *a)
253 a->data.diraction.direction = OB_DIRECTION_SOUTH;
256 void setup_action_movetoedge_east(ObAction *a)
258 a->data.diraction.direction = OB_DIRECTION_EAST;
261 void setup_action_movetoedge_west(ObAction *a)
263 a->data.diraction.direction = OB_DIRECTION_WEST;
266 void setup_action_growtoedge_north(ObAction *a)
268 a->data.diraction.direction = OB_DIRECTION_NORTH;
271 void setup_action_growtoedge_south(ObAction *a)
273 a->data.diraction.direction = OB_DIRECTION_SOUTH;
276 void setup_action_growtoedge_east(ObAction *a)
278 a->data.diraction.direction = OB_DIRECTION_EAST;
281 void setup_action_growtoedge_west(ObAction *a)
283 a->data.diraction.direction = OB_DIRECTION_WEST;
286 void setup_action_top_layer(ObAction *a)
288 a->data.layer.layer = 1;
291 void setup_action_normal_layer(ObAction *a)
293 a->data.layer.layer = 0;
296 void setup_action_bottom_layer(ObAction *a)
298 a->data.layer.layer = -1;
301 ActionString actionstrings[] =
309 "directionalfocusnorth",
310 action_directional_focus,
311 setup_action_directional_focus_north
314 "directionalfocuseast",
315 action_directional_focus,
316 setup_action_directional_focus_east
319 "directionalfocussouth",
320 action_directional_focus,
321 setup_action_directional_focus_south
324 "directionalfocuswest",
325 action_directional_focus,
326 setup_action_directional_focus_west
329 "directionalfocusnortheast",
330 action_directional_focus,
331 setup_action_directional_focus_northeast
334 "directionalfocussoutheast",
335 action_directional_focus,
336 setup_action_directional_focus_southeast
339 "directionalfocussouthwest",
340 action_directional_focus,
341 setup_action_directional_focus_southwest
344 "directionalfocusnorthwest",
345 action_directional_focus,
346 setup_action_directional_focus_northwest
420 action_toggle_omnipresent,
425 action_move_relative_horz,
430 action_move_relative_vert,
434 "resizerelativehorz",
435 action_resize_relative_horz,
439 "resizerelativevert",
440 action_resize_relative_vert,
445 action_maximize_full,
450 action_unmaximize_full,
454 "togglemaximizefull",
455 action_toggle_maximize_full,
460 action_maximize_horz,
465 action_unmaximize_horz,
469 "togglemaximizehorz",
470 action_toggle_maximize_horz,
475 action_maximize_vert,
480 action_unmaximize_vert,
484 "togglemaximizevert",
485 action_toggle_maximize_vert,
490 action_send_to_desktop,
491 setup_action_send_to_desktop
495 action_send_to_desktop_dir,
496 setup_action_send_to_desktop_next
499 "sendtodesktopprevious",
500 action_send_to_desktop_dir,
501 setup_action_send_to_desktop_prev
504 "sendtodesktopright",
505 action_send_to_desktop_dir,
506 setup_action_send_to_desktop_right
510 action_send_to_desktop_dir,
511 setup_action_send_to_desktop_left
515 action_send_to_desktop_dir,
516 setup_action_send_to_desktop_up
520 action_send_to_desktop_dir,
521 setup_action_send_to_desktop_down
531 setup_action_desktop_next
536 setup_action_desktop_prev
541 setup_action_desktop_right
546 setup_action_desktop_left
551 setup_action_desktop_up
556 setup_action_desktop_down
560 action_toggle_decorations,
566 setup_action_move_keyboard
581 setup_action_resize_keyboard
585 action_toggle_show_desktop,
595 action_unshow_desktop,
620 action_send_to_layer,
621 setup_action_top_layer
626 setup_action_top_layer
630 action_send_to_layer,
631 setup_action_normal_layer
635 action_send_to_layer,
636 setup_action_bottom_layer
639 "togglealwaysonbottom",
641 setup_action_bottom_layer
645 action_cycle_windows,
646 setup_action_cycle_windows_linear_next
649 "previouswindowlinear",
650 action_cycle_windows,
651 setup_action_cycle_windows_linear_previous
655 action_cycle_windows,
656 setup_action_cycle_windows_next
660 action_cycle_windows,
661 setup_action_cycle_windows_previous
666 setup_action_movetoedge_north
671 setup_action_movetoedge_south
676 setup_action_movetoedge_west
681 setup_action_movetoedge_east
686 setup_action_growtoedge_north
691 setup_action_growtoedge_south
696 setup_action_growtoedge_west
701 setup_action_growtoedge_east
710 ObAction *action_from_string(char *name)
715 for (i = 0; actionstrings[i].name; i++)
716 if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
717 a = action_new(actionstrings[i].func);
718 if (actionstrings[i].setup)
719 actionstrings[i].setup(a);
723 g_warning("Invalid action '%s' requested. No such action exists.",
728 ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
731 ObAction *act = NULL;
734 if (parse_attr_string("name", node, &actname)) {
735 if ((act = action_from_string(actname))) {
736 if (act->func == action_execute || act->func == action_restart) {
737 if ((n = parse_find_node("execute", node->xmlChildrenNode))) {
738 gchar *s = parse_string(doc, n);
739 act->data.execute.path = ob_expand_tilde(s);
742 } else if (act->func == action_showmenu) {
743 if ((n = parse_find_node("menu", node->xmlChildrenNode)))
744 act->data.showmenu.name = parse_string(doc, n);
745 } else if (act->func == action_desktop) {
746 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
747 act->data.desktop.desk = parse_int(doc, n);
748 if (act->data.desktop.desk > 0) act->data.desktop.desk--;
749 } else if (act->func == action_send_to_desktop) {
750 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
751 act->data.sendto.desk = parse_int(doc, n);
752 if (act->data.sendto.desk > 0) act->data.sendto.desk--;
753 } else if (act->func == action_move_relative_horz ||
754 act->func == action_move_relative_vert ||
755 act->func == action_resize_relative_horz ||
756 act->func == action_resize_relative_vert) {
757 if ((n = parse_find_node("delta", node->xmlChildrenNode)))
758 act->data.relative.delta = parse_int(doc, n);
759 } else if (act->func == action_desktop_dir) {
760 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
761 act->data.desktopdir.wrap = parse_bool(doc, n);
762 } else if (act->func == action_send_to_desktop) {
763 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
764 act->data.sendto.follow = parse_bool(doc, n);
765 } else if (act->func == action_send_to_desktop_dir) {
766 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
767 act->data.sendtodir.wrap = parse_bool(doc, n);
768 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
769 act->data.sendtodir.follow = parse_bool(doc, n);
770 } else if (act->func == action_activate) {
771 if ((n = parse_find_node("here", node->xmlChildrenNode)))
772 act->data.activate.here = parse_bool(doc, n);
780 void action_execute(union ActionData *data)
784 if (data->execute.path) {
785 cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
787 if (!g_spawn_command_line_async(cmd, &e)) {
788 g_warning("failed to execute '%s': %s",
792 g_warning("failed to convert '%s' from utf8", data->execute.path);
797 void action_activate(union ActionData *data)
799 if (data->activate.any.c)
800 client_activate(data->activate.any.c, data->activate.here);
803 void action_focus(union ActionData *data)
805 if (data->client.any.c)
806 client_focus(data->client.any.c);
809 void action_unfocus (union ActionData *data)
811 if (data->client.any.c)
812 client_unfocus(data->client.any.c);
815 void action_iconify(union ActionData *data)
817 if (data->client.any.c)
818 client_iconify(data->client.any.c, TRUE, TRUE);
821 void action_raiselower(union ActionData *data)
823 ObClient *c = data->client.any.c;
825 gboolean raise = FALSE;
829 for (it = stacking_list; it; it = g_list_next(it)) {
830 ObClient *cit = it->data;
833 if (client_normal(cit) == client_normal(c) &&
834 cit->layer == c->layer &&
837 if (RECT_INTERSECTS_RECT(cit->frame->area, c->frame->area)) {
845 stacking_raise(CLIENT_AS_WINDOW(c));
847 stacking_lower(CLIENT_AS_WINDOW(c));
850 void action_raise(union ActionData *data)
852 if (data->client.any.c)
853 stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
856 void action_unshaderaise(union ActionData *data)
858 if (data->client.any.c) {
859 if (data->client.any.c->shaded)
860 client_shade(data->client.any.c, FALSE);
862 stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
866 void action_shadelower(union ActionData *data)
868 if (data->client.any.c) {
869 if (data->client.any.c->shaded)
870 stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
872 client_shade(data->client.any.c, TRUE);
876 void action_lower(union ActionData *data)
878 if (data->client.any.c)
879 stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
882 void action_close(union ActionData *data)
884 if (data->client.any.c)
885 client_close(data->client.any.c);
888 void action_kill(union ActionData *data)
890 if (data->client.any.c)
891 client_kill(data->client.any.c);
894 void action_shade(union ActionData *data)
896 if (data->client.any.c)
897 client_shade(data->client.any.c, TRUE);
900 void action_unshade(union ActionData *data)
902 if (data->client.any.c)
903 client_shade(data->client.any.c, FALSE);
906 void action_toggle_shade(union ActionData *data)
908 if (data->client.any.c)
909 client_shade(data->client.any.c, !data->client.any.c->shaded);
912 void action_toggle_omnipresent(union ActionData *data)
914 if (data->client.any.c)
915 client_set_desktop(data->client.any.c,
916 data->client.any.c->desktop == DESKTOP_ALL ?
917 screen_desktop : DESKTOP_ALL, FALSE);
920 void action_move_relative_horz(union ActionData *data)
922 ObClient *c = data->relative.any.c;
924 grab_pointer(TRUE, None);
925 client_move(c, c->area.x + data->relative.delta, c->area.y);
926 grab_pointer(FALSE, None);
930 void action_move_relative_vert(union ActionData *data)
932 ObClient *c = data->relative.any.c;
934 grab_pointer(TRUE, None);
935 client_move(c, c->area.x, c->area.y + data->relative.delta);
936 grab_pointer(FALSE, None);
940 void action_resize_relative_horz(union ActionData *data)
942 ObClient *c = data->relative.any.c;
944 grab_pointer(TRUE, None);
946 c->area.width + data->relative.delta * c->size_inc.width,
948 grab_pointer(FALSE, None);
952 void action_resize_relative_vert(union ActionData *data)
954 ObClient *c = data->relative.any.c;
955 if (c && !c->shaded) {
956 grab_pointer(TRUE, None);
957 client_resize(c, c->area.width, c->area.height +
958 data->relative.delta * c->size_inc.height);
959 grab_pointer(FALSE, None);
963 void action_maximize_full(union ActionData *data)
965 if (data->client.any.c)
966 client_maximize(data->client.any.c, TRUE, 0, TRUE);
969 void action_unmaximize_full(union ActionData *data)
971 if (data->client.any.c)
972 client_maximize(data->client.any.c, FALSE, 0, TRUE);
975 void action_toggle_maximize_full(union ActionData *data)
977 if (data->client.any.c)
978 client_maximize(data->client.any.c,
979 !(data->client.any.c->max_horz ||
980 data->client.any.c->max_vert),
984 void action_maximize_horz(union ActionData *data)
986 if (data->client.any.c)
987 client_maximize(data->client.any.c, TRUE, 1, TRUE);
990 void action_unmaximize_horz(union ActionData *data)
992 if (data->client.any.c)
993 client_maximize(data->client.any.c, FALSE, 1, TRUE);
996 void action_toggle_maximize_horz(union ActionData *data)
998 if (data->client.any.c)
999 client_maximize(data->client.any.c,
1000 !data->client.any.c->max_horz, 1, TRUE);
1003 void action_maximize_vert(union ActionData *data)
1005 if (data->client.any.c)
1006 client_maximize(data->client.any.c, TRUE, 2, TRUE);
1009 void action_unmaximize_vert(union ActionData *data)
1011 if (data->client.any.c)
1012 client_maximize(data->client.any.c, FALSE, 2, TRUE);
1015 void action_toggle_maximize_vert(union ActionData *data)
1017 if (data->client.any.c)
1018 client_maximize(data->client.any.c, !data->client.any.c->max_vert, 2, TRUE);
1021 void action_send_to_desktop(union ActionData *data)
1023 ObClient *c = data->sendto.any.c;
1025 if (!c || !client_normal(c)) return;
1027 if (data->sendto.desk < screen_num_desktops ||
1028 data->sendto.desk == DESKTOP_ALL) {
1029 client_set_desktop(c, data->sendto.desk, data->sendto.follow);
1030 if (data->sendto.follow)
1031 screen_set_desktop(data->sendto.desk);
1035 void action_desktop(union ActionData *data)
1037 if (data->desktop.desk < screen_num_desktops ||
1038 data->desktop.desk == DESKTOP_ALL)
1039 screen_set_desktop(data->desktop.desk);
1042 void action_desktop_dir(union ActionData *data)
1046 d = screen_cycle_desktop(data->desktopdir.dir,
1047 data->desktopdir.wrap,
1048 data->sendtodir.linear,
1049 data->desktopdir.inter.any.interactive,
1050 data->desktopdir.inter.final,
1051 data->desktopdir.inter.cancel);
1052 screen_set_desktop(d);
1055 void action_send_to_desktop_dir(union ActionData *data)
1057 ObClient *c = data->sendtodir.inter.any.c;
1060 if (!c || !client_normal(c)) return;
1062 d = screen_cycle_desktop(data->sendtodir.dir, data->sendtodir.wrap,
1063 data->sendtodir.linear,
1064 data->sendtodir.inter.any.interactive,
1065 data->sendtodir.inter.final,
1066 data->sendtodir.inter.cancel);
1067 client_set_desktop(c, d, data->sendtodir.follow);
1068 if (data->sendtodir.follow)
1069 screen_set_desktop(d);
1072 void action_desktop_last(union ActionData *data)
1074 screen_set_desktop(screen_last_desktop);
1077 void action_toggle_decorations(union ActionData *data)
1079 ObClient *c = data->client.any.c;
1083 c->decorate = !c->decorate;
1084 client_setup_decor_and_functions(c);
1087 void action_moveresize(union ActionData *data)
1089 ObClient *c = data->moveresize.any.c;
1091 if (!c || !client_normal(c)) return;
1093 moveresize_start(c, data->moveresize.x, data->moveresize.y,
1094 data->moveresize.button, data->moveresize.corner);
1097 void action_restart(union ActionData *data)
1099 ob_restart_other(data->execute.path);
1102 void action_exit(union ActionData *data)
1107 void action_showmenu(union ActionData *data)
1109 if (data->showmenu.name) {
1110 menu_show(data->showmenu.name, data->showmenu.x, data->showmenu.y,
1111 data->showmenu.any.c);
1115 void action_cycle_windows(union ActionData *data)
1117 focus_cycle(data->cycle.forward, data->cycle.linear,
1118 data->cycle.inter.any.interactive,
1119 data->cycle.inter.final, data->cycle.inter.cancel);
1122 void action_directional_focus(union ActionData *data)
1124 focus_directional_cycle(data->interdiraction.direction,
1125 data->interdiraction.inter.any.interactive,
1126 data->interdiraction.inter.final,
1127 data->interdiraction.inter.cancel);
1130 void action_movetoedge(union ActionData *data)
1133 ObClient *c = data->diraction.any.c;
1137 x = c->frame->area.x;
1138 y = c->frame->area.y;
1140 switch(data->diraction.direction) {
1141 case OB_DIRECTION_NORTH:
1142 y = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1144 case OB_DIRECTION_WEST:
1145 x = client_directional_edge_search(c, OB_DIRECTION_WEST);
1147 case OB_DIRECTION_SOUTH:
1148 y = client_directional_edge_search(c, OB_DIRECTION_SOUTH) -
1149 c->frame->area.height;
1151 case OB_DIRECTION_EAST:
1152 x = client_directional_edge_search(c, OB_DIRECTION_EAST) -
1153 c->frame->area.width;
1156 g_assert_not_reached();
1158 frame_frame_gravity(c->frame, &x, &y);
1159 grab_pointer(TRUE, None);
1160 client_move(c, x, y);
1161 grab_pointer(FALSE, None);
1165 void action_growtoedge(union ActionData *data)
1167 int x, y, width, height, dest;
1168 ObClient *c = data->diraction.any.c;
1169 Rect *a = screen_area(c->desktop);
1174 x = c->frame->area.x;
1175 y = c->frame->area.y;
1176 width = c->frame->area.width;
1177 height = c->frame->area.height;
1179 switch(data->diraction.direction) {
1180 case OB_DIRECTION_NORTH:
1181 dest = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1183 height = c->frame->area.height / 2;
1185 height = c->frame->area.y + c->frame->area.height - dest;
1189 case OB_DIRECTION_WEST:
1190 dest = client_directional_edge_search(c, OB_DIRECTION_WEST);
1192 width = c->frame->area.width / 2;
1194 width = c->frame->area.x + c->frame->area.width - dest;
1198 case OB_DIRECTION_SOUTH:
1199 dest = client_directional_edge_search(c, OB_DIRECTION_SOUTH);
1200 if (a->y + a->height == y + c->frame->area.height) {
1201 height = c->frame->area.height / 2;
1202 y = a->y + a->height - height;
1204 height = dest - c->frame->area.y;
1205 y += (height - c->frame->area.height) % c->size_inc.height;
1206 height -= (height - c->frame->area.height) % c->size_inc.height;
1208 case OB_DIRECTION_EAST:
1209 dest = client_directional_edge_search(c, OB_DIRECTION_EAST);
1210 if (a->x + a->width == x + c->frame->area.width) {
1211 width = c->frame->area.width / 2;
1212 x = a->x + a->width - width;
1214 width = dest - c->frame->area.x;
1215 x += (width - c->frame->area.width) % c->size_inc.width;
1216 width -= (width - c->frame->area.width) % c->size_inc.width;
1219 g_assert_not_reached();
1221 frame_frame_gravity(c->frame, &x, &y);
1222 width -= c->frame->size.left + c->frame->size.right;
1223 height -= c->frame->size.top + c->frame->size.bottom;
1224 grab_pointer(TRUE, None);
1225 client_move_resize(c, x, y, width, height);
1226 grab_pointer(FALSE, None);
1229 void action_send_to_layer(union ActionData *data)
1231 if (data->layer.any.c)
1232 client_set_layer(data->layer.any.c, data->layer.layer);
1235 void action_toggle_layer(union ActionData *data)
1237 ObClient *c = data->layer.any.c;
1240 if (data->layer.layer < 0)
1241 client_set_layer(c, c->below ? 0 : -1);
1242 else if (data->layer.layer > 0)
1243 client_set_layer(c, c->above ? 0 : 1);
1247 void action_toggle_show_desktop(union ActionData *data)
1249 screen_show_desktop(!screen_showing_desktop);
1252 void action_show_desktop(union ActionData *data)
1254 screen_show_desktop(TRUE);
1257 void action_unshow_desktop(union ActionData *data)
1259 screen_show_desktop(FALSE);