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_top_layer(ObAction
*a
)
237 a
->data
.layer
.layer
= 1;
240 void setup_action_normal_layer(ObAction
*a
)
242 a
->data
.layer
.layer
= 0;
245 void setup_action_bottom_layer(ObAction
*a
)
247 a
->data
.layer
.layer
= -1;
250 ActionString actionstrings
[] =
258 "directionalfocusnorth",
259 action_directional_focus
,
260 setup_action_directional_focus_north
263 "directionalfocuseast",
264 action_directional_focus
,
265 setup_action_directional_focus_east
268 "directionalfocussouth",
269 action_directional_focus
,
270 setup_action_directional_focus_south
273 "directionalfocuswest",
274 action_directional_focus
,
275 setup_action_directional_focus_west
278 "directionalfocusnortheast",
279 action_directional_focus
,
280 setup_action_directional_focus_northeast
283 "directionalfocussoutheast",
284 action_directional_focus
,
285 setup_action_directional_focus_southeast
288 "directionalfocussouthwest",
289 action_directional_focus
,
290 setup_action_directional_focus_southwest
293 "directionalfocusnorthwest",
294 action_directional_focus
,
295 setup_action_directional_focus_northwest
359 action_toggle_omnipresent
,
364 action_move_relative_horz
,
369 action_move_relative_vert
,
373 "resizerelativehorz",
374 action_resize_relative_horz
,
378 "resizerelativevert",
379 action_resize_relative_vert
,
384 action_maximize_full
,
389 action_unmaximize_full
,
393 "togglemaximizefull",
394 action_toggle_maximize_full
,
399 action_maximize_horz
,
404 action_unmaximize_horz
,
408 "togglemaximizehorz",
409 action_toggle_maximize_horz
,
414 action_maximize_vert
,
419 action_unmaximize_vert
,
423 "togglemaximizevert",
424 action_toggle_maximize_vert
,
429 action_send_to_desktop
,
430 setup_action_send_to_desktop
434 action_send_to_desktop_dir
,
435 setup_action_send_to_desktop_next
438 "sendtodesktopprevious",
439 action_send_to_desktop_dir
,
440 setup_action_send_to_desktop_prev
443 "sendtodesktopright",
444 action_send_to_desktop_dir
,
445 setup_action_send_to_desktop_right
449 action_send_to_desktop_dir
,
450 setup_action_send_to_desktop_left
454 action_send_to_desktop_dir
,
455 setup_action_send_to_desktop_up
459 action_send_to_desktop_dir
,
460 setup_action_send_to_desktop_down
470 setup_action_desktop_next
475 setup_action_desktop_prev
480 setup_action_desktop_right
485 setup_action_desktop_left
490 setup_action_desktop_up
495 setup_action_desktop_down
499 action_toggle_decorations
,
505 setup_action_move_keyboard
520 setup_action_resize_keyboard
524 action_toggle_show_desktop
,
534 action_unshow_desktop
,
554 action_send_to_layer
,
555 setup_action_top_layer
560 setup_action_top_layer
564 action_send_to_layer
,
565 setup_action_normal_layer
569 action_send_to_layer
,
570 setup_action_bottom_layer
573 "togglealwaysonbottom",
575 setup_action_bottom_layer
579 action_cycle_windows
,
580 setup_action_cycle_windows_linear_next
583 "previouswindowlinear",
584 action_cycle_windows
,
585 setup_action_cycle_windows_linear_previous
589 action_cycle_windows
,
590 setup_action_cycle_windows_next
594 action_cycle_windows
,
595 setup_action_cycle_windows_previous
600 setup_action_movetoedge_north
605 setup_action_movetoedge_south
610 setup_action_movetoedge_west
615 setup_action_movetoedge_east
624 ObAction
*action_from_string(char *name
)
629 for (i
= 0; actionstrings
[i
].name
; i
++)
630 if (!g_ascii_strcasecmp(name
, actionstrings
[i
].name
)) {
631 a
= action_new(actionstrings
[i
].func
);
632 if (actionstrings
[i
].setup
)
633 actionstrings
[i
].setup(a
);
639 ObAction
*action_parse(xmlDocPtr doc
, xmlNodePtr node
)
642 ObAction
*act
= NULL
;
645 if (parse_attr_string("name", node
, &actname
)) {
646 if ((act
= action_from_string(actname
))) {
647 if (act
->func
== action_execute
|| act
->func
== action_restart
) {
648 if ((n
= parse_find_node("execute", node
->xmlChildrenNode
)))
649 act
->data
.execute
.path
= parse_string(doc
, n
);
650 } else if (act
->func
== action_showmenu
) {
651 if ((n
= parse_find_node("menu", node
->xmlChildrenNode
)))
652 act
->data
.showmenu
.name
= parse_string(doc
, n
);
653 } else if (act
->func
== action_desktop
) {
654 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
655 act
->data
.desktop
.desk
= parse_int(doc
, n
);
656 if (act
->data
.desktop
.desk
> 0) act
->data
.desktop
.desk
--;
657 } else if (act
->func
== action_send_to_desktop
) {
658 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
659 act
->data
.sendto
.desk
= parse_int(doc
, n
);
660 if (act
->data
.sendto
.desk
> 0) act
->data
.sendto
.desk
--;
661 } else if (act
->func
== action_move_relative_horz
||
662 act
->func
== action_move_relative_vert
||
663 act
->func
== action_resize_relative_horz
||
664 act
->func
== action_resize_relative_vert
) {
665 if ((n
= parse_find_node("delta", node
->xmlChildrenNode
)))
666 act
->data
.relative
.delta
= parse_int(doc
, n
);
667 } else if (act
->func
== action_desktop_dir
) {
668 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
))) {
669 act
->data
.desktopdir
.wrap
= parse_bool(doc
, n
);
671 } else if (act
->func
== action_send_to_desktop_dir
) {
672 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
)))
673 act
->data
.sendtodir
.wrap
= parse_bool(doc
, n
);
681 void action_execute(union ActionData
*data
)
685 if (data
->execute
.path
) {
686 cmd
= g_filename_from_utf8(data
->execute
.path
, -1, NULL
, NULL
, NULL
);
688 if (!g_spawn_command_line_async(cmd
, &e
)) {
689 g_warning("failed to execute '%s': %s",
693 g_warning("failed to convert '%s' from utf8", data
->execute
.path
);
698 void action_focus(union ActionData
*data
)
701 client_focus(data
->client
.c
);
704 void action_unfocus (union ActionData
*data
)
707 client_unfocus(data
->client
.c
);
710 void action_iconify(union ActionData
*data
)
713 client_iconify(data
->client
.c
, TRUE
, TRUE
);
716 void action_raise(union ActionData
*data
)
719 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
722 void action_unshaderaise(union ActionData
*data
)
724 if (data
->client
.c
) {
725 if (data
->client
.c
->shaded
)
726 client_shade(data
->client
.c
, FALSE
);
728 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
732 void action_shadelower(union ActionData
*data
)
734 if (data
->client
.c
) {
735 if (data
->client
.c
->shaded
)
736 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
738 client_shade(data
->client
.c
, TRUE
);
742 void action_lower(union ActionData
*data
)
745 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
748 void action_close(union ActionData
*data
)
751 client_close(data
->client
.c
);
754 void action_kill(union ActionData
*data
)
757 client_kill(data
->client
.c
);
760 void action_shade(union ActionData
*data
)
763 client_shade(data
->client
.c
, TRUE
);
766 void action_unshade(union ActionData
*data
)
769 client_shade(data
->client
.c
, FALSE
);
772 void action_toggle_shade(union ActionData
*data
)
775 client_shade(data
->client
.c
, !data
->client
.c
->shaded
);
778 void action_toggle_omnipresent(union ActionData
*data
)
781 client_set_desktop(data
->client
.c
,
782 data
->client
.c
->desktop
== DESKTOP_ALL
?
783 screen_desktop
: DESKTOP_ALL
, FALSE
);
786 void action_move_relative_horz(union ActionData
*data
)
788 ObClient
*c
= data
->relative
.c
;
790 client_configure(c
, OB_CORNER_TOPLEFT
,
791 c
->area
.x
+ data
->relative
.delta
, c
->area
.y
,
792 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
795 void action_move_relative_vert(union ActionData
*data
)
797 ObClient
*c
= data
->relative
.c
;
799 client_configure(c
, OB_CORNER_TOPLEFT
,
800 c
->area
.x
, c
->area
.y
+ data
->relative
.delta
,
801 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
804 void action_resize_relative_horz(union ActionData
*data
)
806 ObClient
*c
= data
->relative
.c
;
808 client_configure(c
, OB_CORNER_TOPLEFT
, c
->area
.x
, c
->area
.y
,
810 data
->relative
.delta
* c
->size_inc
.width
,
811 c
->area
.height
, TRUE
, TRUE
);
814 void action_resize_relative_vert(union ActionData
*data
)
816 ObClient
*c
= data
->relative
.c
;
818 client_configure(c
, OB_CORNER_TOPLEFT
, c
->area
.x
, c
->area
.y
,
819 c
->area
.width
, c
->area
.height
+
820 data
->relative
.delta
* c
->size_inc
.height
,
824 void action_maximize_full(union ActionData
*data
)
827 client_maximize(data
->client
.c
, TRUE
, 0, TRUE
);
830 void action_unmaximize_full(union ActionData
*data
)
833 client_maximize(data
->client
.c
, FALSE
, 0, TRUE
);
836 void action_toggle_maximize_full(union ActionData
*data
)
839 client_maximize(data
->client
.c
,
840 !(data
->client
.c
->max_horz
||
841 data
->client
.c
->max_vert
),
845 void action_maximize_horz(union ActionData
*data
)
848 client_maximize(data
->client
.c
, TRUE
, 1, TRUE
);
851 void action_unmaximize_horz(union ActionData
*data
)
854 client_maximize(data
->client
.c
, FALSE
, 1, TRUE
);
857 void action_toggle_maximize_horz(union ActionData
*data
)
860 client_maximize(data
->client
.c
, !data
->client
.c
->max_horz
, 1, TRUE
);
863 void action_maximize_vert(union ActionData
*data
)
866 client_maximize(data
->client
.c
, TRUE
, 2, TRUE
);
869 void action_unmaximize_vert(union ActionData
*data
)
872 client_maximize(data
->client
.c
, FALSE
, 2, TRUE
);
875 void action_toggle_maximize_vert(union ActionData
*data
)
878 client_maximize(data
->client
.c
, !data
->client
.c
->max_vert
, 2, TRUE
);
881 void action_send_to_desktop(union ActionData
*data
)
883 ObClient
*c
= data
->sendto
.c
;
885 if (!c
|| !client_normal(c
)) return;
887 if (data
->sendto
.desk
< screen_num_desktops
||
888 data
->sendto
.desk
== DESKTOP_ALL
) {
889 client_set_desktop(c
, data
->sendto
.desk
, TRUE
);
890 screen_set_desktop(data
->sendto
.desk
);
894 void action_desktop(union ActionData
*data
)
896 if (data
->desktop
.desk
< screen_num_desktops
||
897 data
->desktop
.desk
== DESKTOP_ALL
)
898 screen_set_desktop(data
->desktop
.desk
);
901 void action_desktop_dir(union ActionData
*data
)
905 d
= screen_cycle_desktop(data
->desktopdir
.dir
, data
->desktopdir
.wrap
,
906 data
->sendtodir
.linear
,
907 data
->desktopdir
.final
, data
->desktopdir
.cancel
);
908 screen_set_desktop(d
);
911 void action_send_to_desktop_dir(union ActionData
*data
)
913 ObClient
*c
= data
->sendtodir
.c
;
916 if (!c
|| !client_normal(c
)) return;
918 d
= screen_cycle_desktop(data
->sendtodir
.dir
, data
->sendtodir
.wrap
,
919 data
->sendtodir
.linear
,
920 data
->sendtodir
.final
, data
->sendtodir
.cancel
);
921 client_set_desktop(c
, d
, TRUE
);
922 screen_set_desktop(d
);
926 void action_desktop_right(union ActionData
*data
)
932 if (c
>= screen_desktop_layout
.columns
) {
933 if (!data
->desktopdir
.wrap
) return;
936 d
= translate_row_col(r
, c
);
937 if (d
>= screen_num_desktops
) {
938 if (!data
->desktopdir
.wrap
) return;
941 d
= translate_row_col(r
, c
);
942 if (d
< screen_num_desktops
)
943 screen_cycle_desktop(d
, data
->desktopdir
.final
,
944 data
->desktopdir
.cancel
);
947 void action_send_to_desktop_right(union ActionData
*data
)
949 ObClient
*cl
= data
->sendto
.c
;
952 if (!cl
|| !client_normal(cl
)) return;
956 if (c
>= screen_desktop_layout
.columns
) {
957 if (!data
->sendtodir
.wrap
) return;
960 d
= translate_row_col(r
, c
);
961 if (d
>= screen_num_desktops
) {
962 if (!data
->sendtodir
.wrap
) return;
965 d
= translate_row_col(r
, c
);
966 if (d
< screen_num_desktops
) {
967 client_set_desktop(cl
, d
, data
->sendtodir
.follow
);
968 if (data
->sendtodir
.follow
)
969 screen_cycle_desktop(d
, data
->desktopdir
.final
,
970 data
->desktopdir
.cancel
);
974 void action_desktop_left(union ActionData
*data
)
980 if (c
>= screen_desktop_layout
.columns
) {
981 if (!data
->desktopdir
.wrap
) return;
982 c
= screen_desktop_layout
.columns
- 1;
984 d
= translate_row_col(r
, c
);
985 if (d
>= screen_num_desktops
) {
986 if (!data
->desktopdir
.wrap
) return;
989 d
= translate_row_col(r
, c
);
990 if (d
< screen_num_desktops
)
991 screen_cycle_desktop(d
, data
->desktopdir
.final
,
992 data
->desktopdir
.cancel
);
995 void action_send_to_desktop_left(union ActionData
*data
)
997 ObClient
*cl
= data
->sendto
.c
;
1000 if (!cl
|| !client_normal(cl
)) return;
1002 cur_row_col(&r
, &c
);
1004 if (c
>= screen_desktop_layout
.columns
) {
1005 if (!data
->sendtodir
.wrap
) return;
1006 c
= screen_desktop_layout
.columns
- 1;
1008 d
= translate_row_col(r
, c
);
1009 if (d
>= screen_num_desktops
) {
1010 if (!data
->sendtodir
.wrap
) return;
1013 d
= translate_row_col(r
, c
);
1014 if (d
< screen_num_desktops
) {
1015 client_set_desktop(cl
, d
, data
->sendtodir
.follow
);
1016 if (data
->sendtodir
.follow
)
1017 screen_cycle_desktop(d
, data
->desktopdir
.final
,
1018 data
->desktopdir
.cancel
);
1022 void action_desktop_down(union ActionData
*data
)
1026 cur_row_col(&r
, &c
);
1028 if (r
>= screen_desktop_layout
.rows
) {
1029 if (!data
->desktopdir
.wrap
) return;
1032 d
= translate_row_col(r
, c
);
1033 if (d
>= screen_num_desktops
) {
1034 if (!data
->desktopdir
.wrap
) return;
1037 d
= translate_row_col(r
, c
);
1038 if (d
< screen_num_desktops
)
1039 screen_cycle_desktop(d
, data
->desktopdir
.final
,
1040 data
->desktopdir
.cancel
);
1043 void action_send_to_desktop_down(union ActionData
*data
)
1047 if (data
->sendtodir
.c
) {
1048 cur_row_col(&r
, &c
);
1050 if (r
>= screen_desktop_layout
.rows
) {
1051 if (!data
->sendtodir
.wrap
) return;
1054 d
= translate_row_col(r
, c
);
1055 if (d
>= screen_num_desktops
) {
1056 if (!data
->sendtodir
.wrap
) return;
1059 d
= translate_row_col(r
, c
);
1060 if (d
< screen_num_desktops
) {
1061 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1062 if (data
->sendtodir
.follow
)
1063 screen_cycle_desktop(d
, data
->desktopdir
.final
,
1064 data
->desktopdir
.cancel
);
1069 void action_desktop_up(union ActionData
*data
)
1073 cur_row_col(&r
, &c
);
1075 if (r
>= screen_desktop_layout
.rows
) {
1076 if (!data
->desktopdir
.wrap
) return;
1077 r
= screen_desktop_layout
.rows
- 1;
1079 d
= translate_row_col(r
, c
);
1080 if (d
>= screen_num_desktops
) {
1081 if (!data
->desktopdir
.wrap
) return;
1084 d
= translate_row_col(r
, c
);
1085 if (d
< screen_num_desktops
)
1086 screen_cycle_desktop(d
, data
->desktopdir
.final
,
1087 data
->desktopdir
.cancel
);
1090 void action_send_to_desktop_up(union ActionData
*data
)
1094 if (data
->sendtodir
.c
) {
1095 cur_row_col(&r
, &c
);
1097 if (r
>= screen_desktop_layout
.rows
) {
1098 if (!data
->sendtodir
.wrap
) return;
1099 r
= screen_desktop_layout
.rows
- 1;
1101 d
= translate_row_col(r
, c
);
1102 if (d
>= screen_num_desktops
) {
1103 if (!data
->sendtodir
.wrap
) return;
1106 d
= translate_row_col(r
, c
);
1107 if (d
< screen_num_desktops
) {
1108 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1109 if (data
->sendtodir
.follow
)
1110 screen_cycle_desktop(d
, data
->desktopdir
.final
,
1111 data
->desktopdir
.cancel
);
1117 void action_toggle_decorations(union ActionData
*data
)
1119 ObClient
*c
= data
->client
.c
;;
1123 c
->decorate
= !c
->decorate
;
1124 client_setup_decor_and_functions(c
);
1127 void action_moveresize(union ActionData
*data
)
1129 ObClient
*c
= data
->moveresize
.c
;
1131 if (!c
|| !client_normal(c
)) return;
1133 moveresize_start(c
, data
->moveresize
.x
, data
->moveresize
.y
,
1134 data
->moveresize
.button
, data
->moveresize
.corner
);
1137 void action_restart(union ActionData
*data
)
1139 ob_restart_other(data
->execute
.path
);
1142 void action_exit(union ActionData
*data
)
1147 void action_showmenu(union ActionData
*data
)
1149 if (data
->showmenu
.name
) {
1150 menu_show(data
->showmenu
.name
, data
->showmenu
.x
, data
->showmenu
.y
,
1155 void action_cycle_windows(union ActionData
*data
)
1159 c
= focus_cycle(data
->cycle
.forward
, data
->cycle
.linear
, data
->cycle
.final
,
1160 data
->cycle
.cancel
);
1163 void action_directional_focus(union ActionData
*data
)
1167 if (!data
->diraction
.c
)
1169 if ((nf
= client_find_directional(data
->diraction
.c
,
1170 data
->diraction
.direction
)))
1171 client_activate(nf
);
1174 void action_movetoedge(union ActionData
*data
)
1177 ObClient
*c
= data
->diraction
.c
;
1181 x
= c
->frame
->area
.x
;
1182 y
= c
->frame
->area
.y
;
1184 h
= screen_area(c
->desktop
)->height
;
1185 w
= screen_area(c
->desktop
)->width
;
1186 switch(data
->diraction
.direction
) {
1187 case OB_DIRECTION_NORTH
:
1190 case OB_DIRECTION_WEST
:
1193 case OB_DIRECTION_SOUTH
:
1194 y
= h
- c
->frame
->area
.height
;
1196 case OB_DIRECTION_EAST
:
1197 x
= w
- c
->frame
->area
.width
;
1200 g_assert_not_reached();
1202 frame_frame_gravity(c
->frame
, &x
, &y
);
1203 client_configure(c
, OB_CORNER_TOPLEFT
,
1204 x
, y
, c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
1208 void action_send_to_layer(union ActionData
*data
)
1211 client_set_layer(data
->layer
.c
, data
->layer
.layer
);
1214 void action_toggle_layer(union ActionData
*data
)
1216 ObClient
*c
= data
->layer
.c
;
1219 if (data
->layer
.layer
< 0)
1220 client_set_layer(c
, c
->below
? 0 : -1);
1221 else if (data
->layer
.layer
> 0)
1222 client_set_layer(c
, c
->above
? 0 : 1);
1226 void action_toggle_show_desktop(union ActionData
*data
)
1228 screen_show_desktop(!screen_showing_desktop
);
1231 void action_show_desktop(union ActionData
*data
)
1233 screen_show_desktop(TRUE
);
1236 void action_unshow_desktop(union ActionData
*data
)
1238 screen_show_desktop(FALSE
);