4 # define MAX(x, y) (((x) > (y)) ? (x) : (y))
10 act = e_action_add(#name); \
11 if (act) act->func.go = _e_actions_act_##name##_go; \
13 #define ACT_FN_GO(act, use) \
14 static void _e_actions_act_##act##_go(E_Object *obj __UNUSED__, const char *params use)
16 #define ACT_GO_MOUSE(name) \
18 act = e_action_add(#name); \
19 if (act) act->func.go_mouse = _e_actions_act_##name##_go_mouse; \
21 #define ACT_FN_GO_MOUSE(act, use) \
22 static void _e_actions_act_##act##_go_mouse(E_Object *obj __UNUSED__, const char *params use, Ecore_Event_Mouse_Button *ev __UNUSED__)
24 #define ACT_GO_WHEEL(name) \
26 act = e_action_add(#name); \
27 if (act) act->func.go_wheel = _e_actions_act_##name##_go_wheel; \
29 #define ACT_FN_GO_WHEEL(act, use) \
30 static void _e_actions_act_##act##_go_wheel(E_Object *obj __UNUSED__, const char *params use, Ecore_Event_Mouse_Wheel *ev __UNUSED__)
32 #define ACT_GO_EDGE(name) \
34 act = e_action_add(#name); \
35 if (act) act->func.go_edge = _e_actions_act_##name##_go_edge; \
37 #define ACT_FN_GO_EDGE(act, use) \
38 static void _e_actions_act_##act##_go_edge(E_Object *obj __UNUSED__, const char *params use, E_Event_Zone_Edge *ev __UNUSED__)
40 #define ACT_GO_SIGNAL(name) \
42 act = e_action_add(#name); \
43 if (act) act->func.go_signal = _e_actions_act_##name##_go_signal; \
45 #define ACT_FN_GO_SIGNAL(act, use) \
46 static void _e_actions_act_##act##_go_signal(E_Object *obj __UNUSED__, const char *params use, const char *sig, const char *src)
48 #define ACT_GO_KEY(name) \
50 act = e_action_add(#name); \
51 if (act) act->func.go_key = _e_actions_act_##name##_go_key; \
53 #define ACT_FN_GO_KEY(act, use) \
54 static void _e_actions_act_##act##_go_key(E_Object *obj __UNUSED__, const char *params use, Ecore_Event_Key *ev __UNUSED__)
56 #define ACT_END(name) \
58 act = e_action_add(#name); \
59 if (act) act->func.end = _e_actions_act_##name##_end; \
61 #define ACT_FN_END(act, use) \
62 static void _e_actions_act_##act##_end(E_Object *obj __UNUSED__, const char *params use)
64 #define ACT_END_MOUSE(name) \
66 act = e_action_add(#name); \
67 if (act) act->func.end_mouse = _e_actions_act_##name##_end_mouse; \
69 #define ACT_FN_END_MOUSE(act, use) \
70 static void _e_actions_act_##act##_end_mouse(E_Object *obj __UNUSED__, const char *params use, Ecore_Event_Mouse_Button *ev __UNUSED__)
72 #define ACT_END_KEY(name) \
74 act = e_action_add(#name); \
75 if (act) act->func.end_key = _e_actions_act_##name##_end_key; \
77 #define ACT_FN_END_KEY(act, use) \
78 static void _e_actions_act_##act##_end_key(E_Object *obj __UNUSED__, const char *params use, Ecore_Event_Key *ev __UNUSED__)
80 #define ACT_GO_ACPI(name) \
82 act = e_action_add(#name); \
83 if (act) act->func.go_acpi = _e_actions_act_##name##_go_acpi; \
85 #define ACT_FN_GO_ACPI(act, use) \
86 static void _e_actions_act_##act##_go_acpi(E_Object *obj __UNUSED__, const char *params use, E_Event_Acpi *ev __UNUSED__)
88 /* local subsystem functions */
89 static void _e_action_free(E_Action *act);
90 static E_Maximize _e_actions_maximize_parse(const char *maximize);
91 static int _action_groups_sort_cb(const void *d1, const void *d2);
93 /* to save writing this in N places - the sections are defined here */
94 /***************************************************************************/
95 ACT_FN_GO(window_move, __UNUSED__)
97 if (!obj) obj = E_OBJECT(e_border_focused_get());
99 if (obj->type != E_BORDER_TYPE) return;
100 if (!((E_Border *)obj)->lock_user_location)
101 e_border_act_move_begin((E_Border *)obj, NULL);
104 ACT_FN_GO_MOUSE(window_move, __UNUSED__)
106 if (!obj) obj = E_OBJECT(e_border_focused_get());
108 if (obj->type != E_BORDER_TYPE) return;
109 e_border_act_move_begin((E_Border *)obj, ev);
112 ACT_FN_GO_SIGNAL(window_move, )
114 if (!obj) obj = E_OBJECT(e_border_focused_get());
116 if (obj->type != E_BORDER_TYPE) return;
117 if (!((E_Border *)obj)->lock_user_location)
119 if ((params) && (!strcmp(params, "end")))
120 e_border_signal_move_end((E_Border *)obj, sig, src);
123 if (((E_Border *)obj)->moving)
124 e_border_signal_move_end((E_Border *)obj, sig, src);
126 e_border_signal_move_begin((E_Border *)obj, sig, src);
131 ACT_FN_END(window_move, __UNUSED__)
133 if (!obj) obj = E_OBJECT(e_border_focused_get());
135 if (obj->type != E_BORDER_TYPE) return;
136 e_border_act_move_end((E_Border *)obj, NULL);
139 ACT_FN_END_MOUSE(window_move, __UNUSED__)
141 if (!obj) obj = E_OBJECT(e_border_focused_get());
143 if (obj->type != E_BORDER_TYPE) return;
144 e_border_act_move_end((E_Border *)obj, ev);
147 ACT_FN_GO_KEY(window_move, __UNUSED__)
149 if (!obj) obj = E_OBJECT(e_border_focused_get());
151 if (obj->type != E_BORDER_TYPE)
153 obj = E_OBJECT(e_border_focused_get());
156 if (!((E_Border *)obj)->lock_user_location)
157 e_border_act_move_keyboard((E_Border *)obj);
160 /***************************************************************************/
161 ACT_FN_GO(window_resize, __UNUSED__)
163 if (!obj) obj = E_OBJECT(e_border_focused_get());
165 if (obj->type != E_BORDER_TYPE) return;
166 if (!((E_Border *)obj)->lock_user_size)
167 e_border_act_resize_begin((E_Border *)obj, NULL);
170 ACT_FN_GO_MOUSE(window_resize, __UNUSED__)
172 if (!obj) obj = E_OBJECT(e_border_focused_get());
174 if (obj->type != E_BORDER_TYPE) return;
175 if (!((E_Border *)obj)->lock_user_size)
176 e_border_act_resize_begin((E_Border *)obj, ev);
179 ACT_FN_GO_SIGNAL(window_resize, )
181 if (!obj) obj = E_OBJECT(e_border_focused_get());
183 if (obj->type != E_BORDER_TYPE) return;
184 if (!((E_Border *)obj)->lock_user_size)
186 if ((params) && (!strcmp(params, "end")))
187 e_border_signal_resize_end((E_Border *)obj, params, sig, src);
190 if (!params) params = "";
191 if (e_border_resizing_get((E_Border *)obj))
192 e_border_signal_resize_end((E_Border *)obj, params, sig, src);
194 e_border_signal_resize_begin((E_Border *)obj, params, sig, src);
199 ACT_FN_END(window_resize, __UNUSED__)
201 if (!obj) obj = E_OBJECT(e_border_focused_get());
203 if (obj->type != E_BORDER_TYPE) return;
204 e_border_act_resize_end((E_Border *)obj, NULL);
207 ACT_FN_END_MOUSE(window_resize, __UNUSED__)
209 if (!obj) obj = E_OBJECT(e_border_focused_get());
211 if (obj->type != E_BORDER_TYPE) return;
212 e_border_act_resize_end((E_Border *)obj, ev);
215 ACT_FN_GO_KEY(window_resize, __UNUSED__)
217 if (!obj) obj = E_OBJECT(e_border_focused_get());
219 if (obj->type != E_BORDER_TYPE)
221 obj = E_OBJECT(e_border_focused_get());
224 if (!((E_Border *)obj)->lock_user_size)
225 e_border_act_resize_keyboard((E_Border *)obj);
228 /***************************************************************************/
229 ACT_FN_GO(window_menu, __UNUSED__)
231 if (!obj) obj = E_OBJECT(e_border_focused_get());
233 if (obj->type != E_BORDER_TYPE)
235 obj = E_OBJECT(e_border_focused_get());
238 e_border_act_menu_begin((E_Border *)obj, NULL, 0);
241 ACT_FN_GO_MOUSE(window_menu, __UNUSED__)
243 if (!obj) obj = E_OBJECT(e_border_focused_get());
245 if (obj->type != E_BORDER_TYPE)
247 obj = E_OBJECT(e_border_focused_get());
250 e_border_act_menu_begin((E_Border *)obj, ev, 0);
253 ACT_FN_GO_KEY(window_menu, __UNUSED__)
255 if (!obj) obj = E_OBJECT(e_border_focused_get());
257 if (obj->type != E_BORDER_TYPE)
259 obj = E_OBJECT(e_border_focused_get());
262 e_border_act_menu_begin((E_Border *)obj, NULL, 1);
265 /***************************************************************************/
266 ACT_FN_GO(window_raise, __UNUSED__)
268 if (!obj) obj = E_OBJECT(e_border_focused_get());
270 if (obj->type != E_BORDER_TYPE)
272 obj = E_OBJECT(e_border_focused_get());
275 if (!((E_Border *)obj)->lock_user_stacking)
276 e_border_raise((E_Border *)obj);
279 /***************************************************************************/
280 ACT_FN_GO(window_lower, __UNUSED__)
282 if (!obj) obj = E_OBJECT(e_border_focused_get());
284 if (obj->type != E_BORDER_TYPE)
286 obj = E_OBJECT(e_border_focused_get());
289 if (!((E_Border *)obj)->lock_user_stacking)
290 e_border_lower((E_Border *)obj);
293 /***************************************************************************/
294 ACT_FN_GO(window_close, __UNUSED__)
296 if (!obj) obj = E_OBJECT(e_border_focused_get());
298 if (obj->type != E_BORDER_TYPE)
300 obj = E_OBJECT(e_border_focused_get());
303 if (!((E_Border *)obj)->lock_close)
304 e_border_act_close_begin((E_Border *)obj);
307 /***************************************************************************/
308 static E_Dialog *kill_dialog = NULL;
311 _e_actions_cb_kill_dialog_ok(void *data, E_Dialog *dia)
318 e_object_del(E_OBJECT(kill_dialog));
321 if ((!((E_Border *)obj)->lock_close) && (!((E_Border *)obj)->internal))
322 e_border_act_kill_begin((E_Border *)obj);
326 _e_actions_cb_kill_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
328 e_object_del(E_OBJECT(kill_dialog));
333 _e_actions_cb_kill_dialog_delete(E_Win *win)
338 _e_actions_cb_kill_dialog_cancel(NULL, dia);
341 ACT_FN_GO(window_kill, __UNUSED__)
344 char dialog_text[1024];
346 if (!obj) obj = E_OBJECT(e_border_focused_get());
348 if (obj->type != E_BORDER_TYPE)
350 obj = E_OBJECT(e_border_focused_get());
353 bd = (E_Border *)obj;
354 if ((bd->lock_close) || (bd->internal)) return;
356 if (kill_dialog) e_object_del(E_OBJECT(kill_dialog));
358 if (e_config->cnfmdlg_disabled)
360 _e_actions_cb_kill_dialog_ok(obj, NULL);
364 snprintf(dialog_text, sizeof(dialog_text),
365 _("You are about to kill %s.<br><br>"
366 "Please keep in mind that all data from this window<br>"
367 "which has not yet been saved will be lost!<br><br>"
368 "Are you sure you want to kill this window?"),
369 bd->client.icccm.name);
371 kill_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()),
372 "E", "_kill_dialog");
373 if (!kill_dialog) return;
374 e_win_delete_callback_set(kill_dialog->win,
375 _e_actions_cb_kill_dialog_delete);
376 e_dialog_title_set(kill_dialog,
377 _("Are you sure you want to kill this window?"));
378 e_dialog_text_set(kill_dialog, _(dialog_text));
379 e_dialog_icon_set(kill_dialog, "application-exit", 64);
380 e_dialog_button_add(kill_dialog, _("Yes"), NULL,
381 _e_actions_cb_kill_dialog_ok, obj);
382 e_dialog_button_add(kill_dialog, _("No"), NULL,
383 _e_actions_cb_kill_dialog_cancel, NULL);
384 e_dialog_button_focus_num(kill_dialog, 1);
385 e_win_centered_set(kill_dialog->win, 1);
386 e_dialog_show(kill_dialog);
389 /***************************************************************************/
390 ACT_FN_GO(window_sticky_toggle, __UNUSED__)
392 if (!obj) obj = E_OBJECT(e_border_focused_get());
394 if (obj->type != E_BORDER_TYPE)
396 obj = E_OBJECT(e_border_focused_get());
399 if (!((E_Border *)obj)->lock_user_sticky)
403 bd = (E_Border *)obj;
404 if (bd->sticky) e_border_unstick(bd);
405 else e_border_stick(bd);
409 /***************************************************************************/
410 ACT_FN_GO(window_sticky, )
412 if (!obj) obj = E_OBJECT(e_border_focused_get());
414 if (obj->type != E_BORDER_TYPE)
416 obj = E_OBJECT(e_border_focused_get());
419 if (!((E_Border *)obj)->lock_user_sticky)
423 bd = (E_Border *)obj;
426 if (atoi(params) == 1)
428 else if (atoi(params) == 0)
429 e_border_unstick(bd);
434 /***************************************************************************/
435 ACT_FN_GO(window_iconic_toggle, __UNUSED__)
439 if (!obj) obj = E_OBJECT(e_border_focused_get());
441 if (obj->type != E_BORDER_TYPE)
443 obj = E_OBJECT(e_border_focused_get());
446 bd = (E_Border *)obj;
448 if ((!bd->lock_user_iconify) && (!bd->fullscreen) &&
449 ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
450 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN)))
452 if (bd->iconic) e_border_uniconify(bd);
453 else e_border_iconify(bd);
457 /***************************************************************************/
458 ACT_FN_GO(window_iconic, )
460 if (!obj) obj = E_OBJECT(e_border_focused_get());
462 if (obj->type != E_BORDER_TYPE)
464 obj = E_OBJECT(e_border_focused_get());
467 if (!((E_Border *)obj)->lock_user_iconify)
471 bd = (E_Border *)obj;
474 if (atoi(params) == 1)
475 e_border_iconify(bd);
476 else if (atoi(params) == 0)
477 e_border_uniconify(bd);
482 /***************************************************************************/
483 ACT_FN_GO(window_fullscreen_toggle, )
485 if (!obj) obj = E_OBJECT(e_border_focused_get());
487 if (obj->type != E_BORDER_TYPE)
489 obj = E_OBJECT(e_border_focused_get());
492 if (!((E_Border *)obj)->lock_user_fullscreen)
496 bd = (E_Border *)obj;
498 e_border_unfullscreen(bd);
499 else if (!params || *params == '\0')
500 e_border_fullscreen(bd, e_config->fullscreen_policy);
501 else if (! strcmp(params, "resize"))
502 e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
503 else if (! strcmp(params, "zoom"))
504 e_border_fullscreen(bd, E_FULLSCREEN_ZOOM);
508 /***************************************************************************/
509 ACT_FN_GO(window_fullscreen, )
511 if (!obj) obj = E_OBJECT(e_border_focused_get());
513 if (obj->type != E_BORDER_TYPE)
515 obj = E_OBJECT(e_border_focused_get());
518 if (!((E_Border *)obj)->lock_user_fullscreen)
522 bd = (E_Border *)obj;
529 if (sscanf(params, "%i %20s", &v, buf) == 2)
534 e_border_fullscreen(bd, e_config->fullscreen_policy);
535 else if (!strcmp(buf, "resize"))
536 e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
537 else if (!strcmp(buf, "zoom"))
538 e_border_fullscreen(bd, E_FULLSCREEN_ZOOM);
541 e_border_unfullscreen(bd);
547 /***************************************************************************/
548 ACT_FN_GO(window_maximized_toggle, )
552 if (!obj) obj = E_OBJECT(e_border_focused_get());
554 if (obj->type != E_BORDER_TYPE)
556 obj = E_OBJECT(e_border_focused_get());
559 bd = (E_Border *)obj;
561 if ((!bd->lock_user_maximize) && (!bd->fullscreen) &&
562 ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_NORMAL) ||
563 (bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN)))
565 if ((bd->maximized & E_MAXIMIZE_TYPE) != E_MAXIMIZE_NONE)
568 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
573 max = _e_actions_maximize_parse(params);
574 max &= E_MAXIMIZE_DIRECTION;
575 if (max == E_MAXIMIZE_VERTICAL)
577 if (bd->maximized & E_MAXIMIZE_VERTICAL)
578 e_border_unmaximize(bd, E_MAXIMIZE_VERTICAL);
582 else if (max == E_MAXIMIZE_HORIZONTAL)
584 if (bd->maximized & E_MAXIMIZE_HORIZONTAL)
585 e_border_unmaximize(bd, E_MAXIMIZE_HORIZONTAL);
590 e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
596 e_border_maximize(bd, _e_actions_maximize_parse(params));
600 /***************************************************************************/
601 ACT_FN_GO(window_maximized, )
603 if (!obj) obj = E_OBJECT(e_border_focused_get());
605 if (obj->type != E_BORDER_TYPE)
607 obj = E_OBJECT(e_border_focused_get());
610 if (!((E_Border *)obj)->lock_user_maximize)
614 bd = (E_Border *)obj;
621 max = (e_config->maximize_policy & E_MAXIMIZE_DIRECTION);
622 ret = sscanf(params, "%i %20s %20s", &v, s1, s2);
625 if (!strcmp(s2, "horizontal"))
626 max = E_MAXIMIZE_HORIZONTAL;
627 else if (!strcmp(s2, "vertical"))
628 max = E_MAXIMIZE_VERTICAL;
630 max = E_MAXIMIZE_BOTH;
636 if (!strcmp(s1, "fullscreen"))
637 e_border_maximize(bd, E_MAXIMIZE_FULLSCREEN | max);
638 else if (!strcmp(s1, "smart"))
639 e_border_maximize(bd, E_MAXIMIZE_SMART | max);
640 else if (!strcmp(s1, "expand"))
641 e_border_maximize(bd, E_MAXIMIZE_EXPAND | max);
642 else if (!strcmp(s1, "fill"))
643 e_border_maximize(bd, E_MAXIMIZE_FILL | max);
645 e_border_maximize(bd, (e_config->maximize_policy & E_MAXIMIZE_TYPE) | max);
648 e_border_unmaximize(bd, max);
654 /***************************************************************************/
655 ACT_FN_GO(window_shaded_toggle, )
657 if (!obj) obj = E_OBJECT(e_border_focused_get());
659 if (obj->type != E_BORDER_TYPE)
661 obj = E_OBJECT(e_border_focused_get());
664 if (!((E_Border *)obj)->lock_user_shade)
668 bd = (E_Border *)obj;
672 e_border_unshade(bd, E_DIRECTION_UP);
675 if (!strcmp(params, "up"))
676 e_border_unshade(bd, E_DIRECTION_UP);
677 else if (!strcmp(params, "down"))
678 e_border_unshade(bd, E_DIRECTION_DOWN);
679 else if (!strcmp(params, "left"))
680 e_border_unshade(bd, E_DIRECTION_LEFT);
681 else if (!strcmp(params, "right"))
682 e_border_unshade(bd, E_DIRECTION_RIGHT);
684 e_border_unshade(bd, E_DIRECTION_UP);
690 e_border_shade(bd, E_DIRECTION_UP);
693 if (!strcmp(params, "up"))
694 e_border_shade(bd, E_DIRECTION_UP);
695 else if (!strcmp(params, "down"))
696 e_border_shade(bd, E_DIRECTION_DOWN);
697 else if (!strcmp(params, "left"))
698 e_border_shade(bd, E_DIRECTION_LEFT);
699 else if (!strcmp(params, "right"))
700 e_border_shade(bd, E_DIRECTION_RIGHT);
702 e_border_shade(bd, E_DIRECTION_UP);
708 /***************************************************************************/
709 ACT_FN_GO(window_shaded, )
711 if (!obj) obj = E_OBJECT(e_border_focused_get());
713 if (obj->type != E_BORDER_TYPE)
715 obj = E_OBJECT(e_border_focused_get());
718 if (!((E_Border *)obj)->lock_user_shade)
722 bd = (E_Border *)obj;
728 if (sscanf(params, "%i %20s", &v, buf) == 2)
732 if (!strcmp(buf, "up"))
733 e_border_shade(bd, E_DIRECTION_UP);
734 else if (!strcmp(buf, "down"))
735 e_border_shade(bd, E_DIRECTION_DOWN);
736 else if (!strcmp(buf, "left"))
737 e_border_shade(bd, E_DIRECTION_LEFT);
738 else if (!strcmp(buf, "right"))
739 e_border_shade(bd, E_DIRECTION_RIGHT);
743 if (!strcmp(buf, "up"))
744 e_border_unshade(bd, E_DIRECTION_UP);
745 else if (!strcmp(buf, "down"))
746 e_border_unshade(bd, E_DIRECTION_DOWN);
747 else if (!strcmp(buf, "left"))
748 e_border_unshade(bd, E_DIRECTION_LEFT);
749 else if (!strcmp(buf, "right"))
750 e_border_unshade(bd, E_DIRECTION_RIGHT);
757 /***************************************************************************/
758 ACT_FN_GO(window_borderless_toggle, __UNUSED__)
760 if ((!obj) || (obj->type != E_BORDER_TYPE))
761 obj = E_OBJECT(e_border_focused_get());
763 if (!((E_Border *)obj)->lock_border)
767 bd = (E_Border *)obj;
768 bd->borderless = !bd->borderless;
770 bd->client.border.changed = 1;
775 /***************************************************************************/
776 ACT_FN_GO(window_border_set, __UNUSED__)
778 if ((!obj) || (obj->type != E_BORDER_TYPE))
779 obj = E_OBJECT(e_border_focused_get());
781 if (!((E_Border *)obj)->lock_border)
785 bd = (E_Border *)obj;
788 eina_stringshare_replace(&bd->bordername, params);
789 bd->client.border.changed = 1;
795 /***************************************************************************/
796 ACT_FN_GO(window_border_cycle, __UNUSED__)
798 if ((!obj) || (obj->type != E_BORDER_TYPE))
799 obj = E_OBJECT(e_border_focused_get());
801 if (!((E_Border *)obj)->lock_border)
805 bd = (E_Border *)obj;
810 while (*params == ' ')
815 const char *bdname = params;
817 while (bdname && (space = strchr(bdname, ' ')))
819 if (strncmp(bd->bordername, bdname, space - bdname) == 0)
822 while (*bdname == ' ')
824 space = strchr(bdname, ' ');
826 eina_stringshare_replace_length(
828 bdname, space - bdname);
830 eina_stringshare_replace(&bd->bordername, bdname);
831 bd->client.border.changed = 1;
836 while (*bdname == ' ')
841 space = strchr(params, ' ');
843 eina_stringshare_replace_length(&bd->bordername,
844 params, space - params);
846 eina_stringshare_replace(&bd->bordername, params);
847 bd->client.border.changed = 1;
853 /***************************************************************************/
854 ACT_FN_GO(window_pinned_toggle, __UNUSED__)
856 if ((!obj) || (obj->type != E_BORDER_TYPE))
857 obj = E_OBJECT(e_border_focused_get());
859 if (!((E_Border *)obj)->lock_border)
863 bd = (E_Border *)obj;
864 if ((bd->client.netwm.state.stacking == E_STACKING_BELOW) &&
865 (bd->user_skip_winlist) && (bd->borderless))
866 e_border_pinned_set(bd, 0);
868 e_border_pinned_set(bd, 1);
872 /***************************************************************************/
873 ACT_FN_GO(window_move_by, )
875 if (!obj) obj = E_OBJECT(e_border_focused_get());
877 if (obj->type != E_BORDER_TYPE)
879 obj = E_OBJECT(e_border_focused_get());
886 if (sscanf(params, "%i %i", &dx, &dy) == 2)
890 bd = (E_Border *)obj;
891 e_border_move(bd, bd->x + dx, bd->y + dy);
893 if (e_config->focus_policy != E_FOCUS_CLICK)
894 ecore_x_pointer_warp(bd->zone->container->win,
896 bd->y + (bd->h / 2));
901 /***************************************************************************/
902 ACT_FN_GO(window_move_to, )
904 if (!obj) obj = E_OBJECT(e_border_focused_get());
906 if (obj->type != E_BORDER_TYPE)
908 obj = E_OBJECT(e_border_focused_get());
914 int x, y, zx, zy, zw, zh;
917 bd = (E_Border *)obj;
918 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
920 if (sscanf(params, "%c%i %c%i", &cx, &x, &cy, &y) == 4)
925 else if (sscanf(params, "* %c%i", &cy, &y) == 2)
927 /* Updated y, keep x. */
932 else if (sscanf(params, "%c%i *", &cx, &x) == 2)
934 /* Updated x, keep y. */
941 if (cx == '-') x = zw - bd->w - x + 2 * zx; /* compensate x with zx */
942 if (cy == '-') y = zh - bd->h - y + 2 * zy; /* compensate y with zy */
944 if ((x != bd->x) || (y != bd->y))
946 e_border_move(bd, x, y);
948 if (e_config->focus_policy != E_FOCUS_CLICK)
949 ecore_x_pointer_warp(bd->zone->container->win,
951 bd->y + (bd->h / 2));
956 /***************************************************************************/
957 ACT_FN_GO(window_move_to_center, __UNUSED__)
962 if (!obj) obj = E_OBJECT(e_border_focused_get());
964 if (obj->type != E_BORDER_TYPE)
966 obj = E_OBJECT(e_border_focused_get());
970 bd = (E_Border *)obj;
971 e_border_center_pos_get(bd, &x, &y);
973 if ((x != bd->x) || (y != bd->y))
975 e_border_move(bd, x, y);
977 if (e_config->focus_policy != E_FOCUS_CLICK)
978 ecore_x_pointer_warp(bd->zone->container->win,
984 /***************************************************************************/
985 ACT_FN_GO(window_resize_by, )
987 if (!obj) obj = E_OBJECT(e_border_focused_get());
989 if (obj->type != E_BORDER_TYPE)
991 obj = E_OBJECT(e_border_focused_get());
999 if (sscanf(params, "%i %i", &dw, &dh) == 2)
1003 bd = (E_Border *)obj;
1007 e_border_resize_limit(bd, &dw, &dh);
1008 e_border_resize(bd, dw, dh);
1010 if (e_config->focus_policy != E_FOCUS_CLICK)
1011 ecore_x_pointer_warp(bd->zone->container->win,
1012 bd->x + (dw / 2), bd->y + (dh / 2));
1017 /***************************************************************************/
1018 ACT_FN_GO(window_push, )
1020 if (!obj) obj = E_OBJECT(e_border_focused_get());
1022 if (obj->type != E_BORDER_TYPE)
1024 obj = E_OBJECT(e_border_focused_get());
1031 E_Border_List *bd_list;
1033 int x, y, zx, zy, zw, zh;
1035 if (strcmp(params, "left") == 0)
1040 else if (strcmp(params, "right") == 0)
1045 else if (strcmp(params, "up") == 0)
1050 else if (strcmp(params, "down") == 0)
1055 else if (strcmp(params, "up-left") == 0)
1060 else if (strcmp(params, "up-right") == 0)
1065 else if (strcmp(params, "down-left") == 0)
1070 else if (strcmp(params, "down-right") == 0)
1078 bd = (E_Border *)obj;
1079 e_zone_useful_geometry_get(bd->zone, &zx, &zy, &zw, &zh);
1081 if (hdir < 0) x = zx;
1082 else if (hdir > 0) x = zx + zw - bd->w;
1085 if (vdir < 0) y = zy;
1086 else if (vdir > 0) y = zy + zh - bd->h;
1089 bd_list = e_container_border_list_first(bd->zone->container);
1090 cur = e_container_border_list_next(bd_list);
1094 if ((bd->desk == cur->desk) && (bd != cur) && (!cur->iconic))
1097 && (cur->x + cur->w < bd->x)
1098 && (E_SPANS_COMMON(bd->y, bd->h, cur->y, cur->h)))
1099 x = MAX(x, cur->x + cur->w);
1101 && (cur->x > bd->x + bd->w)
1102 && (E_SPANS_COMMON(bd->y, bd->h, cur->y, cur->h)))
1103 x = MIN(x, zx + cur->x - bd->w);
1106 && (cur->y + cur->h < bd->y)
1107 && (E_SPANS_COMMON(bd->x, bd->w, cur->x, cur->w)))
1108 y = MAX(y, cur->y + cur->h);
1110 && (cur->y > bd->y + bd->h)
1111 && (E_SPANS_COMMON(bd->x, bd->w, cur->x, cur->w)))
1112 y = MIN(y, zy + cur->y - bd->h);
1114 cur = e_container_border_list_next(bd_list);
1116 e_container_border_list_free(bd_list);
1118 if ((x != bd->x) || (y != bd->y))
1120 e_border_move(bd, x, y);
1121 if (e_config->focus_policy != E_FOCUS_CLICK)
1122 ecore_x_pointer_warp(bd->zone->container->win,
1123 bd->x + (bd->w / 2), bd->y + (bd->h / 2));
1128 /***************************************************************************/
1129 ACT_FN_GO(window_drag_icon, __UNUSED__)
1131 if (!obj) obj = E_OBJECT(e_border_focused_get());
1133 if (obj->type != E_BORDER_TYPE)
1135 obj = E_OBJECT(e_border_focused_get());
1141 bd = (E_Border *)obj;
1148 /***************************************************************************/
1149 ACT_FN_GO(window_desk_move_by, )
1154 if (!params) return;
1155 if (!obj) obj = E_OBJECT(e_border_focused_get());
1157 if (obj->type != E_BORDER_TYPE)
1159 obj = E_OBJECT(e_border_focused_get());
1163 bd = (E_Border *)obj;
1164 if ((!bd->zone) || (!bd->desk)) return;
1165 if (sscanf(params, "%d %d", &x, &y) == 2)
1169 int to_x = 0, to_y = 0;
1171 e_desk_xy_get(bd->desk, &dx, &dy);
1175 while (!(desk = e_desk_at_xy_get(bd->zone, to_x, to_y)))
1177 /* here we are out of our desktop range */
1178 while (to_x >= bd->zone->desk_x_count)
1180 to_x -= bd->zone->desk_x_count;
1185 to_x += bd->zone->desk_x_count;
1189 while (to_y >= bd->zone->desk_y_count)
1190 to_y -= bd->zone->desk_y_count;
1192 to_y += bd->zone->desk_y_count;
1197 /* switch desktop. Quite useful from the interface point of view. */
1198 e_zone_desk_flip_by(bd->zone, to_x - dx, to_y - dy);
1199 /* send the border to the required desktop. */
1200 e_border_desk_set(bd, desk);
1201 if (!bd->lock_user_stacking)
1203 e_border_focus_set(bd, 1, 1);
1208 /***************************************************************************/
1209 ACT_FN_GO(window_desk_move_to, )
1214 if (!params) return;
1215 if (!obj) obj = E_OBJECT(e_border_focused_get());
1217 if (obj->type != E_BORDER_TYPE)
1219 obj = E_OBJECT(e_border_focused_get());
1223 bd = (E_Border *)obj;
1224 if ((!bd->zone) || (!bd->desk)) return;
1225 if (sscanf(params, "%d %d", &x, &y) == 2)
1229 desk = e_desk_at_xy_get(bd->zone, x, y);
1230 if (desk) e_border_desk_set(bd, desk);
1234 /***************************************************************************/
1236 _e_actions_zone_get(E_Object *obj)
1240 if (obj->type == (int)E_MANAGER_TYPE) return e_util_zone_current_get((E_Manager *)obj);
1241 else if (obj->type == (int)E_CONTAINER_TYPE) return e_util_zone_current_get(((E_Container *)obj)->manager);
1242 else if (obj->type == (int)E_ZONE_TYPE) return (E_Zone *)obj;
1243 else if (obj->type == (int)E_BORDER_TYPE) return ((E_Border *)obj)->zone;
1244 else if (obj->type == (int)E_SHELF_TYPE) return ((E_Shelf *)obj)->zone;
1245 else if (obj->type == (int)E_POPUP_TYPE) return ((E_Popup *)obj)->zone;
1246 else if (obj->type == (int)E_WIN_TYPE) return ((E_Win *)obj)->border->zone;
1248 return e_util_zone_current_get(e_manager_current_get());
1251 ACT_FN_GO(desk_flip_by, )
1255 zone = _e_actions_zone_get(obj);
1262 if (sscanf(params, "%i %i", &dx, &dy) == 2)
1263 e_zone_desk_flip_by(zone, dx, dy);
1268 /***************************************************************************/
1269 ACT_FN_GO(desk_flip_to, )
1273 zone = _e_actions_zone_get(obj);
1280 if (sscanf(params, "%i %i", &dx, &dy) == 2)
1281 e_zone_desk_flip_to(zone, dx, dy);
1286 /***************************************************************************/
1287 #define ACT_FLIP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0))
1288 #define ACT_FLIP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || (((zone)->desk_x_current + 1) < (zone)->desk_x_count))
1289 #define ACT_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0))
1290 #define ACT_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count))
1291 #define ACT_FLIP_UP_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && ((zone)->desk_y_current > 0)))
1292 #define ACT_FLIP_UP_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && ((zone)->desk_y_current > 0)))
1293 #define ACT_FLIP_DOWN_RIGHT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || ((((zone)->desk_x_current + 1) < (zone)->desk_x_count) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count)))
1294 #define ACT_FLIP_DOWN_LEFT(zone) ((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1) && ((zone)->desk_y_count > 1)) || (((zone)->desk_x_current > 0) && (((zone)->desk_y_current + 1) < (zone)->desk_y_count)))
1296 ACT_FN_GO_EDGE(desk_flip_in_direction, )
1299 E_Desk *current = NULL;
1300 E_Event_Pointer_Warp *wev;
1301 int x, y, offset = 25;
1303 if (!ev) return; // with flip on _e_zone_cb_edge_timer we don't have ev!!!
1304 zone = _e_actions_zone_get(obj);
1305 wev = E_NEW(E_Event_Pointer_Warp, 1);
1306 if ((!wev) || (!zone)) return;
1307 ecore_x_pointer_xy_get(zone->container->win, &x, &y);
1312 if (sscanf(params, "%i", &offset) != 1)
1317 case E_ZONE_EDGE_LEFT:
1318 if (ACT_FLIP_LEFT(zone))
1320 e_zone_desk_flip_by(zone, -1, 0);
1321 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, y);
1323 wev->curr.x = zone->w - offset;
1326 case E_ZONE_EDGE_RIGHT:
1327 if (ACT_FLIP_RIGHT(zone))
1329 e_zone_desk_flip_by(zone, 1, 0);
1330 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, y);
1332 wev->curr.x = offset;
1335 case E_ZONE_EDGE_TOP:
1336 if (ACT_FLIP_UP(zone))
1338 e_zone_desk_flip_by(zone, 0, -1);
1339 ecore_x_pointer_warp(zone->container->win, x, zone->container->y + zone->y + zone->h - offset);
1341 wev->curr.y = zone->h - offset;
1344 case E_ZONE_EDGE_BOTTOM:
1345 if (ACT_FLIP_DOWN(zone))
1347 e_zone_desk_flip_by(zone, 0, 1);
1348 ecore_x_pointer_warp(zone->container->win, x, zone->container->y + zone->y + offset);
1350 wev->curr.y = offset;
1353 case E_ZONE_EDGE_TOP_LEFT:
1354 if (ACT_FLIP_UP_LEFT(zone))
1356 e_zone_desk_flip_by(zone, -1, -1);
1357 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, zone->container->y + zone->y + zone->h - offset);
1358 wev->curr.x = zone->w - offset;
1359 wev->curr.y = zone->h - offset;
1362 case E_ZONE_EDGE_TOP_RIGHT:
1363 if (ACT_FLIP_UP_RIGHT(zone))
1365 e_zone_desk_flip_by(zone, 1, -1);
1366 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, zone->container->y + zone->y + zone->h - offset);
1367 wev->curr.x = offset;
1368 wev->curr.y = zone->h - offset;
1371 case E_ZONE_EDGE_BOTTOM_LEFT:
1372 if (ACT_FLIP_DOWN_LEFT(zone))
1374 e_zone_desk_flip_by(zone, -1, 1);
1375 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + zone->w - offset, zone->container->y + zone->y + offset);
1376 wev->curr.y = offset;
1377 wev->curr.x = zone->w - offset;
1380 case E_ZONE_EDGE_BOTTOM_RIGHT:
1381 if (ACT_FLIP_DOWN_RIGHT(zone))
1383 e_zone_desk_flip_by(zone, 1, 1);
1384 ecore_x_pointer_warp(zone->container->win, zone->container->x + zone->x + offset, zone->container->y + zone->y + offset);
1385 wev->curr.y = offset;
1386 wev->curr.x = offset;
1393 current = e_desk_current_get(zone);
1395 ecore_event_add(E_EVENT_POINTER_WARP, wev, NULL, NULL);
1400 /***************************************************************************/
1401 ACT_FN_GO(desk_linear_flip_by, )
1405 zone = _e_actions_zone_get(obj);
1412 if (sscanf(params, "%i", &dx) == 1)
1413 e_zone_desk_linear_flip_by(zone, dx);
1418 /***************************************************************************/
1419 ACT_FN_GO(desk_linear_flip_to, )
1423 zone = _e_actions_zone_get(obj);
1430 if (sscanf(params, "%i", &dx) == 1)
1431 e_zone_desk_linear_flip_to(zone, dx);
1437 #define DESK_ACTION_ALL(zone, act) \
1439 Eina_List *lm, *lc, *lz; \
1443 EINA_LIST_FOREACH(e_manager_list(), lm, man) { \
1444 EINA_LIST_FOREACH(man->containers, lc, con) { \
1445 EINA_LIST_FOREACH(con->zones, lz, zone) { \
1452 /***************************************************************************/
1453 ACT_FN_GO(desk_flip_by_all, )
1459 if (sscanf(params, "%i %i", &dx, &dy) == 2)
1461 DESK_ACTION_ALL(zone, e_zone_desk_flip_by(zone, dx, dy));
1466 /***************************************************************************/
1467 ACT_FN_GO(desk_flip_to_all, )
1473 if (sscanf(params, "%i %i", &dx, &dy) == 2)
1475 DESK_ACTION_ALL(zone, e_zone_desk_flip_to(zone, dx, dy));
1480 /***************************************************************************/
1481 ACT_FN_GO(desk_linear_flip_by_all, )
1487 if (sscanf(params, "%i", &dx) == 1)
1489 DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_by(zone, dx));
1494 /***************************************************************************/
1495 ACT_FN_GO(desk_linear_flip_to_all, )
1501 if (sscanf(params, "%i", &dx) == 1)
1503 DESK_ACTION_ALL(zone, e_zone_desk_linear_flip_to(zone, dx));
1508 /***************************************************************************/
1509 ACT_FN_GO(screen_send_to, )
1513 zone = _e_actions_zone_get(obj);
1514 if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
1521 if (sscanf(params, "%i", &scr) == 1)
1523 E_Zone *zone2 = NULL;
1525 if (eina_list_count(e_manager_list()) > 1)
1527 scr = scr % eina_list_count(e_manager_list());
1528 if (scr < 0) scr += eina_list_count(e_manager_list());
1529 zone2 = e_util_container_zone_number_get(scr, 0);
1533 scr = scr % eina_list_count(zone->container->zones);
1534 if (scr < 0) scr += eina_list_count(zone->container->zones);
1535 zone2 = e_util_container_zone_number_get(0, scr);
1537 if ((zone2) && (zone != zone2))
1538 ecore_x_pointer_warp(zone2->container->win,
1539 zone2->x + (zone2->w / 2),
1540 zone2->y + (zone2->h / 2));
1546 ACT_FN_GO(screen_send_by, )
1550 zone = _e_actions_zone_get(obj);
1551 if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
1558 if (sscanf(params, "%i", &scr) == 1)
1560 E_Zone *zone2 = NULL;
1562 if (eina_list_count(e_manager_list()) > 1)
1564 scr += zone->container->num;
1565 scr = scr % eina_list_count(e_manager_list());
1566 if (scr < 0) scr += eina_list_count(e_manager_list());
1567 zone2 = e_util_container_zone_number_get(scr, 0);
1572 scr = scr % eina_list_count(zone->container->zones);
1573 if (scr < 0) scr += eina_list_count(zone->container->zones);
1574 zone2 = e_util_container_zone_number_get(0, scr);
1576 if ((zone2) && (zone != zone2))
1577 ecore_x_pointer_warp(zone2->container->win,
1578 zone2->x + (zone2->w / 2),
1579 zone2->y + (zone2->h / 2));
1585 #define ZONE_DESK_ACTION(con_num, zone_num, zone, act) \
1587 if ((con_num < 0) || (zone_num < 0)) { \
1588 Eina_List *l, *ll, *lll; \
1591 if ((con_num >= 0) && (zone_num < 0)) /* con=1 zone=all */ { \
1592 con = e_util_container_number_get(con_num); \
1593 EINA_LIST_FOREACH(con->zones, l, zone) { \
1596 else if ((con_num < 0) && (zone_num >= 0)) /* con=all zone=1 */ { \
1597 EINA_LIST_FOREACH(e_manager_list(), l, man) { \
1598 EINA_LIST_FOREACH(man->containers, ll, con) { \
1599 zone = e_container_zone_number_get(con, zone_num); \
1603 else if ((con_num < 0) && (zone_num < 0)) /* con=all zone=all */ { \
1604 EINA_LIST_FOREACH(e_manager_list(), l, man) { \
1605 EINA_LIST_FOREACH(man->containers, ll, con) { \
1606 EINA_LIST_FOREACH(con->zones, lll, zone) { \
1610 zone = e_util_container_zone_number_get(con_num, zone_num); \
1614 /***************************************************************************/
1616 ACT_FN_GO(zone_desk_flip_by, )
1620 int con_num = 0, zone_num = 0;
1623 if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &dx, &dy) == 4)
1624 ZONE_DESK_ACTION(con_num, zone_num, zone,
1625 e_zone_desk_flip_by(zone, dx, dy));
1630 /***************************************************************************/
1632 ACT_FN_GO(zone_desk_flip_to, )
1636 int con_num = 0, zone_num = 0;
1639 if (sscanf(params, "%i %i %i %i", &con_num, &zone_num, &dx, &dy) == 4)
1640 ZONE_DESK_ACTION(con_num, zone_num, zone,
1641 e_zone_desk_flip_to(zone, dx, dy));
1646 /***************************************************************************/
1648 ACT_FN_GO(zone_desk_linear_flip_by, )
1652 int con_num = 0, zone_num = 0;
1655 if (sscanf(params, "%i %i %i", &con_num, &zone_num, &dx) == 3)
1656 ZONE_DESK_ACTION(con_num, zone_num, zone,
1657 e_zone_desk_linear_flip_by(zone, dx));
1662 /***************************************************************************/
1664 ACT_FN_GO(zone_desk_linear_flip_to, )
1668 int con_num = 0, zone_num = 0;
1671 if (sscanf(params, "%i %i %i", &con_num, &zone_num, &dx) == 3)
1672 ZONE_DESK_ACTION(con_num, zone_num, zone,
1673 e_zone_desk_linear_flip_to(zone, dx));
1678 /***************************************************************************/
1680 _e_actions_cb_menu_end(void *data __UNUSED__, E_Menu *m)
1682 e_object_del(E_OBJECT(m));
1686 _e_actions_menu_find(const char *name)
1688 if (!strcmp(name, "main"))
1689 return e_int_menus_main_new();
1690 else if (!strcmp(name, "favorites"))
1691 return e_int_menus_favorite_apps_new();
1692 else if (!strcmp(name, "all"))
1693 return e_int_menus_all_apps_new();
1694 else if (!strcmp(name, "clients"))
1695 return e_int_menus_clients_new();
1696 else if (!strcmp(name, "lost_clients"))
1697 return e_int_menus_lost_clients_new();
1698 else if (!strcmp(name, "configuration"))
1699 return e_int_menus_config_new();
1703 ACT_FN_GO(menu_show, )
1707 /* menu is active - abort */
1708 if (e_menu_grab_window_get()) return;
1709 zone = _e_actions_zone_get(obj);
1716 m = _e_actions_menu_find(params);
1721 /* FIXME: this is a bit of a hack... setting m->con - bad hack */
1723 ecore_x_pointer_xy_get(zone->container->win, &x, &y);
1724 e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
1725 e_menu_activate_mouse(m, zone, x, y, 1, 1,
1726 E_MENU_POP_DIRECTION_DOWN,
1727 ecore_x_current_time_get());
1733 ACT_FN_GO_MOUSE(menu_show, )
1737 /* menu is active - abort */
1738 if (e_menu_grab_window_get()) return;
1739 zone = _e_actions_zone_get(obj);
1746 m = _e_actions_menu_find(params);
1751 /* FIXME: this is a bit of a hack... setting m->con - bad hack */
1755 x -= zone->container->x;
1756 y -= zone->container->y;
1757 e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
1758 e_menu_activate_mouse(m, zone, x, y, 1, 1,
1759 E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
1765 ACT_FN_GO_KEY(menu_show, )
1769 /* menu is active - abort */
1770 if (e_menu_grab_window_get()) return;
1771 zone = _e_actions_zone_get(obj);
1778 m = _e_actions_menu_find(params);
1783 /* FIXME: this is a bit of a hack... setting m->con - bad hack */
1785 ecore_x_pointer_xy_get(zone->container->win, &x, &y);
1786 e_menu_post_deactivate_callback_set(m, _e_actions_cb_menu_end, NULL);
1787 e_menu_activate_key(m, zone, x, y, 1, 1,
1788 E_MENU_POP_DIRECTION_DOWN);
1794 /***************************************************************************/
1799 zone = _e_actions_zone_get(obj);
1803 e_exec(zone, NULL, params, NULL, "action/exec");
1807 /***************************************************************************/
1812 zone = _e_actions_zone_get(obj);
1817 Efreet_Desktop *desktop = NULL;
1820 p2 = alloca(strlen(params) + 1);
1822 p = strchr(p2, ' ');
1826 if (!strcmp(p2, "file:"))
1827 desktop = efreet_util_desktop_file_id_find(p + 1);
1828 else if (!strcmp(p2, "name:"))
1829 desktop = efreet_util_desktop_name_find(p + 1);
1830 else if (!strcmp(p2, "generic:"))
1831 desktop = efreet_util_desktop_generic_name_find(p + 1);
1832 else if (!strcmp(p2, "exe:"))
1833 desktop = efreet_util_desktop_exec_find(p + 1);
1836 e_exec(zone, desktop, NULL, NULL, "action/app");
1837 efreet_desktop_free(desktop);
1844 /***************************************************************************/
1845 ACT_FN_GO(desk_deskshow_toggle, __UNUSED__)
1849 zone = _e_actions_zone_get(obj);
1850 if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
1851 if (zone) e_desk_deskshow(zone);
1854 ACT_FN_GO(cleanup_windows, __UNUSED__)
1858 zone = _e_actions_zone_get(obj);
1859 if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
1860 if (zone) e_place_zone_region_smart_cleanup(zone);
1863 /***************************************************************************/
1864 static E_Dialog *exit_dialog = NULL;
1867 _e_actions_cb_exit_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
1871 e_object_del(E_OBJECT(exit_dialog));
1874 e_sys_action_do(E_SYS_EXIT, NULL);
1878 _e_actions_cb_exit_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
1880 e_object_del(E_OBJECT(exit_dialog));
1885 _e_actions_cb_exit_dialog_delete(E_Win *win)
1890 _e_actions_cb_exit_dialog_cancel(NULL, dia);
1895 if ((params) && (!strcmp(params, "now")))
1897 e_sys_action_do(E_SYS_EXIT, NULL);
1900 if (exit_dialog) e_object_del(E_OBJECT(exit_dialog));
1902 if (e_config->cnfmdlg_disabled)
1904 _e_actions_cb_exit_dialog_ok(NULL, NULL);
1908 exit_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_exit_dialog");
1909 if (!exit_dialog) return;
1910 e_win_delete_callback_set(exit_dialog->win, _e_actions_cb_exit_dialog_delete);
1911 e_dialog_title_set(exit_dialog, _("Are you sure you want to exit?"));
1912 e_dialog_text_set(exit_dialog,
1913 _("You requested to exit Enlightenment.<br>"
1915 "Are you sure you want to exit?"));
1916 e_dialog_icon_set(exit_dialog, "application-exit", 64);
1917 e_dialog_button_add(exit_dialog, _("Yes"), NULL,
1918 _e_actions_cb_exit_dialog_ok, NULL);
1919 e_dialog_button_add(exit_dialog, _("No"), NULL,
1920 _e_actions_cb_exit_dialog_cancel, NULL);
1921 e_dialog_button_focus_num(exit_dialog, 1);
1922 e_win_centered_set(exit_dialog->win, 1);
1923 e_dialog_show(exit_dialog);
1926 /***************************************************************************/
1927 ACT_FN_GO(restart, __UNUSED__)
1929 e_sys_action_do(E_SYS_RESTART, NULL);
1932 /***************************************************************************/
1933 ACT_FN_GO(exit_now, __UNUSED__)
1935 e_sys_action_do(E_SYS_EXIT_NOW, NULL);
1938 /***************************************************************************/
1939 ACT_FN_GO(halt_now, __UNUSED__)
1941 e_sys_action_do(E_SYS_HALT_NOW, NULL);
1944 /***************************************************************************/
1945 ACT_FN_GO(mode_presentation_toggle, __UNUSED__)
1947 e_config->mode.presentation = !e_config->mode.presentation;
1948 e_config_mode_changed();
1949 e_config_save_queue();
1952 /***************************************************************************/
1953 ACT_FN_GO(mode_offline_toggle, __UNUSED__)
1955 e_config->mode.offline = !e_config->mode.offline;
1956 e_config_mode_changed();
1957 e_config_save_queue();
1960 /***************************************************************************/
1961 static E_Dialog *logout_dialog = NULL;
1964 _e_actions_cb_logout_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
1968 e_object_del(E_OBJECT(logout_dialog));
1969 logout_dialog = NULL;
1971 e_sys_action_do(E_SYS_LOGOUT, NULL);
1975 _e_actions_cb_logout_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
1977 e_object_del(E_OBJECT(logout_dialog));
1978 logout_dialog = NULL;
1982 _e_actions_cb_logout_dialog_delete(E_Win *win)
1987 _e_actions_cb_logout_dialog_cancel(NULL, dia);
1992 if ((params) && (!strcmp(params, "now")))
1994 e_sys_action_do(E_SYS_LOGOUT, NULL);
1997 if (logout_dialog) e_object_del(E_OBJECT(logout_dialog));
1999 if (e_config->cnfmdlg_disabled)
2001 _e_actions_cb_logout_dialog_ok(NULL, NULL);
2005 logout_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_logout_dialog");
2006 if (!logout_dialog) return;
2007 e_win_delete_callback_set(logout_dialog->win, _e_actions_cb_logout_dialog_delete);
2008 e_dialog_title_set(logout_dialog, _("Are you sure you want to log out?"));
2009 e_dialog_text_set(logout_dialog,
2010 _("You are about to log out.<br>"
2012 "Are you sure you want to do this?"));
2013 e_dialog_icon_set(logout_dialog, "system-log-out", 64);
2014 e_dialog_button_add(logout_dialog, _("Yes"), NULL,
2015 _e_actions_cb_logout_dialog_ok, NULL);
2016 e_dialog_button_add(logout_dialog, _("No"), NULL,
2017 _e_actions_cb_logout_dialog_cancel, NULL);
2018 e_dialog_button_focus_num(logout_dialog, 1);
2019 e_win_centered_set(logout_dialog->win, 1);
2020 e_dialog_show(logout_dialog);
2023 /***************************************************************************/
2024 static E_Dialog *halt_dialog = NULL;
2027 _e_actions_cb_halt_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
2031 e_object_del(E_OBJECT(halt_dialog));
2034 e_sys_action_do(E_SYS_HALT, NULL);
2038 _e_actions_cb_halt_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
2040 e_object_del(E_OBJECT(halt_dialog));
2045 _e_actions_cb_halt_dialog_delete(E_Win *win)
2050 _e_actions_cb_halt_dialog_cancel(NULL, dia);
2055 if ((params) && (!strcmp(params, "now")))
2057 e_sys_action_do(E_SYS_HALT, NULL);
2060 if (halt_dialog) e_object_del(E_OBJECT(halt_dialog));
2062 if (e_config->cnfmdlg_disabled)
2064 _e_actions_cb_halt_dialog_ok(NULL, NULL);
2068 halt_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_halt_dialog");
2069 if (!halt_dialog) return;
2070 e_win_delete_callback_set(halt_dialog->win, _e_actions_cb_halt_dialog_delete);
2071 e_dialog_title_set(halt_dialog, _("Are you sure you want to turn off?"));
2072 e_dialog_text_set(halt_dialog,
2073 _("You requested to turn off your Computer.<br>"
2075 "Are you sure you want to shut down?"));
2076 e_dialog_icon_set(halt_dialog, "system-shutdown", 64);
2077 e_dialog_button_add(halt_dialog, _("Yes"), NULL,
2078 _e_actions_cb_halt_dialog_ok, NULL);
2079 e_dialog_button_add(halt_dialog, _("No"), NULL,
2080 _e_actions_cb_halt_dialog_cancel, NULL);
2081 e_dialog_button_focus_num(halt_dialog, 1);
2082 e_win_centered_set(halt_dialog->win, 1);
2083 e_dialog_show(halt_dialog);
2086 /***************************************************************************/
2087 static E_Dialog *reboot_dialog = NULL;
2090 _e_actions_cb_reboot_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
2094 e_object_del(E_OBJECT(reboot_dialog));
2095 reboot_dialog = NULL;
2097 e_sys_action_do(E_SYS_REBOOT, NULL);
2101 _e_actions_cb_reboot_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
2103 e_object_del(E_OBJECT(reboot_dialog));
2104 reboot_dialog = NULL;
2108 _e_actions_cb_reboot_dialog_delete(E_Win *win)
2113 _e_actions_cb_reboot_dialog_cancel(NULL, dia);
2118 if ((params) && (!strcmp(params, "now")))
2120 e_sys_action_do(E_SYS_REBOOT, NULL);
2123 if (reboot_dialog) e_object_del(E_OBJECT(reboot_dialog));
2125 if (e_config->cnfmdlg_disabled)
2127 _e_actions_cb_reboot_dialog_ok(NULL, NULL);
2131 reboot_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_reboot_dialog");
2132 if (!reboot_dialog) return;
2133 e_win_delete_callback_set(reboot_dialog->win, _e_actions_cb_reboot_dialog_delete);
2134 e_dialog_title_set(reboot_dialog, _("Are you sure you want to reboot?"));
2135 e_dialog_text_set(reboot_dialog,
2136 _("You requested to reboot your Computer.<br>"
2138 "Are you sure you want to restart it?"));
2139 e_dialog_icon_set(reboot_dialog, "system-restart", 64);
2140 e_dialog_button_add(reboot_dialog, _("Yes"), NULL,
2141 _e_actions_cb_reboot_dialog_ok, NULL);
2142 e_dialog_button_add(reboot_dialog, _("No"), NULL,
2143 _e_actions_cb_reboot_dialog_cancel, NULL);
2144 e_dialog_button_focus_num(reboot_dialog, 1);
2145 e_win_centered_set(reboot_dialog->win, 1);
2146 e_dialog_show(reboot_dialog);
2149 /***************************************************************************/
2150 static E_Dialog *suspend_dialog = NULL;
2153 _e_actions_cb_suspend_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
2157 e_object_del(E_OBJECT(suspend_dialog));
2158 suspend_dialog = NULL;
2160 e_sys_action_do(E_SYS_SUSPEND, NULL);
2164 _e_actions_cb_suspend_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
2166 e_object_del(E_OBJECT(suspend_dialog));
2167 suspend_dialog = NULL;
2171 _e_actions_cb_suspend_dialog_delete(E_Win *win)
2176 _e_actions_cb_suspend_dialog_cancel(NULL, dia);
2179 ACT_FN_GO(suspend_now, __UNUSED__)
2181 e_sys_action_do(E_SYS_SUSPEND, NULL);
2184 ACT_FN_GO(suspend, )
2186 if ((params) && (!strcmp(params, "now")))
2188 e_sys_action_do(E_SYS_SUSPEND, NULL);
2191 if (suspend_dialog) e_object_del(E_OBJECT(suspend_dialog));
2193 if (e_config->cnfmdlg_disabled)
2195 _e_actions_cb_suspend_dialog_ok(NULL, NULL);
2199 suspend_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_suspend_dialog");
2200 if (!suspend_dialog) return;
2201 e_win_delete_callback_set(suspend_dialog->win, _e_actions_cb_suspend_dialog_delete);
2202 e_dialog_title_set(suspend_dialog, _("Are you sure you want to turn off?"));
2203 e_dialog_text_set(suspend_dialog,
2204 _("You requested to suspend your Computer.<br>"
2206 "Are you sure you want to suspend?"));
2207 e_dialog_icon_set(suspend_dialog, "system-suspend", 64);
2208 e_dialog_button_add(suspend_dialog, _("Yes"), NULL,
2209 _e_actions_cb_suspend_dialog_ok, NULL);
2210 e_dialog_button_add(suspend_dialog, _("No"), NULL,
2211 _e_actions_cb_suspend_dialog_cancel, NULL);
2212 e_dialog_button_focus_num(suspend_dialog, 1);
2213 e_win_centered_set(suspend_dialog->win, 1);
2214 e_dialog_show(suspend_dialog);
2217 /***************************************************************************/
2218 static E_Dialog *hibernate_dialog = NULL;
2221 _e_actions_cb_hibernate_dialog_ok(void *data __UNUSED__, E_Dialog *dia)
2225 e_object_del(E_OBJECT(hibernate_dialog));
2226 hibernate_dialog = NULL;
2228 e_sys_action_do(E_SYS_HIBERNATE, NULL);
2232 _e_actions_cb_hibernate_dialog_cancel(void *data __UNUSED__, E_Dialog *dia __UNUSED__)
2234 e_object_del(E_OBJECT(hibernate_dialog));
2235 hibernate_dialog = NULL;
2239 _e_actions_cb_hibernate_dialog_delete(E_Win *win)
2244 _e_actions_cb_hibernate_dialog_cancel(NULL, dia);
2247 ACT_FN_GO(hibernate, )
2249 if ((params) && (!strcmp(params, "now")))
2251 e_sys_action_do(E_SYS_HIBERNATE, NULL);
2254 if (hibernate_dialog) e_object_del(E_OBJECT(hibernate_dialog));
2256 if (e_config->cnfmdlg_disabled)
2258 _e_actions_cb_hibernate_dialog_ok(NULL, NULL);
2262 hibernate_dialog = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_hibernate_dialog");
2263 if (!hibernate_dialog) return;
2264 e_win_delete_callback_set(hibernate_dialog->win, _e_actions_cb_hibernate_dialog_delete);
2265 e_dialog_title_set(hibernate_dialog, _("Are you sure you want to hibernate?"));
2266 e_dialog_text_set(hibernate_dialog,
2267 _("You requested to hibernate your Computer.<br>"
2269 "Are you sure you want to suspend to disk?"));
2270 e_dialog_icon_set(hibernate_dialog, "system-suspend-hibernate", 64);
2271 e_dialog_button_add(hibernate_dialog, _("Yes"), NULL,
2272 _e_actions_cb_hibernate_dialog_ok, NULL);
2273 e_dialog_button_add(hibernate_dialog, _("No"), NULL,
2274 _e_actions_cb_hibernate_dialog_cancel, NULL);
2275 e_dialog_button_focus_num(hibernate_dialog, 1);
2276 e_win_centered_set(hibernate_dialog->win, 1);
2277 e_dialog_show(hibernate_dialog);
2280 /***************************************************************************/
2281 ACT_FN_GO(pointer_resize_push, )
2284 if (obj->type == E_BORDER_TYPE)
2288 bd = (E_Border *)obj;
2289 if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) ||
2290 (bd->fullscreen) || ((bd->maximized) && (!e_config->allow_manip)))
2292 e_pointer_type_push(bd->pointer, bd, params);
2296 /***************************************************************************/
2297 ACT_FN_GO(pointer_resize_pop, )
2300 if (obj->type == E_BORDER_TYPE)
2304 bd = (E_Border *)obj;
2305 if ((bd->lock_user_size) || (bd->shaded) || (bd->shading) ||
2306 (bd->fullscreen) || ((bd->maximized) && (!e_config->allow_manip)))
2308 e_pointer_type_pop(bd->pointer, bd, params);
2312 /***************************************************************************/
2313 ACT_FN_GO(desk_lock, __UNUSED__)
2317 zone = _e_actions_zone_get(obj);
2322 /***************************************************************************/
2323 ACT_FN_GO(shelf_show, )
2330 for (; *params != '\0'; params++)
2331 if (!isspace(*params))
2333 if (*params == '\0')
2337 EINA_LIST_FOREACH(e_shelf_list(), l, es)
2339 if ((!params) || (params && (fnmatch(params, es->name, 0) == 0)))
2341 e_shelf_toggle(es, 1);
2342 e_shelf_toggle(es, 0);
2346 /***************************************************************************/
2347 #define ACT_SHELF_SHOW(params, es) \
2348 if ((!params) || (params && (fnmatch(params, es->name, 0) == 0))) \
2350 e_shelf_toggle(es, 1); \
2351 e_shelf_toggle(es, 0); \
2354 ACT_FN_GO_EDGE(shelf_show, )
2361 for (; *params != '\0'; params++)
2363 if (!isspace(*params))
2366 if (*params == '\0')
2370 EINA_LIST_FOREACH(e_shelf_list(), l, es)
2374 case E_ZONE_EDGE_LEFT:
2375 if ((es->gadcon->orient == E_GADCON_ORIENT_LEFT ||
2376 es->gadcon->orient == E_GADCON_ORIENT_CORNER_LT ||
2377 es->gadcon->orient == E_GADCON_ORIENT_CORNER_LB) &&
2378 (ev->y >= es->y) && (ev->y <= (es->y + es->h)))
2379 ACT_SHELF_SHOW(params, es);
2381 case E_ZONE_EDGE_RIGHT:
2382 if ((es->gadcon->orient == E_GADCON_ORIENT_RIGHT ||
2383 es->gadcon->orient == E_GADCON_ORIENT_CORNER_RT ||
2384 es->gadcon->orient == E_GADCON_ORIENT_CORNER_RB) &&
2385 (ev->y >= es->y) && (ev->y <= (es->y + es->h)))
2386 ACT_SHELF_SHOW(params, es);
2388 case E_ZONE_EDGE_TOP:
2389 if ((es->gadcon->orient == E_GADCON_ORIENT_TOP ||
2390 es->gadcon->orient == E_GADCON_ORIENT_CORNER_TL ||
2391 es->gadcon->orient == E_GADCON_ORIENT_CORNER_TR) &&
2392 (ev->x >= es->x) && (ev->x <= (es->x + es->w)))
2393 ACT_SHELF_SHOW(params, es);
2395 case E_ZONE_EDGE_BOTTOM:
2396 if ((es->gadcon->orient == E_GADCON_ORIENT_BOTTOM ||
2397 es->gadcon->orient == E_GADCON_ORIENT_CORNER_BL ||
2398 es->gadcon->orient == E_GADCON_ORIENT_CORNER_BR) &&
2399 (ev->x >= es->x) && (ev->x <= (es->x + es->w)))
2400 ACT_SHELF_SHOW(params, es);
2407 #undef ACT_SHELF_SHOW
2409 /***************************************************************************/
2410 typedef struct _Delayed_Action Delayed_Action;
2412 struct _Delayed_Action
2415 const char *keyname;
2420 const char *action, *params;
2424 static Eina_List *_delayed_actions = NULL;
2427 _delayed_action_free(Delayed_Action *da)
2429 if (da->obj) e_object_unref(da->obj);
2430 if (da->keyname) eina_stringshare_del(da->keyname);
2431 if (da->timer) ecore_timer_del(da->timer);
2432 if (da->def.action) eina_stringshare_del(da->def.action);
2433 if (da->def.params) eina_stringshare_del(da->def.params);
2434 if (da->delayed.action) eina_stringshare_del(da->delayed.action);
2435 if (da->delayed.params) eina_stringshare_del(da->delayed.params);
2440 _delayed_action_cb_timer(void *data)
2447 act = e_action_find(da->delayed.action);
2450 if (act->func.go) act->func.go(da->obj, da->delayed.params);
2452 _delayed_actions = eina_list_remove(_delayed_actions, da);
2453 _delayed_action_free(da);
2454 return ECORE_CALLBACK_CANCEL;
2458 _delayed_action_do(Delayed_Action *da)
2462 act = e_action_find(da->def.action);
2465 if (act->func.go) act->func.go(da->obj, da->def.params);
2470 _delayed_action_list_parse_action(const char *str, double *delay, const char **action, const char **params)
2477 sscanf(str, "%10s %1000s", fbuf, buf);
2478 *action = eina_stringshare_add(buf);
2479 *delay = atof(fbuf);
2480 p = strchr(str, ' ');
2488 *params = eina_stringshare_add(p);
2494 _delayed_action_list_parse(Delayed_Action *da, const char *params)
2497 const char *p, *a1start = NULL, *a1stop = NULL;
2498 const char *a2start = NULL, *a2stop = NULL;
2500 // FORMAT: "[0.0 default_action param1 param2] [x.x action2 param1 param2]"
2504 if ((*p == '[') && ((p == params) || ((p > params) && (p[-1] != '\\')))) {a1start = p + 1; break;}
2509 if ((*p == ']') && ((p == params) || ((p > params) && (p[-1] != '\\')))) {a1stop = p; break;}
2514 if ((*p == '[') && ((p == params) || ((p > params) && (p[-1] != '\\')))) {a2start = p + 1; break;}
2519 if ((*p == ']') && ((p == params) || ((p > params) && (p[-1] != '\\')))) {a2stop = p; break;}
2522 if ((a1start) && (a2start) && (a1stop) && (a2stop))
2525 const char *action, *params;
2527 a1 = alloca(a1stop - a1start + 1);
2528 eina_strlcpy(a1, a1start, a1stop - a1start + 1);
2531 _delayed_action_list_parse_action(a1, &delay, &da->def.action, &da->def.params);
2533 a2 = alloca(a1stop - a1start + 1);
2534 eina_strlcpy(a2, a2start, a2stop - a2start + 1);
2535 _delayed_action_list_parse_action(a2, &delay, &da->delayed.action, &da->delayed.params);
2537 da->timer = ecore_timer_add(delay, _delayed_action_cb_timer, da);
2541 _delayed_action_key_add(E_Object *obj, const char *params, Ecore_Event_Key *ev)
2545 da = E_NEW(Delayed_Action, 1);
2550 e_object_ref(da->obj);
2553 da->keyname = eina_stringshare_add(ev->keyname);
2554 if (params) _delayed_action_list_parse(da, params);
2555 _delayed_actions = eina_list_append(_delayed_actions, da);
2559 _delayed_action_key_del(E_Object *obj, const char *params __UNUSED__, Ecore_Event_Key *ev)
2564 EINA_LIST_FOREACH(_delayed_actions, l, da)
2566 if ((da->obj == obj) && (!da->mouse) &&
2567 (!strcmp(da->keyname, ev->keyname)))
2569 _delayed_action_do(da);
2570 _delayed_action_free(da);
2571 _delayed_actions = eina_list_remove_list(_delayed_actions, l);
2578 _delayed_action_mouse_add(E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev)
2582 da = E_NEW(Delayed_Action, 1);
2587 e_object_ref(da->obj);
2590 da->button = ev->buttons;
2591 if (params) _delayed_action_list_parse(da, params);
2592 _delayed_actions = eina_list_append(_delayed_actions, da);
2596 _delayed_action_mouse_del(E_Object *obj, const char *params __UNUSED__, Ecore_Event_Mouse_Button *ev)
2601 EINA_LIST_FOREACH(_delayed_actions, l, da)
2603 if ((da->obj == obj) && (da->mouse) &&
2604 ((int) ev->buttons == da->button))
2606 _delayed_action_do(da);
2607 _delayed_action_free(da);
2608 _delayed_actions = eina_list_remove_list(_delayed_actions, l);
2614 // obj , params , ev
2615 ACT_FN_GO_KEY(delayed_action, )
2617 _delayed_action_key_add(obj, params, ev);
2620 ACT_FN_GO_MOUSE(delayed_action, )
2622 _delayed_action_mouse_add(obj, params, ev);
2625 ACT_FN_END_KEY(delayed_action, )
2627 _delayed_action_key_del(obj, params, ev);
2630 ACT_FN_END_MOUSE(delayed_action, )
2632 _delayed_action_mouse_del(obj, params, ev);
2635 ACT_FN_GO_ACPI(dim_screen, __UNUSED__)
2637 E_Zone *zone = _e_actions_zone_get(obj);
2638 e_backlight_mode_set(zone, E_BACKLIGHT_MODE_DIM);
2641 ACT_FN_GO_ACPI(undim_screen, __UNUSED__)
2643 E_Zone *zone = _e_actions_zone_get(obj);
2644 e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
2647 ACT_FN_GO(backlight_set, )
2649 E_Zone *zone = _e_actions_zone_get(obj);
2655 v = e_backlight_level_get(zone) * 100.0;
2656 if (v == 0) v = 100;
2659 e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
2660 e_backlight_level_set(zone, ((double)v / 100.0), -1.0);
2663 ACT_FN_GO(backlight_adjust, )
2665 E_Zone *zone = _e_actions_zone_get(obj);
2667 if (!params) return;
2669 e_backlight_mode_set(zone, E_BACKLIGHT_MODE_NORMAL);
2670 e_backlight_level_set(zone, e_backlight_level_get(zone) + ((double)v / 100.0), -1.0);
2673 /* local subsystem globals */
2674 static Eina_Hash *actions = NULL;
2675 static Eina_List *action_list = NULL;
2676 static Eina_List *action_names = NULL;
2677 static Eina_List *action_groups = NULL;
2679 /* externally accessible functions */
2682 e_actions_init(void)
2686 actions = eina_hash_string_superfast_new(NULL);
2687 ACT_GO(window_move);
2688 e_action_predef_name_set(N_("Window : Actions"), N_("Move"),
2689 "window_move", NULL, NULL, 0);
2691 ACT_GO_MOUSE(window_move);
2692 ACT_GO_SIGNAL(window_move);
2693 ACT_END(window_move);
2694 ACT_END_MOUSE(window_move);
2695 ACT_GO_KEY(window_move);
2698 ACT_GO(window_resize);
2699 e_action_predef_name_set(N_("Window : Actions"), N_("Resize"),
2700 "window_resize", NULL, NULL, 0);
2702 ACT_GO_MOUSE(window_resize);
2703 ACT_GO_SIGNAL(window_resize);
2704 ACT_END(window_resize);
2705 ACT_END_MOUSE(window_resize);
2706 ACT_GO_KEY(window_resize);
2709 ACT_GO(window_menu);
2710 e_action_predef_name_set(N_("Menu"), N_("Window Menu"),
2711 "window_menu", NULL, NULL, 0);
2713 ACT_GO_MOUSE(window_menu);
2714 ACT_GO_KEY(window_menu);
2717 ACT_GO(window_raise);
2718 e_action_predef_name_set(N_("Window : Actions"), N_("Raise"),
2719 "window_raise", NULL, NULL, 0);
2722 ACT_GO(window_lower);
2723 e_action_predef_name_set(N_("Window : Actions"), N_("Lower"),
2724 "window_lower", NULL, NULL, 0);
2727 ACT_GO(window_close);
2728 e_action_predef_name_set(N_("Window : Actions"), N_("Close"),
2729 "window_close", NULL, NULL, 0);
2732 ACT_GO(window_kill);
2733 e_action_predef_name_set(N_("Window : Actions"), N_("Kill"),
2734 "window_kill", NULL, NULL, 0);
2736 /* window_sticky_toggle */
2737 ACT_GO(window_sticky_toggle);
2738 e_action_predef_name_set(N_("Window : State"), N_("Sticky Mode Toggle"),
2739 "window_sticky_toggle", NULL, NULL, 0);
2741 ACT_GO(window_sticky);
2743 /* window_iconic_toggle */
2744 ACT_GO(window_iconic_toggle);
2745 e_action_predef_name_set(N_("Window : State"), N_("Iconic Mode Toggle"),
2746 "window_iconic_toggle", NULL, NULL, 0);
2748 ACT_GO(window_iconic);
2750 /* window_fullscreen_toggle */
2751 ACT_GO(window_fullscreen_toggle);
2752 e_action_predef_name_set(N_("Window : State"), N_("Fullscreen Mode Toggle"),
2753 "window_fullscreen_toggle", NULL, NULL, 0);
2755 ACT_GO(window_fullscreen);
2757 /* window_maximized_toggle */
2758 ACT_GO(window_maximized_toggle);
2759 e_action_predef_name_set(N_("Window : State"), N_("Maximize"),
2760 "window_maximized_toggle", NULL, NULL, 0);
2761 e_action_predef_name_set(N_("Window : State"), N_("Maximize Vertically"),
2762 "window_maximized_toggle", "default vertical",
2764 e_action_predef_name_set(N_("Window : State"), N_("Maximize Horizontally"),
2765 "window_maximized_toggle", "default horizontal",
2767 e_action_predef_name_set(N_("Window : State"), N_("Maximize Fullscreen"),
2768 "window_maximized_toggle", "fullscreen", NULL, 0);
2769 e_action_predef_name_set(N_("Window : State"), N_("Maximize Mode \"Smart\""),
2770 "window_maximized_toggle", "smart", NULL, 0);
2771 e_action_predef_name_set(N_("Window : State"), N_("Maximize Mode \"Expand\""),
2772 "window_maximized_toggle", "expand", NULL, 0);
2773 e_action_predef_name_set(N_("Window : State"), N_("Maximize Mode \"Fill\""),
2774 "window_maximized_toggle", "fill", NULL, 0);
2776 ACT_GO(window_maximized);
2778 /* window_shaded_toggle */
2779 ACT_GO(window_shaded_toggle);
2780 e_action_predef_name_set(N_("Window : State"), N_("Shade Up Mode Toggle"),
2781 "window_shaded_toggle", "up", NULL, 0);
2782 e_action_predef_name_set(N_("Window : State"), N_("Shade Down Mode Toggle"),
2783 "window_shaded_toggle", "down", NULL, 0);
2784 e_action_predef_name_set(N_("Window : State"), N_("Shade Left Mode Toggle"),
2785 "window_shaded_toggle", "left", NULL, 0);
2786 e_action_predef_name_set(N_("Window : State"), N_("Shade Right Mode Toggle"),
2787 "window_shaded_toggle", "right", NULL, 0);
2788 e_action_predef_name_set(N_("Window : State"), N_("Shade Mode Toggle"),
2789 "window_shaded_toggle", NULL, NULL, 0);
2791 ACT_GO(window_shaded);
2793 /* window_borderless_toggle */
2794 ACT_GO(window_borderless_toggle);
2795 e_action_predef_name_set(N_("Window : State"), N_("Toggle Borderless State"),
2796 "window_borderless_toggle", NULL, NULL, 0);
2798 /* window_border_set */
2799 ACT_GO(window_border_set);
2800 e_action_predef_name_set(N_("Window : State"), N_("Set Border"),
2801 "window_border_set", NULL,
2802 "syntax: BorderName, example: pixel", 1);
2804 /* window_border_cycle */
2805 ACT_GO(window_border_cycle);
2806 e_action_predef_name_set(N_("Window : State"), N_("Cycle between Borders"),
2807 "window_border_cycle", NULL,
2808 "syntax: BorderNames, example: default pixel", 1);
2810 /* window_pinned_toggle */
2811 ACT_GO(window_pinned_toggle);
2812 e_action_predef_name_set(N_("Window : State"), N_("Toggle Pinned State"),
2813 "window_pinned_toggle", NULL, NULL, 0);
2816 ACT_GO(desk_flip_by);
2817 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Left"),
2818 "desk_flip_by", "-1 0", NULL, 0);
2819 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Right"),
2820 "desk_flip_by", "1 0", NULL, 0);
2821 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Up"),
2822 "desk_flip_by", "0 -1", NULL, 0);
2823 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Down"),
2824 "desk_flip_by", "0 1", NULL, 0);
2825 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop By..."),
2826 "desk_flip_by", NULL,
2827 "syntax: X-offset Y-offset, example: -1 0", 1);
2829 /* desk_deskshow_toggle */
2830 ACT_GO(desk_deskshow_toggle);
2831 e_action_predef_name_set(N_("Desktop"), N_("Show The Desktop"),
2832 "desk_deskshow_toggle", NULL, NULL, 0);
2836 ACT_GO_EDGE(shelf_show);
2837 e_action_predef_name_set(N_("Desktop"), N_("Show The Shelf"), "shelf_show",
2838 NULL, "shelf name glob: Shelf-* ", 1);
2840 /* desk_linear_flip_to */
2841 ACT_GO(desk_flip_to);
2842 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop To..."),
2843 "desk_flip_to", NULL,
2844 "syntax: X Y, example: 1 2", 1);
2846 /* desk_linear_flip_by */
2847 ACT_GO(desk_linear_flip_by);
2848 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Linearly..."),
2849 "desk_linear_flip_by",
2850 NULL, "syntax: N-offset, example: -2", 1);
2852 /* desk_linear_flip_to */
2853 ACT_GO(desk_linear_flip_to);
2854 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 0"),
2855 "desk_linear_flip_to", "0", NULL, 0);
2856 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 1"),
2857 "desk_linear_flip_to", "1", NULL, 0);
2858 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 2"),
2859 "desk_linear_flip_to", "2", NULL, 0);
2860 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 3"),
2861 "desk_linear_flip_to", "3", NULL, 0);
2862 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 4"),
2863 "desk_linear_flip_to", "4", NULL, 0);
2864 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 5"),
2865 "desk_linear_flip_to", "5", NULL, 0);
2866 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 6"),
2867 "desk_linear_flip_to", "6", NULL, 0);
2868 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 7"),
2869 "desk_linear_flip_to", "7", NULL, 0);
2870 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 8"),
2871 "desk_linear_flip_to", "8", NULL, 0);
2872 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 9"),
2873 "desk_linear_flip_to", "9", NULL, 0);
2874 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 10"),
2875 "desk_linear_flip_to", "10", NULL, 0);
2876 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 11"),
2877 "desk_linear_flip_to", "11", NULL, 0);
2878 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop..."),
2879 "desk_linear_flip_to", NULL,
2880 "syntax: N, example: 1", 1);
2882 /* desk_flip_by_all */
2883 ACT_GO(desk_flip_by_all);
2884 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Left (All Screens)"),
2885 "desk_flip_by_all", "-1 0", NULL, 0);
2886 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Right (All Screens)"),
2887 "desk_flip_by_all", "1 0", NULL, 0);
2888 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Up (All Screens)"),
2889 "desk_flip_by_all", "0 -1", NULL, 0);
2890 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Down (All Screens)"),
2891 "desk_flip_by_all", "0 1", NULL, 0);
2892 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop By... (All Screens)"),
2893 "desk_flip_by_all", NULL,
2894 "syntax: X-offset Y-offset, example: -1 0", 1);
2896 /* desk_flip_to_all */
2897 ACT_GO(desk_flip_to_all);
2898 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop To... (All Screens)"),
2899 "desk_flip_to_all", NULL,
2900 "syntax: X Y, example: 1 2", 1);
2902 /* desk_linear_flip_by_all */
2903 ACT_GO(desk_linear_flip_by_all);
2904 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop Linearly... (All Screens)"),
2905 "desk_linear_flip_by_all",
2906 NULL, "syntax: N-offset, example: -2", 1);
2908 /* desk_flip_in_direction */
2909 ACT_GO_EDGE(desk_flip_in_direction);
2910 e_action_predef_name_set(N_("Desktop"), N_("Flip Desktop In Direction..."),
2911 "desk_flip_in_direction", NULL, "syntax: N-pixel-offset, example: 25", 1);
2913 /* desk_linear_flip_to_all */
2914 ACT_GO(desk_linear_flip_to_all);
2915 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 0 (All Screens)"),
2916 "desk_linear_flip_to_all", "0", NULL, 0);
2917 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 1 (All Screens)"),
2918 "desk_linear_flip_to_all", "1", NULL, 0);
2919 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 2 (All Screens)"),
2920 "desk_linear_flip_to_all", "2", NULL, 0);
2921 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 3 (All Screens)"),
2922 "desk_linear_flip_to_all", "3", NULL, 0);
2923 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 4 (All Screens)"),
2924 "desk_linear_flip_to_all", "4", NULL, 0);
2925 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 5 (All Screens)"),
2926 "desk_linear_flip_to_all", "5", NULL, 0);
2927 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 6 (All Screens)"),
2928 "desk_linear_flip_to_all", "6", NULL, 0);
2929 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 7 (All Screens)"),
2930 "desk_linear_flip_to_all", "7", NULL, 0);
2931 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 8 (All Screens)"),
2932 "desk_linear_flip_to_all", "8", NULL, 0);
2933 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 9 (All Screens)"),
2934 "desk_linear_flip_to_all", "9", NULL, 0);
2935 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 10 (All Screens)"),
2936 "desk_linear_flip_to_all", "10", NULL, 0);
2937 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop 11 (All Screens)"),
2938 "desk_linear_flip_to_all", "11", NULL, 0);
2939 e_action_predef_name_set(N_("Desktop"), N_("Switch To Desktop... (All Screens)"),
2940 "desk_linear_flip_to_all", NULL,
2941 "syntax: N, example: 1", 1);
2943 /* screen_send_to */
2944 ACT_GO(screen_send_to);
2945 e_action_predef_name_set(N_("Screen"), N_("Send Mouse To Screen 0"),
2946 "screen_send_to", "0", NULL, 0);
2947 e_action_predef_name_set(N_("Screen"), N_("Send Mouse To Screen 1"),
2948 "screen_send_to", "1", NULL, 0);
2949 e_action_predef_name_set(N_("Screen"), N_("Send Mouse To Screen..."),
2950 "screen_send_to", NULL,
2951 "syntax: N, example: 0", 1);
2953 /* screen_send_by */
2954 ACT_GO(screen_send_by);
2955 e_action_predef_name_set(N_("Screen"), N_("Send Mouse Forward 1 Screen"),
2956 "screen_send_by", "1", NULL, 0);
2957 e_action_predef_name_set(N_("Screen"), N_("Send Mouse Back 1 Screen"),
2958 "screen_send_by", "-1", NULL, 0);
2959 e_action_predef_name_set(N_("Screen"), N_("Send Mouse Forward/Back Screens..."),
2960 "screen_send_by", NULL,
2961 "syntax: N-offset, example: -2", 1);
2963 ACT_GO_ACPI(dim_screen);
2964 e_action_predef_name_set(N_("Screen"), N_("Dim"), "dim_screen",
2966 ACT_GO_ACPI(undim_screen);
2967 e_action_predef_name_set(N_("Screen"), N_("Undim"), "undim_screen",
2969 ACT_GO(backlight_set);
2970 e_action_predef_name_set(N_("Screen"), N_("Backlight Set"), "backlight_set",
2971 NULL, "syntax: brightness(0 - 100), example: 50", 1);
2972 e_action_predef_name_set(N_("Screen"), N_("Backlight Min"), "backlight_set",
2974 e_action_predef_name_set(N_("Screen"), N_("Backlight Mid"), "backlight_set",
2976 e_action_predef_name_set(N_("Screen"), N_("Backlight Max"), "backlight_set",
2978 ACT_GO(backlight_adjust);
2979 e_action_predef_name_set(N_("Screen"), N_("Backlight Adjust"), "backlight_adjust",
2980 NULL, "syntax: brightness(-100 - 100), example: -20", 1);
2981 e_action_predef_name_set(N_("Screen"), N_("Backlight Up"), "backlight_adjust",
2983 e_action_predef_name_set(N_("Screen"), N_("Backlight Down"), "backlight_adjust",
2986 /* window_move_to_center */
2987 ACT_GO(window_move_to_center);
2988 e_action_predef_name_set(N_("Window : Actions"), N_("Move To Center"),
2989 "window_move_to_center", NULL, NULL, 0);
2990 /* window_move_to */
2991 ACT_GO(window_move_to);
2992 e_action_predef_name_set(N_("Window : Actions"), N_("Move To..."),
2993 "window_move_to", NULL,
2994 "syntax: [+,-]X [+,-]Y or * [+,-]Y or [+,-]X *, example: -1 +1", 1);
2995 /* window_move_by */
2996 ACT_GO(window_move_by);
2997 e_action_predef_name_set(N_("Window : Actions"), N_("Move By..."),
2998 "window_move_by", NULL,
2999 "syntax: X-offset Y-offset, example: -1 0", 1);
3001 /* window_resize_by */
3002 ACT_GO(window_resize_by);
3003 e_action_predef_name_set(N_("Window : Actions"), N_("Resize By..."),
3004 "window_resize_by", NULL,
3005 "syntax: W H, example: 100 150", 1);
3008 ACT_GO(window_push);
3009 e_action_predef_name_set(N_("Window : Actions"), N_("Push in Direction..."),
3010 "window_push", NULL,
3011 "syntax: direction, example: up, down, left, right, up-left, up-right, down-left, down-right", 1);
3013 /* window_drag_icon */
3014 ACT_GO(window_drag_icon);
3015 e_action_predef_name_set(N_("Window : Actions"), N_("Drag Icon..."),
3016 "window_drag_icon", NULL, NULL, 0);
3018 /* window_desk_move_by */
3019 ACT_GO(window_desk_move_by);
3020 e_action_predef_name_set(N_("Window : Moving"), N_("To Next Desktop"),
3021 "window_desk_move_by", "1 0", NULL, 0);
3022 e_action_predef_name_set(N_("Window : Moving"), N_("To Previous Desktop"),
3023 "window_desk_move_by", "-1 0", NULL, 0);
3024 e_action_predef_name_set(N_("Window : Moving"), N_("By Desktop #..."),
3025 "window_desk_move_by", NULL,
3026 "syntax: X-offset Y-offset, example: -2 2", 1);
3028 /* window_desk_move_to */
3029 ACT_GO(window_desk_move_to);
3030 e_action_predef_name_set(N_("Window : Moving"), N_("To Desktop..."),
3031 "window_desk_move_to", NULL,
3032 "syntax: X Y, example: 0 1", 1);
3036 e_action_predef_name_set(N_("Menu"), N_("Show Main Menu"),
3037 "menu_show", "main", NULL, 0);
3038 e_action_predef_name_set(N_("Menu"), N_("Show Favorites Menu"), "menu_show",
3039 "favorites", NULL, 0);
3040 e_action_predef_name_set(N_("Menu"), N_("Show All Applications Menu"),
3041 "menu_show", "all", NULL, 0);
3042 e_action_predef_name_set(N_("Menu"), N_("Show Clients Menu"), "menu_show",
3043 "clients", NULL, 0);
3044 e_action_predef_name_set(N_("Menu"), N_("Show Menu..."), "menu_show", NULL,
3045 "syntax: MenuName, example: MyMenu", 1);
3046 ACT_GO_MOUSE(menu_show);
3047 ACT_GO_KEY(menu_show);
3051 e_action_predef_name_set(N_("Launch"), N_("Command"), "exec", NULL,
3052 "syntax: CommandName, example: /usr/bin/xmms", 1);
3056 e_action_predef_name_set(N_("Launch"), N_("Application"), "app", NULL,
3057 "syntax: , example:", 1);
3060 e_action_predef_name_set(N_("Enlightenment"), N_("Restart"), "restart",
3064 e_action_predef_name_set(N_("Enlightenment"), N_("Exit"), "exit",
3068 e_action_predef_name_set(N_("Enlightenment"), N_("Exit Now"),
3069 "exit_now", NULL, NULL, 0);
3071 ACT_GO(mode_presentation_toggle);
3072 e_action_predef_name_set(N_("Enlightenment : Mode"),
3073 N_("Presentation Mode Toggle"),
3074 "mode_presentation_toggle", NULL, NULL, 0);
3076 ACT_GO(mode_offline_toggle);
3077 e_action_predef_name_set(N_("Enlightenment : Mode"),
3078 N_("Offline Mode Toggle"),
3079 "mode_offline_toggle", NULL, NULL, 0);
3082 e_action_predef_name_set(N_("System"), N_("Log Out"), "logout",
3086 e_action_predef_name_set(N_("System"), N_("Power Off Now"),
3087 "halt_now", NULL, NULL, 0);
3090 e_action_predef_name_set(N_("System"), N_("Power Off"), "halt",
3094 e_action_predef_name_set(N_("System"), N_("Reboot"), "reboot",
3097 ACT_GO(suspend_now);
3098 e_action_predef_name_set(N_("System"), N_("Suspend Now"), "suspend_now",
3102 e_action_predef_name_set(N_("System"), N_("Suspend"), "suspend",
3106 e_action_predef_name_set(N_("System"), N_("Hibernate"), "hibernate",
3109 ACT_GO(pointer_resize_push);
3110 ACT_GO(pointer_resize_pop);
3114 e_action_predef_name_set(N_("Desktop"), N_("Lock"), "desk_lock",
3117 /* cleanup_windows */
3118 ACT_GO(cleanup_windows);
3119 e_action_predef_name_set(N_("Desktop"), N_("Cleanup Windows"),
3120 "cleanup_windows", NULL, NULL, 0);
3122 /* delayed_action */
3123 ACT_GO_KEY(delayed_action);
3124 e_action_predef_name_set(N_("Generic : Actions"), N_("Delayed Action"),
3125 "delayed_action", NULL, "[0.0 exec xterm] [0.3 exec xev]", 1);
3126 ACT_GO_MOUSE(delayed_action);
3127 ACT_END_KEY(delayed_action);
3128 ACT_END_MOUSE(delayed_action);
3134 e_actions_shutdown(void)
3136 e_action_predef_name_all_del();
3139 e_object_del(action_list->data);
3141 action_names = eina_list_free(action_names);
3142 eina_hash_free(actions);
3149 e_action_name_list(void)
3151 return action_names;
3155 e_action_add(const char *name)
3159 act = e_action_find(name);
3162 act = E_OBJECT_ALLOC(E_Action, E_ACTION_TYPE, _e_action_free);
3163 if (!act) return NULL;
3165 eina_hash_direct_add(actions, act->name, act);
3166 action_names = eina_list_append(action_names, name);
3167 action_list = eina_list_append(action_list, act);
3173 e_action_del(const char *name)
3177 act = eina_hash_find(actions, name);
3178 if (act) _e_action_free(act);
3182 e_action_find(const char *name)
3186 act = eina_hash_find(actions, name);
3191 e_action_predef_label_get(const char *action, const char *params)
3193 E_Action_Group *actg = NULL;
3194 E_Action_Description *actd = NULL;
3197 EINA_LIST_FOREACH(action_groups, l, actg)
3199 EINA_LIST_FOREACH(actg->acts, l2, actd)
3201 if (!strcmp(actd->act_cmd, action))
3203 if ((params) && (actd->act_params))
3205 if (!strcmp(params, actd->act_params))
3206 return actd->act_name;
3208 else return actd->act_name;
3212 if (params) return e_action_predef_label_get(action, NULL);
3217 e_action_predef_name_set(const char *act_grp, const char *act_name, const char *act_cmd, const char *act_params, const char *param_example, int editable)
3219 E_Action_Group *actg = NULL;
3220 E_Action_Description *actd = NULL;
3223 if ((!act_grp) || (!act_name)) return;
3225 EINA_LIST_FOREACH(action_groups, l, actg)
3227 if (!strcmp(actg->act_grp, act_grp)) break;
3233 actg = E_NEW(E_Action_Group, 1);
3236 actg->act_grp = eina_stringshare_add(act_grp);
3239 action_groups = eina_list_append(action_groups, actg);
3241 eina_list_sort(action_groups, -1, _action_groups_sort_cb);
3244 EINA_LIST_FOREACH(actg->acts, l, actd)
3246 if (!strcmp(actd->act_name, act_name)) break;
3252 actd = E_NEW(E_Action_Description, 1);
3255 actd->act_name = eina_stringshare_add(act_name);
3256 actd->act_cmd = !act_cmd ? NULL : eina_stringshare_add(act_cmd);
3257 actd->act_params = !act_params ? NULL : eina_stringshare_add(act_params);
3258 actd->param_example = !param_example ? NULL : eina_stringshare_add(param_example);
3259 actd->editable = editable;
3261 actg->acts = eina_list_append(actg->acts, actd);
3265 e_action_predef_name_del(const char *act_grp, const char *act_name)
3267 E_Action_Group *actg = NULL;
3268 E_Action_Description *actd = NULL;
3271 EINA_LIST_FOREACH(action_groups, l, actg)
3273 if (!strcmp(actg->act_grp, act_grp)) break;
3279 EINA_LIST_FOREACH(actg->acts, l, actd)
3281 if (!strcmp(actd->act_name, act_name))
3283 actg->acts = eina_list_remove(actg->acts, actd);
3285 if (actd->act_name) eina_stringshare_del(actd->act_name);
3286 if (actd->act_cmd) eina_stringshare_del(actd->act_cmd);
3287 if (actd->act_params) eina_stringshare_del(actd->act_params);
3288 if (actd->param_example) eina_stringshare_del(actd->param_example);
3292 if (!eina_list_count(actg->acts))
3294 action_groups = eina_list_remove(action_groups, actg);
3295 if (actg->act_grp) eina_stringshare_del(actg->act_grp);
3304 e_action_predef_name_all_del(void)
3306 E_Action_Group *actg = NULL;
3307 E_Action_Description *actd = NULL;
3309 EINA_LIST_FREE(action_groups, actg)
3311 EINA_LIST_FREE(actg->acts, actd)
3313 if (actd->act_name) eina_stringshare_del(actd->act_name);
3314 if (actd->act_cmd) eina_stringshare_del(actd->act_cmd);
3315 if (actd->act_params) eina_stringshare_del(actd->act_params);
3316 if (actd->param_example) eina_stringshare_del(actd->param_example);
3320 if (actg->act_grp) eina_stringshare_del(actg->act_grp);
3323 action_groups = NULL;
3327 e_action_groups_get(void)
3329 return action_groups;
3332 /* local subsystem functions */
3335 _e_action_free(E_Action *act)
3337 eina_hash_del(actions, act->name, act);
3338 action_names = eina_list_remove(action_names, act->name);
3339 action_list = eina_list_remove(action_list, act);
3344 _e_actions_maximize_parse(const char *params)
3348 char s1[32], s2[32];
3350 if (!params) return e_config->maximize_policy;
3351 ret = sscanf(params, "%20s %20s", s1, s2);
3354 if (!strcmp(s2, "horizontal"))
3355 max = E_MAXIMIZE_HORIZONTAL;
3356 else if (!strcmp(s2, "vertical"))
3357 max = E_MAXIMIZE_VERTICAL;
3359 max = E_MAXIMIZE_BOTH;
3363 if (!strcmp(s1, "fullscreen"))
3364 max |= E_MAXIMIZE_FULLSCREEN;
3365 else if (!strcmp(s1, "smart"))
3366 max |= E_MAXIMIZE_SMART;
3367 else if (!strcmp(s1, "expand"))
3368 max |= E_MAXIMIZE_EXPAND;
3369 else if (!strcmp(s1, "fill"))
3370 max |= E_MAXIMIZE_FILL;
3372 max |= (e_config->maximize_policy & E_MAXIMIZE_TYPE);
3375 max = e_config->maximize_policy;
3380 _action_groups_sort_cb(const void *d1, const void *d2)
3382 const E_Action_Group *g1, *g2;
3384 if (!(g1 = d1)) return 1;
3385 if (!(g2 = d2)) return -1;
3386 return strcmp(g1->act_grp, g2->act_grp);