4 #include "moveresize.h"
15 typedef struct ActionString {
17 void (*func)(union ActionData *);
18 void (*setup)(ObAction *);
21 ObAction *action_new(void (*func)(union ActionData *data))
23 ObAction *a = g_new0(ObAction, 1);
29 void action_free(ObAction *a)
31 if (a == NULL) return;
33 /* deal with pointers */
34 if (a->func == action_execute || a->func == action_restart)
35 g_free(a->data.execute.path);
36 else if (a->func == action_showmenu)
37 g_free(a->data.showmenu.name);
42 void setup_action_directional_focus_north(ObAction *a)
44 a->data.diraction.direction = OB_DIRECTION_NORTH;
47 void setup_action_directional_focus_east(ObAction *a)
49 a->data.diraction.direction = OB_DIRECTION_EAST;
52 void setup_action_directional_focus_south(ObAction *a)
54 a->data.diraction.direction = OB_DIRECTION_SOUTH;
57 void setup_action_directional_focus_west(ObAction *a)
59 a->data.diraction.direction = OB_DIRECTION_WEST;
62 void setup_action_directional_focus_northeast(ObAction *a)
64 a->data.diraction.direction = OB_DIRECTION_NORTHEAST;
67 void setup_action_directional_focus_southeast(ObAction *a)
69 a->data.diraction.direction = OB_DIRECTION_SOUTHEAST;
72 void setup_action_directional_focus_southwest(ObAction *a)
74 a->data.diraction.direction = OB_DIRECTION_SOUTHWEST;
77 void setup_action_directional_focus_northwest(ObAction *a)
79 a->data.diraction.direction = OB_DIRECTION_NORTHWEST;
82 void setup_action_send_to_desktop(ObAction *a)
84 a->data.sendto.follow = TRUE;
87 void setup_action_send_to_desktop_prev(ObAction *a)
89 a->data.sendtodir.inter.any.interactive = TRUE;
90 a->data.sendtodir.dir = OB_DIRECTION_WEST;
91 a->data.sendtodir.linear = TRUE;
92 a->data.sendtodir.wrap = TRUE;
93 a->data.sendtodir.follow = TRUE;
96 void setup_action_send_to_desktop_next(ObAction *a)
98 a->data.sendtodir.inter.any.interactive = TRUE;
99 a->data.sendtodir.dir = OB_DIRECTION_EAST;
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_left(ObAction *a)
107 a->data.sendtodir.inter.any.interactive = TRUE;
108 a->data.sendtodir.dir = OB_DIRECTION_WEST;
109 a->data.sendtodir.linear = FALSE;
110 a->data.sendtodir.wrap = TRUE;
111 a->data.sendtodir.follow = TRUE;
114 void setup_action_send_to_desktop_right(ObAction *a)
116 a->data.sendtodir.inter.any.interactive = TRUE;
117 a->data.sendtodir.dir = OB_DIRECTION_EAST;
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_up(ObAction *a)
125 a->data.sendtodir.inter.any.interactive = TRUE;
126 a->data.sendtodir.dir = OB_DIRECTION_NORTH;
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_down(ObAction *a)
134 a->data.sendtodir.inter.any.interactive = TRUE;
135 a->data.sendtodir.dir = OB_DIRECTION_SOUTH;
136 a->data.sendtodir.linear = FALSE;
137 a->data.sendtodir.wrap = TRUE;
138 a->data.sendtodir.follow = TRUE;
141 void setup_action_desktop_prev(ObAction *a)
143 a->data.desktopdir.inter.any.interactive = TRUE;
144 a->data.desktopdir.dir = OB_DIRECTION_WEST;
145 a->data.desktopdir.linear = TRUE;
146 a->data.desktopdir.wrap = TRUE;
149 void setup_action_desktop_next(ObAction *a)
151 a->data.desktopdir.inter.any.interactive = TRUE;
152 a->data.desktopdir.dir = OB_DIRECTION_EAST;
153 a->data.desktopdir.linear = TRUE;
154 a->data.desktopdir.wrap = TRUE;
157 void setup_action_desktop_left(ObAction *a)
159 a->data.desktopdir.inter.any.interactive = TRUE;
160 a->data.desktopdir.dir = OB_DIRECTION_WEST;
161 a->data.desktopdir.linear = FALSE;
162 a->data.desktopdir.wrap = TRUE;
165 void setup_action_desktop_right(ObAction *a)
167 a->data.desktopdir.inter.any.interactive = TRUE;
168 a->data.desktopdir.dir = OB_DIRECTION_EAST;
169 a->data.desktopdir.linear = FALSE;
170 a->data.desktopdir.wrap = TRUE;
173 void setup_action_desktop_up(ObAction *a)
175 a->data.desktopdir.inter.any.interactive = TRUE;
176 a->data.desktopdir.dir = OB_DIRECTION_NORTH;
177 a->data.desktopdir.linear = FALSE;
178 a->data.desktopdir.wrap = TRUE;
181 void setup_action_desktop_down(ObAction *a)
183 a->data.desktopdir.inter.any.interactive = TRUE;
184 a->data.desktopdir.dir = OB_DIRECTION_SOUTH;
185 a->data.desktopdir.linear = FALSE;
186 a->data.desktopdir.wrap = TRUE;
189 void setup_action_move_keyboard(ObAction *a)
191 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move_keyboard;
194 void setup_action_move(ObAction *a)
196 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_move;
199 void setup_action_resize(ObAction *a)
201 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_topleft;
204 void setup_action_resize_keyboard(ObAction *a)
206 a->data.moveresize.corner = prop_atoms.net_wm_moveresize_size_keyboard;
209 void setup_action_cycle_windows_linear_next(ObAction *a)
211 a->data.cycle.inter.any.interactive = TRUE;
212 a->data.cycle.linear = TRUE;
213 a->data.cycle.forward = TRUE;
216 void setup_action_cycle_windows_linear_previous(ObAction *a)
218 a->data.cycle.inter.any.interactive = TRUE;
219 a->data.cycle.linear = TRUE;
220 a->data.cycle.forward = FALSE;
223 void setup_action_cycle_windows_next(ObAction *a)
225 a->data.cycle.inter.any.interactive = TRUE;
226 a->data.cycle.linear = FALSE;
227 a->data.cycle.forward = TRUE;
230 void setup_action_cycle_windows_previous(ObAction *a)
232 a->data.cycle.inter.any.interactive = TRUE;
233 a->data.cycle.linear = FALSE;
234 a->data.cycle.forward = FALSE;
237 void setup_action_movetoedge_north(ObAction *a)
239 a->data.diraction.direction = OB_DIRECTION_NORTH;
242 void setup_action_movetoedge_south(ObAction *a)
244 a->data.diraction.direction = OB_DIRECTION_SOUTH;
247 void setup_action_movetoedge_east(ObAction *a)
249 a->data.diraction.direction = OB_DIRECTION_EAST;
252 void setup_action_movetoedge_west(ObAction *a)
254 a->data.diraction.direction = OB_DIRECTION_WEST;
257 void setup_action_growtoedge_north(ObAction *a)
259 a->data.diraction.direction = OB_DIRECTION_NORTH;
262 void setup_action_growtoedge_south(ObAction *a)
264 a->data.diraction.direction = OB_DIRECTION_SOUTH;
267 void setup_action_growtoedge_east(ObAction *a)
269 a->data.diraction.direction = OB_DIRECTION_EAST;
272 void setup_action_growtoedge_west(ObAction *a)
274 a->data.diraction.direction = OB_DIRECTION_WEST;
277 void setup_action_top_layer(ObAction *a)
279 a->data.layer.layer = 1;
282 void setup_action_normal_layer(ObAction *a)
284 a->data.layer.layer = 0;
287 void setup_action_bottom_layer(ObAction *a)
289 a->data.layer.layer = -1;
292 ActionString actionstrings[] =
300 "directionalfocusnorth",
301 action_directional_focus,
302 setup_action_directional_focus_north
305 "directionalfocuseast",
306 action_directional_focus,
307 setup_action_directional_focus_east
310 "directionalfocussouth",
311 action_directional_focus,
312 setup_action_directional_focus_south
315 "directionalfocuswest",
316 action_directional_focus,
317 setup_action_directional_focus_west
320 "directionalfocusnortheast",
321 action_directional_focus,
322 setup_action_directional_focus_northeast
325 "directionalfocussoutheast",
326 action_directional_focus,
327 setup_action_directional_focus_southeast
330 "directionalfocussouthwest",
331 action_directional_focus,
332 setup_action_directional_focus_southwest
335 "directionalfocusnorthwest",
336 action_directional_focus,
337 setup_action_directional_focus_northwest
411 action_toggle_omnipresent,
416 action_move_relative_horz,
421 action_move_relative_vert,
425 "resizerelativehorz",
426 action_resize_relative_horz,
430 "resizerelativevert",
431 action_resize_relative_vert,
436 action_maximize_full,
441 action_unmaximize_full,
445 "togglemaximizefull",
446 action_toggle_maximize_full,
451 action_maximize_horz,
456 action_unmaximize_horz,
460 "togglemaximizehorz",
461 action_toggle_maximize_horz,
466 action_maximize_vert,
471 action_unmaximize_vert,
475 "togglemaximizevert",
476 action_toggle_maximize_vert,
481 action_send_to_desktop,
482 setup_action_send_to_desktop
486 action_send_to_desktop_dir,
487 setup_action_send_to_desktop_next
490 "sendtodesktopprevious",
491 action_send_to_desktop_dir,
492 setup_action_send_to_desktop_prev
495 "sendtodesktopright",
496 action_send_to_desktop_dir,
497 setup_action_send_to_desktop_right
501 action_send_to_desktop_dir,
502 setup_action_send_to_desktop_left
506 action_send_to_desktop_dir,
507 setup_action_send_to_desktop_up
511 action_send_to_desktop_dir,
512 setup_action_send_to_desktop_down
522 setup_action_desktop_next
527 setup_action_desktop_prev
532 setup_action_desktop_right
537 setup_action_desktop_left
542 setup_action_desktop_up
547 setup_action_desktop_down
551 action_toggle_decorations,
557 setup_action_move_keyboard
572 setup_action_resize_keyboard
576 action_toggle_show_desktop,
586 action_unshow_desktop,
606 action_send_to_layer,
607 setup_action_top_layer
612 setup_action_top_layer
616 action_send_to_layer,
617 setup_action_normal_layer
621 action_send_to_layer,
622 setup_action_bottom_layer
625 "togglealwaysonbottom",
627 setup_action_bottom_layer
631 action_cycle_windows,
632 setup_action_cycle_windows_linear_next
635 "previouswindowlinear",
636 action_cycle_windows,
637 setup_action_cycle_windows_linear_previous
641 action_cycle_windows,
642 setup_action_cycle_windows_next
646 action_cycle_windows,
647 setup_action_cycle_windows_previous
652 setup_action_movetoedge_north
657 setup_action_movetoedge_south
662 setup_action_movetoedge_west
667 setup_action_movetoedge_east
672 setup_action_growtoedge_north
677 setup_action_growtoedge_south
682 setup_action_growtoedge_west
687 setup_action_growtoedge_east
696 ObAction *action_from_string(char *name)
701 for (i = 0; actionstrings[i].name; i++)
702 if (!g_ascii_strcasecmp(name, actionstrings[i].name)) {
703 a = action_new(actionstrings[i].func);
704 if (actionstrings[i].setup)
705 actionstrings[i].setup(a);
711 ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
714 ObAction *act = NULL;
717 if (parse_attr_string("name", node, &actname)) {
718 if ((act = action_from_string(actname))) {
719 if (act->func == action_execute || act->func == action_restart) {
720 if ((n = parse_find_node("execute", node->xmlChildrenNode)))
721 act->data.execute.path = parse_string(doc, n);
722 } else if (act->func == action_showmenu) {
723 if ((n = parse_find_node("menu", node->xmlChildrenNode)))
724 act->data.showmenu.name = parse_string(doc, n);
725 } else if (act->func == action_desktop) {
726 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
727 act->data.desktop.desk = parse_int(doc, n);
728 if (act->data.desktop.desk > 0) act->data.desktop.desk--;
729 } else if (act->func == action_send_to_desktop) {
730 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
731 act->data.sendto.desk = parse_int(doc, n);
732 if (act->data.sendto.desk > 0) act->data.sendto.desk--;
733 } else if (act->func == action_move_relative_horz ||
734 act->func == action_move_relative_vert ||
735 act->func == action_resize_relative_horz ||
736 act->func == action_resize_relative_vert) {
737 if ((n = parse_find_node("delta", node->xmlChildrenNode)))
738 act->data.relative.delta = parse_int(doc, n);
739 } else if (act->func == action_desktop_dir) {
740 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
741 act->data.desktopdir.wrap = parse_bool(doc, n);
742 } else if (act->func == action_send_to_desktop) {
743 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
744 act->data.sendto.follow = parse_bool(doc, n);
745 } else if (act->func == action_send_to_desktop_dir) {
746 if ((n = parse_find_node("wrap", node->xmlChildrenNode)))
747 act->data.sendtodir.wrap = parse_bool(doc, n);
748 if ((n = parse_find_node("follow", node->xmlChildrenNode)))
749 act->data.sendtodir.follow = parse_bool(doc, n);
750 } else if (act->func == action_activate) {
751 if ((n = parse_find_node("here", node->xmlChildrenNode)))
752 act->data.activate.here = parse_bool(doc, n);
755 if (act->data.any.interactive) {
756 if ((n = parse_find_node("interactive",node->xmlChildrenNode)))
757 act->data.any.interactive = parse_bool(doc, n);
765 void action_execute(union ActionData *data)
769 if (data->execute.path) {
770 cmd = g_filename_from_utf8(data->execute.path, -1, NULL, NULL, NULL);
772 if (!g_spawn_command_line_async(cmd, &e)) {
773 g_warning("failed to execute '%s': %s",
777 g_warning("failed to convert '%s' from utf8", data->execute.path);
782 void action_activate(union ActionData *data)
784 if (data->activate.any.c)
785 client_activate(data->activate.any.c, data->activate.here);
788 void action_focus(union ActionData *data)
790 if (data->client.any.c)
791 client_focus(data->client.any.c);
794 void action_unfocus (union ActionData *data)
796 if (data->client.any.c)
797 client_unfocus(data->client.any.c);
800 void action_iconify(union ActionData *data)
802 if (data->client.any.c)
803 client_iconify(data->client.any.c, TRUE, TRUE);
806 void action_raiselower(union ActionData *data)
808 ObClient *c = data->client.any.c;
810 gboolean raise = FALSE;
814 for (it = stacking_list; it; it = g_list_next(it)) {
815 ObClient *cit = it->data;
818 if (client_normal(cit) == client_normal(c) &&
819 cit->layer == c->layer &&
822 if (RECT_INTERSECTS_RECT(cit->frame->area, c->frame->area)) {
830 stacking_raise(CLIENT_AS_WINDOW(c));
832 stacking_lower(CLIENT_AS_WINDOW(c));
835 void action_raise(union ActionData *data)
837 if (data->client.any.c)
838 stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
841 void action_unshaderaise(union ActionData *data)
843 if (data->client.any.c) {
844 if (data->client.any.c->shaded)
845 client_shade(data->client.any.c, FALSE);
847 stacking_raise(CLIENT_AS_WINDOW(data->client.any.c));
851 void action_shadelower(union ActionData *data)
853 if (data->client.any.c) {
854 if (data->client.any.c->shaded)
855 stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
857 client_shade(data->client.any.c, TRUE);
861 void action_lower(union ActionData *data)
863 if (data->client.any.c)
864 stacking_lower(CLIENT_AS_WINDOW(data->client.any.c));
867 void action_close(union ActionData *data)
869 if (data->client.any.c)
870 client_close(data->client.any.c);
873 void action_kill(union ActionData *data)
875 if (data->client.any.c)
876 client_kill(data->client.any.c);
879 void action_shade(union ActionData *data)
881 if (data->client.any.c)
882 client_shade(data->client.any.c, TRUE);
885 void action_unshade(union ActionData *data)
887 if (data->client.any.c)
888 client_shade(data->client.any.c, FALSE);
891 void action_toggle_shade(union ActionData *data)
893 if (data->client.any.c)
894 client_shade(data->client.any.c, !data->client.any.c->shaded);
897 void action_toggle_omnipresent(union ActionData *data)
899 if (data->client.any.c)
900 client_set_desktop(data->client.any.c,
901 data->client.any.c->desktop == DESKTOP_ALL ?
902 screen_desktop : DESKTOP_ALL, FALSE);
905 void action_move_relative_horz(union ActionData *data)
907 ObClient *c = data->relative.any.c;
909 client_configure(c, OB_CORNER_TOPLEFT,
910 c->area.x + data->relative.delta, c->area.y,
911 c->area.width, c->area.height, TRUE, TRUE);
914 void action_move_relative_vert(union ActionData *data)
916 ObClient *c = data->relative.any.c;
918 client_configure(c, OB_CORNER_TOPLEFT,
919 c->area.x, c->area.y + data->relative.delta,
920 c->area.width, c->area.height, TRUE, TRUE);
923 void action_resize_relative_horz(union ActionData *data)
925 ObClient *c = data->relative.any.c;
927 client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
929 data->relative.delta * c->size_inc.width,
930 c->area.height, TRUE, TRUE);
933 void action_resize_relative_vert(union ActionData *data)
935 ObClient *c = data->relative.any.c;
937 client_configure(c, OB_CORNER_TOPLEFT, c->area.x, c->area.y,
938 c->area.width, c->area.height +
939 data->relative.delta * c->size_inc.height,
943 void action_maximize_full(union ActionData *data)
945 if (data->client.any.c)
946 client_maximize(data->client.any.c, TRUE, 0, TRUE);
949 void action_unmaximize_full(union ActionData *data)
951 if (data->client.any.c)
952 client_maximize(data->client.any.c, FALSE, 0, TRUE);
955 void action_toggle_maximize_full(union ActionData *data)
957 if (data->client.any.c)
958 client_maximize(data->client.any.c,
959 !(data->client.any.c->max_horz ||
960 data->client.any.c->max_vert),
964 void action_maximize_horz(union ActionData *data)
966 if (data->client.any.c)
967 client_maximize(data->client.any.c, TRUE, 1, TRUE);
970 void action_unmaximize_horz(union ActionData *data)
972 if (data->client.any.c)
973 client_maximize(data->client.any.c, FALSE, 1, TRUE);
976 void action_toggle_maximize_horz(union ActionData *data)
978 if (data->client.any.c)
979 client_maximize(data->client.any.c,
980 !data->client.any.c->max_horz, 1, TRUE);
983 void action_maximize_vert(union ActionData *data)
985 if (data->client.any.c)
986 client_maximize(data->client.any.c, TRUE, 2, TRUE);
989 void action_unmaximize_vert(union ActionData *data)
991 if (data->client.any.c)
992 client_maximize(data->client.any.c, FALSE, 2, TRUE);
995 void action_toggle_maximize_vert(union ActionData *data)
997 if (data->client.any.c)
998 client_maximize(data->client.any.c, !data->client.any.c->max_vert, 2, TRUE);
1001 void action_send_to_desktop(union ActionData *data)
1003 ObClient *c = data->sendto.any.c;
1005 if (!c || !client_normal(c)) return;
1007 if (data->sendto.desk < screen_num_desktops ||
1008 data->sendto.desk == DESKTOP_ALL) {
1009 client_set_desktop(c, data->sendto.desk, data->sendto.follow);
1010 if (data->sendto.follow)
1011 screen_set_desktop(data->sendto.desk);
1015 void action_desktop(union ActionData *data)
1017 if (data->desktop.desk < screen_num_desktops ||
1018 data->desktop.desk == DESKTOP_ALL)
1019 screen_set_desktop(data->desktop.desk);
1022 void action_desktop_dir(union ActionData *data)
1026 d = screen_cycle_desktop(data->desktopdir.dir,
1027 data->desktopdir.wrap,
1028 data->sendtodir.linear,
1029 data->desktopdir.inter.any.interactive,
1030 data->desktopdir.inter.final,
1031 data->desktopdir.inter.cancel);
1032 screen_set_desktop(d);
1035 void action_send_to_desktop_dir(union ActionData *data)
1037 ObClient *c = data->sendtodir.inter.any.c;
1040 if (!c || !client_normal(c)) return;
1042 d = screen_cycle_desktop(data->sendtodir.dir, data->sendtodir.wrap,
1043 data->sendtodir.linear,
1044 data->sendtodir.inter.any.interactive,
1045 data->sendtodir.inter.final,
1046 data->sendtodir.inter.cancel);
1047 client_set_desktop(c, d, data->sendtodir.follow);
1048 if (data->sendtodir.follow)
1049 screen_set_desktop(d);
1052 void action_toggle_decorations(union ActionData *data)
1054 ObClient *c = data->client.any.c;
1058 c->decorate = !c->decorate;
1059 client_setup_decor_and_functions(c);
1062 void action_moveresize(union ActionData *data)
1064 ObClient *c = data->moveresize.any.c;
1066 if (!c || !client_normal(c)) return;
1068 moveresize_start(c, data->moveresize.x, data->moveresize.y,
1069 data->moveresize.button, data->moveresize.corner);
1072 void action_restart(union ActionData *data)
1074 ob_restart_other(data->execute.path);
1077 void action_exit(union ActionData *data)
1082 void action_showmenu(union ActionData *data)
1084 if (data->showmenu.name) {
1085 menu_show(data->showmenu.name, data->showmenu.x, data->showmenu.y,
1086 data->showmenu.any.c);
1090 void action_cycle_windows(union ActionData *data)
1094 c = focus_cycle(data->cycle.forward, data->cycle.linear,
1095 data->cycle.inter.any.interactive,
1096 data->cycle.inter.final, data->cycle.inter.cancel);
1099 void action_directional_focus(union ActionData *data)
1103 if (!data->diraction.any.c)
1105 if ((nf = client_find_directional(data->diraction.any.c,
1106 data->diraction.direction)))
1107 client_activate(nf, FALSE);
1110 void action_movetoedge(union ActionData *data)
1113 ObClient *c = data->diraction.any.c;
1117 x = c->frame->area.x;
1118 y = c->frame->area.y;
1120 switch(data->diraction.direction) {
1121 case OB_DIRECTION_NORTH:
1122 y = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1124 case OB_DIRECTION_WEST:
1125 x = client_directional_edge_search(c, OB_DIRECTION_WEST);
1127 case OB_DIRECTION_SOUTH:
1128 y = client_directional_edge_search(c, OB_DIRECTION_SOUTH) -
1129 c->frame->area.height;
1131 case OB_DIRECTION_EAST:
1132 x = client_directional_edge_search(c, OB_DIRECTION_EAST) -
1133 c->frame->area.width;
1136 g_assert_not_reached();
1138 frame_frame_gravity(c->frame, &x, &y);
1139 client_configure(c, OB_CORNER_TOPLEFT,
1140 x, y, c->area.width, c->area.height, TRUE, TRUE);
1144 void action_growtoedge(union ActionData *data)
1146 int x, y, width, height, dest;
1147 ObClient *c = data->diraction.any.c;
1148 Rect *a = screen_area(c->desktop);
1153 x = c->frame->area.x;
1154 y = c->frame->area.y;
1155 width = c->frame->area.width;
1156 height = c->frame->area.height;
1158 switch(data->diraction.direction) {
1159 case OB_DIRECTION_NORTH:
1160 dest = client_directional_edge_search(c, OB_DIRECTION_NORTH);
1162 height = c->frame->area.height / 2;
1164 height = c->frame->area.y + c->frame->area.height - dest;
1168 case OB_DIRECTION_WEST:
1169 dest = client_directional_edge_search(c, OB_DIRECTION_WEST);
1171 width = c->frame->area.width / 2;
1173 width = c->frame->area.x + c->frame->area.width - dest;
1177 case OB_DIRECTION_SOUTH:
1178 dest = client_directional_edge_search(c, OB_DIRECTION_SOUTH);
1179 if (a->y + a->height == y + c->frame->area.height) {
1180 height = c->frame->area.height / 2;
1181 y = a->y + a->height - height;
1183 height = dest - c->frame->area.y;
1184 y += (height - c->frame->area.height) % c->size_inc.height;
1185 height -= (height - c->frame->area.height) % c->size_inc.height;
1187 case OB_DIRECTION_EAST:
1188 dest = client_directional_edge_search(c, OB_DIRECTION_EAST);
1189 if (a->x + a->width == x + c->frame->area.width) {
1190 width = c->frame->area.width / 2;
1191 x = a->x + a->width - width;
1193 width = dest - c->frame->area.x;
1194 x += (width - c->frame->area.width) % c->size_inc.width;
1195 width -= (width - c->frame->area.width) % c->size_inc.width;
1198 g_assert_not_reached();
1200 frame_frame_gravity(c->frame, &x, &y);
1201 width -= c->frame->size.left + c->frame->size.right;
1202 height -= c->frame->size.top + c->frame->size.bottom;
1203 client_configure(c, OB_CORNER_TOPLEFT, x, y, width, height, TRUE, TRUE);
1206 void action_send_to_layer(union ActionData *data)
1208 if (data->layer.any.c)
1209 client_set_layer(data->layer.any.c, data->layer.layer);
1212 void action_toggle_layer(union ActionData *data)
1214 ObClient *c = data->layer.any.c;
1217 if (data->layer.layer < 0)
1218 client_set_layer(c, c->below ? 0 : -1);
1219 else if (data->layer.layer > 0)
1220 client_set_layer(c, c->above ? 0 : 1);
1224 void action_toggle_show_desktop(union ActionData *data)
1226 screen_show_desktop(!screen_showing_desktop);
1229 void action_show_desktop(union ActionData *data)
1231 screen_show_desktop(TRUE);
1234 void action_unshow_desktop(union ActionData *data)
1236 screen_show_desktop(FALSE);