compositor: let the shell wake up the compositor

When compositor enters SLEEPING state, the shell plugin goes locked. If
compositor wakes up itself, it will fade in while the shell may not yet
have a lock surface to show.

Fix this by assigning wake-up to be called from the shell, if the
compositor is SLEEPING. The shell may wait for the lock surface request,
and only then wake up the compositor. The compositor will fade in
directly to the lock screen.

krh: original patch for compositor.c
ppaalanen: integration and shell.c changes

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
Kristian Høgsberg 2011-11-15 13:34:49 +02:00
parent 9ef3e012d6
commit af867cc2f7
4 changed files with 26 additions and 6 deletions

View file

@ -1334,9 +1334,6 @@ wlsc_compositor_wake(struct wlsc_compositor *compositor)
if (compositor->idle_inhibit)
return;
if (compositor->state == WLSC_COMPOSITOR_SLEEPING)
compositor->shell->unlock(compositor->shell);
wlsc_compositor_fade(compositor, 0.0);
compositor->state = WLSC_COMPOSITOR_ACTIVE;
@ -1344,10 +1341,20 @@ wlsc_compositor_wake(struct wlsc_compositor *compositor)
option_idle_time * 1000);
}
WL_EXPORT void
wlsc_compositor_activity(struct wlsc_compositor *compositor)
{
if (compositor->state != WLSC_COMPOSITOR_SLEEPING) {
wlsc_compositor_wake(compositor);
} else {
compositor->shell->unlock(compositor->shell);
}
}
static void
wlsc_compositor_idle_inhibit(struct wlsc_compositor *compositor)
{
wlsc_compositor_wake(compositor);
wlsc_compositor_activity(compositor);
compositor->idle_inhibit++;
}
@ -1355,7 +1362,7 @@ static void
wlsc_compositor_idle_release(struct wlsc_compositor *compositor)
{
compositor->idle_inhibit--;
wlsc_compositor_wake(compositor);
wlsc_compositor_activity(compositor);
}
static int
@ -1384,7 +1391,7 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y)
int x_valid = 0, y_valid = 0;
int min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN;
wlsc_compositor_wake(ec);
wlsc_compositor_activity(ec);
wl_list_for_each(output, &ec->output_list, link) {
if (output->x <= x && x <= output->x + output->current->width)

View file

@ -326,6 +326,8 @@ void
wlsc_compositor_unlock(struct wlsc_compositor *compositor);
void
wlsc_compositor_wake(struct wlsc_compositor *compositor);
void
wlsc_compositor_activity(struct wlsc_compositor *compositor);
struct wlsc_binding;
typedef void (*wlsc_binding_handler_t)(struct wl_input_device *device,

View file

@ -829,6 +829,11 @@ desktop_shell_set_lock_surface(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *surface_resource)
{
struct wl_shell *shell = resource->data;
/* TODO: put the lock surface always on top modal until unlocked */
wlsc_compositor_wake(shell->compositor);
}
static void
@ -839,6 +844,7 @@ desktop_shell_unlock(struct wl_client *client,
shell->locked = false;
shell->prepare_event_sent = false;
wlsc_compositor_wake(shell->compositor);
}
static const struct desktop_shell_interface desktop_shell_implementation = {
@ -952,6 +958,7 @@ unlock(struct wlsc_shell *base)
/* If desktop-shell client has gone away, unlock immediately. */
if (!shell->child.desktop_shell) {
shell->locked = false;
wlsc_compositor_wake(shell->compositor);
return;
}

View file

@ -556,6 +556,10 @@ tablet_shell_lock(struct wlsc_shell *base)
static void
tablet_shell_unlock(struct wlsc_shell *base)
{
struct tablet_shell *shell =
container_of(base, struct tablet_shell, shell);
wlsc_compositor_wake(shell->compositor);
}
static void