diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2011-12-02 13:07:27 +0200 |
---|---|---|
committer | Pekka Paalanen <ppaalanen@gmail.com> | 2011-12-14 13:44:29 +0200 |
commit | bce2d3f9a742c67f5485886b655a2d50d491e096 (patch) | |
tree | e52ee9d7c91c2204032d23052a718080d5a0ba81 /compositor | |
parent | af0e34ce368ad3aabb366871d5e415fa33e7c54d (diff) |
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>
Diffstat (limited to 'compositor')
-rw-r--r-- | compositor/compositor-drm.c | 7 | ||||
-rw-r--r-- | compositor/compositor.c | 2 | ||||
-rw-r--r-- | compositor/compositor.h | 3 | ||||
-rw-r--r-- | compositor/shell.c | 6 |
4 files changed, 14 insertions, 4 deletions
diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c index cd342e64..4744a46a 100644 --- a/compositor/compositor-drm.c +++ b/compositor/compositor-drm.c @@ -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); diff --git a/compositor/compositor.c b/compositor/compositor.c index 6ee2298e..118d0ded 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -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); diff --git a/compositor/compositor.h b/compositor/compositor.h index 7f1dd74c..1584f809 100644 --- a/compositor/compositor.h +++ b/compositor/compositor.h @@ -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 { diff --git a/compositor/shell.c b/compositor/shell.c index e32e8bcd..32738819 100644 --- a/compositor/shell.c +++ b/compositor/shell.c @@ -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; |