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
devs/bu5hm4n/recognition
Carsten Haitzler 2 years ago
parent 8cc3bd7cdb
commit f6e4be1005
  1. 2
      src/bin/e_backlight.c
  2. 2
      src/bin/e_client.c
  3. 4
      src/bin/e_comp.c
  4. 21
      src/bin/e_comp_canvas.c
  5. 1
      src/bin/e_comp_canvas.h
  6. 159
      src/bin/e_comp_wl.c
  7. 6
      src/bin/e_comp_wl.h
  8. 79
      src/bin/e_screensaver.c
  9. 1
      src/bin/e_screensaver.h
  10. 8
      src/bin/e_sys.c

@ -728,6 +728,8 @@ e_backlight_level_set(E_Zone *zone, double val, double tim)
if (zone->bl_mode == E_BACKLIGHT_MODE_NORMAL) tim = 0.5;
else if (tim < 0.0) tim = e_config->backlight.transition;
if ((bd->anim) && (fabs(bd->to_val - val) < DBL_EPSILON)) return;
E_FREE_FUNC(bd->retry_timer, ecore_timer_del);
E_FREE_FUNC(bd->anim, ecore_animator_del);
bd->from_val = bl_now;

@ -4709,7 +4709,7 @@ e_client_urgent_set(E_Client *ec, Eina_Bool urgent)
int x, y;
ecore_evas_pointer_xy_get(e_comp->ee, &x, &y);
ecore_evas_pointer_warp(e_comp->ee, x, y);
e_screensaver_notidle();
e_comp_canvas_notidle();
}
if (!ec->zone) return;

@ -1589,7 +1589,7 @@ e_comp_ignore_win_find(Ecore_Window win)
}
E_API void
e_comp_override_del()
e_comp_override_del(void)
{
e_comp->nocomp_override--;
if (e_comp->nocomp_override <= 0)
@ -1600,7 +1600,7 @@ e_comp_override_del()
}
E_API void
e_comp_override_add()
e_comp_override_add(void)
{
e_comp->nocomp_override++;
if ((e_comp->nocomp_override > 0) && (e_comp->nocomp)) _e_comp_nocomp_end();

@ -74,7 +74,7 @@ _e_comp_canvas_cb_mouse_in(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
{
E_Client *ec;
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
ec = e_client_focused_get();
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
static void
_e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_mouse_down_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
}
@ -91,7 +91,7 @@ _e_comp_canvas_cb_mouse_down(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Obje
static void
_e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_mouse_up_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
}
@ -99,7 +99,7 @@ _e_comp_canvas_cb_mouse_up(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object
static void
_e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_client_action_get() || e_grabinput_mouse_win_get()) return;
e_bindings_wheel_evas_event_handle(E_BINDING_CONTEXT_COMPOSITOR, E_OBJECT(e_comp), event_info);
}
@ -107,7 +107,7 @@ _e_comp_canvas_cb_mouse_wheel(void *d EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Obj
static Eina_Bool
_key_down(int ctx, Ecore_Event_Key *ev)
{
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER))
{
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
static Eina_Bool
_key_up(int ctx, Ecore_Event_Key *ev)
{
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_desklock_state_get() && (ctx == E_BINDING_CONTEXT_MANAGER))
{
E_Desklock_Interface *iface = e_desklock_interface_current_get();
@ -437,6 +437,7 @@ e_comp_canvas_init(int w, int h)
if ((!after_restart) || (!e_comp_x))
ecore_evas_pointer_warp(e_comp->ee, e_comp->w / 2, e_comp->h / 2);
e_comp_wl_notidle();
return EINA_TRUE;
}
@ -874,6 +875,14 @@ e_comp_canvas_feed_mouse_up(unsigned int activate_time)
}
}
E_API void
e_comp_canvas_notidle(void)
{
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL) e_comp_wl_notidle();
#endif
}
E_API Evas_Object *
e_comp_canvas_event_grabber_add(void)
{

@ -29,6 +29,7 @@ E_API E_Layer e_comp_canvas_client_layer_map_nearest(int layer);
E_API void e_comp_canvas_keys_grab(void);
E_API void e_comp_canvas_keys_ungrab(void);
E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time);
E_API void e_comp_canvas_notidle(void);
E_API Evas_Object *e_comp_canvas_event_grabber_add(void);
EINTERN void e_comp_canvas_intercept(void);

