summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-03-11 16:35:16 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-03-12 01:28:50 -0400
commitaa6019e1254465f882294b90b87b163906197ebc (patch)
treed2ccd9def105bb2d24b575f87bbfc72432eaad65
parent8efbc8ee621edac19341f993624c6d5a27686803 (diff)
Fix picking crashes
The surface list is only valid after repaint, so we need to do picking and input delivery there.
-rw-r--r--src/compositor.c13
-rw-r--r--src/shell.c5
2 files changed, 8 insertions, 10 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 96e7fe7..50eb018 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -604,11 +604,13 @@ weston_surface_unmap(struct weston_surface *surface)
surface->output = NULL;
wl_list_remove(&surface->link);
wl_list_remove(&surface->layer_link);
- weston_compositor_repick(surface->compositor);
if (device->keyboard_focus == &surface->surface)
wl_input_device_set_keyboard_focus(device, NULL,
weston_compositor_get_time());
+ if (device->pointer_focus == &surface->surface)
+ wl_input_device_set_pointer_focus(device, NULL, 0, 0,
+ weston_compositor_get_time());
weston_compositor_schedule_repaint(surface->compositor);
}
@@ -820,11 +822,8 @@ out:
WL_EXPORT void
weston_surface_restack(struct weston_surface *surface, struct wl_list *below)
{
- struct weston_compositor *compositor = surface->compositor;
-
wl_list_remove(&surface->layer_link);
wl_list_insert(below, &surface->layer_link);
- weston_compositor_repick(compositor);
weston_surface_damage_below(surface);
weston_surface_damage(surface);
}
@@ -964,6 +963,9 @@ weston_output_repaint(struct weston_output *output, int msecs)
output->repaint_needed = 0;
+ weston_compositor_repick(ec);
+ wl_event_loop_dispatch(ec->input_loop, 0);
+
wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_callback_send_done(&cb->resource, msecs);
wl_resource_destroy(&cb->resource, 0);
@@ -991,7 +993,6 @@ weston_output_finish_frame(struct weston_output *output, int msecs)
wl_display_get_event_loop(compositor->wl_display);
int fd;
- wl_event_loop_dispatch(compositor->input_loop, 0);
if (output->repaint_needed) {
weston_output_repaint(output, msecs);
return;
@@ -1270,7 +1271,7 @@ surface_set_input_region(struct wl_client *client,
surface->geometry.height);
}
- weston_compositor_repick(surface->compositor);
+ weston_compositor_schedule_repaint(surface->compositor);
}
const static struct wl_surface_interface surface_interface = {
diff --git a/src/shell.c b/src/shell.c
index 92b7540..765b0a4 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1055,7 +1055,6 @@ resume_desktop(struct wl_shell *shell)
wl_list_insert(&shell->panel_layer.link, &shell->toplevel_layer.link);
shell->locked = false;
- weston_compositor_repick(shell->compositor);
shell->compositor->idle_time = shell->compositor->option_idle_time;
weston_compositor_wake(shell->compositor);
weston_compositor_damage_all(shell->compositor);
@@ -1440,7 +1439,7 @@ lock(struct weston_shell *base)
}
/* reset pointer foci */
- weston_compositor_repick(shell->compositor);
+ weston_compositor_schedule_repaint(shell->compositor);
/* reset keyboard foci */
time = weston_compositor_get_time();
@@ -1584,7 +1583,6 @@ map(struct weston_shell *base, struct weston_surface *surface,
if (surface_type != SHELL_SURFACE_NONE) {
weston_surface_assign_output(surface);
- weston_compositor_repick(compositor);
if (surface_type == SHELL_SURFACE_MAXIMIZED)
surface->output = shsurf->output;
}
@@ -1651,7 +1649,6 @@ configure(struct weston_shell *base, struct weston_surface *surface,
/* XXX: would a fullscreen surface need the same handling? */
if (surface->output) {
weston_surface_assign_output(surface);
- weston_compositor_repick(surface->compositor);
if (surface_type == SHELL_SURFACE_SCREENSAVER)
surface->output = shsurf->output;