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
.interdiraction
.inter
.any
.interactive
= TRUE
;
45 a
->data
.interdiraction
.direction
= OB_DIRECTION_NORTH
;
48 void setup_action_directional_focus_east(ObAction
*a
)
50 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
51 a
->data
.interdiraction
.direction
= OB_DIRECTION_EAST
;
54 void setup_action_directional_focus_south(ObAction
*a
)
56 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
57 a
->data
.interdiraction
.direction
= OB_DIRECTION_SOUTH
;
60 void setup_action_directional_focus_west(ObAction
*a
)
62 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
63 a
->data
.interdiraction
.direction
= OB_DIRECTION_WEST
;
66 void setup_action_directional_focus_northeast(ObAction
*a
)
68 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
69 a
->data
.interdiraction
.direction
= OB_DIRECTION_NORTHEAST
;
72 void setup_action_directional_focus_southeast(ObAction
*a
)
74 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
75 a
->data
.interdiraction
.direction
= OB_DIRECTION_SOUTHEAST
;
78 void setup_action_directional_focus_southwest(ObAction
*a
)
80 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
81 a
->data
.interdiraction
.direction
= OB_DIRECTION_SOUTHWEST
;
84 void setup_action_directional_focus_northwest(ObAction
*a
)
86 a
->data
.interdiraction
.inter
.any
.interactive
= TRUE
;
87 a
->data
.interdiraction
.direction
= OB_DIRECTION_NORTHWEST
;
90 void setup_action_send_to_desktop(ObAction
*a
)
92 a
->data
.sendto
.follow
= TRUE
;
95 void setup_action_send_to_desktop_prev(ObAction
*a
)
97 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
98 a
->data
.sendtodir
.dir
= OB_DIRECTION_WEST
;
99 a
->data
.sendtodir
.linear
= TRUE
;
100 a
->data
.sendtodir
.wrap
= TRUE
;
101 a
->data
.sendtodir
.follow
= TRUE
;
104 void setup_action_send_to_desktop_next(ObAction
*a
)
106 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
107 a
->data
.sendtodir
.dir
= OB_DIRECTION_EAST
;
108 a
->data
.sendtodir
.linear
= TRUE
;
109 a
->data
.sendtodir
.wrap
= TRUE
;
110 a
->data
.sendtodir
.follow
= TRUE
;
113 void setup_action_send_to_desktop_left(ObAction
*a
)
115 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
116 a
->data
.sendtodir
.dir
= OB_DIRECTION_WEST
;
117 a
->data
.sendtodir
.linear
= FALSE
;
118 a
->data
.sendtodir
.wrap
= TRUE
;
119 a
->data
.sendtodir
.follow
= TRUE
;
122 void setup_action_send_to_desktop_right(ObAction
*a
)
124 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
125 a
->data
.sendtodir
.dir
= OB_DIRECTION_EAST
;
126 a
->data
.sendtodir
.linear
= FALSE
;
127 a
->data
.sendtodir
.wrap
= TRUE
;
128 a
->data
.sendtodir
.follow
= TRUE
;
131 void setup_action_send_to_desktop_up(ObAction
*a
)
133 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
134 a
->data
.sendtodir
.dir
= OB_DIRECTION_NORTH
;
135 a
->data
.sendtodir
.linear
= FALSE
;
136 a
->data
.sendtodir
.wrap
= TRUE
;
137 a
->data
.sendtodir
.follow
= TRUE
;
140 void setup_action_send_to_desktop_down(ObAction
*a
)
142 a
->data
.sendtodir
.inter
.any
.interactive
= TRUE
;
143 a
->data
.sendtodir
.dir
= OB_DIRECTION_SOUTH
;
144 a
->data
.sendtodir
.linear
= FALSE
;
145 a
->data
.sendtodir
.wrap
= TRUE
;
146 a
->data
.sendtodir
.follow
= TRUE
;
149 void setup_action_desktop_prev(ObAction
*a
)
151 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
152 a
->data
.desktopdir
.dir
= OB_DIRECTION_WEST
;
153 a
->data
.desktopdir
.linear
= TRUE
;
154 a
->data
.desktopdir
.wrap
= TRUE
;
157 void setup_action_desktop_next(ObAction
*a
)
159 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
160 a
->data
.desktopdir
.dir
= OB_DIRECTION_EAST
;
161 a
->data
.desktopdir
.linear
= TRUE
;
162 a
->data
.desktopdir
.wrap
= TRUE
;
165 void setup_action_desktop_left(ObAction
*a
)
167 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
168 a
->data
.desktopdir
.dir
= OB_DIRECTION_WEST
;
169 a
->data
.desktopdir
.linear
= FALSE
;
170 a
->data
.desktopdir
.wrap
= TRUE
;
173 void setup_action_desktop_right(ObAction
*a
)
175 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
176 a
->data
.desktopdir
.dir
= OB_DIRECTION_EAST
;
177 a
->data
.desktopdir
.linear
= FALSE
;
178 a
->data
.desktopdir
.wrap
= TRUE
;
181 void setup_action_desktop_up(ObAction
*a
)
183 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
184 a
->data
.desktopdir
.dir
= OB_DIRECTION_NORTH
;
185 a
->data
.desktopdir
.linear
= FALSE
;
186 a
->data
.desktopdir
.wrap
= TRUE
;
189 void setup_action_desktop_down(ObAction
*a
)
191 a
->data
.desktopdir
.inter
.any
.interactive
= TRUE
;
192 a
->data
.desktopdir
.dir
= OB_DIRECTION_SOUTH
;
193 a
->data
.desktopdir
.linear
= FALSE
;
194 a
->data
.desktopdir
.wrap
= TRUE
;
197 void setup_action_move_keyboard(ObAction
*a
)
199 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_move_keyboard
;
202 void setup_action_move(ObAction
*a
)
204 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_move
;
207 void setup_action_resize(ObAction
*a
)
209 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_size_topleft
;
212 void setup_action_resize_keyboard(ObAction
*a
)
214 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_size_keyboard
;
217 void setup_action_cycle_windows_linear_next(ObAction
*a
)
219 a
->data
.cycle
.inter
.any
.interactive
= TRUE
;
220 a
->data
.cycle
.linear
= TRUE
;
221 a
->data
.cycle
.forward
= TRUE
;
224 void setup_action_cycle_windows_linear_previous(ObAction
*a
)
226 a
->data
.cycle
.inter
.any
.interactive
= TRUE
;
227 a
->data
.cycle
.linear
= TRUE
;
228 a
->data
.cycle
.forward
= FALSE
;
231 void setup_action_cycle_windows_next(ObAction
*a
)
233 a
->data
.cycle
.inter
.any
.interactive
= TRUE
;
234 a
->data
.cycle
.linear
= FALSE
;
235 a
->data
.cycle
.forward
= TRUE
;
238 void setup_action_cycle_windows_previous(ObAction
*a
)
240 a
->data
.cycle
.inter
.any
.interactive
= TRUE
;
241 a
->data
.cycle
.linear
= FALSE
;
242 a
->data
.cycle
.forward
= FALSE
;
245 void setup_action_movetoedge_north(ObAction
*a
)
247 a
->data
.diraction
.direction
= OB_DIRECTION_NORTH
;
250 void setup_action_movetoedge_south(ObAction
*a
)
252 a
->data
.diraction
.direction
= OB_DIRECTION_SOUTH
;
255 void setup_action_movetoedge_east(ObAction
*a
)
257 a
->data
.diraction
.direction
= OB_DIRECTION_EAST
;
260 void setup_action_movetoedge_west(ObAction
*a
)
262 a
->data
.diraction
.direction
= OB_DIRECTION_WEST
;
265 void setup_action_growtoedge_north(ObAction
*a
)
267 a
->data
.diraction
.direction
= OB_DIRECTION_NORTH
;
270 void setup_action_growtoedge_south(ObAction
*a
)
272 a
->data
.diraction
.direction
= OB_DIRECTION_SOUTH
;
275 void setup_action_growtoedge_east(ObAction
*a
)
277 a
->data
.diraction
.direction
= OB_DIRECTION_EAST
;
280 void setup_action_growtoedge_west(ObAction
*a
)
282 a
->data
.diraction
.direction
= OB_DIRECTION_WEST
;
285 void setup_action_top_layer(ObAction
*a
)
287 a
->data
.layer
.layer
= 1;
290 void setup_action_normal_layer(ObAction
*a
)
292 a
->data
.layer
.layer
= 0;
295 void setup_action_bottom_layer(ObAction
*a
)
297 a
->data
.layer
.layer
= -1;
300 ActionString actionstrings
[] =
308 "directionalfocusnorth",
309 action_directional_focus
,
310 setup_action_directional_focus_north
313 "directionalfocuseast",
314 action_directional_focus
,
315 setup_action_directional_focus_east
318 "directionalfocussouth",
319 action_directional_focus
,
320 setup_action_directional_focus_south
323 "directionalfocuswest",
324 action_directional_focus
,
325 setup_action_directional_focus_west
328 "directionalfocusnortheast",
329 action_directional_focus
,
330 setup_action_directional_focus_northeast
333 "directionalfocussoutheast",
334 action_directional_focus
,
335 setup_action_directional_focus_southeast
338 "directionalfocussouthwest",
339 action_directional_focus
,
340 setup_action_directional_focus_southwest
343 "directionalfocusnorthwest",
344 action_directional_focus
,
345 setup_action_directional_focus_northwest
419 action_toggle_omnipresent
,
424 action_move_relative_horz
,
429 action_move_relative_vert
,
433 "resizerelativehorz",
434 action_resize_relative_horz
,
438 "resizerelativevert",
439 action_resize_relative_vert
,
444 action_maximize_full
,
449 action_unmaximize_full
,
453 "togglemaximizefull",
454 action_toggle_maximize_full
,
459 action_maximize_horz
,
464 action_unmaximize_horz
,
468 "togglemaximizehorz",
469 action_toggle_maximize_horz
,
474 action_maximize_vert
,
479 action_unmaximize_vert
,
483 "togglemaximizevert",
484 action_toggle_maximize_vert
,
489 action_send_to_desktop
,
490 setup_action_send_to_desktop
494 action_send_to_desktop_dir
,
495 setup_action_send_to_desktop_next
498 "sendtodesktopprevious",
499 action_send_to_desktop_dir
,
500 setup_action_send_to_desktop_prev
503 "sendtodesktopright",
504 action_send_to_desktop_dir
,
505 setup_action_send_to_desktop_right
509 action_send_to_desktop_dir
,
510 setup_action_send_to_desktop_left
514 action_send_to_desktop_dir
,
515 setup_action_send_to_desktop_up
519 action_send_to_desktop_dir
,
520 setup_action_send_to_desktop_down
530 setup_action_desktop_next
535 setup_action_desktop_prev
540 setup_action_desktop_right
545 setup_action_desktop_left
550 setup_action_desktop_up
555 setup_action_desktop_down
559 action_toggle_decorations
,
565 setup_action_move_keyboard
580 setup_action_resize_keyboard
584 action_toggle_show_desktop
,
594 action_unshow_desktop
,
619 action_send_to_layer
,
620 setup_action_top_layer
625 setup_action_top_layer
629 action_send_to_layer
,
630 setup_action_normal_layer
634 action_send_to_layer
,
635 setup_action_bottom_layer
638 "togglealwaysonbottom",
640 setup_action_bottom_layer
644 action_cycle_windows
,
645 setup_action_cycle_windows_linear_next
648 "previouswindowlinear",
649 action_cycle_windows
,
650 setup_action_cycle_windows_linear_previous
654 action_cycle_windows
,
655 setup_action_cycle_windows_next
659 action_cycle_windows
,
660 setup_action_cycle_windows_previous
665 setup_action_movetoedge_north
670 setup_action_movetoedge_south
675 setup_action_movetoedge_west
680 setup_action_movetoedge_east
685 setup_action_growtoedge_north
690 setup_action_growtoedge_south
695 setup_action_growtoedge_west
700 setup_action_growtoedge_east
709 ObAction
*action_from_string(char *name
)
714 for (i
= 0; actionstrings
[i
].name
; i
++)
715 if (!g_ascii_strcasecmp(name
, actionstrings
[i
].name
)) {
716 a
= action_new(actionstrings
[i
].func
);
717 if (actionstrings
[i
].setup
)
718 actionstrings
[i
].setup(a
);
724 ObAction
*action_parse(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
727 ObAction
*act
= NULL
;
730 if (parse_attr_string("name", node
, &actname
)) {
731 if ((act
= action_from_string(actname
))) {
732 if (act
->func
== action_execute
|| act
->func
== action_restart
) {
733 if ((n
= parse_find_node("execute", node
->xmlChildrenNode
)))
734 act
->data
.execute
.path
= parse_string(doc
, n
);
735 } else if (act
->func
== action_showmenu
) {
736 if ((n
= parse_find_node("menu", node
->xmlChildrenNode
)))
737 act
->data
.showmenu
.name
= parse_string(doc
, n
);
738 } else if (act
->func
== action_desktop
) {
739 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
740 act
->data
.desktop
.desk
= parse_int(doc
, n
);
741 if (act
->data
.desktop
.desk
> 0) act
->data
.desktop
.desk
--;
742 } else if (act
->func
== action_send_to_desktop
) {
743 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
744 act
->data
.sendto
.desk
= parse_int(doc
, n
);
745 if (act
->data
.sendto
.desk
> 0) act
->data
.sendto
.desk
--;
746 } else if (act
->func
== action_move_relative_horz
||
747 act
->func
== action_move_relative_vert
||
748 act
->func
== action_resize_relative_horz
||
749 act
->func
== action_resize_relative_vert
) {
750 if ((n
= parse_find_node("delta", node
->xmlChildrenNode
)))
751 act
->data
.relative
.delta
= parse_int(doc
, n
);
752 } else if (act
->func
== action_desktop_dir
) {
753 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
)))
754 act
->data
.desktopdir
.wrap
= parse_bool(doc
, n
);
755 } else if (act
->func
== action_send_to_desktop
) {
756 if ((n
= parse_find_node("follow", node
->xmlChildrenNode
)))
757 act
->data
.sendto
.follow
= parse_bool(doc
, n
);
758 } else if (act
->func
== action_send_to_desktop_dir
) {
759 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
)))
760 act
->data
.sendtodir
.wrap
= parse_bool(doc
, n
);
761 if ((n
= parse_find_node("follow", node
->xmlChildrenNode
)))
762 act
->data
.sendtodir
.follow
= parse_bool(doc
, n
);
763 } else if (act
->func
== action_activate
) {
764 if ((n
= parse_find_node("here", node
->xmlChildrenNode
)))
765 act
->data
.activate
.here
= parse_bool(doc
, n
);
773 void action_execute(union ActionData
*data
)
777 if (data
->execute
.path
) {
778 cmd
= g_filename_from_utf8(data
->execute
.path
, -1, NULL
, NULL
, NULL
);
780 if (!g_spawn_command_line_async(cmd
, &e
)) {
781 g_warning("failed to execute '%s': %s",
785 g_warning("failed to convert '%s' from utf8", data
->execute
.path
);
790 void action_activate(union ActionData
*data
)
792 if (data
->activate
.any
.c
)
793 client_activate(data
->activate
.any
.c
, data
->activate
.here
);
796 void action_focus(union ActionData
*data
)
798 if (data
->client
.any
.c
)
799 client_focus(data
->client
.any
.c
);
802 void action_unfocus (union ActionData
*data
)
804 if (data
->client
.any
.c
)
805 client_unfocus(data
->client
.any
.c
);
808 void action_iconify(union ActionData
*data
)
810 if (data
->client
.any
.c
)
811 client_iconify(data
->client
.any
.c
, TRUE
, TRUE
);
814 void action_raiselower(union ActionData
*data
)
816 ObClient
*c
= data
->client
.any
.c
;
818 gboolean raise
= FALSE
;
822 for (it
= stacking_list
; it
; it
= g_list_next(it
)) {
823 ObClient
*cit
= it
->data
;
826 if (client_normal(cit
) == client_normal(c
) &&
827 cit
->layer
== c
->layer
&&
830 if (RECT_INTERSECTS_RECT(cit
->frame
->area
, c
->frame
->area
)) {
838 stacking_raise(CLIENT_AS_WINDOW(c
));
840 stacking_lower(CLIENT_AS_WINDOW(c
));
843 void action_raise(union ActionData
*data
)
845 if (data
->client
.any
.c
)
846 stacking_raise(CLIENT_AS_WINDOW(data
->client
.any
.c
));
849 void action_unshaderaise(union ActionData
*data
)
851 if (data
->client
.any
.c
) {
852 if (data
->client
.any
.c
->shaded
)
853 client_shade(data
->client
.any
.c
, FALSE
);
855 stacking_raise(CLIENT_AS_WINDOW(data
->client
.any
.c
));
859 void action_shadelower(union ActionData
*data
)
861 if (data
->client
.any
.c
) {
862 if (data
->client
.any
.c
->shaded
)
863 stacking_lower(CLIENT_AS_WINDOW(data
->client
.any
.c
));
865 client_shade(data
->client
.any
.c
, TRUE
);
869 void action_lower(union ActionData
*data
)
871 if (data
->client
.any
.c
)
872 stacking_lower(CLIENT_AS_WINDOW(data
->client
.any
.c
));
875 void action_close(union ActionData
*data
)
877 if (data
->client
.any
.c
)
878 client_close(data
->client
.any
.c
);
881 void action_kill(union ActionData
*data
)
883 if (data
->client
.any
.c
)
884 client_kill(data
->client
.any
.c
);
887 void action_shade(union ActionData
*data
)
889 if (data
->client
.any
.c
)
890 client_shade(data
->client
.any
.c
, TRUE
);
893 void action_unshade(union ActionData
*data
)
895 if (data
->client
.any
.c
)
896 client_shade(data
->client
.any
.c
, FALSE
);
899 void action_toggle_shade(union ActionData
*data
)
901 if (data
->client
.any
.c
)
902 client_shade(data
->client
.any
.c
, !data
->client
.any
.c
->shaded
);
905 void action_toggle_omnipresent(union ActionData
*data
)
907 if (data
->client
.any
.c
)
908 client_set_desktop(data
->client
.any
.c
,
909 data
->client
.any
.c
->desktop
== DESKTOP_ALL
?
910 screen_desktop
: DESKTOP_ALL
, FALSE
);
913 void action_move_relative_horz(union ActionData
*data
)
915 ObClient
*c
= data
->relative
.any
.c
;
917 client_configure(c
, OB_CORNER_TOPLEFT
,
918 c
->area
.x
+ data
->relative
.delta
, c
->area
.y
,
919 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
922 void action_move_relative_vert(union ActionData
*data
)
924 ObClient
*c
= data
->relative
.any
.c
;
926 client_configure(c
, OB_CORNER_TOPLEFT
,
927 c
->area
.x
, c
->area
.y
+ data
->relative
.delta
,
928 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
931 void action_resize_relative_horz(union ActionData
*data
)
933 ObClient
*c
= data
->relative
.any
.c
;
935 client_configure(c
, OB_CORNER_TOPLEFT
, c
->area
.x
, c
->area
.y
,
937 data
->relative
.delta
* c
->size_inc
.width
,
938 c
->area
.height
, TRUE
, TRUE
);
941 void action_resize_relative_vert(union ActionData
*data
)
943 ObClient
*c
= data
->relative
.any
.c
;
945 client_configure(c
, OB_CORNER_TOPLEFT
, c
->area
.x
, c
->area
.y
,
946 c
->area
.width
, c
->area
.height
+
947 data
->relative
.delta
* c
->size_inc
.height
,
951 void action_maximize_full(union ActionData
*data
)
953 if (data
->client
.any
.c
)
954 client_maximize(data
->client
.any
.c
, TRUE
, 0, TRUE
);
957 void action_unmaximize_full(union ActionData
*data
)
959 if (data
->client
.any
.c
)
960 client_maximize(data
->client
.any
.c
, FALSE
, 0, TRUE
);
963 void action_toggle_maximize_full(union ActionData
*data
)
965 if (data
->client
.any
.c
)
966 client_maximize(data
->client
.any
.c
,
967 !(data
->client
.any
.c
->max_horz
||
968 data
->client
.any
.c
->max_vert
),
972 void action_maximize_horz(union ActionData
*data
)
974 if (data
->client
.any
.c
)
975 client_maximize(data
->client
.any
.c
, TRUE
, 1, TRUE
);
978 void action_unmaximize_horz(union ActionData
*data
)
980 if (data
->client
.any
.c
)
981 client_maximize(data
->client
.any
.c
, FALSE
, 1, TRUE
);
984 void action_toggle_maximize_horz(union ActionData
*data
)
986 if (data
->client
.any
.c
)
987 client_maximize(data
->client
.any
.c
,
988 !data
->client
.any
.c
->max_horz
, 1, TRUE
);
991 void action_maximize_vert(union ActionData
*data
)
993 if (data
->client
.any
.c
)
994 client_maximize(data
->client
.any
.c
, TRUE
, 2, TRUE
);
997 void action_unmaximize_vert(union ActionData
*data
)
999 if (data
->client
.any
.c
)
1000 client_maximize(data
->client
.any
.c
, FALSE
, 2, TRUE
);
1003 void action_toggle_maximize_vert(union ActionData
*data
)
1005 if (data
->client
.any
.c
)
1006 client_maximize(data
->client
.any
.c
, !data
->client
.any
.c
->max_vert
, 2, TRUE
);
1009 void action_send_to_desktop(union ActionData
*data
)
1011 ObClient
*c
= data
->sendto
.any
.c
;
1013 if (!c
|| !client_normal(c
)) return;
1015 if (data
->sendto
.desk
< screen_num_desktops
||
1016 data
->sendto
.desk
== DESKTOP_ALL
) {
1017 client_set_desktop(c
, data
->sendto
.desk
, data
->sendto
.follow
);
1018 if (data
->sendto
.follow
)
1019 screen_set_desktop(data
->sendto
.desk
);
1023 void action_desktop(union ActionData
*data
)
1025 if (data
->desktop
.desk
< screen_num_desktops
||
1026 data
->desktop
.desk
== DESKTOP_ALL
)
1027 screen_set_desktop(data
->desktop
.desk
);
1030 void action_desktop_dir(union ActionData
*data
)
1034 d
= screen_cycle_desktop(data
->desktopdir
.dir
,
1035 data
->desktopdir
.wrap
,
1036 data
->sendtodir
.linear
,
1037 data
->desktopdir
.inter
.any
.interactive
,
1038 data
->desktopdir
.inter
.final
,
1039 data
->desktopdir
.inter
.cancel
);
1040 screen_set_desktop(d
);
1043 void action_send_to_desktop_dir(union ActionData
*data
)
1045 ObClient
*c
= data
->sendtodir
.inter
.any
.c
;
1048 if (!c
|| !client_normal(c
)) return;
1050 d
= screen_cycle_desktop(data
->sendtodir
.dir
, data
->sendtodir
.wrap
,
1051 data
->sendtodir
.linear
,
1052 data
->sendtodir
.inter
.any
.interactive
,
1053 data
->sendtodir
.inter
.final
,
1054 data
->sendtodir
.inter
.cancel
);
1055 client_set_desktop(c
, d
, data
->sendtodir
.follow
);
1056 if (data
->sendtodir
.follow
)
1057 screen_set_desktop(d
);
1060 void action_desktop_last(union ActionData
*data
)
1062 screen_set_desktop(screen_last_desktop
);
1065 void action_toggle_decorations(union ActionData
*data
)
1067 ObClient
*c
= data
->client
.any
.c
;
1071 c
->decorate
= !c
->decorate
;
1072 client_setup_decor_and_functions(c
);
1075 void action_moveresize(union ActionData
*data
)
1077 ObClient
*c
= data
->moveresize
.any
.c
;
1079 if (!c
|| !client_normal(c
)) return;
1081 moveresize_start(c
, data
->moveresize
.x
, data
->moveresize
.y
,
1082 data
->moveresize
.button
, data
->moveresize
.corner
);
1085 void action_restart(union ActionData
*data
)
1087 ob_restart_other(data
->execute
.path
);
1090 void action_exit(union ActionData
*data
)
1095 void action_showmenu(union ActionData
*data
)
1097 if (data
->showmenu
.name
) {
1098 menu_show(data
->showmenu
.name
, data
->showmenu
.x
, data
->showmenu
.y
,
1099 data
->showmenu
.any
.c
);
1103 void action_cycle_windows(union ActionData
*data
)
1105 focus_cycle(data
->cycle
.forward
, data
->cycle
.linear
,
1106 data
->cycle
.inter
.any
.interactive
,
1107 data
->cycle
.inter
.final
, data
->cycle
.inter
.cancel
);
1110 void action_directional_focus(union ActionData
*data
)
1112 focus_directional_cycle(data
->interdiraction
.direction
,
1113 data
->interdiraction
.inter
.any
.interactive
,
1114 data
->interdiraction
.inter
.final
,
1115 data
->interdiraction
.inter
.cancel
);
1118 void action_movetoedge(union ActionData
*data
)
1121 ObClient
*c
= data
->diraction
.any
.c
;
1125 x
= c
->frame
->area
.x
;
1126 y
= c
->frame
->area
.y
;
1128 switch(data
->diraction
.direction
) {
1129 case OB_DIRECTION_NORTH
:
1130 y
= client_directional_edge_search(c
, OB_DIRECTION_NORTH
);
1132 case OB_DIRECTION_WEST
:
1133 x
= client_directional_edge_search(c
, OB_DIRECTION_WEST
);
1135 case OB_DIRECTION_SOUTH
:
1136 y
= client_directional_edge_search(c
, OB_DIRECTION_SOUTH
) -
1137 c
->frame
->area
.height
;
1139 case OB_DIRECTION_EAST
:
1140 x
= client_directional_edge_search(c
, OB_DIRECTION_EAST
) -
1141 c
->frame
->area
.width
;
1144 g_assert_not_reached();
1146 frame_frame_gravity(c
->frame
, &x
, &y
);
1147 client_configure(c
, OB_CORNER_TOPLEFT
,
1148 x
, y
, c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
1152 void action_growtoedge(union ActionData
*data
)
1154 int x
, y
, width
, height
, dest
;
1155 ObClient
*c
= data
->diraction
.any
.c
;
1156 Rect
*a
= screen_area(c
->desktop
);
1161 x
= c
->frame
->area
.x
;
1162 y
= c
->frame
->area
.y
;
1163 width
= c
->frame
->area
.width
;
1164 height
= c
->frame
->area
.height
;
1166 switch(data
->diraction
.direction
) {
1167 case OB_DIRECTION_NORTH
:
1168 dest
= client_directional_edge_search(c
, OB_DIRECTION_NORTH
);
1170 height
= c
->frame
->area
.height
/ 2;
1172 height
= c
->frame
->area
.y
+ c
->frame
->area
.height
- dest
;
1176 case OB_DIRECTION_WEST
:
1177 dest
= client_directional_edge_search(c
, OB_DIRECTION_WEST
);
1179 width
= c
->frame
->area
.width
/ 2;
1181 width
= c
->frame
->area
.x
+ c
->frame
->area
.width
- dest
;
1185 case OB_DIRECTION_SOUTH
:
1186 dest
= client_directional_edge_search(c
, OB_DIRECTION_SOUTH
);
1187 if (a
->y
+ a
->height
== y
+ c
->frame
->area
.height
) {
1188 height
= c
->frame
->area
.height
/ 2;
1189 y
= a
->y
+ a
->height
- height
;
1191 height
= dest
- c
->frame
->area
.y
;
1192 y
+= (height
- c
->frame
->area
.height
) % c
->size_inc
.height
;
1193 height
-= (height
- c
->frame
->area
.height
) % c
->size_inc
.height
;
1195 case OB_DIRECTION_EAST
:
1196 dest
= client_directional_edge_search(c
, OB_DIRECTION_EAST
);
1197 if (a
->x
+ a
->width
== x
+ c
->frame
->area
.width
) {
1198 width
= c
->frame
->area
.width
/ 2;
1199 x
= a
->x
+ a
->width
- width
;
1201 width
= dest
- c
->frame
->area
.x
;
1202 x
+= (width
- c
->frame
->area
.width
) % c
->size_inc
.width
;
1203 width
-= (width
- c
->frame
->area
.width
) % c
->size_inc
.width
;
1206 g_assert_not_reached();
1208 frame_frame_gravity(c
->frame
, &x
, &y
);
1209 width
-= c
->frame
->size
.left
+ c
->frame
->size
.right
;
1210 height
-= c
->frame
->size
.top
+ c
->frame
->size
.bottom
;
1211 client_configure(c
, OB_CORNER_TOPLEFT
, x
, y
, width
, height
, TRUE
, TRUE
);
1214 void action_send_to_layer(union ActionData
*data
)
1216 if (data
->layer
.any
.c
)
1217 client_set_layer(data
->layer
.any
.c
, data
->layer
.layer
);
1220 void action_toggle_layer(union ActionData
*data
)
1222 ObClient
*c
= data
->layer
.any
.c
;
1225 if (data
->layer
.layer
< 0)
1226 client_set_layer(c
, c
->below
? 0 : -1);
1227 else if (data
->layer
.layer
> 0)
1228 client_set_layer(c
, c
->above
? 0 : 1);
1232 void action_toggle_show_desktop(union ActionData
*data
)
1234 screen_show_desktop(!screen_showing_desktop
);
1237 void action_show_desktop(union ActionData
*data
)
1239 screen_show_desktop(TRUE
);
1242 void action_unshow_desktop(union ActionData
*data
)
1244 screen_show_desktop(FALSE
);