e - restarts - if theme supports make it totally seamless

if theme doesn't support, fade-in will not happen (it'll just appear),
but if it does... e will fade to black for a restart, then fade back
in nice and cleanly.
This commit is contained in:
Carsten Haitzler 2020-04-19 23:14:35 +01:00
parent 24524001c4
commit e66af58795
5 changed files with 98 additions and 4 deletions

View File

@ -541,6 +541,15 @@ e_comp_desk_window_profile_get(const char *profile)
return NULL;
}
E_API void
e_comp_canvas_zone_restarted(E_Zone *zone)
{
if (edje_object_data_get(zone->over, "restarted"))
{
edje_object_signal_emit(zone->over, "e,state,sys,restarted,show", "e");
}
}
E_API void
e_comp_canvas_zone_update(E_Zone *zone)
{
@ -579,6 +588,12 @@ e_comp_canvas_zone_update(E_Zone *zone)
evas_object_resize(o, zone->w, zone->h);
evas_object_raise(o);
evas_object_show(o);
if (starting && after_restart &&
(edje_object_data_get(zone->over, "restarted")))
{
edje_object_signal_emit(zone->over, "e,state,sys,restarted", "e");
edje_object_message_signal_process(zone->over);
}
}
E_API void

View File

@ -17,6 +17,7 @@ E_API E_Zone * e_comp_zone_xy_get(Evas_Coord x, Evas_Coord y);
E_API E_Zone * e_comp_zone_number_get(int num);
E_API E_Zone * e_comp_zone_id_get(int id);
E_API E_Desk * e_comp_desk_window_profile_get(const char *profile);
E_API void e_comp_canvas_zone_restarted(E_Zone *zone);
E_API void e_comp_canvas_zone_update(E_Zone *zone);
E_API void e_comp_canvas_update(void);
E_API void e_comp_canvas_fake_layers_init(void);

View File

