summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-30 11:39:55 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-30 12:14:23 +0000
commitdabda6154bfa4f2eaf5e945a1b95c2505502981c (patch)
tree791c29dd5529eff72151169c5c1cd6cc2eaf028d /src
parent4fa3ca249b435c5a79ded0f4173fdb06418b6188 (diff)
desklock - remove autolock as its pointless as we can lock on blank
alsoit was inaccurate reling on polling (a poller) and thus wakeups all the time ... so use the "lock on blanking" in timers instead... :) less complexity to deal with in config anyway.
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_config.c4
-rw-r--r--src/bin/e_config.h2
-rw-r--r--src/bin/e_desklock.c116
-rw-r--r--src/modules/conf_display/e_int_config_desklock.c27
4 files changed, 1 insertions, 148 deletions
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index bbe845984..48abc692a 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -600,8 +600,6 @@ _e_config_edd_init(Eina_Bool old)
600 E_CONFIG_VAL(D, T, desklock_on_suspend, INT); 600 E_CONFIG_VAL(D, T, desklock_on_suspend, INT);
601 E_CONFIG_VAL(D, T, desklock_autolock_screensaver, INT); 601 E_CONFIG_VAL(D, T, desklock_autolock_screensaver, INT);
602 E_CONFIG_VAL(D, T, desklock_post_screensaver_time, DOUBLE); 602 E_CONFIG_VAL(D, T, desklock_post_screensaver_time, DOUBLE);
603 E_CONFIG_VAL(D, T, desklock_autolock_idle, INT);
604 E_CONFIG_VAL(D, T, desklock_autolock_idle_timeout, DOUBLE);
605 E_CONFIG_VAL(D, T, desklock_use_custom_desklock, INT); 603 E_CONFIG_VAL(D, T, desklock_use_custom_desklock, INT);
606 E_CONFIG_VAL(D, T, desklock_custom_desklock_cmd, STR); 604 E_CONFIG_VAL(D, T, desklock_custom_desklock_cmd, STR);
607 E_CONFIG_VAL(D, T, desklock_ask_presentation, UCHAR); 605 E_CONFIG_VAL(D, T, desklock_ask_presentation, UCHAR);
@@ -1714,8 +1712,6 @@ e_config_load(void)
1714 E_CONFIG_LIMIT(e_config->desklock_login_box_zone, -2, 1000); 1712 E_CONFIG_LIMIT(e_config->desklock_login_box_zone, -2, 1000);
1715 E_CONFIG_LIMIT(e_config->desklock_autolock_screensaver, 0, 1); 1713 E_CONFIG_LIMIT(e_config->desklock_autolock_screensaver, 0, 1);
1716 E_CONFIG_LIMIT(e_config->desklock_post_screensaver_time, 0.0, 300.0); 1714 E_CONFIG_LIMIT(e_config->desklock_post_screensaver_time, 0.0, 300.0);
1717 E_CONFIG_LIMIT(e_config->desklock_autolock_idle, 0, 1);
1718 E_CONFIG_LIMIT(e_config->desklock_autolock_idle_timeout, 1.0, 5400.0);
1719 E_CONFIG_LIMIT(e_config->desklock_use_custom_desklock, 0, 1); 1715 E_CONFIG_LIMIT(e_config->desklock_use_custom_desklock, 0, 1);
1720 E_CONFIG_LIMIT(e_config->desklock_ask_presentation, 0, 1); 1716 E_CONFIG_LIMIT(e_config->desklock_ask_presentation, 0, 1);
1721 E_CONFIG_LIMIT(e_config->desklock_ask_presentation_timeout, 1.0, 300.0); 1717 E_CONFIG_LIMIT(e_config->desklock_ask_presentation_timeout, 1.0, 300.0);
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index 08922a498..deae01d31 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -204,8 +204,6 @@ struct _E_Config
204 int desklock_on_suspend; // GUI 204 int desklock_on_suspend; // GUI
205 int desklock_autolock_screensaver; // GUI 205 int desklock_autolock_screensaver; // GUI
206 double desklock_post_screensaver_time; // GUI 206 double desklock_post_screensaver_time; // GUI
207 int desklock_autolock_idle; // GUI
208 double desklock_autolock_idle_timeout; // GUI
209 int desklock_use_custom_desklock; // GUI 207 int desklock_use_custom_desklock; // GUI
210 const char *desklock_custom_desklock_cmd; // GUI 208 const char *desklock_custom_desklock_cmd; // GUI
211 unsigned char desklock_ask_presentation; // GUI 209 unsigned char desklock_ask_presentation; // GUI
diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c
index 219175b75..6da5762bf 100644
--- a/src/bin/e_desklock.c
+++ b/src/bin/e_desklock.c
@@ -1,6 +1,5 @@
1#include "e.h" 1#include "e.h"
2 2
3
4/**************************** private data ******************************/ 3/**************************** private data ******************************/
5 4
6typedef struct _E_Desklock_Run E_Desklock_Run; 5typedef struct _E_Desklock_Run E_Desklock_Run;
@@ -14,9 +13,6 @@ struct _E_Desklock_Run
14 13
15static Ecore_Exe *_e_custom_desklock_exe = NULL; 14static Ecore_Exe *_e_custom_desklock_exe = NULL;
16static Ecore_Event_Handler *_e_custom_desklock_exe_handler = NULL; 15static Ecore_Event_Handler *_e_custom_desklock_exe_handler = NULL;
17static Ecore_Poller *_e_desklock_idle_poller = NULL;
18static int _e_desklock_user_idle = 0;
19static double _e_desklock_autolock_time = 0.0;
20static E_Dialog *_e_desklock_ask_presentation_dia = NULL; 16static E_Dialog *_e_desklock_ask_presentation_dia = NULL;
21static int _e_desklock_ask_presentation_count = 0; 17static int _e_desklock_ask_presentation_count = 0;
22 18
@@ -41,14 +37,11 @@ static Eina_Bool desklock_manual = EINA_FALSE;
41 37
42/***********************************************************************/ 38/***********************************************************************/
43static Eina_Bool _e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); 39static Eina_Bool _e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
44static Eina_Bool _e_desklock_cb_idle_poller(void *data EINA_UNUSED);
45static Eina_Bool _e_desklock_cb_run(void *data, int type, void *event); 40static Eina_Bool _e_desklock_cb_run(void *data, int type, void *event);
46static Eina_Bool _e_desklock_cb_randr(void *data, int type, void *event); 41static Eina_Bool _e_desklock_cb_randr(void *data, int type, void *event);
47 42
48static Eina_Bool _e_desklock_state = EINA_FALSE; 43static Eina_Bool _e_desklock_state = EINA_FALSE;
49 44
50static void _e_desklock_ask_presentation_mode(void);
51
52E_API int E_EVENT_DESKLOCK = 0; 45E_API int E_EVENT_DESKLOCK = 0;
53 46
54EINTERN int 47EINTERN int
@@ -56,9 +49,6 @@ e_desklock_init(void)
56{ 49{
57 Eina_List *l; 50 Eina_List *l;
58 E_Config_Desklock_Background *bg; 51 E_Config_Desklock_Background *bg;
59 /* A poller to tick every 256 ticks, watching for an idle user */
60 _e_desklock_idle_poller = ecore_poller_add(ECORE_POLLER_CORE, 256,
61 _e_desklock_cb_idle_poller, NULL);
62 52
63 EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, bg) 53 EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, bg)
64 e_filereg_register(bg->file); 54 e_filereg_register(bg->file);
@@ -214,8 +204,6 @@ e_desklock_hide_hook_del(E_Desklock_Hide_Cb cb)
214E_API int 204E_API int
215e_desklock_show_autolocked(void) 205e_desklock_show_autolocked(void)
216{ 206{
217 if (_e_desklock_autolock_time < 1.0)
218 _e_desklock_autolock_time = ecore_loop_time_get();
219 return e_desklock_show(EINA_FALSE); 207 return e_desklock_show(EINA_FALSE);
220} 208}
221 209
@@ -450,23 +438,6 @@ _desklock_hide_internal(void)
450 current_iface = NULL; 438 current_iface = NULL;
451 } 439 }
452 440
453 if (_e_desklock_autolock_time > 0.0)
454 {
455 if ((e_config->desklock_ask_presentation) &&
456 (e_config->desklock_ask_presentation_timeout > 0.0))
457 {
458 double max, now;
459
460 now = ecore_loop_time_get();
461 max = _e_desklock_autolock_time + e_config->desklock_ask_presentation_timeout;
462 if (now <= max)
463 _e_desklock_ask_presentation_mode();
464 }
465 else
466 _e_desklock_ask_presentation_count = 0;
467
468 _e_desklock_autolock_time = 0.0;
469 }
470 if (getenv("E_START_MANAGER")) kill(getppid(), SIGHUP); 441 if (getenv("E_START_MANAGER")) kill(getppid(), SIGHUP);
471} 442}
472 443
@@ -541,55 +512,6 @@ _e_desklock_cb_custom_desklock_exit(void *data EINA_UNUSED, int type EINA_UNUSED
541 return ECORE_CALLBACK_DONE; 512 return ECORE_CALLBACK_DONE;
542} 513}
543 514
544static Eina_Bool
545_e_desklock_cb_idle_poller(void *data EINA_UNUSED)
546{
547 if ((e_config->desklock_autolock_idle) && (!e_config->mode.presentation))
548 {
549 double idle = 0.0, max;
550
551 /* If a desklock is already up, bail */
552 if ((_e_custom_desklock_exe) || (_e_desklock_state)) return ECORE_CALLBACK_RENEW;
553
554#ifndef HAVE_WAYLAND_ONLY
555 if (e_comp->comp_type == E_PIXMAP_TYPE_X)
556 idle = ecore_x_screensaver_idle_time_get();
557#endif
558#ifdef HAVE_WAYLAND
559 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
560 idle = e_comp_wl_idle_time_get();
561#endif
562
563 max = e_config->desklock_autolock_idle_timeout;
564 if (_e_desklock_ask_presentation_count > 0)
565 max *= (1 + _e_desklock_ask_presentation_count);
566
567 /* If we have exceeded our idle time... */
568 if (idle >= max)
569 {
570 /*
571 * Unfortunately, not all "desklocks" stay up for as long as
572 * the user is idle or until it is unlocked.
573 *
574 * 'xscreensaver-command -lock' for example sends a command
575 * to xscreensaver and then terminates. So, we have another
576 * check (_e_desklock_user_idle) which lets us know that we
577 * have locked the screen due to idleness.
578 */
579 if (!_e_desklock_user_idle)
580 {
581 _e_desklock_user_idle = 1;
582 e_desklock_show_autolocked();
583 }
584 }
585 else
586 _e_desklock_user_idle = 0;
587 }
588
589 /* Make sure our poller persists. */
590 return ECORE_CALLBACK_RENEW;
591}
592
593static void 515static void
594_e_desklock_ask_presentation_del(void *data) 516_e_desklock_ask_presentation_del(void *data)
595{ 517{
@@ -650,44 +572,6 @@ _e_desklock_ask_presentation_key_down(void *data, Evas *e EINA_UNUSED, Evas_Obje
650 _e_desklock_ask_presentation_no(NULL, dia); 572 _e_desklock_ask_presentation_no(NULL, dia);
651} 573}
652 574
653static void
654_e_desklock_ask_presentation_mode(void)
655{
656 E_Dialog *dia;
657
658 if (_e_desklock_ask_presentation_dia) return;
659
660 if (!(dia = e_dialog_new(NULL, "E", "_desklock_ask_presentation"))) return;
661
662 e_dialog_title_set(dia, _("Activate Presentation Mode?"));
663 e_dialog_icon_set(dia, "dialog-ask", 64);
664 e_dialog_text_set(dia,
665 _("You unlocked your desktop too fast.<ps/><ps/>"
666 "Would you like to enable <b>presentation</b> mode and "
667 "temporarily disable screen saver, lock and power saving?"));
668
669 e_object_del_attach_func_set(E_OBJECT(dia),
670 _e_desklock_ask_presentation_del);
671 e_dialog_button_add(dia, _("Yes"), NULL,
672 _e_desklock_ask_presentation_yes, NULL);
673 e_dialog_button_add(dia, _("No"), NULL,
674 _e_desklock_ask_presentation_no, NULL);
675 e_dialog_button_add(dia, _("No, but increase timeout"), NULL,
676 _e_desklock_ask_presentation_no_increase, NULL);
677 e_dialog_button_add(dia, _("No, and stop asking"), NULL,
678 _e_desklock_ask_presentation_no_forever, NULL);
679
680 e_dialog_button_focus_num(dia, 0);
681 e_widget_list_homogeneous_set(dia->box_object, 0);
682 elm_win_center(dia->win, 1, 1);
683 e_dialog_show(dia);
684
685 evas_object_event_callback_add(dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
686 _e_desklock_ask_presentation_key_down, dia);
687
688 _e_desklock_ask_presentation_dia = dia;
689}
690
691static Eina_Bool 575static Eina_Bool
692_e_desklock_run(E_Desklock_Run *task) 576_e_desklock_run(E_Desklock_Run *task)
693{ 577{
diff --git a/src/modules/conf_display/e_int_config_desklock.c b/src/modules/conf_display/e_int_config_desklock.c
index 08632b10a..4466d62f8 100644
--- a/src/modules/conf_display/e_int_config_desklock.c
+++ b/src/modules/conf_display/e_int_config_desklock.c
@@ -27,7 +27,6 @@ struct _E_Config_Dialog_Data
27 /* Locking */ 27 /* Locking */
28 int start_locked; 28 int start_locked;
29 int lock_on_suspend; 29 int lock_on_suspend;
30 int auto_lock;
31 int desklock_auth_method; 30 int desklock_auth_method;
32 int login_zone; 31 int login_zone;
33 int zone; 32 int zone;
@@ -40,7 +39,6 @@ struct _E_Config_Dialog_Data
40 39
41 /* Timers */ 40 /* Timers */
42 int screensaver_lock; 41 int screensaver_lock;
43 double idle_time;
44 double post_screensaver_time; 42 double post_screensaver_time;
45 43
46 /* Adv props */ 44 /* Adv props */
@@ -54,7 +52,6 @@ struct _E_Config_Dialog_Data
54 { 52 {
55 Evas_Object *kbd_list; 53 Evas_Object *kbd_list;
56 Evas_Object *loginbox_slider; 54 Evas_Object *loginbox_slider;
57 Evas_Object *auto_lock_slider;
58 Evas_Object *o_table; 55 Evas_Object *o_table;
59 Eina_List *bgs; 56 Eina_List *bgs;
60 } gui; 57 } gui;
@@ -165,9 +162,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
165 cfdata->desklock_layout = e_config->xkb.desklock_layout; 162 cfdata->desklock_layout = e_config->xkb.desklock_layout;
166 cfdata->start_locked = e_config->desklock_start_locked; 163 cfdata->start_locked = e_config->desklock_start_locked;
167 cfdata->lock_on_suspend = e_config->desklock_on_suspend; 164 cfdata->lock_on_suspend = e_config->desklock_on_suspend;
168 cfdata->auto_lock = e_config->desklock_autolock_idle;
169 cfdata->screensaver_lock = e_config->desklock_autolock_screensaver; 165 cfdata->screensaver_lock = e_config->desklock_autolock_screensaver;
170 cfdata->idle_time = e_config->desklock_autolock_idle_timeout / 60;
171 cfdata->post_screensaver_time = e_config->desklock_post_screensaver_time; 166 cfdata->post_screensaver_time = e_config->desklock_post_screensaver_time;
172 if (e_config->desklock_login_box_zone >= 0) 167 if (e_config->desklock_login_box_zone >= 0)
173 { 168 {
@@ -354,7 +349,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
354 349
355 /* Timers */ 350 /* Timers */
356 ol = e_widget_list_add(evas, 0, 0); 351 ol = e_widget_list_add(evas, 0, 0);
357 oc = e_widget_check_add(evas, _("Lock after screensaver activates"), 352 oc = e_widget_check_add(evas, _("Lock after blanking"),
358 &cfdata->screensaver_lock); 353 &cfdata->screensaver_lock);
359 e_widget_disabled_set(oc, !cfdata->use_xscreensaver); 354 e_widget_disabled_set(oc, !cfdata->use_xscreensaver);
360 e_widget_list_object_append(ol, oc, 1, 1, 0.5); 355 e_widget_list_object_append(ol, oc, 1, 1, 0.5);
@@ -366,14 +361,6 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
366 e_widget_check_widget_disable_on_unchecked_add(oc, ow); 361 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
367 e_widget_list_object_append(ol, ow, 1, 1, 0.5); 362 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
368 363
369 oc = e_widget_check_add(evas, _("Lock when idle time exceeded"),
370 &cfdata->auto_lock);
371 e_widget_list_object_append(ol, oc, 1, 1, 0.5);
372
373 ow = e_widget_slider_add(evas, 1, 0, _("%1.0f minutes"), 1.0, 90.0, 1.0, 0,
374 &(cfdata->idle_time), NULL, 100);
375 e_widget_check_widget_disable_on_unchecked_add(oc, ow);
376 e_widget_list_object_append(ol, ow, 1, 1, 0.5);
377 e_widget_toolbook_page_append(otb, NULL, _("Timers"), ol, 364 e_widget_toolbook_page_append(otb, NULL, _("Timers"), ol,
378 1, 1, 1, 0, 0.0, 0.0); 365 1, 1, 1, 0, 0.0, 0.0);
379 366
@@ -470,10 +457,8 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
470 } 457 }
471 e_config->desklock_start_locked = cfdata->start_locked; 458 e_config->desklock_start_locked = cfdata->start_locked;
472 e_config->desklock_on_suspend = cfdata->lock_on_suspend; 459 e_config->desklock_on_suspend = cfdata->lock_on_suspend;
473 e_config->desklock_autolock_idle = cfdata->auto_lock;
474 e_config->desklock_post_screensaver_time = cfdata->post_screensaver_time; 460 e_config->desklock_post_screensaver_time = cfdata->post_screensaver_time;
475 e_config->desklock_autolock_screensaver = cfdata->screensaver_lock; 461 e_config->desklock_autolock_screensaver = cfdata->screensaver_lock;
476 e_config->desklock_autolock_idle_timeout = (cfdata->idle_time * 60);
477 e_config->desklock_ask_presentation = cfdata->ask_presentation; 462 e_config->desklock_ask_presentation = cfdata->ask_presentation;
478 e_config->desklock_ask_presentation_timeout = cfdata->ask_presentation_timeout; 463 e_config->desklock_ask_presentation_timeout = cfdata->ask_presentation_timeout;
479 if (e_config->xkb.desklock_layout != cfdata->desklock_layout) 464 if (e_config->xkb.desklock_layout != cfdata->desklock_layout)
@@ -530,16 +515,10 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
530 515
531 if (e_config->xkb.desklock_layout != cfdata->desklock_layout) 516 if (e_config->xkb.desklock_layout != cfdata->desklock_layout)
532 return 1; 517 return 1;
533
534 if (e_config->desklock_start_locked != cfdata->start_locked) 518 if (e_config->desklock_start_locked != cfdata->start_locked)
535 return 1; 519 return 1;
536
537 if (e_config->desklock_on_suspend != cfdata->lock_on_suspend) 520 if (e_config->desklock_on_suspend != cfdata->lock_on_suspend)
538 return 1; 521 return 1;
539
540 if (e_config->desklock_autolock_idle != cfdata->auto_lock)
541 return 1;
542
543 if (e_config->desklock_auth_method != cfdata->desklock_auth_method) 522 if (e_config->desklock_auth_method != cfdata->desklock_auth_method)
544 return 1; 523 return 1;
545 if (e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL) 524 if (e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL)
@@ -567,13 +546,9 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
567 546
568 if (e_config->desklock_autolock_screensaver != cfdata->screensaver_lock) 547 if (e_config->desklock_autolock_screensaver != cfdata->screensaver_lock)
569 return 1; 548 return 1;
570
571 if (!EINA_DBL_EQ(e_config->desklock_post_screensaver_time, cfdata->post_screensaver_time)) 549 if (!EINA_DBL_EQ(e_config->desklock_post_screensaver_time, cfdata->post_screensaver_time))
572 return 1; 550 return 1;
573 551
574 if (!EINA_DBL_EQ(e_config->desklock_autolock_idle_timeout, cfdata->idle_time * 60))
575 return 1;
576
577 if (cfdata->bg_method_prev != (int)cfdata->bg_method) return 1; 552 if (cfdata->bg_method_prev != (int)cfdata->bg_method) return 1;
578 ll = cfdata->bgs; 553 ll = cfdata->bgs;
579 EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, cbg) 554 EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, cbg)