@ -1106,6 +1106,16 @@ _e_comp_wl_client_evas_init(E_Client *ec)
_e_comp_wl_evas_cb_color_set, ec);
ec->comp_data->evas_init = EINA_TRUE;
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_wl_screensaver_on, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_wl_screensaver_off, NULL);
e_comp_wl_notidle();
e_screensaver_attrs_set(e_screensaver_timeout_get(EINA_TRUE),
e_config->screensaver_blanking,
e_config->screensaver_expose);
// XXX: maybe later like x work on explicit suspend of compositor stuff?
// e_desklock_show_hook_add(_e_comp_x_desklock_show);
// e_desklock_hide_hook_add(_e_comp_x_desklock_hide);
}
static inline int
@ -1199,7 +1209,7 @@ _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mou
e_comp_wl->ptr.x = ev->x;
e_comp_wl->ptr.y = ev->y;
e_screensaver_notidle();
e_comp_canvas_notidle();
if (e_comp_wl->selection.target &&
(!e_client_has_xwindow(e_comp_wl->selection.target)) &&
e_comp_wl->drag)
@ -3405,7 +3415,9 @@ e_comp_wl_key_down(Ecore_Event_Key *ev, E_Client *ec)
((ev->modifiers & ECORE_EVENT_MODIFIER_ALT) ||
(ev->modifiers & ECORE_EVENT_MODIFIER_ALTGR)) &&
eina_streq(ev->key, "BackSpace"))
exit(0);
{
if (!e_desklock_state_get()) exit(0);
}
#endif
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)
e_comp_canvas_feed_mouse_up(0);
return ECORE_CALLBACK_DONE;
}
static Eina_Bool saver_inhibit = EINA_FALSE;
static Eina_Bool saver_on = EINA_FALSE;
static Ecore_Timer *screensaver_eval_timer = NULL;
static Ecore_Timer *screensaver_idle_timer = NULL;
static Eina_Bool
_e_comp_wl_creensaver_eval_cb(void *d EINA_UNUSED)
{
screensaver_eval_timer = NULL;
if (!saver_on)
{
if (e_comp->screen && e_comp->screen->dpms)
e_comp->screen->dpms(0);
}
e_screensaver_eval(saver_on);
return EINA_FALSE;
}
static Eina_Bool
_e_comp_wl_screensaver_idle_cb(void *data EINA_UNUSED)
{
screensaver_idle_timer = NULL;
if (e_screensaver_ignore_get()) return EINA_FALSE;
if (!saver_on)
{
saver_on = EINA_TRUE;
E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
screensaver_eval_timer = ecore_timer_loop_add
(0.3, _e_comp_wl_creensaver_eval_cb, NULL);
}
return EINA_FALSE;
}
static void
_e_comp_cb_pointer_suspend_resume_done(void *data, Evas_Object *obj, const char *emission, const char *source)
{
edje_object_signal_callback_del(obj, emission, source,
_e_comp_cb_pointer_suspend_resume_done);
if (!data)
{
e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
}
}
EINTERN Eina_Bool
_e_comp_wl_screensaver_on()
{
const char *s;
if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
if ((s) && (atoi(s) == 1))
{
if (!e_desklock_state_get())
{
e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
}
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
e_comp);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,suspend", "e");
}
return ECORE_CALLBACK_RENEW;
}
EINTERN Eina_Bool
_e_comp_wl_screensaver_off()
{
const char *s;
e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
if ((s) && (atoi(s) == 1))
{
if (!e_desklock_state_get())
{
e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
}
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
NULL);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,resume", "e");
}
return ECORE_CALLBACK_RENEW;
}
E_API void
e_comp_wl_notidle(void)
{
if (saver_on)
{
saver_on = EINA_FALSE;
E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
screensaver_eval_timer = ecore_timer_loop_add
(0.3, _e_comp_wl_creensaver_eval_cb, NULL);
}
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
screensaver_idle_timer = ecore_timer_add
(e_screensaver_timeout_get(EINA_TRUE),
_e_comp_wl_screensaver_idle_cb, NULL);
}
E_API void
e_comp_wl_screensaver_activate(void)
{
saver_on = EINA_TRUE;
E_FREE_FUNC(screensaver_eval_timer, ecore_timer_del);
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
e_screensaver_eval(saver_on);
}
E_API void
e_comp_wl_screensaver_inhibit(Eina_Bool inhibit)
{
if (inhibit == saver_inhibit) return;
saver_inhibit = inhibit;
e_comp_wl_notidle();
if (inhibit)
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
}

