Commit bce2d3f9 authored by Pekka Paalanen's avatar Pekka Paalanen

compositor: add IDLE state

Add WLSC_COMPOSITOR_IDLE state to the possible compositor internal
states, and fix the drm backend to restore the previous state instead of
forcing ACTIVE.

Normally, the compositor only uses the ACTIVE and SLEEPING states. The
IDLE state is another active state, reserved for the shell, when the
shell wants to have unlock() calls on activity, but the compositor cannot
be SLEEPING.

Use the IDLE state to fix exposing the unlock dialog while a screensaver
is animating. Without this fix, is it impossible to activate the unlock
dialog without waiting for a second idle timeout that really puts the
compositor into SLEEPING.
Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <ppaalanen@gmail.com>
parent af0e34ce
......@@ -52,6 +52,8 @@ struct drm_compositor {
uint32_t crtc_allocator;
uint32_t connector_allocator;
struct tty *tty;
uint32_t prev_state;
};
struct drm_mode {
......@@ -788,11 +790,12 @@ vt_func(struct wlsc_compositor *compositor, int event)
case TTY_ENTER_VT:
compositor->focus = 1;
drmSetMaster(ec->drm.fd);
compositor->state = WLSC_COMPOSITOR_ACTIVE;
compositor->state = ec->prev_state;
wlsc_compositor_damage_all(compositor);
break;
case TTY_LEAVE_VT:
compositor->focus = 0;
ec->prev_state = compositor->state;
compositor->state = WLSC_COMPOSITOR_SLEEPING;
wl_list_for_each(output, &ec->base.output_list, link)
......@@ -865,6 +868,8 @@ drm_compositor_create(struct wl_display *display,
ec->base.focus = 1;
ec->prev_state = WLSC_COMPOSITOR_ACTIVE;
glGenFramebuffers(1, &ec->base.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, ec->base.fbo);
......
......@@ -1305,7 +1305,7 @@ wlsc_compositor_wake(struct wlsc_compositor *compositor)
WL_EXPORT void
wlsc_compositor_activity(struct wlsc_compositor *compositor)
{
if (compositor->state != WLSC_COMPOSITOR_SLEEPING) {
if (compositor->state == WLSC_COMPOSITOR_ACTIVE) {
wlsc_compositor_wake(compositor);
} else {
compositor->shell->unlock(compositor->shell);
......
......@@ -183,7 +183,8 @@ struct wlsc_shell {
enum {
WLSC_COMPOSITOR_ACTIVE,
WLSC_COMPOSITOR_SLEEPING
WLSC_COMPOSITOR_IDLE, /* shell->unlock called on activity */
WLSC_COMPOSITOR_SLEEPING /* no rendering, no frame events */
};
struct wlsc_compositor {
......
......@@ -865,8 +865,10 @@ lock(struct wlsc_shell *base)
wl_list_for_each(shsurf, &shell->screensaver.surfaces, link)
show_screensaver(shell, shsurf);
if (!wl_list_empty(&shell->screensaver.surfaces))
if (!wl_list_empty(&shell->screensaver.surfaces)) {
wlsc_compositor_wake(shell->compositor);
shell->compositor->state = WLSC_COMPOSITOR_IDLE;
}
/* reset pointer foci */
wlsc_compositor_repick(shell->compositor);
......@@ -983,6 +985,8 @@ map(struct wlsc_shell *base,
if (shell->locked) {
show_screensaver(shell, shsurf);
wlsc_compositor_wake(compositor);
if (!shell->lock_surface)
compositor->state = WLSC_COMPOSITOR_IDLE;
}
do_configure = 0;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment