1 /* Ask about focus mode */
2 #include "e_wizard.h"
3 #include "e_wizard_api.h"
4 
5 static int focus_mode = 1;
6 /*
7 E_API int
8 wizard_page_init(E_Wizard_Page *pg EINA_UNUSED, Eina_Bool *need_xdg_desktops EINA_UNUSED, Eina_Bool *need_xdg_icons EINA_UNUSED)
9 {
10    return 1;
11 }
12 
13 E_API int
14 wizard_page_shutdown(E_Wizard_Page *pg EINA_UNUSED)
15 {
16    return 1;
17 }
18 */
19 E_API int
wizard_page_show(E_Wizard_Page * pg EINA_UNUSED)20 wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
21 {
22    Evas_Object *o, *of, *ob, *rg;
23 
24    if (e_config->focus_policy == E_FOCUS_CLICK) focus_mode = 0;
25 
26    api->wizard_title_set(_("Window Focus"));
27 
28    of = elm_frame_add(e_comp->elm);
29    elm_object_text_set(of, _("Focus:"));
30    o = elm_box_add(of);
31    elm_box_homogeneous_set(o, 1);
32    elm_object_content_set(of, o);
33 
34    rg = ob = elm_radio_add(o);
35    evas_object_show(ob);
36    E_ALIGN(ob, 0, 0.5);
37    elm_box_pack_end(o, ob);
38    elm_object_text_set(ob, _("Whenever a window is clicked"));
39    elm_radio_state_value_set(ob, 0);
40    elm_radio_value_pointer_set(ob, &focus_mode);
41 
42    ob = elm_radio_add(o);
43    E_ALIGN(ob, 0, 0.5);
44    evas_object_show(ob);
45    elm_box_pack_end(o, ob);
46    elm_radio_group_add(ob, rg);
47    elm_object_text_set(ob, _("Whenever the mouse enters a window"));
48    elm_radio_state_value_set(ob, 1);
49 
50    api->wizard_page_show(of);
51 //   pg->data = o;
52    return 1; /* 1 == show ui, and wait for user, 0 == just continue */
53 }
54 
55 E_API int
wizard_page_hide(E_Wizard_Page * pg EINA_UNUSED)56 wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED)
57 {
58    if (!focus_mode)
59      {
60         e_config->focus_policy = E_FOCUS_CLICK;
61         e_config->focus_setting = E_FOCUS_NEW_WINDOW;
62         e_config->pass_click_on = 1;
63         e_config->always_click_to_raise = 1;
64         e_config->always_click_to_focus = 1;
65         e_config->raise_on_revert_focus = 1;
66         e_config->focus_last_focused_per_desktop = 1;
67         e_config->pointer_slide = 0;
68         e_config->disable_all_pointer_warps = 1;
69         e_config->winlist_warp_while_selecting = 0;
70         e_config->winlist_warp_at_end = 0;
71         e_config->winlist_no_warp_on_direction = 1;
72      }
73    else
74      {
75         e_config->focus_policy = E_FOCUS_SLOPPY;
76         e_config->focus_setting = E_FOCUS_NEW_DIALOG_IF_OWNER_FOCUSED;
77         e_config->pass_click_on = 1;
78         e_config->always_click_to_raise = 0;
79         e_config->always_click_to_focus = 0;
80         e_config->focus_last_focused_per_desktop = 1;
81         e_config->pointer_slide = 1;
82 // auto raise seems to irritate some people so request - disable in wiz
83 //        e_config->use_auto_raise = 1;
84 //        e_config->auto_raise_delay = 0.5;
85      }
86 //   evas_object_del(pg->data);
87    return 1;
88 }
89 /*
90 E_API int
91 wizard_page_apply(E_Wizard_Page *pg EINA_UNUSED)
92 {
93    return 1;
94 }
95 */
96