summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-14 00:33:44 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-14 00:33:44 +0100
commitce66161874e98668e0c6333cfef44f1d636b7b8b (patch)
treebc88678cc8187937b683bb331a1d0516b44472e3 /src
parent3e31c9ebf8d4f759bea31f87fe3a67915eb48179 (diff)
init - handle zone changes during startup/init
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_init.c167
1 files changed, 145 insertions, 22 deletions
diff --git a/src/bin/e_init.c b/src/bin/e_init.c
index 28c1b723e..b55637fc4 100644
--- a/src/bin/e_init.c
+++ b/src/bin/e_init.c
@@ -8,6 +8,11 @@ static int undone = 0;
8static Evas_Object *_e_init_object = NULL; 8static Evas_Object *_e_init_object = NULL;
9static Eina_List *splash_objs = NULL; 9static Eina_List *splash_objs = NULL;
10static Ecore_Timer *_e_init_timeout_timer = NULL; 10static Ecore_Timer *_e_init_timeout_timer = NULL;
11static Ecore_Job *_e_init_update_job = NULL;
12static Ecore_Event_Handler *_e_init_event_zone_add = NULL;
13static Ecore_Event_Handler *_e_init_event_zone_del = NULL;
14static Ecore_Event_Handler *_e_init_event_zone_move_resize = NULL;
15static Eina_Bool _pre_called = EINA_FALSE;
11 16
12static Eina_Bool 17static Eina_Bool
13_e_init_cb_timeout(void *data EINA_UNUSED) 18_e_init_cb_timeout(void *data EINA_UNUSED)
@@ -29,6 +34,7 @@ _e_init_render_pre(void *data EINA_UNUSED, Evas *e, void *info EINA_UNUSED)
29 Eina_List *l; 34 Eina_List *l;
30 Evas_Object *o; 35 Evas_Object *o;
31 36
37 _pre_called = EINA_TRUE;
32 evas_event_callback_del(e, EVAS_CALLBACK_RENDER_PRE, _e_init_render_pre); 38 evas_event_callback_del(e, EVAS_CALLBACK_RENDER_PRE, _e_init_render_pre);
33 EINA_LIST_FOREACH(splash_objs, l, o) 39 EINA_LIST_FOREACH(splash_objs, l, o)
34 { 40 {
@@ -36,6 +42,129 @@ _e_init_render_pre(void *data EINA_UNUSED, Evas *e, void *info EINA_UNUSED)
36 } 42 }
37} 43}
38 44
45static E_Zone *
46_get_zone_num(int num)
47{
48 E_Zone *zone;
49 Eina_List *l;
50
51 EINA_LIST_FOREACH(e_comp->zones, l, zone)
52 {
53 if ((int)zone->num == num) return zone;
54 }
55 return NULL;
56}
57
58static Evas_Object *
59_get_splash_num(int num)
60{
61 Evas_Object *o;
62 Eina_List *l;
63
64 EINA_LIST_FOREACH(splash_objs, l, o)
65 {
66 int n = (intptr_t)evas_object_data_get(o, "num");
67 if (n > 0)
68 {
69 n--;
70 if (num == n) return o;
71 }
72 }
73 return NULL;
74}
75
76static void
77_e_init_splash_obj_zone_update(Evas_Object *o, E_Zone *zone)
78{
79 evas_object_clip_set(o, zone->bg_clip_object);
80 evas_object_move(o, zone->x, zone->y);
81 evas_object_resize(o, zone->w, zone->h);
82 evas_object_layer_set(o, E_LAYER_MAX - 1000);
83}
84
85static Evas_Object *
86_e_init_splash_obj_new(E_Zone *zone)
87{
88 Evas_Object *o;
89
90 o = edje_object_add(e_comp->evas);
91 evas_object_data_set(o, "num", (void *)(intptr_t)(zone->num + 1));
92 if (!zone->num)
93 {
94 e_theme_edje_object_set(o, NULL, "e/init/splash");
95 edje_object_part_text_set(o, "e.text.disable_text", "");
96 edje_object_signal_callback_add(o, "e,state,done_ok", "e",
97 _e_init_cb_signal_done_ok, NULL);
98 }
99 else
100 e_theme_edje_object_set(o, NULL, "e/init/extra_screen");
101 _e_init_splash_obj_zone_update(o, zone);
102 splash_objs = eina_list_append(splash_objs, o);
103 return o;
104}
105
106static void
107_e_init_zone_change_job(void *data EINA_UNUSED)
108{
109 Evas_Object *o;
110 E_Zone *zone;
111 Eina_List *l, *ll;
112
113 _e_init_update_job = NULL;
114 // pass 1 - delete splash objects for zones that have gone OR
115 // update the zone obj to have the right clip and geometry
116 EINA_LIST_FOREACH_SAFE(splash_objs, l, ll, o)
117 {
118 int num = (intptr_t)evas_object_data_get(o, "num");
119 if (num > 0)
120 {
121 num--;
122 zone = _get_zone_num(num);
123 if (!zone)
124 {
125 if (o == _e_init_object)
126 {
127 if (_e_init_timeout_timer)
128 {
129 ecore_timer_del(_e_init_timeout_timer);
130 _e_init_timeout_timer =
131 ecore_timer_add(2.0, _e_init_cb_timeout, NULL);
132 }
133 _e_init_object = NULL;
134 }
135 splash_objs = eina_list_remove_list(splash_objs, l);
136 evas_object_del(o);
137 }
138 else _e_init_splash_obj_zone_update(o, zone);
139 }
140 // something went wrong - so delete it
141 else
142 {
143 if (o == _e_init_object) _e_init_object = NULL;
144 splash_objs = eina_list_remove_list(splash_objs, l);
145 evas_object_del(o);
146 }
147 }
148 // pass 2 - add splash objects for new zones
149 EINA_LIST_FOREACH(e_comp->zones, l, zone)
150 {
151 o = _get_splash_num(zone->num);
152 if (!o) // no splash obj for this zone, add one
153 {
154 o = _e_init_splash_obj_new(zone);
155 if (_pre_called) evas_object_show(o);
156 }
157 }
158}
159
160static Eina_Bool
161_e_init_zone_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
162{
163 if (_e_init_update_job) ecore_job_del(_e_init_update_job);
164 _e_init_update_job = ecore_job_add(_e_init_zone_change_job, NULL);
165 return ECORE_CALLBACK_PASS_ON;
166}
167
39/* public functions */ 168/* public functions */
40EINTERN int 169EINTERN int
41e_init_init(void) 170e_init_init(void)
@@ -50,6 +179,12 @@ EINTERN int
50e_init_shutdown(void) 179e_init_shutdown(void)
51{ 180{
52 /* if not killed, kill init */ 181 /* if not killed, kill init */
182 ecore_event_handler_del(_e_init_event_zone_add);
183 ecore_event_handler_del(_e_init_event_zone_del);
184 ecore_event_handler_del(_e_init_event_zone_move_resize);
185 _e_init_event_zone_add = NULL;
186 _e_init_event_zone_del = NULL;
187 _e_init_event_zone_move_resize = NULL;
53 e_init_hide(); 188 e_init_hide();
54 return 1; 189 return 1;
55} 190}
@@ -62,33 +197,20 @@ e_init_show(void)
62 Eina_List *l; 197 Eina_List *l;
63 /* exec init */ 198 /* exec init */
64 199
200 _e_init_event_zone_add =
201 ecore_event_handler_add(E_EVENT_ZONE_ADD, _e_init_zone_change, NULL);
202 _e_init_event_zone_del =
203 ecore_event_handler_add(E_EVENT_ZONE_DEL, _e_init_zone_change, NULL);
204 _e_init_event_zone_move_resize =
205 ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, _e_init_zone_change, NULL);
65 EINA_LIST_FOREACH(e_comp->zones, l, zone) 206 EINA_LIST_FOREACH(e_comp->zones, l, zone)
66 { 207 {
67 o = edje_object_add(e_comp->evas); 208 o = _e_init_splash_obj_new(zone);
68 if (!zone->num) 209 if (!zone->num) _e_init_object = o;
69 {
70 e_theme_edje_object_set(o, NULL, "e/init/splash");
71 evas_object_name_set(o, "_e_init_object");
72 _e_init_object = o;
73 }
74 else
75 {
76 e_theme_edje_object_set(o, NULL, "e/init/extra_screen");
77 evas_object_name_set(o, "_e_init_extra_screen");
78 }
79 evas_object_clip_set(o, zone->bg_clip_object);
80 evas_object_move(o, zone->x, zone->y);
81 evas_object_resize(o, zone->w, zone->h);
82 evas_object_layer_set(o, E_LAYER_MAX - 1000);
83 splash_objs = eina_list_append(splash_objs, o);
84 } 210 }
85 evas_event_callback_add 211 evas_event_callback_add
86 (e_comp->evas, EVAS_CALLBACK_RENDER_PRE, _e_init_render_pre, NULL); 212 (e_comp->evas, EVAS_CALLBACK_RENDER_PRE, _e_init_render_pre, NULL);
87 edje_object_part_text_set(_e_init_object, "e.text.disable_text", 213 _e_init_timeout_timer = ecore_timer_loop_add(60.0, _e_init_cb_timeout, NULL);
88 "Disable splash screen");
89 edje_object_signal_callback_add(_e_init_object, "e,state,done_ok", "e",
90 _e_init_cb_signal_done_ok, NULL);
91 _e_init_timeout_timer = ecore_timer_loop_add(240.0, _e_init_cb_timeout, NULL);
92 e_init_title_set(_("Enlightenment")); 214 e_init_title_set(_("Enlightenment"));
93 e_init_version_set(VERSION); 215 e_init_version_set(VERSION);
94} 216}
@@ -100,6 +222,7 @@ e_init_hide(void)
100 e_comp_shape_queue(); 222 e_comp_shape_queue();
101 _e_init_object = NULL; 223 _e_init_object = NULL;
102 E_FREE_FUNC(_e_init_timeout_timer, ecore_timer_del); 224 E_FREE_FUNC(_e_init_timeout_timer, ecore_timer_del);
225 E_FREE_FUNC(_e_init_update_job, ecore_job_del);
103} 226}
104 227
105E_API void 228E_API void