From: Pekka Paalanen Date: Fri, 2 Dec 2011 11:07:27 +0000 (+0200) Subject: compositor: add IDLE state X-Git-Tag: 0.85.0~184 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bce2d3f9a742c67f5485886b655a2d50d491e096;p=profile%2Fivi%2Fweston.git 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 --- 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 @@ 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 6ee2298..118d0de 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 7f1dd74..1584f80 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 e32e8bc..3273881 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;