From cb2bc1d1c186b85dd3478477080535f5d29a7b3d Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 10 Feb 2023 22:21:54 +0000 Subject: [PATCH] desklock - use immediate show for lock on suspend etc. makes lock more correct and not fade in on lock on suspend @feat --- src/bin/e_comp_wl.c | 2 +- src/bin/e_desklock.c | 10 +++--- src/bin/e_desklock.h | 2 +- src/modules/lokker/e_mod_main.h | 2 +- src/modules/lokker/lokker.c | 55 ++++++++++++++++++++++++++------- 5 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 4e38d4820..14427dafb 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -2881,7 +2881,7 @@ disp_err: } static Eina_Bool -_e_comp_wl_desklock_show(void) +_e_comp_wl_desklock_show(Eina_Bool immediate EINA_UNUSED) { return e_comp_grab_input(1, 1); } diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c index c55846d55..be68f8290 100644 --- a/src/bin/e_desklock.c +++ b/src/bin/e_desklock.c @@ -124,7 +124,7 @@ e_desklock_interface_append(E_Desklock_Interface *iface) desklock_ifaces = eina_list_append(desklock_ifaces, (void*)iface); if (_e_desklock_state && (!current_iface)) { - if (iface->show()) + if (iface->show(EINA_TRUE)) { iface->active = EINA_TRUE; current_iface = iface; @@ -155,7 +155,7 @@ e_desklock_interface_remove(E_Desklock_Interface *iface) /* then try to find a replacement locker */ EINA_LIST_REVERSE_FOREACH(desklock_ifaces, l, diface) { - if (!diface->show()) continue; + if (!diface->show(EINA_TRUE)) continue; diface->active = EINA_TRUE; current_iface = diface; break; @@ -209,7 +209,7 @@ e_desklock_demo(void) EINA_LIST_REVERSE_FOREACH(desklock_ifaces, l, iface) { - if (iface->show()) + if (iface->show(EINA_FALSE)) { demo = iface->active = EINA_TRUE; current_iface = iface; @@ -254,7 +254,7 @@ _desklock_show_internal(Eina_Bool suspend) e_menu_hide_all(); EINA_LIST_FOREACH(show_hooks, l, show_cb) { - if (!show_cb()) goto fail; + if (!show_cb(suspend)) goto fail; } EINA_LIST_FOREACH(e_comp->zones, l, zone) @@ -295,7 +295,7 @@ _desklock_show_internal(Eina_Bool suspend) EINA_LIST_REVERSE_FOREACH(desklock_ifaces, l, iface) { - success = iface->show(); + success = iface->show(suspend); if (success) { iface->active = EINA_TRUE; diff --git a/src/bin/e_desklock.h b/src/bin/e_desklock.h index fead91410..808a85b54 100644 --- a/src/bin/e_desklock.h +++ b/src/bin/e_desklock.h @@ -1,7 +1,7 @@ #ifdef E_TYPEDEFS typedef struct _E_Event_Desklock E_Event_Desklock; -typedef Eina_Bool (*E_Desklock_Show_Cb)(void); +typedef Eina_Bool (*E_Desklock_Show_Cb)(Eina_Bool immediate); typedef void (*E_Desklock_Hide_Cb)(void); typedef enum _E_Desklock_Background_Method { diff --git a/src/modules/lokker/e_mod_main.h b/src/modules/lokker/e_mod_main.h index 68832c0c6..8774d8fa7 100644 --- a/src/modules/lokker/e_mod_main.h +++ b/src/modules/lokker/e_mod_main.h @@ -24,7 +24,7 @@ typedef enum E_DESKLOCK_AUTH_METHOD_LINES = 4, } E_Desklock_Auth_Method2; -EINTERN Eina_Bool lokker_lock(void); +EINTERN Eina_Bool lokker_lock(Eina_Bool immediate); EINTERN void lokker_unlock(void); E_API E_Config_Dialog *e_int_config_lokker(Evas_Object *parent, const char *params EINA_UNUSED); EINTERN Eina_Bool lokker_key_down(Ecore_Event_Key*); diff --git a/src/modules/lokker/lokker.c b/src/modules/lokker/lokker.c index 91ad1cda0..1dff0d610 100644 --- a/src/modules/lokker/lokker.c +++ b/src/modules/lokker/lokker.c @@ -343,7 +343,7 @@ _lokker_cb_show_done(void *data, Evas_Object *obj EINA_UNUSED, const char *sig E } static void -_lokker_popup_add(E_Zone *zone) +_lokker_popup_add(E_Zone *zone, Eina_Bool immediate) { E_Zone *current_zone; Evas_Object *o = NULL; @@ -353,6 +353,7 @@ _lokker_popup_add(E_Zone *zone) Eina_Stringshare *bg; Evas *evas; int nocreate = 0; + Eina_Bool is_edje = EINA_FALSE; lp = E_NEW(Lokker_Popup, 1); cbg = eina_list_nth(e_config->desklock_backgrounds, zone->num); @@ -366,6 +367,7 @@ _lokker_popup_add(E_Zone *zone) { o = edje_object_add(evas); evas_object_data_set(o, "is_edje", o); + is_edje = EINA_TRUE; e_theme_edje_object_set(o, "base/theme/desklock", "e/desklock/background"); } @@ -373,6 +375,7 @@ _lokker_popup_add(E_Zone *zone) { o = edje_object_add(evas); evas_object_data_set(o, "is_edje", o); + is_edje = EINA_TRUE; e_theme_edje_object_set(o, "base/theme/backgrounds", "e/desktop/background"); } @@ -389,6 +392,7 @@ _lokker_popup_add(E_Zone *zone) { o = edje_object_add(evas); evas_object_data_set(o, "is_edje", o); + is_edje = EINA_TRUE; if (e_util_edje_collection_exists(f, "e/desklock/background")) { edje_object_file_set(o, f, "e/desklock/background"); @@ -426,15 +430,25 @@ _lokker_popup_add(E_Zone *zone) evas_object_move(lp->bg_object, zone->x, zone->y); evas_object_resize(lp->bg_object, zone->w, zone->h); evas_object_show(lp->bg_object); + if (is_edje) { const char *s = edje_object_data_get(lp->bg_object, "show_signal"); - lp->show_anim = s && (atoi(s) == 1); - e_desklock_zone_block_set(zone, !lp->show_anim); - if ((lp->show_anim) && - (evas_object_data_get(lp->bg_object, "is_edje"))) - edje_object_signal_callback_add(lp->bg_object, - "e,action,show,done", "e", - _lokker_cb_show_done, lp); + + if (immediate) + { + edje_object_signal_emit(lp->bg_object, + "e,action,show,immediate", "e"); + } + else + { + s = edje_object_data_get(lp->bg_object, "show_signal"); + lp->show_anim = s && (atoi(s) == 1); + e_desklock_zone_block_set(zone, !lp->show_anim); + if (lp->show_anim) + edje_object_signal_callback_add(lp->bg_object, + "e,action,show,done", "e", + _lokker_cb_show_done, lp); + } s = edje_object_data_get(lp->bg_object, "hide_signal"); lp->hide_anim = s && (atoi(s) == 1); } @@ -494,6 +508,18 @@ _lokker_popup_add(E_Zone *zone) edd->elock_wnd_list = eina_list_append(edd->elock_wnd_list, lp); } +static void +_lokker_popup_add_normal(E_Zone *zone) +{ + _lokker_popup_add(zone, EINA_FALSE); +} + +static void +_lokker_popup_add_immediate(E_Zone *zone) +{ + _lokker_popup_add(zone, EINA_TRUE); +} + static void _lokker_cb_hide_done(void *data, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED) { @@ -627,7 +653,7 @@ _lokker_cb_zone_add(void *data EINA_UNUSED, if (!edd) return ECORE_CALLBACK_PASS_ON; if ((!edd->move_handler) && (e_config->desklock_login_box_zone == -2)) edd->move_handler = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _lokker_cb_mouse_move, NULL); - if (!_lokker_popup_find(ev->zone)) _lokker_popup_add(ev->zone); + if (!_lokker_popup_find(ev->zone)) _lokker_popup_add_immediate(ev->zone); return ECORE_CALLBACK_PASS_ON; } @@ -900,7 +926,7 @@ lokker_key_down(Ecore_Event_Key *ev) } EINTERN Eina_Bool -lokker_lock(void) +lokker_lock(Eina_Bool immediate) { int total_zone_num = 0; @@ -921,7 +947,14 @@ lokker_lock(void) #endif e_pointer_type_push(e_comp->pointer, edd, "default"); - E_LIST_FOREACH(e_comp->zones, _lokker_popup_add); + if (immediate) + { + E_LIST_FOREACH(e_comp->zones, _lokker_popup_add_immediate); + } + else + { + E_LIST_FOREACH(e_comp->zones, _lokker_popup_add_normal); + } total_zone_num = eina_list_count(e_comp->zones); /* handlers */