3 #include "moveresize.h"
15 typedef struct ActionString
{
17 void (*func
)(union ActionData
*);
18 void (*setup
)(Action
*);
21 Action
*action_new(void (*func
)(union ActionData
*data
))
23 Action
*a
= g_new0(Action
, 1);
29 void action_free(Action
*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(Action
*a
)
44 a
->data
.diraction
.direction
= Direction_North
;
47 void setup_action_directional_focus_east(Action
*a
)
49 a
->data
.diraction
.direction
= Direction_East
;
52 void setup_action_directional_focus_south(Action
*a
)
54 a
->data
.diraction
.direction
= Direction_South
;
57 void setup_action_directional_focus_west(Action
*a
)
59 a
->data
.diraction
.direction
= Direction_West
;
62 void setup_action_directional_focus_northeast(Action
*a
)
64 a
->data
.diraction
.direction
= Direction_NorthEast
;
67 void setup_action_directional_focus_southeast(Action
*a
)
69 a
->data
.diraction
.direction
= Direction_SouthEast
;
72 void setup_action_directional_focus_southwest(Action
*a
)
74 a
->data
.diraction
.direction
= Direction_SouthWest
;
77 void setup_action_directional_focus_northwest(Action
*a
)
79 a
->data
.diraction
.direction
= Direction_NorthWest
;
82 void setup_action_send_to_desktop(Action
*a
)
84 a
->data
.sendto
.follow
= TRUE
;
87 void setup_action_send_to_desktop_direction(Action
*a
)
89 a
->data
.sendtodir
.wrap
= TRUE
;
90 a
->data
.sendtodir
.follow
= TRUE
;
93 void setup_action_desktop_direction(Action
*a
)
95 a
->data
.desktopdir
.wrap
= TRUE
;
98 void setup_action_move_keyboard(Action
*a
)
100 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_move_keyboard
;
103 void setup_action_move(Action
*a
)
105 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_move
;
108 void setup_action_resize(Action
*a
)
110 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_size_topleft
;
113 void setup_action_resize_keyboard(Action
*a
)
115 a
->data
.moveresize
.corner
= prop_atoms
.net_wm_moveresize_size_keyboard
;
118 void setup_action_cycle_windows_linear_next(Action
*a
)
120 a
->data
.cycle
.linear
= TRUE
;
121 a
->data
.cycle
.forward
= TRUE
;
124 void setup_action_cycle_windows_linear_previous(Action
*a
)
126 a
->data
.cycle
.linear
= TRUE
;
127 a
->data
.cycle
.forward
= FALSE
;
130 void setup_action_cycle_windows_next(Action
*a
)
132 a
->data
.cycle
.linear
= FALSE
;
133 a
->data
.cycle
.forward
= TRUE
;
136 void setup_action_cycle_windows_previous(Action
*a
)
138 a
->data
.cycle
.linear
= FALSE
;
139 a
->data
.cycle
.forward
= FALSE
;
142 void setup_action_movetoedge_north(Action
*a
)
144 a
->data
.diraction
.direction
= Direction_North
;
147 void setup_action_movetoedge_south(Action
*a
)
149 a
->data
.diraction
.direction
= Direction_South
;
152 void setup_action_movetoedge_east(Action
*a
)
154 a
->data
.diraction
.direction
= Direction_East
;
157 void setup_action_movetoedge_west(Action
*a
)
159 a
->data
.diraction
.direction
= Direction_West
;
162 void setup_action_top_layer(Action
*a
)
164 a
->data
.layer
.layer
= 1;
167 void setup_action_normal_layer(Action
*a
)
169 a
->data
.layer
.layer
= 0;
172 void setup_action_bottom_layer(Action
*a
)
174 a
->data
.layer
.layer
= -1;
177 ActionString actionstrings
[] =
185 "directionalfocusnorth",
186 action_directional_focus
,
187 setup_action_directional_focus_north
190 "directionalfocuseast",
191 action_directional_focus
,
192 setup_action_directional_focus_east
195 "directionalfocussouth",
196 action_directional_focus
,
197 setup_action_directional_focus_south
200 "directionalfocuswest",
201 action_directional_focus
,
202 setup_action_directional_focus_west
205 "directionalfocusnortheast",
206 action_directional_focus
,
207 setup_action_directional_focus_northeast
210 "directionalfocussoutheast",
211 action_directional_focus
,
212 setup_action_directional_focus_southeast
215 "directionalfocussouthwest",
216 action_directional_focus
,
217 setup_action_directional_focus_southwest
220 "directionalfocusnorthwest",
221 action_directional_focus
,
222 setup_action_directional_focus_northwest
291 action_toggle_omnipresent
,
296 action_move_relative_horz
,
301 action_move_relative_vert
,
305 "resizerelativehorz",
306 action_resize_relative_horz
,
310 "resizerelativevert",
311 action_resize_relative_vert
,
316 action_maximize_full
,
321 action_unmaximize_full
,
325 "togglemaximizefull",
326 action_toggle_maximize_full
,
331 action_maximize_horz
,
336 action_unmaximize_horz
,
340 "togglemaximizehorz",
341 action_toggle_maximize_horz
,
346 action_maximize_vert
,
351 action_unmaximize_vert
,
355 "togglemaximizevert",
356 action_toggle_maximize_vert
,
361 action_send_to_desktop
,
362 setup_action_send_to_desktop
365 "sendtodesktopright",
366 action_send_to_desktop_right
,
367 setup_action_send_to_desktop_direction
371 action_send_to_desktop_left
,
372 setup_action_send_to_desktop_direction
376 action_send_to_desktop_up
,
377 setup_action_send_to_desktop_direction
381 action_send_to_desktop_down
,
382 setup_action_send_to_desktop_direction
391 action_desktop_right
,
392 setup_action_desktop_direction
397 setup_action_desktop_direction
402 setup_action_desktop_direction
407 setup_action_desktop_direction
411 action_toggle_decorations
,
417 setup_action_move_keyboard
432 setup_action_resize_keyboard
436 action_toggle_show_desktop
,
446 action_unshow_desktop
,
466 action_send_to_layer
,
467 setup_action_top_layer
472 setup_action_top_layer
476 action_send_to_layer
,
477 setup_action_normal_layer
481 action_send_to_layer
,
482 setup_action_bottom_layer
485 "togglealwaysonbottom",
487 setup_action_bottom_layer
491 action_cycle_windows
,
492 setup_action_cycle_windows_linear_next
495 "previouswindowlinear",
496 action_cycle_windows
,
497 setup_action_cycle_windows_linear_previous
501 action_cycle_windows
,
502 setup_action_cycle_windows_next
506 action_cycle_windows
,
507 setup_action_cycle_windows_previous
512 setup_action_movetoedge_north
517 setup_action_movetoedge_south
522 setup_action_movetoedge_west
527 setup_action_movetoedge_east
536 Action
*action_from_string(char *name
)
541 for (i
= 0; actionstrings
[i
].name
; i
++)
542 if (!g_ascii_strcasecmp(name
, actionstrings
[i
].name
)) {
543 a
= action_new(actionstrings
[i
].func
);
544 if (actionstrings
[i
].setup
)
545 actionstrings
[i
].setup(a
);
551 Action
*action_parse(xmlDocPtr doc
, xmlNodePtr node
)
557 if (parse_attr_string("name", node
, &actname
)) {
558 if ((act
= action_from_string(actname
))) {
559 if (act
->func
== action_execute
|| act
->func
== action_restart
) {
560 if ((n
= parse_find_node("execute", node
->xmlChildrenNode
)))
561 act
->data
.execute
.path
= parse_string(doc
, n
);
562 } else if (act
->func
== action_showmenu
) {
563 if ((n
= parse_find_node("menu", node
->xmlChildrenNode
)))
564 act
->data
.showmenu
.name
= parse_string(doc
, n
);
565 } else if (act
->func
== action_desktop
) {
566 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
567 act
->data
.desktop
.desk
= parse_int(doc
, n
);
568 if (act
->data
.desktop
.desk
> 0) act
->data
.desktop
.desk
--;
569 } else if (act
->func
== action_send_to_desktop
) {
570 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
571 act
->data
.sendto
.desk
= parse_int(doc
, n
);
572 if (act
->data
.sendto
.desk
> 0) act
->data
.sendto
.desk
--;
573 } else if (act
->func
== action_move_relative_horz
||
574 act
->func
== action_move_relative_vert
||
575 act
->func
== action_resize_relative_horz
||
576 act
->func
== action_resize_relative_vert
) {
577 if ((n
= parse_find_node("delta", node
->xmlChildrenNode
)))
578 act
->data
.relative
.delta
= parse_int(doc
, n
);
579 } else if (act
->func
== action_desktop_right
||
580 act
->func
== action_desktop_left
||
581 act
->func
== action_desktop_up
||
582 act
->func
== action_desktop_down
) {
583 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
))) {
584 g_message("WRAP %d", parse_bool(doc
, n
));
585 act
->data
.desktopdir
.wrap
= parse_bool(doc
, n
);
587 } else if (act
->func
== action_send_to_desktop_right
||
588 act
->func
== action_send_to_desktop_left
||
589 act
->func
== action_send_to_desktop_up
||
590 act
->func
== action_send_to_desktop_down
) {
591 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
)))
592 act
->data
.sendtodir
.wrap
= parse_bool(doc
, n
);
593 if ((n
= parse_find_node("follow", node
->xmlChildrenNode
)))
594 act
->data
.sendtodir
.follow
= parse_bool(doc
, n
);
601 void action_execute(union ActionData
*data
)
605 if (data
->execute
.path
) {
606 cmd
= g_filename_from_utf8(data
->execute
.path
, -1, NULL
, NULL
, NULL
);
608 if (!g_spawn_command_line_async(cmd
, &e
)) {
609 g_warning("failed to execute '%s': %s",
613 g_warning("failed to convert '%s' from utf8", data
->execute
.path
);
618 void action_focus(union ActionData
*data
)
621 client_focus(data
->client
.c
);
624 void action_unfocus (union ActionData
*data
)
627 client_unfocus(data
->client
.c
);
630 void action_iconify(union ActionData
*data
)
633 client_iconify(data
->client
.c
, TRUE
, TRUE
);
636 void action_focusraise(union ActionData
*data
)
638 if (data
->client
.c
) {
639 client_focus(data
->client
.c
);
640 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
644 void action_raise(union ActionData
*data
)
647 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
650 void action_unshaderaise(union ActionData
*data
)
652 if (data
->client
.c
) {
653 if (data
->client
.c
->shaded
)
654 client_shade(data
->client
.c
, FALSE
);
656 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
660 void action_shadelower(union ActionData
*data
)
662 if (data
->client
.c
) {
663 if (data
->client
.c
->shaded
)
664 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
666 client_shade(data
->client
.c
, TRUE
);
670 void action_lower(union ActionData
*data
)
673 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
676 void action_close(union ActionData
*data
)
679 client_close(data
->client
.c
);
682 void action_kill(union ActionData
*data
)
685 client_kill(data
->client
.c
);
688 void action_shade(union ActionData
*data
)
691 client_shade(data
->client
.c
, TRUE
);
694 void action_unshade(union ActionData
*data
)
697 client_shade(data
->client
.c
, FALSE
);
700 void action_toggle_shade(union ActionData
*data
)
703 client_shade(data
->client
.c
, !data
->client
.c
->shaded
);
706 void action_toggle_omnipresent(union ActionData
*data
)
709 client_set_desktop(data
->client
.c
,
710 data
->client
.c
->desktop
== DESKTOP_ALL
?
711 screen_desktop
: DESKTOP_ALL
, FALSE
);
714 void action_move_relative_horz(union ActionData
*data
)
716 Client
*c
= data
->relative
.c
;
718 client_configure(c
, Corner_TopLeft
,
719 c
->area
.x
+ data
->relative
.delta
, c
->area
.y
,
720 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
723 void action_move_relative_vert(union ActionData
*data
)
725 Client
*c
= data
->relative
.c
;
727 client_configure(c
, Corner_TopLeft
,
728 c
->area
.x
, c
->area
.y
+ data
->relative
.delta
,
729 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
732 void action_resize_relative_horz(union ActionData
*data
)
734 Client
*c
= data
->relative
.c
;
736 client_configure(c
, Corner_TopLeft
, c
->area
.x
, c
->area
.y
,
738 data
->relative
.delta
* c
->size_inc
.width
,
739 c
->area
.height
, TRUE
, TRUE
);
742 void action_resize_relative_vert(union ActionData
*data
)
744 Client
*c
= data
->relative
.c
;
746 client_configure(c
, Corner_TopLeft
, c
->area
.x
, c
->area
.y
,
747 c
->area
.width
, c
->area
.height
+
748 data
->relative
.delta
* c
->size_inc
.height
,
752 void action_maximize_full(union ActionData
*data
)
755 client_maximize(data
->client
.c
, TRUE
, 0, TRUE
);
758 void action_unmaximize_full(union ActionData
*data
)
761 client_maximize(data
->client
.c
, FALSE
, 0, TRUE
);
764 void action_toggle_maximize_full(union ActionData
*data
)
767 client_maximize(data
->client
.c
,
768 !(data
->client
.c
->max_horz
||
769 data
->client
.c
->max_vert
),
773 void action_maximize_horz(union ActionData
*data
)
776 client_maximize(data
->client
.c
, TRUE
, 1, TRUE
);
779 void action_unmaximize_horz(union ActionData
*data
)
782 client_maximize(data
->client
.c
, FALSE
, 1, TRUE
);
785 void action_toggle_maximize_horz(union ActionData
*data
)
788 client_maximize(data
->client
.c
, !data
->client
.c
->max_horz
, 1, TRUE
);
791 void action_maximize_vert(union ActionData
*data
)
794 client_maximize(data
->client
.c
, TRUE
, 2, TRUE
);
797 void action_unmaximize_vert(union ActionData
*data
)
800 client_maximize(data
->client
.c
, FALSE
, 2, TRUE
);
803 void action_toggle_maximize_vert(union ActionData
*data
)
806 client_maximize(data
->client
.c
, !data
->client
.c
->max_vert
, 2, TRUE
);
809 void action_send_to_desktop(union ActionData
*data
)
811 if (data
->sendto
.c
) {
812 if (data
->sendto
.desk
< screen_num_desktops
||
813 data
->sendto
.desk
== DESKTOP_ALL
) {
814 client_set_desktop(data
->desktop
.c
,
815 data
->sendto
.desk
, data
->sendto
.follow
);
816 if (data
->sendto
.follow
) screen_set_desktop(data
->sendto
.desk
);
821 void action_desktop(union ActionData
*data
)
823 if (data
->desktop
.desk
< screen_num_desktops
||
824 data
->desktop
.desk
== DESKTOP_ALL
)
825 screen_set_desktop(data
->desktop
.desk
);
828 static void cur_row_col(guint
*r
, guint
*c
)
830 switch (screen_desktop_layout
.orientation
) {
831 case Orientation_Horz
:
832 switch (screen_desktop_layout
.start_corner
) {
834 *r
= screen_desktop
/ screen_desktop_layout
.columns
;
835 *c
= screen_desktop
% screen_desktop_layout
.columns
;
837 case Corner_BottomLeft
:
838 *r
= screen_desktop_layout
.rows
- 1 -
839 screen_desktop
/ screen_desktop_layout
.columns
;
840 *c
= screen_desktop
% screen_desktop_layout
.columns
;
842 case Corner_TopRight
:
843 *r
= screen_desktop
/ screen_desktop_layout
.columns
;
844 *c
= screen_desktop_layout
.columns
- 1 -
845 screen_desktop
% screen_desktop_layout
.columns
;
847 case Corner_BottomRight
:
848 *r
= screen_desktop_layout
.rows
- 1 -
849 screen_desktop
/ screen_desktop_layout
.columns
;
850 *c
= screen_desktop_layout
.columns
- 1 -
851 screen_desktop
% screen_desktop_layout
.columns
;
855 case Orientation_Vert
:
856 switch (screen_desktop_layout
.start_corner
) {
858 *r
= screen_desktop
% screen_desktop_layout
.rows
;
859 *c
= screen_desktop
/ screen_desktop_layout
.rows
;
861 case Corner_BottomLeft
:
862 *r
= screen_desktop_layout
.rows
- 1 -
863 screen_desktop
% screen_desktop_layout
.rows
;
864 *c
= screen_desktop
/ screen_desktop_layout
.rows
;
866 case Corner_TopRight
:
867 *r
= screen_desktop
% screen_desktop_layout
.rows
;
868 *c
= screen_desktop_layout
.columns
- 1 -
869 screen_desktop
/ screen_desktop_layout
.rows
;
871 case Corner_BottomRight
:
872 *r
= screen_desktop_layout
.rows
- 1 -
873 screen_desktop
% screen_desktop_layout
.rows
;
874 *c
= screen_desktop_layout
.columns
- 1 -
875 screen_desktop
/ screen_desktop_layout
.rows
;
882 static guint
translate_row_col(guint r
, guint c
)
884 switch (screen_desktop_layout
.orientation
) {
885 case Orientation_Horz
:
886 switch (screen_desktop_layout
.start_corner
) {
888 return r
% screen_desktop_layout
.rows
*
889 screen_desktop_layout
.columns
+
890 c
% screen_desktop_layout
.columns
;
891 case Corner_BottomLeft
:
892 return (screen_desktop_layout
.rows
- 1 -
893 r
% screen_desktop_layout
.rows
) *
894 screen_desktop_layout
.columns
+
895 c
% screen_desktop_layout
.columns
;
896 case Corner_TopRight
:
897 return r
% screen_desktop_layout
.rows
*
898 screen_desktop_layout
.columns
+
899 (screen_desktop_layout
.columns
- 1 -
900 c
% screen_desktop_layout
.columns
);
901 case Corner_BottomRight
:
902 return (screen_desktop_layout
.rows
- 1 -
903 r
% screen_desktop_layout
.rows
) *
904 screen_desktop_layout
.columns
+
905 (screen_desktop_layout
.columns
- 1 -
906 c
% screen_desktop_layout
.columns
);
908 case Orientation_Vert
:
909 switch (screen_desktop_layout
.start_corner
) {
911 return c
% screen_desktop_layout
.columns
*
912 screen_desktop_layout
.rows
+
913 r
% screen_desktop_layout
.rows
;
914 case Corner_BottomLeft
:
915 return c
% screen_desktop_layout
.columns
*
916 screen_desktop_layout
.rows
+
917 (screen_desktop_layout
.rows
- 1 -
918 r
% screen_desktop_layout
.rows
);
919 case Corner_TopRight
:
920 return (screen_desktop_layout
.columns
- 1 -
921 c
% screen_desktop_layout
.columns
) *
922 screen_desktop_layout
.rows
+
923 r
% screen_desktop_layout
.rows
;
924 case Corner_BottomRight
:
925 return (screen_desktop_layout
.columns
- 1 -
926 c
% screen_desktop_layout
.columns
) *
927 screen_desktop_layout
.rows
+
928 (screen_desktop_layout
.rows
- 1 -
929 r
% screen_desktop_layout
.rows
);
932 g_assert_not_reached();
936 void action_desktop_right(union ActionData
*data
)
942 if (c
>= screen_desktop_layout
.columns
) {
943 if (!data
->desktopdir
.wrap
) return;
946 d
= translate_row_col(r
, c
);
947 if (d
>= screen_num_desktops
) {
948 if (!data
->desktopdir
.wrap
) return;
951 d
= translate_row_col(r
, c
);
952 if (d
< screen_num_desktops
)
953 screen_set_desktop(d
);
956 void action_send_to_desktop_right(union ActionData
*data
)
960 if (data
->sendtodir
.c
) {
963 if (c
>= screen_desktop_layout
.columns
) {
964 if (!data
->sendtodir
.wrap
) return;
967 d
= translate_row_col(r
, c
);
968 if (d
>= screen_num_desktops
) {
969 if (!data
->sendtodir
.wrap
) return;
972 d
= translate_row_col(r
, c
);
973 if (d
< screen_num_desktops
) {
974 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
975 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
980 void action_desktop_left(union ActionData
*data
)
986 if (c
>= screen_desktop_layout
.columns
) {
987 if (!data
->desktopdir
.wrap
) return;
988 c
= screen_desktop_layout
.columns
- 1;
990 d
= translate_row_col(r
, c
);
991 if (d
>= screen_num_desktops
) {
992 if (!data
->desktopdir
.wrap
) return;
995 d
= translate_row_col(r
, c
);
996 if (d
< screen_num_desktops
)
997 screen_set_desktop(d
);
1000 void action_send_to_desktop_left(union ActionData
*data
)
1004 if (data
->sendtodir
.c
) {
1005 cur_row_col(&r
, &c
);
1007 if (c
>= screen_desktop_layout
.columns
) {
1008 if (!data
->sendtodir
.wrap
) return;
1009 c
= screen_desktop_layout
.columns
- 1;
1011 d
= translate_row_col(r
, c
);
1012 if (d
>= screen_num_desktops
) {
1013 if (!data
->sendtodir
.wrap
) return;
1016 d
= translate_row_col(r
, c
);
1017 if (d
< screen_num_desktops
) {
1018 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1019 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1024 void action_desktop_down(union ActionData
*data
)
1028 cur_row_col(&r
, &c
);
1030 if (r
>= screen_desktop_layout
.rows
) {
1031 if (!data
->desktopdir
.wrap
) return;
1034 d
= translate_row_col(r
, c
);
1035 if (d
>= screen_num_desktops
) {
1036 if (!data
->desktopdir
.wrap
) return;
1039 d
= translate_row_col(r
, c
);
1040 if (d
< screen_num_desktops
)
1041 screen_set_desktop(d
);
1044 void action_send_to_desktop_down(union ActionData
*data
)
1048 if (data
->sendtodir
.c
) {
1049 cur_row_col(&r
, &c
);
1051 if (r
>= screen_desktop_layout
.rows
) {
1052 if (!data
->sendtodir
.wrap
) return;
1055 d
= translate_row_col(r
, c
);
1056 if (d
>= screen_num_desktops
) {
1057 if (!data
->sendtodir
.wrap
) return;
1060 d
= translate_row_col(r
, c
);
1061 if (d
< screen_num_desktops
) {
1062 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1063 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1068 void action_desktop_up(union ActionData
*data
)
1072 cur_row_col(&r
, &c
);
1074 if (r
>= screen_desktop_layout
.rows
) {
1075 if (!data
->desktopdir
.wrap
) return;
1076 r
= screen_desktop_layout
.rows
- 1;
1078 d
= translate_row_col(r
, c
);
1079 if (d
>= screen_num_desktops
) {
1080 if (!data
->desktopdir
.wrap
) return;
1083 d
= translate_row_col(r
, c
);
1084 if (d
< screen_num_desktops
)
1085 screen_set_desktop(d
);
1088 void action_send_to_desktop_up(union ActionData
*data
)
1092 if (data
->sendtodir
.c
) {
1093 cur_row_col(&r
, &c
);
1095 if (r
>= screen_desktop_layout
.rows
) {
1096 if (!data
->sendtodir
.wrap
) return;
1097 r
= screen_desktop_layout
.rows
- 1;
1099 d
= translate_row_col(r
, c
);
1100 if (d
>= screen_num_desktops
) {
1101 if (!data
->sendtodir
.wrap
) return;
1104 d
= translate_row_col(r
, c
);
1105 if (d
< screen_num_desktops
) {
1106 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1107 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1112 void action_toggle_decorations(union ActionData
*data
)
1114 Client
*c
= data
->client
.c
;;
1118 c
->disabled_decorations
= c
->disabled_decorations
? 0 : ~0;
1119 client_setup_decor_and_functions(c
);
1122 void action_moveresize(union ActionData
*data
)
1124 Client
*c
= data
->moveresize
.c
;
1126 if (!c
|| !client_normal(c
)) return;
1128 moveresize_start(c
, data
->moveresize
.x
, data
->moveresize
.y
,
1129 data
->moveresize
.button
, data
->moveresize
.corner
);
1132 void action_restart(union ActionData
*data
)
1134 ob_restart_path
= data
->execute
.path
;
1135 ob_shutdown
= ob_restart
= TRUE
;
1138 void action_exit(union ActionData
*data
)
1143 void action_showmenu(union ActionData
*data
)
1145 if (data
->showmenu
.name
) {
1146 menu_show(data
->showmenu
.name
, data
->showmenu
.x
, data
->showmenu
.y
,
1151 void action_cycle_windows(union ActionData
*data
)
1155 c
= focus_cycle(data
->cycle
.forward
, data
->cycle
.linear
, data
->cycle
.final
,
1156 data
->cycle
.cancel
);
1159 void action_directional_focus(union ActionData
*data
)
1163 if (!data
->diraction
.c
)
1165 if ((nf
= client_find_directional(data
->diraction
.c
,
1166 data
->diraction
.direction
)))
1167 client_activate(nf
);
1170 void action_movetoedge(union ActionData
*data
)
1173 Client
*c
= data
->diraction
.c
;
1177 x
= c
->frame
->area
.x
;
1178 y
= c
->frame
->area
.y
;
1180 h
= screen_area(c
->desktop
)->height
;
1181 w
= screen_area(c
->desktop
)->width
;
1182 switch(data
->diraction
.direction
) {
1183 case Direction_North
:
1186 case Direction_West
:
1189 case Direction_South
:
1190 y
= h
- c
->frame
->area
.height
;
1192 case Direction_East
:
1193 x
= w
- c
->frame
->area
.width
;
1196 frame_frame_gravity(c
->frame
, &x
, &y
);
1197 client_configure(c
, Corner_TopLeft
,
1198 x
, y
, c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
1202 void action_send_to_layer(union ActionData
*data
)
1205 client_set_layer(data
->layer
.c
, data
->layer
.layer
);
1208 void action_toggle_layer(union ActionData
*data
)
1210 Client
*c
= data
->layer
.c
;
1213 if (data
->layer
.layer
< 0)
1214 client_set_layer(c
, c
->below
? 0 : -1);
1215 else if (data
->layer
.layer
> 0)
1216 client_set_layer(c
, c
->above
? 0 : 1);
1220 void action_toggle_show_desktop(union ActionData
*data
)
1222 screen_show_desktop(!screen_showing_desktop
);
1225 void action_show_desktop(union ActionData
*data
)
1227 screen_show_desktop(TRUE
);
1230 void action_unshow_desktop(union ActionData
*data
)
1232 screen_show_desktop(FALSE
);