Fix picking crashes

The surface list is only valid after repaint, so we need to do picking and
input delivery there.
This commit is contained in:
Kristian Høgsberg
2012-03-11 16:35:16 -04:00
parent 8efbc8ee62
commit aa6019e125
2 changed files with 8 additions and 10 deletions
+7 -6
View File
@@ -604,11 +604,13 @@ weston_surface_unmap(struct weston_surface *surface)
surface->output = NULL; surface->output = NULL;
wl_list_remove(&surface->link); wl_list_remove(&surface->link);
wl_list_remove(&surface->layer_link); wl_list_remove(&surface->layer_link);
weston_compositor_repick(surface->compositor);
if (device->keyboard_focus == &surface->surface) if (device->keyboard_focus == &surface->surface)
wl_input_device_set_keyboard_focus(device, NULL, wl_input_device_set_keyboard_focus(device, NULL,
weston_compositor_get_time()); 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); weston_compositor_schedule_repaint(surface->compositor);
} }
@@ -820,11 +822,8 @@ out:
WL_EXPORT void WL_EXPORT void
weston_surface_restack(struct weston_surface *surface, struct wl_list *below) 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_remove(&surface->layer_link);
wl_list_insert(below, &surface->layer_link); wl_list_insert(below, &surface->layer_link);
weston_compositor_repick(compositor);
weston_surface_damage_below(surface); weston_surface_damage_below(surface);
weston_surface_damage(surface); weston_surface_damage(surface);
} }
@@ -964,6 +963,9 @@ weston_output_repaint(struct weston_output *output, int msecs)
output->repaint_needed = 0; 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_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_callback_send_done(&cb->resource, msecs); wl_callback_send_done(&cb->resource, msecs);
wl_resource_destroy(&cb->resource, 0); 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); wl_display_get_event_loop(compositor->wl_display);
int fd; int fd;
wl_event_loop_dispatch(compositor->input_loop, 0);
if (output->repaint_needed) { if (output->repaint_needed) {
weston_output_repaint(output, msecs); weston_output_repaint(output, msecs);
return; return;
@@ -1270,7 +1271,7 @@ surface_set_input_region(struct wl_client *client,
surface->geometry.height); surface->geometry.height);
} }
weston_compositor_repick(surface->compositor); weston_compositor_schedule_repaint(surface->compositor);
} }
const static struct wl_surface_interface surface_interface = { const static struct wl_surface_interface surface_interface = {
+1 -4
View File
@@ -1055,7 +1055,6 @@ resume_desktop(struct wl_shell *shell)
wl_list_insert(&shell->panel_layer.link, &shell->toplevel_layer.link); wl_list_insert(&shell->panel_layer.link, &shell->toplevel_layer.link);
shell->locked = false; shell->locked = false;
weston_compositor_repick(shell->compositor);
shell->compositor->idle_time = shell->compositor->option_idle_time; shell->compositor->idle_time = shell->compositor->option_idle_time;
weston_compositor_wake(shell->compositor); weston_compositor_wake(shell->compositor);
weston_compositor_damage_all(shell->compositor); weston_compositor_damage_all(shell->compositor);
@@ -1440,7 +1439,7 @@ lock(struct weston_shell *base)
} }
/* reset pointer foci */ /* reset pointer foci */
weston_compositor_repick(shell->compositor); weston_compositor_schedule_repaint(shell->compositor);
/* reset keyboard foci */ /* reset keyboard foci */
time = weston_compositor_get_time(); time = weston_compositor_get_time();
@@ -1584,7 +1583,6 @@ map(struct weston_shell *base, struct weston_surface *surface,
if (surface_type != SHELL_SURFACE_NONE) { if (surface_type != SHELL_SURFACE_NONE) {
weston_surface_assign_output(surface); weston_surface_assign_output(surface);
weston_compositor_repick(compositor);
if (surface_type == SHELL_SURFACE_MAXIMIZED) if (surface_type == SHELL_SURFACE_MAXIMIZED)
surface->output = shsurf->output; 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? */ /* XXX: would a fullscreen surface need the same handling? */
if (surface->output) { if (surface->output) {
weston_surface_assign_output(surface); weston_surface_assign_output(surface);
weston_compositor_repick(surface->compositor);
if (surface_type == SHELL_SURFACE_SCREENSAVER) if (surface_type == SHELL_SURFACE_SCREENSAVER)
surface->output = shsurf->output; surface->output = shsurf->output;