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 <ppaalanen@gmail.com>
diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c
index cd342e6..4744a46 100644
--- a/compositor/compositor-drm.c
+++ b/compositor/compositor-drm.c
@@ -52,6 +52,8 @@
uint32_t crtc_allocator;
uint32_t connector_allocator;
struct tty *tty;
+
+ uint32_t prev_state;
};
struct drm_mode {
@@ -788,11 +790,12 @@
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 @@
ec->base.focus = 1;
+ ec->prev_state = WLSC_COMPOSITOR_ACTIVE;
+
glGenFramebuffers(1, &ec->base.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, ec->base.fbo);