@ -5450,6 +5450,22 @@ _e_comp_x_del(E_Comp *c)
{
unsigned int i;
if (restart)
{
Ecore_X_Atom a;
Ecore_X_Window blackwin;
a = ecore_x_atom_get("E_COMP_BLACK_WIN");
blackwin = ecore_x_window_permanent_new(c->root, a);
ecore_x_window_ignore_set(blackwin, 1);
ecore_x_window_override_set(blackwin, EINA_TRUE);
ecore_x_window_move_resize(blackwin, 0, 0, 32000, 32000);
ecore_x_window_background_color_set(blackwin, 0, 0, 0);
ecore_x_window_show(blackwin);
ecore_x_window_prop_window_set(c->root, a, &blackwin, 1);
ecore_x_sync();
}
if (!e_comp_wl)
ecore_x_window_key_ungrab(c->root, "F", ECORE_EVENT_MODIFIER_SHIFT |
ECORE_EVENT_MODIFIER_CTRL |
@ -5671,6 +5687,8 @@ static Eina_Bool
_e_comp_x_setup(Ecore_X_Window root, int w, int h)
{
Ecore_X_Window_Attributes att;
Ecore_X_Atom a;
Ecore_X_Window blackwin = 0;
Eina_Bool res;
unsigned int i;
@ -5682,6 +5700,12 @@ _e_comp_x_setup(Ecore_X_Window root, int w, int h)
}
if (!ecore_x_window_manage(root)) return EINA_FALSE;
a = ecore_x_atom_get("E_COMP_BLACK_WIN");
if (ecore_x_window_prop_window_get(root, a, &blackwin, 1) == 1)
{
ecore_x_window_ignore_set(blackwin, 1);
}
e_comp_x = e_comp->x_comp_data = E_NEW(E_Comp_X_Data, 1);
ecore_x_e_window_profile_supported_set(root, EINA_TRUE);
e_comp->cm_selection = ecore_x_window_input_new(root, 0, 0, 1, 1);
@ -5785,6 +5809,13 @@ _e_comp_x_setup(Ecore_X_Window root, int w, int h)
e_pointer_window_add(e_comp->pointer, e_comp->root);
_e_comp_x_manage_windows();
if (blackwin)
{
ecore_x_window_free(blackwin);
ecore_x_window_prop_property_del(root, a);
ecore_x_window_ignore_set(blackwin, 0);
}
return !!e_comp->canvas->resize_object;
}

View File

@ -1092,6 +1092,11 @@ main(int argc, char **argv)
if (e_config->show_splash && (!after_restart))
ecore_timer_add(2.0, _e_main_cb_startup_fake_end, NULL);
if (after_restart)
{
E_LIST_FOREACH(e_comp->zones, e_comp_canvas_zone_restarted);
}
TS("MAIN LOOP AT LAST");
if (!setjmp(x_fatal_buff))
ecore_main_loop_begin();

View File

@ -64,6 +64,7 @@ E_API int E_EVENT_SYS_RESUME = -1;
static Eina_Bool
_e_sys_comp_done2_cb(void *data)
{
printf("_e_sys_comp_done2_cb %p\n", data);
e_sys_action_raw_do((E_Sys_Action)(long)data, NULL);
return EINA_FALSE;
}
@ -83,8 +84,11 @@ _e_sys_comp_done_cb(void *data, Evas_Object *obj, const char *sig, const char *s
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
{
ecore_x_screensaver_suspend();
ecore_x_dpms_force(EINA_TRUE);
if (_e_sys_action_after != E_SYS_RESTART)
{
ecore_x_screensaver_suspend();
ecore_x_dpms_force(EINA_TRUE);
}
}
#endif
#ifdef HAVE_WAYLAND
@ -94,8 +98,15 @@ _e_sys_comp_done_cb(void *data, Evas_Object *obj, const char *sig, const char *s
e_comp->screen->dpms(3);
}
#endif
edje_freeze();
ecore_timer_add(0.5, _e_sys_comp_done2_cb, data);
if (_e_sys_action_after != E_SYS_RESTART)
{
edje_freeze();
ecore_timer_add(0.5, _e_sys_comp_done2_cb, data);
}
else
{
ecore_timer_add(0.3, _e_sys_comp_done2_cb, data);
}
E_FREE_FUNC(action_timeout, ecore_timer_del);
}
@ -110,6 +121,9 @@ _e_sys_comp_action_timeout(void *data)
if (_e_sys_comp_waiting == 1) _e_sys_comp_waiting--;
switch (a)
{
case E_SYS_RESTART:
sig = "e,state,sys,logout,done";
break;
case E_SYS_LOGOUT:
sig = "e,state,sys,logout,done";
break;
@ -207,6 +221,19 @@ _e_sys_comp_logout(void)
_e_sys_comp_emit_cb_wait(E_SYS_LOGOUT, "e,state,sys,logout", "e,state,sys,logout,done", EINA_TRUE);
}
static void
_e_sys_comp_restart(void)
{
E_Zone *zone;
resume_backlight = e_config->backlight.normal;
zone = eina_list_data_get(e_comp->zones);
if ((zone) && (edje_object_data_get(zone->over, "restarted")))
_e_sys_comp_emit_cb_wait(E_SYS_RESTART, "e,state,sys,restart", "e,state,sys,restart,done", EINA_TRUE);
else
_e_sys_comp_emit_cb_wait(E_SYS_RESTART, "e,state,sys,logout", "e,state,sys,logout,done", EINA_TRUE);
}
static Eina_Bool
_e_sys_screensaver_unignore_delay(void *data EINA_UNUSED)
{
@ -476,6 +503,7 @@ e_sys_action_raw_do(E_Sys_Action a, char *param)
_e_sys_current_action();
return 0;
}
ret = _e_sys_action_do(a, param, EINA_TRUE);
if (ret) _e_sys_action_current = a;
@ -857,6 +885,13 @@ _e_sys_logout_begin(E_Sys_Action a_after, Eina_Bool raw)
_e_sys_logout_timer = ecore_timer_loop_add(0.5, _e_sys_cb_logout_timer, NULL);
}
static void
_e_sys_restart_begin(E_Sys_Action a_after, Eina_Bool raw)
{
_e_sys_action_after = a_after;
_e_sys_action_after_raw = raw;
}
static void
_e_sys_current_action(void)
{
@ -961,11 +996,18 @@ _e_sys_action_do(E_Sys_Action a, char *param EINA_UNUSED, Eina_Bool raw)
// XXX TODO: check for e_fm_op_registry entries and confirm
// FIXME: we don't share out immortal info to restarted e. :(
// if (!e_util_immortal_check())
if (raw)
{
e_fm2_die();
restart = 1;
ecore_main_loop_quit();
}
else
{
_e_sys_restart_begin(E_SYS_RESTART, raw);
_e_sys_comp_restart();
return 0;
}
// else
// return 0;
break;