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
286 action_toggle_omnipresent
,
291 action_move_relative_horz
,
296 action_move_relative_vert
,
300 "resizerelativehorz",
301 action_resize_relative_horz
,
305 "resizerelativevert",
306 action_resize_relative_vert
,
311 action_maximize_full
,
316 action_unmaximize_full
,
320 "togglemaximizefull",
321 action_toggle_maximize_full
,
326 action_maximize_horz
,
331 action_unmaximize_horz
,
335 "togglemaximizehorz",
336 action_toggle_maximize_horz
,
341 action_maximize_vert
,
346 action_unmaximize_vert
,
350 "togglemaximizevert",
351 action_toggle_maximize_vert
,
356 action_send_to_desktop
,
357 setup_action_send_to_desktop
360 "sendtodesktopright",
361 action_send_to_desktop_right
,
362 setup_action_send_to_desktop_direction
366 action_send_to_desktop_left
,
367 setup_action_send_to_desktop_direction
371 action_send_to_desktop_up
,
372 setup_action_send_to_desktop_direction
376 action_send_to_desktop_down
,
377 setup_action_send_to_desktop_direction
386 action_desktop_right
,
387 setup_action_desktop_direction
392 setup_action_desktop_direction
397 setup_action_desktop_direction
402 setup_action_desktop_direction
406 action_toggle_decorations
,
412 setup_action_move_keyboard
427 setup_action_resize_keyboard
431 action_toggle_show_desktop
,
441 action_unshow_desktop
,
461 action_send_to_layer
,
462 setup_action_top_layer
467 setup_action_top_layer
471 action_send_to_layer
,
472 setup_action_normal_layer
476 action_send_to_layer
,
477 setup_action_bottom_layer
480 "togglealwaysonbottom",
482 setup_action_bottom_layer
486 action_cycle_windows
,
487 setup_action_cycle_windows_linear_next
490 "previouswindowlinear",
491 action_cycle_windows
,
492 setup_action_cycle_windows_linear_previous
496 action_cycle_windows
,
497 setup_action_cycle_windows_next
501 action_cycle_windows
,
502 setup_action_cycle_windows_previous
507 setup_action_movetoedge_north
512 setup_action_movetoedge_south
517 setup_action_movetoedge_west
522 setup_action_movetoedge_east
531 Action
*action_from_string(char *name
)
536 for (i
= 0; actionstrings
[i
].name
; i
++)
537 if (!g_ascii_strcasecmp(name
, actionstrings
[i
].name
)) {
538 a
= action_new(actionstrings
[i
].func
);
539 if (actionstrings
[i
].setup
)
540 actionstrings
[i
].setup(a
);
546 Action
*action_parse(xmlDocPtr doc
, xmlNodePtr node
)
552 if (parse_attr_string("name", node
, &actname
)) {
553 if ((act
= action_from_string(actname
))) {
554 if (act
->func
== action_execute
|| act
->func
== action_restart
) {
555 if ((n
= parse_find_node("execute", node
->xmlChildrenNode
)))
556 act
->data
.execute
.path
= parse_string(doc
, n
);
557 } else if (act
->func
== action_showmenu
) {
558 if ((n
= parse_find_node("menu", node
->xmlChildrenNode
)))
559 act
->data
.showmenu
.name
= parse_string(doc
, n
);
560 } else if (act
->func
== action_desktop
) {
561 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
562 act
->data
.desktop
.desk
= parse_int(doc
, n
);
563 if (act
->data
.desktop
.desk
> 0) act
->data
.desktop
.desk
--;
564 } else if (act
->func
== action_send_to_desktop
) {
565 if ((n
= parse_find_node("desktop", node
->xmlChildrenNode
)))
566 act
->data
.sendto
.desk
= parse_int(doc
, n
);
567 if (act
->data
.sendto
.desk
> 0) act
->data
.sendto
.desk
--;
568 } else if (act
->func
== action_move_relative_horz
||
569 act
->func
== action_move_relative_vert
||
570 act
->func
== action_resize_relative_horz
||
571 act
->func
== action_resize_relative_vert
) {
572 if ((n
= parse_find_node("delta", node
->xmlChildrenNode
)))
573 act
->data
.relative
.delta
= parse_int(doc
, n
);
574 } else if (act
->func
== action_desktop_right
||
575 act
->func
== action_desktop_left
||
576 act
->func
== action_desktop_up
||
577 act
->func
== action_desktop_down
) {
578 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
))) {
579 g_message("WRAP %d", parse_bool(doc
, n
));
580 act
->data
.desktopdir
.wrap
= parse_bool(doc
, n
);
582 } else if (act
->func
== action_send_to_desktop_right
||
583 act
->func
== action_send_to_desktop_left
||
584 act
->func
== action_send_to_desktop_up
||
585 act
->func
== action_send_to_desktop_down
) {
586 if ((n
= parse_find_node("wrap", node
->xmlChildrenNode
)))
587 act
->data
.sendtodir
.wrap
= parse_bool(doc
, n
);
588 if ((n
= parse_find_node("follow", node
->xmlChildrenNode
)))
589 act
->data
.sendtodir
.follow
= parse_bool(doc
, n
);
596 void action_execute(union ActionData
*data
)
600 if (data
->execute
.path
) {
601 cmd
= g_filename_from_utf8(data
->execute
.path
, -1, NULL
, NULL
, NULL
);
603 if (!g_spawn_command_line_async(cmd
, &e
)) {
604 g_warning("failed to execute '%s': %s",
608 g_warning("failed to convert '%s' from utf8", data
->execute
.path
);
613 void action_focus(union ActionData
*data
)
616 client_focus(data
->client
.c
);
619 void action_unfocus (union ActionData
*data
)
622 client_unfocus(data
->client
.c
);
625 void action_iconify(union ActionData
*data
)
628 client_iconify(data
->client
.c
, TRUE
, TRUE
);
631 void action_raise(union ActionData
*data
)
634 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
637 void action_unshaderaise(union ActionData
*data
)
639 if (data
->client
.c
) {
640 if (data
->client
.c
->shaded
)
641 client_shade(data
->client
.c
, FALSE
);
643 stacking_raise(CLIENT_AS_WINDOW(data
->client
.c
));
647 void action_shadelower(union ActionData
*data
)
649 if (data
->client
.c
) {
650 if (data
->client
.c
->shaded
)
651 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
653 client_shade(data
->client
.c
, TRUE
);
657 void action_lower(union ActionData
*data
)
660 stacking_lower(CLIENT_AS_WINDOW(data
->client
.c
));
663 void action_close(union ActionData
*data
)
666 client_close(data
->client
.c
);
669 void action_kill(union ActionData
*data
)
672 client_kill(data
->client
.c
);
675 void action_shade(union ActionData
*data
)
678 client_shade(data
->client
.c
, TRUE
);
681 void action_unshade(union ActionData
*data
)
684 client_shade(data
->client
.c
, FALSE
);
687 void action_toggle_shade(union ActionData
*data
)
690 client_shade(data
->client
.c
, !data
->client
.c
->shaded
);
693 void action_toggle_omnipresent(union ActionData
*data
)
696 client_set_desktop(data
->client
.c
,
697 data
->client
.c
->desktop
== DESKTOP_ALL
?
698 screen_desktop
: DESKTOP_ALL
, FALSE
);
701 void action_move_relative_horz(union ActionData
*data
)
703 Client
*c
= data
->relative
.c
;
705 client_configure(c
, Corner_TopLeft
,
706 c
->area
.x
+ data
->relative
.delta
, c
->area
.y
,
707 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
710 void action_move_relative_vert(union ActionData
*data
)
712 Client
*c
= data
->relative
.c
;
714 client_configure(c
, Corner_TopLeft
,
715 c
->area
.x
, c
->area
.y
+ data
->relative
.delta
,
716 c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
719 void action_resize_relative_horz(union ActionData
*data
)
721 Client
*c
= data
->relative
.c
;
723 client_configure(c
, Corner_TopLeft
, c
->area
.x
, c
->area
.y
,
725 data
->relative
.delta
* c
->size_inc
.width
,
726 c
->area
.height
, TRUE
, TRUE
);
729 void action_resize_relative_vert(union ActionData
*data
)
731 Client
*c
= data
->relative
.c
;
733 client_configure(c
, Corner_TopLeft
, c
->area
.x
, c
->area
.y
,
734 c
->area
.width
, c
->area
.height
+
735 data
->relative
.delta
* c
->size_inc
.height
,
739 void action_maximize_full(union ActionData
*data
)
742 client_maximize(data
->client
.c
, TRUE
, 0, TRUE
);
745 void action_unmaximize_full(union ActionData
*data
)
748 client_maximize(data
->client
.c
, FALSE
, 0, TRUE
);
751 void action_toggle_maximize_full(union ActionData
*data
)
754 client_maximize(data
->client
.c
,
755 !(data
->client
.c
->max_horz
||
756 data
->client
.c
->max_vert
),
760 void action_maximize_horz(union ActionData
*data
)
763 client_maximize(data
->client
.c
, TRUE
, 1, TRUE
);
766 void action_unmaximize_horz(union ActionData
*data
)
769 client_maximize(data
->client
.c
, FALSE
, 1, TRUE
);
772 void action_toggle_maximize_horz(union ActionData
*data
)
775 client_maximize(data
->client
.c
, !data
->client
.c
->max_horz
, 1, TRUE
);
778 void action_maximize_vert(union ActionData
*data
)
781 client_maximize(data
->client
.c
, TRUE
, 2, TRUE
);
784 void action_unmaximize_vert(union ActionData
*data
)
787 client_maximize(data
->client
.c
, FALSE
, 2, TRUE
);
790 void action_toggle_maximize_vert(union ActionData
*data
)
793 client_maximize(data
->client
.c
, !data
->client
.c
->max_vert
, 2, TRUE
);
796 void action_send_to_desktop(union ActionData
*data
)
798 if (data
->sendto
.c
) {
799 if (data
->sendto
.desk
< screen_num_desktops
||
800 data
->sendto
.desk
== DESKTOP_ALL
) {
801 client_set_desktop(data
->desktop
.c
,
802 data
->sendto
.desk
, data
->sendto
.follow
);
803 if (data
->sendto
.follow
) screen_set_desktop(data
->sendto
.desk
);
808 void action_desktop(union ActionData
*data
)
810 if (data
->desktop
.desk
< screen_num_desktops
||
811 data
->desktop
.desk
== DESKTOP_ALL
)
812 screen_set_desktop(data
->desktop
.desk
);
815 static void cur_row_col(guint
*r
, guint
*c
)
817 switch (screen_desktop_layout
.orientation
) {
818 case Orientation_Horz
:
819 switch (screen_desktop_layout
.start_corner
) {
821 *r
= screen_desktop
/ screen_desktop_layout
.columns
;
822 *c
= screen_desktop
% screen_desktop_layout
.columns
;
824 case Corner_BottomLeft
:
825 *r
= screen_desktop_layout
.rows
- 1 -
826 screen_desktop
/ screen_desktop_layout
.columns
;
827 *c
= screen_desktop
% screen_desktop_layout
.columns
;
829 case Corner_TopRight
:
830 *r
= screen_desktop
/ screen_desktop_layout
.columns
;
831 *c
= screen_desktop_layout
.columns
- 1 -
832 screen_desktop
% screen_desktop_layout
.columns
;
834 case Corner_BottomRight
:
835 *r
= screen_desktop_layout
.rows
- 1 -
836 screen_desktop
/ screen_desktop_layout
.columns
;
837 *c
= screen_desktop_layout
.columns
- 1 -
838 screen_desktop
% screen_desktop_layout
.columns
;
842 case Orientation_Vert
:
843 switch (screen_desktop_layout
.start_corner
) {
845 *r
= screen_desktop
% screen_desktop_layout
.rows
;
846 *c
= screen_desktop
/ screen_desktop_layout
.rows
;
848 case Corner_BottomLeft
:
849 *r
= screen_desktop_layout
.rows
- 1 -
850 screen_desktop
% screen_desktop_layout
.rows
;
851 *c
= screen_desktop
/ screen_desktop_layout
.rows
;
853 case Corner_TopRight
:
854 *r
= screen_desktop
% screen_desktop_layout
.rows
;
855 *c
= screen_desktop_layout
.columns
- 1 -
856 screen_desktop
/ screen_desktop_layout
.rows
;
858 case Corner_BottomRight
:
859 *r
= screen_desktop_layout
.rows
- 1 -
860 screen_desktop
% screen_desktop_layout
.rows
;
861 *c
= screen_desktop_layout
.columns
- 1 -
862 screen_desktop
/ screen_desktop_layout
.rows
;
869 static guint
translate_row_col(guint r
, guint c
)
871 switch (screen_desktop_layout
.orientation
) {
872 case Orientation_Horz
:
873 switch (screen_desktop_layout
.start_corner
) {
875 return r
% screen_desktop_layout
.rows
*
876 screen_desktop_layout
.columns
+
877 c
% screen_desktop_layout
.columns
;
878 case Corner_BottomLeft
:
879 return (screen_desktop_layout
.rows
- 1 -
880 r
% screen_desktop_layout
.rows
) *
881 screen_desktop_layout
.columns
+
882 c
% screen_desktop_layout
.columns
;
883 case Corner_TopRight
:
884 return r
% screen_desktop_layout
.rows
*
885 screen_desktop_layout
.columns
+
886 (screen_desktop_layout
.columns
- 1 -
887 c
% screen_desktop_layout
.columns
);
888 case Corner_BottomRight
:
889 return (screen_desktop_layout
.rows
- 1 -
890 r
% screen_desktop_layout
.rows
) *
891 screen_desktop_layout
.columns
+
892 (screen_desktop_layout
.columns
- 1 -
893 c
% screen_desktop_layout
.columns
);
895 case Orientation_Vert
:
896 switch (screen_desktop_layout
.start_corner
) {
898 return c
% screen_desktop_layout
.columns
*
899 screen_desktop_layout
.rows
+
900 r
% screen_desktop_layout
.rows
;
901 case Corner_BottomLeft
:
902 return c
% screen_desktop_layout
.columns
*
903 screen_desktop_layout
.rows
+
904 (screen_desktop_layout
.rows
- 1 -
905 r
% screen_desktop_layout
.rows
);
906 case Corner_TopRight
:
907 return (screen_desktop_layout
.columns
- 1 -
908 c
% screen_desktop_layout
.columns
) *
909 screen_desktop_layout
.rows
+
910 r
% screen_desktop_layout
.rows
;
911 case Corner_BottomRight
:
912 return (screen_desktop_layout
.columns
- 1 -
913 c
% screen_desktop_layout
.columns
) *
914 screen_desktop_layout
.rows
+
915 (screen_desktop_layout
.rows
- 1 -
916 r
% screen_desktop_layout
.rows
);
919 g_assert_not_reached();
923 void action_desktop_right(union ActionData
*data
)
929 if (c
>= screen_desktop_layout
.columns
) {
930 if (!data
->desktopdir
.wrap
) return;
933 d
= translate_row_col(r
, c
);
934 if (d
>= screen_num_desktops
) {
935 if (!data
->desktopdir
.wrap
) return;
938 d
= translate_row_col(r
, c
);
939 if (d
< screen_num_desktops
)
940 screen_set_desktop(d
);
943 void action_send_to_desktop_right(union ActionData
*data
)
947 if (data
->sendtodir
.c
) {
950 if (c
>= screen_desktop_layout
.columns
) {
951 if (!data
->sendtodir
.wrap
) return;
954 d
= translate_row_col(r
, c
);
955 if (d
>= screen_num_desktops
) {
956 if (!data
->sendtodir
.wrap
) return;
959 d
= translate_row_col(r
, c
);
960 if (d
< screen_num_desktops
) {
961 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
962 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
967 void action_desktop_left(union ActionData
*data
)
973 if (c
>= screen_desktop_layout
.columns
) {
974 if (!data
->desktopdir
.wrap
) return;
975 c
= screen_desktop_layout
.columns
- 1;
977 d
= translate_row_col(r
, c
);
978 if (d
>= screen_num_desktops
) {
979 if (!data
->desktopdir
.wrap
) return;
982 d
= translate_row_col(r
, c
);
983 if (d
< screen_num_desktops
)
984 screen_set_desktop(d
);
987 void action_send_to_desktop_left(union ActionData
*data
)
991 if (data
->sendtodir
.c
) {
994 if (c
>= screen_desktop_layout
.columns
) {
995 if (!data
->sendtodir
.wrap
) return;
996 c
= screen_desktop_layout
.columns
- 1;
998 d
= translate_row_col(r
, c
);
999 if (d
>= screen_num_desktops
) {
1000 if (!data
->sendtodir
.wrap
) return;
1003 d
= translate_row_col(r
, c
);
1004 if (d
< screen_num_desktops
) {
1005 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1006 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1011 void action_desktop_down(union ActionData
*data
)
1015 cur_row_col(&r
, &c
);
1017 if (r
>= screen_desktop_layout
.rows
) {
1018 if (!data
->desktopdir
.wrap
) return;
1021 d
= translate_row_col(r
, c
);
1022 if (d
>= screen_num_desktops
) {
1023 if (!data
->desktopdir
.wrap
) return;
1026 d
= translate_row_col(r
, c
);
1027 if (d
< screen_num_desktops
)
1028 screen_set_desktop(d
);
1031 void action_send_to_desktop_down(union ActionData
*data
)
1035 if (data
->sendtodir
.c
) {
1036 cur_row_col(&r
, &c
);
1038 if (r
>= screen_desktop_layout
.rows
) {
1039 if (!data
->sendtodir
.wrap
) return;
1042 d
= translate_row_col(r
, c
);
1043 if (d
>= screen_num_desktops
) {
1044 if (!data
->sendtodir
.wrap
) return;
1047 d
= translate_row_col(r
, c
);
1048 if (d
< screen_num_desktops
) {
1049 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1050 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1055 void action_desktop_up(union ActionData
*data
)
1059 cur_row_col(&r
, &c
);
1061 if (r
>= screen_desktop_layout
.rows
) {
1062 if (!data
->desktopdir
.wrap
) return;
1063 r
= screen_desktop_layout
.rows
- 1;
1065 d
= translate_row_col(r
, c
);
1066 if (d
>= screen_num_desktops
) {
1067 if (!data
->desktopdir
.wrap
) return;
1070 d
= translate_row_col(r
, c
);
1071 if (d
< screen_num_desktops
)
1072 screen_set_desktop(d
);
1075 void action_send_to_desktop_up(union ActionData
*data
)
1079 if (data
->sendtodir
.c
) {
1080 cur_row_col(&r
, &c
);
1082 if (r
>= screen_desktop_layout
.rows
) {
1083 if (!data
->sendtodir
.wrap
) return;
1084 r
= screen_desktop_layout
.rows
- 1;
1086 d
= translate_row_col(r
, c
);
1087 if (d
>= screen_num_desktops
) {
1088 if (!data
->sendtodir
.wrap
) return;
1091 d
= translate_row_col(r
, c
);
1092 if (d
< screen_num_desktops
) {
1093 client_set_desktop(data
->sendtodir
.c
, d
, data
->sendtodir
.follow
);
1094 if (data
->sendtodir
.follow
) screen_set_desktop(d
);
1099 void action_toggle_decorations(union ActionData
*data
)
1101 Client
*c
= data
->client
.c
;;
1105 c
->disabled_decorations
= c
->disabled_decorations
? 0 : ~0;
1106 client_setup_decor_and_functions(c
);
1109 void action_moveresize(union ActionData
*data
)
1111 Client
*c
= data
->moveresize
.c
;
1113 if (!c
|| !client_normal(c
)) return;
1115 moveresize_start(c
, data
->moveresize
.x
, data
->moveresize
.y
,
1116 data
->moveresize
.button
, data
->moveresize
.corner
);
1119 void action_restart(union ActionData
*data
)
1121 ob_restart_path
= g_strdup(data
->execute
.path
);
1122 ob_shutdown
= ob_restart
= TRUE
;
1125 void action_exit(union ActionData
*data
)
1130 void action_showmenu(union ActionData
*data
)
1132 if (data
->showmenu
.name
) {
1133 menu_show(data
->showmenu
.name
, data
->showmenu
.x
, data
->showmenu
.y
,
1138 void action_cycle_windows(union ActionData
*data
)
1142 c
= focus_cycle(data
->cycle
.forward
, data
->cycle
.linear
, data
->cycle
.final
,
1143 data
->cycle
.cancel
);
1146 void action_directional_focus(union ActionData
*data
)
1150 if (!data
->diraction
.c
)
1152 if ((nf
= client_find_directional(data
->diraction
.c
,
1153 data
->diraction
.direction
)))
1154 client_activate(nf
);
1157 void action_movetoedge(union ActionData
*data
)
1160 Client
*c
= data
->diraction
.c
;
1164 x
= c
->frame
->area
.x
;
1165 y
= c
->frame
->area
.y
;
1167 h
= screen_area(c
->desktop
)->height
;
1168 w
= screen_area(c
->desktop
)->width
;
1169 switch(data
->diraction
.direction
) {
1170 case Direction_North
:
1173 case Direction_West
:
1176 case Direction_South
:
1177 y
= h
- c
->frame
->area
.height
;
1179 case Direction_East
:
1180 x
= w
- c
->frame
->area
.width
;
1183 frame_frame_gravity(c
->frame
, &x
, &y
);
1184 client_configure(c
, Corner_TopLeft
,
1185 x
, y
, c
->area
.width
, c
->area
.height
, TRUE
, TRUE
);
1189 void action_send_to_layer(union ActionData
*data
)
1192 client_set_layer(data
->layer
.c
, data
->layer
.layer
);
1195 void action_toggle_layer(union ActionData
*data
)
1197 Client
*c
= data
->layer
.c
;
1200 if (data
->layer
.layer
< 0)
1201 client_set_layer(c
, c
->below
? 0 : -1);
1202 else if (data
->layer
.layer
> 0)
1203 client_set_layer(c
, c
->above
? 0 : 1);
1207 void action_toggle_show_desktop(union ActionData
*data
)
1209 screen_show_desktop(!screen_showing_desktop
);
1212 void action_show_desktop(union ActionData
*data
)
1214 screen_show_desktop(TRUE
);
1217 void action_unshow_desktop(union ActionData
*data
)
1219 screen_show_desktop(FALSE
);