summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-28 15:06:37 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-28 15:06:37 +0100
commitf6e4be10057e4b80bc16d95feec5dd2c989d5a65 (patch)
treefbc5b97fb4fd604d4ab38762c76ab8076bfda074 /src
parent8cc3bd7cdbce517fb1ae08b44af182fc814076fe (diff)
e wl screen dimming.blanking/timeouts/lock handling redo/fixup
so there was a fair bit of stick-tape and chewing gum in putting the wl screensaving in e_Screensaver.c ... it thus was very different to the x stuff. it SHOULd have had e_comp_wl handle idle timeout like the xserver did and then glue in the same way the x code did to be conistsent. instead of trying to fix the chewing gum ball there in e_Screensver.c to find the logic holes ... i made it work like the code as indicated above. this now makes it work reliably. dim reliably. lock reliably. it even doesnt exit on ctrl+alt+backspace once desklock is up now to allow locks to really lock... (dont use locks during dev then if you need ctl+alt+backspace). at least now all this dpms/screensavwr/brightness/backlight/lock goop is consistent between wl and x11 and wl seems reliabkle now (to me). knock this off as an annoyance fixed. @fix
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_backlight.c2
-rw-r--r--src/bin/e_client.c2
-rw-r--r--src/bin/e_comp.c4
-rw-r--r--src/bin/e_comp_canvas.c21
-rw-r--r--src/bin/e_comp_canvas.h1
-rw-r--r--src/bin/e_comp_wl.c159
-rw-r--r--src/bin/e_comp_wl.h6
-rw-r--r--src/bin/e_screensaver.c79
-rw-r--r--src/bin/e_screensaver.h1
-rw-r--r--src/bin/e_sys.c8
10 files changed, 208 insertions, 75 deletions
diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
index cdb2c6a3f..b1ccd7d6a 100644
--- a/src/bin/e_backlight.c
+++ b/src/bin/e_backlight.c
@@ -728,6 +728,8 @@ e_backlight_level_set(E_Zone *zone, double val, double tim)
728 if (zone->bl_mode == E_BACKLIGHT_MODE_NORMAL) tim = 0.5; 728 if (zone->bl_mode == E_BACKLIGHT_MODE_NORMAL) tim = 0.5;
729 else if (tim < 0.0) tim = e_config->backlight.transition; 729 else if (tim < 0.0) tim = e_config->backlight.transition;
730 730
731 if ((bd->anim) && (fabs(bd->to_val - val) < DBL_EPSILON)) return;
732
731 E_FREE_FUNC(bd->retry_timer, ecore_timer_del); 733 E_FREE_FUNC(bd->retry_timer, ecore_timer_del);
732 E_FREE_FUNC(bd->anim, ecore_animator_del); 734 E_FREE_FUNC(bd->anim, ecore_animator_del);
733 bd->from_val = bl_now; 735 bd->from_val = bl_now;
diff --git a/src/bin/e_client.c b/src/bin/e_client.c
index f486af8cb..c04d9da61 100644
--- a/src/bin/e_client.c
+++ b/src/bin/e_client.c
@@ -4709,7 +4709,7 @@ e_client_urgent_set(E_Client *ec, Eina_Bool urgent)
4709 int x, y; 4709 int x, y;
4710 ecore_evas_pointer_xy_get(e_comp->ee, &x, &y); 4710 ecore_evas_pointer_xy_get(e_comp->ee, &x, &y);
4711 ecore_evas_pointer_warp(e_comp->ee, x, y); 4711 ecore_evas_pointer_warp(e_comp->ee, x, y);
4712 e_screensaver_notidle(); 4712 e_comp_canvas_notidle();
4713 } 4713 }
4714 if (!ec->zone) return; 4714 if (!ec->zone) return;
4715 4715
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index 642008998..523c5f24f 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -1589,7 +1589,7 @@ e_comp_ignore_win_find(Ecore_Window win)
1589} 1589}
1590 1590
1591E_API void 1591E_API void
1592e_comp_override_del() 1592e_comp_override_del(void)
1593{ 1593{
1594 e_comp->nocomp_override--; 1594 e_comp->nocomp_override--;
1595 if (e_comp->nocomp_override <= 0) 1595 if (e_comp->nocomp_override <= 0)
@@ -1600,7 +1600,7 @@ e_comp_override_del()
1600} 1600}
1601 1601
1602E_API void 1602E_API void
1603e_comp_override_add() 1603e_comp_override_add(void)
1604{ 1604{
1605 e_comp->nocomp_override++; 1605 e_comp->nocomp_override++;
1606 if ((e_comp->nocomp_override > 0) && (e_comp->nocomp)) _e_comp_nocomp_end(); 1606 if ((e_comp->nocomp_override > 0) && (e_comp->nocomp)) _e_comp_nocomp_end();
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index 596ab52d4..5ee32a853 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -74,7 +74,7 @@ _e_comp_canvas_cb_mouse_in(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
74{ 74{
75 E_Client *ec; 75 E_Client *ec;
76 76
77 e_screensaver_notidle(); 77 e_comp_canvas_notidle();
78 if (e_client_action_get() || e_grabinput_mouse_win_get()) return; 78 if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
79 ec = e_client_focused_get(); 79 ec = e_client_focused_get();
80 if (ec && (!ec->border_menu)) e_focus_event_mouse_out(ec); 80 if (ec && (!ec->border_menu)) e_focus_event_mouse_out(ec);
@@ -83,7 +83,7 @@ _e_comp_canvas_cb_mouse_in(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
83static void 83static void
84_e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 84_e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
85{ 85{
86 e_screensaver_notidle(); 86 e_comp_canvas_notidle();
87 if (e_client_action_get() || e_grabinput_mouse_win_get()) return; 87 if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
88 e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); 88 e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
89} 89}
@@ -91,7 +91,7 @@ _e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Obje
91static void 91static void
92_e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 92_e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
93{ 93{
94 e_screensaver_notidle(); 94 e_comp_canvas_notidle();
95 if (e_client_action_get() || e_grabinput_mouse_win_get()) return; 95 if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
96 e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); 96 e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
97} 97}
@@ -99,7 +99,7 @@ _e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
99static void 99static void
100_e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 100_e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
101{ 101{
102 e_screensaver_notidle(); 102 e_comp_canvas_notidle();
103 if (e_client_action_get() || e_grabinput_mouse_win_get()) return; 103 if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
104 e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info); 104 e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
105} 105}
@@ -107,7 +107,7 @@ _e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Obj
107static Eina_Bool 107static Eina_Bool
108_key_down(int ctx, Ecore_Event_Key *ev) 108_key_down(int ctx, Ecore_Event_Key *ev)
109{ 109{
110 e_screensaver_notidle(); 110 e_comp_canvas_notidle();
111 if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER)) 111 if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER))
112 { 112 {
113 E_Desklock_Interface *iface = e_desklock_interface_current_get(); 113 E_Desklock_Interface *iface = e_desklock_interface_current_get();
@@ -157,7 +157,7 @@ _e_comp_cb_key_down(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_Event
157static Eina_Bool 157static Eina_Bool
158_key_up(int ctx, Ecore_Event_Key *ev) 158_key_up(int ctx, Ecore_Event_Key *ev)
159{ 159{
160 e_screensaver_notidle(); 160 e_comp_canvas_notidle();
161 if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER)) 161 if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER))
162 { 162 {
163 E_Desklock_Interface *iface = e_desklock_interface_current_get(); 163 E_Desklock_Interface *iface = e_desklock_interface_current_get();
@@ -437,6 +437,7 @@ e_comp_canvas_init(int w, int h)
437 if ((!after_restart) || (!e_comp_x)) 437 if ((!after_restart) || (!e_comp_x))
438 ecore_evas_pointer_warp(e_comp->ee, e_comp->w / 2, e_comp->h / 2); 438 ecore_evas_pointer_warp(e_comp->ee, e_comp->w / 2, e_comp->h / 2);
439 439
440 e_comp_wl_notidle();
440 return EINA_TRUE; 441 return EINA_TRUE;
441} 442}
442 443
@@ -874,6 +875,14 @@ e_comp_canvas_feed_mouse_up(unsigned int activate_time)
874 } 875 }
875} 876}
876 877
878E_API void
879e_comp_canvas_notidle(void)
880{
881#ifdef HAVE_WAYLAND
882 if (e_comp->comp_type == E_PIXMAP_TYPE_WL) e_comp_wl_notidle();
883#endif
884}
885
877E_API Evas_Object * 886E_API Evas_Object *
878e_comp_canvas_event_grabber_add(void) 887e_comp_canvas_event_grabber_add(void)
879{ 888{
diff --git a/src/bin/e_comp_canvas.h b/src/bin/e_comp_canvas.h
index 8391c67be..1144c0fa0 100644
--- a/src/bin/e_comp_canvas.h
+++ b/src/bin/e_comp_canvas.h
@@ -29,6 +29,7 @@ E_API E_Layer e_comp_canvas_client_layer_map_nearest(int layer);
29E_API void e_comp_canvas_keys_grab(void); 29E_API void e_comp_canvas_keys_grab(void);
30E_API void e_comp_canvas_keys_ungrab(void); 30E_API void e_comp_canvas_keys_ungrab(void);
31E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time); 31E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time);
32E_API void e_comp_canvas_notidle(void);
32E_API Evas_Object *e_comp_canvas_event_grabber_add(void); 33E_API Evas_Object *e_comp_canvas_event_grabber_add(void);
33EINTERN void e_comp_canvas_intercept(void); 34EINTERN void e_comp_canvas_intercept(void);
34 35
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index a32ff16ac..a9ceed782 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -1106,6 +1106,16 @@ _e_comp_wl_client_evas_init(E_Client *ec)
1106 _e_comp_wl_evas_cb_color_set, ec); 1106 _e_comp_wl_evas_cb_color_set, ec);
1107 1107
1108 ec->comp_data->evas_init = EINA_TRUE; 1108 ec->comp_data->evas_init = EINA_TRUE;
1109 E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_wl_screensaver_on, NULL);
1110 E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_wl_screensaver_off, NULL);
1111 e_comp_wl_notidle();
1112
1113 e_screensaver_attrs_set(e_screensaver_timeout_get(EINA_TRUE),
1114 e_config->screensaver_blanking,
1115 e_config->screensaver_expose);
1116// XXX: maybe later like x work on explicit suspend of compositor stuff?
1117// e_desklock_show_hook_add(_e_comp_x_desklock_show);
1118// e_desklock_hide_hook_add(_e_comp_x_desklock_hide);
1109} 1119}
1110 1120
1111static inline int 1121static inline int
@@ -1199,7 +1209,7 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
1199 1209
1200 e_comp_wl->ptr.x = ev->x; 1210 e_comp_wl->ptr.x = ev->x;
1201 e_comp_wl->ptr.y = ev->y; 1211 e_comp_wl->ptr.y = ev->y;
1202 e_screensaver_notidle(); 1212 e_comp_canvas_notidle();
1203 if (e_comp_wl->selection.target && 1213 if (e_comp_wl->selection.target &&
1204 (!e_client_has_xwindow(e_comp_wl->selection.target)) && 1214 (!e_client_has_xwindow(e_comp_wl->selection.target)) &&
1205 e_comp_wl->drag) 1215 e_comp_wl->drag)
@@ -3405,7 +3415,9 @@ e_comp_wl_key_down(Ecore_Event_Key *ev, E_Client *ec)
3405 ((ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || 3415 ((ev->modifiers & ECORE_EVENT_MODIFIER_ALT) ||
3406 (ev->modifiers & ECORE_EVENT_MODIFIER_ALTGR)) && 3416 (ev->modifiers & ECORE_EVENT_MODIFIER_ALTGR)) &&
3407 eina_streq(ev->key, "BackSpace")) 3417 eina_streq(ev->key, "BackSpace"))
3408 exit(0); 3418 {
3419 if (!e_desklock_state_get()) exit(0);
3420 }
3409#endif 3421#endif
3410 3422
3411 end = (uint32_t *)e_comp_wl->kbd.keys.data + (e_comp_wl->kbd.keys.size / sizeof(*k)); 3423 end = (uint32_t *)e_comp_wl->kbd.keys.data + (e_comp_wl->kbd.keys.size / sizeof(*k));
@@ -3682,3 +3694,146 @@ e_comp_wl_grab_client_mouse_button(const Ecore_Event_Mouse_Button *ev)
3682 e_comp_canvas_feed_mouse_up(0); 3694 e_comp_canvas_feed_mouse_up(0);
3683 return ECORE_CALLBACK_DONE; 3695 return ECORE_CALLBACK_DONE;
3684} 3696}
3697
3698static Eina_Bool saver_inhibit = EINA_FALSE;
3699static Eina_Bool saver_on = EINA_FALSE;
3700static Ecore_Timer *screensaver_eval_timer = NULL;
3701static Ecore_Timer *screensaver_idle_timer = NULL;
3702
3703static Eina_Bool
3704_e_comp_wl_creensaver_eval_cb(void *d EINA_UNUSED)
3705{
3706 screensaver_eval_timer = NULL;
3707 if (!saver_on)
3708 {
3709 if (e_comp->screen && e_comp->screen->dpms)
3710 e_comp->screen->dpms(0);
3711 }
3712 e_screensaver_eval(saver_on);
3713 return EINA_FALSE;
3714}
3715
3716static Eina_Bool
3717_e_comp_wl_screensaver_idle_cb(void *data EINA_UNUSED)
3718{
3719 screensaver_idle_timer = NULL;
3720 if (e_screensaver_ignore_get()) return EINA_FALSE;
3721 if (!saver_on)
3722 {
3723 saver_on = EINA_TRUE;
3724 E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
3725 screensaver_eval_timer = ecore_timer_loop_add
3726 (0.3, _e_comp_wl_creensaver_eval_cb, NULL);
3727 }
3728 return EINA_FALSE;
3729}
3730
3731static void
3732_e_comp_cb_pointer_suspend_resume_done(void *data, Evas_Object *obj, const char *emission, const char *source)
3733{
3734 edje_object_signal_callback_del(obj, emission, source,
3735 _e_comp_cb_pointer_suspend_resume_done);
3736 if (!data)
3737 {
3738 e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
3739 }
3740}
3741
3742EINTERN Eina_Bool
3743_e_comp_wl_screensaver_on()
3744{
3745 const char *s;
3746
3747 if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
3748 s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
3749
3750 if ((s) && (atoi(s) == 1))
3751 {
3752 if (!e_desklock_state_get())
3753 {
3754 e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
3755 e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
3756 }
3757 edje_object_signal_callback_del(e_comp->pointer->o_ptr,
3758 "e,state,mouse,suspend,done", "e",
3759 _e_comp_cb_pointer_suspend_resume_done);
3760 edje_object_signal_callback_del(e_comp->pointer->o_ptr,
3761 "e,state,mouse,resume,done", "e",
3762 _e_comp_cb_pointer_suspend_resume_done);
3763 edje_object_signal_callback_add(e_comp->pointer->o_ptr,
3764 "e,state,mouse,suspend,done",
3765 "e",
3766 _e_comp_cb_pointer_suspend_resume_done,
3767 e_comp);
3768 edje_object_signal_emit(e_comp->pointer->o_ptr,
3769 "e,state,mouse,suspend", "e");
3770 }
3771 return ECORE_CALLBACK_RENEW;
3772}
3773
3774EINTERN Eina_Bool
3775_e_comp_wl_screensaver_off()
3776{
3777 const char *s;
3778
3779 e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
3780 if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
3781 s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
3782
3783 if ((s) && (atoi(s) == 1))
3784 {
3785 if (!e_desklock_state_get())
3786 {
3787 e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
3788 }
3789 edje_object_signal_callback_del(e_comp->pointer->o_ptr,
3790 "e,state,mouse,suspend,done", "e",
3791 _e_comp_cb_pointer_suspend_resume_done);
3792 edje_object_signal_callback_del(e_comp->pointer->o_ptr,
3793 "e,state,mouse,resume,done", "e",
3794 _e_comp_cb_pointer_suspend_resume_done);
3795 edje_object_signal_callback_add(e_comp->pointer->o_ptr,
3796 "e,state,mouse,resume,done",
3797 "e",
3798 _e_comp_cb_pointer_suspend_resume_done,
3799 NULL);
3800 edje_object_signal_emit(e_comp->pointer->o_ptr,
3801 "e,state,mouse,resume", "e");
3802 }
3803 return ECORE_CALLBACK_RENEW;
3804}
3805
3806E_API void
3807e_comp_wl_notidle(void)
3808{
3809 if (saver_on)
3810 {
3811 saver_on = EINA_FALSE;
3812 E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
3813 screensaver_eval_timer = ecore_timer_loop_add
3814 (0.3, _e_comp_wl_creensaver_eval_cb, NULL);
3815 }
3816 E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
3817 screensaver_idle_timer = ecore_timer_add
3818 (e_screensaver_timeout_get(EINA_TRUE),
3819 _e_comp_wl_screensaver_idle_cb, NULL);
3820}
3821
3822E_API void
3823e_comp_wl_screensaver_activate(void)
3824{
3825 saver_on = EINA_TRUE;
3826 E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
3827 E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
3828 e_screensaver_eval(saver_on);
3829}
3830
3831E_API void
3832e_comp_wl_screensaver_inhibit(Eina_Bool inhibit)
3833{
3834 if (inhibit == saver_inhibit) return;
3835 saver_inhibit = inhibit;
3836 e_comp_wl_notidle();
3837 if (inhibit)
3838 E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
3839}
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index e234e5d44..f9b29b5dd 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -439,6 +439,12 @@ E_API void e_comp_wl_extension_pointer_unconstrain(E_Client *ec);
439E_API void e_comp_wl_extension_action_route_pid_allowed_set(uint32_t pid, Eina_Bool allow); 439E_API void e_comp_wl_extension_action_route_pid_allowed_set(uint32_t pid, Eina_Bool allow);
440E_API const void *e_comp_wl_extension_action_route_interface_get(int *version); 440E_API const void *e_comp_wl_extension_action_route_interface_get(int *version);
441 441
442E_API void e_comp_wl_notidle(void);
443E_API void e_comp_wl_screensaver_activate(void);
444E_API void e_comp_wl_screensaver_inhibit(Eina_Bool inhibit);
445
446EINTERN Eina_Bool _e_comp_wl_screensaver_on();
447EINTERN Eina_Bool _e_comp_wl_screensaver_off();
442 448
443E_API void 449E_API void
444e_policy_wl_aux_message_send(E_Client *ec, 450e_policy_wl_aux_message_send(E_Client *ec,
diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c
index a75ae6d1a..d83335850 100644
--- a/src/bin/e_screensaver.c
+++ b/src/bin/e_screensaver.c
@@ -15,7 +15,6 @@ static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
15static int _e_screensaver_ask_presentation_count = 0; 15static int _e_screensaver_ask_presentation_count = 0;
16 16
17static int _e_screensaver_timeout = 0; 17static int _e_screensaver_timeout = 0;
18//static int _e_screensaver_interval = 0;
19static int _e_screensaver_blanking = 0; 18static int _e_screensaver_blanking = 0;
20static int _e_screensaver_expose = 0; 19static int _e_screensaver_expose = 0;
21 20
@@ -25,11 +24,6 @@ static Eina_Bool _e_screensaver_on = EINA_FALSE;
25static Ecore_Timer *screensaver_idle_timer = NULL; 24static Ecore_Timer *screensaver_idle_timer = NULL;
26static Eina_Bool screensaver_dimmed = EINA_FALSE; 25static Eina_Bool screensaver_dimmed = EINA_FALSE;
27 26
28#ifdef HAVE_WAYLAND
29static Ecore_Timer *_e_screensaver_timer;
30static Eina_Bool _e_screensaver_inhibited = EINA_FALSE;
31#endif
32
33static Eina_Bool _screensaver_ignore = EINA_FALSE; 27static Eina_Bool _screensaver_ignore = EINA_FALSE;
34static Eina_Bool _screensaver_now = EINA_FALSE; 28static Eina_Bool _screensaver_now = EINA_FALSE;
35 29
@@ -37,16 +31,6 @@ E_API int E_EVENT_SCREENSAVER_ON = -1;
37E_API int E_EVENT_SCREENSAVER_OFF = -1; 31E_API int E_EVENT_SCREENSAVER_OFF = -1;
38E_API int E_EVENT_SCREENSAVER_OFF_PRE = -1; 32E_API int E_EVENT_SCREENSAVER_OFF_PRE = -1;
39 33
40#ifdef HAVE_WAYLAND
41static Eina_Bool
42_e_screensaver_idle_timeout_cb(void *d)
43{
44 e_screensaver_eval(!!d);
45 _e_screensaver_timer = NULL;
46 return EINA_FALSE;
47}
48#endif
49
50E_API int 34E_API int
51e_screensaver_timeout_get(Eina_Bool use_idle) 35e_screensaver_timeout_get(Eina_Bool use_idle)
52{ 36{
@@ -107,7 +91,7 @@ e_screensaver_ignore_get(void)
107E_API void 91E_API void
108e_screensaver_update(void) 92e_screensaver_update(void)
109{ 93{
110 int timeout; 94 int timeout, interval = 0, blanking = 0, expose = 0;
111 Eina_Bool changed = EINA_FALSE; 95 Eina_Bool changed = EINA_FALSE;
112 96
113 timeout = e_screensaver_timeout_get(EINA_TRUE); 97 timeout = e_screensaver_timeout_get(EINA_TRUE);
@@ -122,18 +106,11 @@ e_screensaver_update(void)
122 _e_screensaver_timeout = timeout; 106 _e_screensaver_timeout = timeout;
123 changed = EINA_TRUE; 107 changed = EINA_TRUE;
124 } 108 }
125#ifndef HAVE_WAYLAND_ONLY
126 int interval = 0, blanking = 0, expose = 0;
127 109
128 interval = e_config->screensaver_interval; 110 interval = e_config->screensaver_interval;
129 blanking = e_config->screensaver_blanking; 111 blanking = e_config->screensaver_blanking;
130 expose = e_config->screensaver_expose; 112 expose = e_config->screensaver_expose;
131 113
132// if (_e_screensaver_interval != interval)
133// {
134// _e_screensaver_interval = interval;
135// changed = EINA_TRUE;
136// }
137 if (_e_screensaver_blanking != blanking) 114 if (_e_screensaver_blanking != blanking)
138 { 115 {
139 _e_screensaver_blanking = blanking; 116 _e_screensaver_blanking = blanking;
@@ -145,9 +122,10 @@ e_screensaver_update(void)
145 changed = EINA_TRUE; 122 changed = EINA_TRUE;
146 } 123 }
147 124
148 if (e_comp->comp_type != E_PIXMAP_TYPE_WL) 125 if (changed)
149 { 126 {
150 if (changed) 127#ifndef HAVE_WAYLAND_ONLY
128 if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
151 { 129 {
152 // this toggling of dpms is a bug workaround in x that i found 130 // this toggling of dpms is a bug workaround in x that i found
153 // where if we change screensaver timeouts and force a manual 131 // where if we change screensaver timeouts and force a manual
@@ -168,16 +146,8 @@ e_screensaver_update(void)
168 } 146 }
169 ecore_x_screensaver_set(timeout, interval, blanking, expose); 147 ecore_x_screensaver_set(timeout, interval, blanking, expose);
170 } 148 }
171 }
172#endif 149#endif
173#ifdef HAVE_WAYLAND
174 if (changed && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
175 {
176 E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
177 if (timeout)
178 _e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1);
179 } 150 }
180#endif
181} 151}
182 152
183static Eina_Bool 153static Eina_Bool
@@ -354,10 +324,6 @@ _e_screensaver_handler_screensaver_off_cb(void *data EINA_UNUSED, int type EINA_
354 } 324 }
355 else if (_e_screensaver_ask_presentation_count) 325 else if (_e_screensaver_ask_presentation_count)
356 _e_screensaver_ask_presentation_count = 0; 326 _e_screensaver_ask_presentation_count = 0;
357#ifdef HAVE_WAYLAND
358 if (_e_screensaver_timeout && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
359 _e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
360#endif
361 return ECORE_CALLBACK_PASS_ON; 327 return ECORE_CALLBACK_PASS_ON;
362} 328}
363 329
@@ -534,8 +500,7 @@ e_screensaver_activate(void)
534#endif 500#endif
535#ifdef HAVE_WAYLAND 501#ifdef HAVE_WAYLAND
536 if (e_comp->comp_type == E_PIXMAP_TYPE_WL) 502 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
537 e_screensaver_eval(1); 503 e_comp_wl_screensaver_activate();
538 E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
539#endif 504#endif
540} 505}
541 506
@@ -550,7 +515,8 @@ e_screensaver_deactivate(void)
550 ecore_x_screensaver_reset(); 515 ecore_x_screensaver_reset();
551#endif 516#endif
552#ifdef HAVE_WAYLAND 517#ifdef HAVE_WAYLAND
553 e_screensaver_notidle(); 518 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
519 e_comp_canvas_notidle();
554#endif 520#endif
555} 521}
556 522
@@ -605,6 +571,13 @@ e_screensaver_eval(Eina_Bool saver_on)
605 } 571 }
606 return; 572 return;
607 } 573 }
574 else
575 {
576#ifdef HAVE_WAYLAND
577 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
578 ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL);
579#endif
580 }
608 if (screensaver_idle_timer) 581 if (screensaver_idle_timer)
609 { 582 {
610 E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del); 583 E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
@@ -633,33 +606,13 @@ e_screensaver_eval(Eina_Bool saver_on)
633} 606}
634 607
635E_API void 608E_API void
636e_screensaver_notidle(void)
637{
638#ifdef HAVE_WAYLAND
639 if (_e_screensaver_inhibited || (e_comp->comp_type != E_PIXMAP_TYPE_WL)) return;
640 E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
641 if (e_screensaver_on_get())
642 {
643 ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL);
644 _e_screensaver_timer = ecore_timer_loop_add(0.2, _e_screensaver_idle_timeout_cb, NULL);
645 }
646 else if (_e_screensaver_timeout)
647 _e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
648#endif
649}
650
651E_API void
652e_screensaver_inhibit_toggle(Eina_Bool inhibit) 609e_screensaver_inhibit_toggle(Eina_Bool inhibit)
653{ 610{
654#ifdef HAVE_WAYLAND 611#ifdef HAVE_WAYLAND
655 if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return; 612 if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
656 E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del); 613 e_comp_wl_screensaver_inhibit(inhibit);
657 _e_screensaver_inhibited = !!inhibit;
658 if (inhibit)
659 e_screensaver_eval(0);
660 else
661 e_screensaver_notidle();
662#else 614#else
663 (void)inhibit; 615 (void)inhibit;
664#endif 616#endif
665} 617}
618
diff --git a/src/bin/e_screensaver.h b/src/bin/e_screensaver.h
index 5b1cd6187..a8cd8753d 100644
--- a/src/bin/e_screensaver.h
+++ b/src/bin/e_screensaver.h
@@ -21,7 +21,6 @@ E_API void e_screensaver_deactivate(void);
21 21
22E_API void e_screensaver_now_set(Eina_Bool now); 22E_API void e_screensaver_now_set(Eina_Bool now);
23E_API void e_screensaver_eval(Eina_Bool saver_on); 23E_API void e_screensaver_eval(Eina_Bool saver_on);
24E_API void e_screensaver_notidle(void);
25E_API void e_screensaver_inhibit_toggle(Eina_Bool inhibit); 24E_API void e_screensaver_inhibit_toggle(Eina_Bool inhibit);
26 25
27E_API extern int E_EVENT_SCREENSAVER_ON; 26E_API extern int E_EVENT_SCREENSAVER_ON;
diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index ee917732a..ec894fec9 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -189,6 +189,10 @@ _e_sys_comp_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_
189 if (e_comp->comp_type == E_PIXMAP_TYPE_X) 189 if (e_comp->comp_type == E_PIXMAP_TYPE_X)
190 _e_comp_x_screensaver_on(); 190 _e_comp_x_screensaver_on();
191#endif 191#endif
192#ifdef HAVE_WAYLAND
193 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
194 _e_comp_wl_screensaver_on();
195#endif
192 196
193 if (rep) 197 if (rep)
194 { 198 {
@@ -277,6 +281,10 @@ _e_sys_comp_resume2(void *data EINA_UNUSED)
277 if (e_comp->comp_type == E_PIXMAP_TYPE_X) 281 if (e_comp->comp_type == E_PIXMAP_TYPE_X)
278 _e_comp_x_screensaver_off(); 282 _e_comp_x_screensaver_off();
279#endif 283#endif
284#ifdef HAVE_WAYLAND
285 if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
286 _e_comp_wl_screensaver_off();
287#endif
280 EINA_LIST_FOREACH(e_comp->zones, l, zone) 288 EINA_LIST_FOREACH(e_comp->zones, l, zone)
281 e_backlight_level_set(zone, resume_backlight, -1.0); 289 e_backlight_level_set(zone, resume_backlight, -1.0);
282 _e_sys_comp_zones_fade(E_SYS_SUSPEND, "e,state,sys,resume", EINA_FALSE); 290 _e_sys_comp_zones_fade(E_SYS_SUSPEND, "e,state,sys,resume", EINA_FALSE);