@ -439,6 +439,12 @@ E_API void e_comp_wl_extension_pointer_unconstrain(E_Client *ec);
E_API void e_comp_wl_extension_action_route_pid_allowed_set(uint32_t pid, Eina_Bool allow);
E_API const void *e_comp_wl_extension_action_route_interface_get(int *version);
E_API void e_comp_wl_notidle(void);
E_API void e_comp_wl_screensaver_activate(void);
E_API void e_comp_wl_screensaver_inhibit(Eina_Bool inhibit);
EINTERN Eina_Bool _e_comp_wl_screensaver_on();
EINTERN Eina_Bool _e_comp_wl_screensaver_off();
E_API void
e_policy_wl_aux_message_send(E_Client *ec,

@ -15,7 +15,6 @@ static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
static int _e_screensaver_ask_presentation_count = 0;
static int _e_screensaver_timeout = 0;
//static int _e_screensaver_interval = 0;
static int _e_screensaver_blanking = 0;
static int _e_screensaver_expose = 0;
@ -25,11 +24,6 @@ static Eina_Bool _e_screensaver_on = EINA_FALSE;
static Ecore_Timer *screensaver_idle_timer = NULL;
static Eina_Bool screensaver_dimmed = EINA_FALSE;
#ifdef HAVE_WAYLAND
static Ecore_Timer *_e_screensaver_timer;
static Eina_Bool _e_screensaver_inhibited = EINA_FALSE;
#endif
static Eina_Bool _screensaver_ignore = EINA_FALSE;
static Eina_Bool _screensaver_now = EINA_FALSE;
@ -37,16 +31,6 @@ E_API int E_EVENT_SCREENSAVER_ON = -1;
E_API int E_EVENT_SCREENSAVER_OFF = -1;
E_API int E_EVENT_SCREENSAVER_OFF_PRE = -1;
#ifdef HAVE_WAYLAND
static Eina_Bool
_e_screensaver_idle_timeout_cb(void *d)
{
e_screensaver_eval(!!d);
_e_screensaver_timer = NULL;
return EINA_FALSE;
}
#endif
E_API int
e_screensaver_timeout_get(Eina_Bool use_idle)
{
@ -107,7 +91,7 @@ e_screensaver_ignore_get(void)
E_API void
e_screensaver_update(void)
{
int timeout;
int timeout, interval = 0, blanking = 0, expose = 0;
Eina_Bool changed = EINA_FALSE;
timeout = e_screensaver_timeout_get(EINA_TRUE);
@ -122,18 +106,11 @@ e_screensaver_update(void)
_e_screensaver_timeout = timeout;
changed = EINA_TRUE;
}
#ifndef HAVE_WAYLAND_ONLY
int interval = 0, blanking = 0, expose = 0;
interval = e_config->screensaver_interval;
blanking = e_config->screensaver_blanking;
expose = e_config->screensaver_expose;
// if (_e_screensaver_interval != interval)
// {
// _e_screensaver_interval = interval;
// changed = EINA_TRUE;
// }
if (_e_screensaver_blanking != blanking)
{
_e_screensaver_blanking = blanking;
@ -145,9 +122,10 @@ e_screensaver_update(void)
changed = EINA_TRUE;
}
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
if (changed)
{
if (changed)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
{
// this toggling of dpms is a bug workaround in x that i found
// where if we change screensaver timeouts and force a manual
@ -168,16 +146,8 @@ e_screensaver_update(void)
}
ecore_x_screensaver_set(timeout, interval, blanking, expose);
}
}
#endif
#ifdef HAVE_WAYLAND
if (changed && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
{
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
if (timeout)
_e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1);
}
#endif
}
static Eina_Bool
@ -354,10 +324,6 @@ _e_screensaver_handler_screensaver_off_cb(void *data EINA_UNUSED, int type EINA_
}
else if (_e_screensaver_ask_presentation_count)
_e_screensaver_ask_presentation_count = 0;
#ifdef HAVE_WAYLAND
if (_e_screensaver_timeout && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
_e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
#endif
return ECORE_CALLBACK_PASS_ON;
}
@ -534,8 +500,7 @@ e_screensaver_activate(void)
#endif
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
e_screensaver_eval(1);
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
e_comp_wl_screensaver_activate();
#endif
}
@ -550,7 +515,8 @@ e_screensaver_deactivate(void)
ecore_x_screensaver_reset();
#endif
#ifdef HAVE_WAYLAND
e_screensaver_notidle();
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
e_comp_canvas_notidle();
#endif
}
@ -605,6 +571,13 @@ e_screensaver_eval(Eina_Bool saver_on)
}
return;
}
else
{
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL);
#endif
}
if (screensaver_idle_timer)
{
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
@ -632,34 +605,14 @@ e_screensaver_eval(Eina_Bool saver_on)
}
}
E_API void
e_screensaver_notidle(void)
{
#ifdef HAVE_WAYLAND
if (_e_screensaver_inhibited || (e_comp->comp_type != E_PIXMAP_TYPE_WL)) return;
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
if (e_screensaver_on_get())
{
ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL);
_e_screensaver_timer = ecore_timer_loop_add(0.2, _e_screensaver_idle_timeout_cb, NULL);
}
else if (_e_screensaver_timeout)
_e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
#endif
}
E_API void
e_screensaver_inhibit_toggle(Eina_Bool inhibit)
{
#ifdef HAVE_WAYLAND
if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
_e_screensaver_inhibited = !!inhibit;
if (inhibit)
e_screensaver_eval(0);
else
e_screensaver_notidle();
e_comp_wl_screensaver_inhibit(inhibit);
#else
(void)inhibit;
#endif
}

@ -21,7 +21,6 @@ E_API void e_screensaver_deactivate(void);
E_API void e_screensaver_now_set(Eina_Bool now);
E_API void e_screensaver_eval(Eina_Bool saver_on);
E_API void e_screensaver_notidle(void);
E_API void e_screensaver_inhibit_toggle(Eina_Bool inhibit);
E_API extern int E_EVENT_SCREENSAVER_ON;

@ -189,6 +189,10 @@ _e_sys_comp_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
_e_comp_x_screensaver_on();
#endif
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
_e_comp_wl_screensaver_on();
#endif
if (rep)
{
@ -276,6 +280,10 @@ _e_sys_comp_resume2(void *data EINA_UNUSED)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
_e_comp_x_screensaver_off();
#endif
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
_e_comp_wl_screensaver_off();
#endif
EINA_LIST_FOREACH(e_comp->zones, l, zone)
e_backlight_level_set(zone, resume_backlight, -1.0);

Loading…
Cancel
Save