}
}
-static void
-weston_compositor_verify_pointers(struct weston_compositor *ec)
-{
- struct weston_seat *seat;
-
- wl_list_for_each(seat, &ec->seat_list, link) {
- if (!seat->pointer)
- continue;
-
- weston_pointer_verify(seat->pointer);
- }
-}
-
WL_EXPORT void
weston_output_destroy(struct weston_output *output)
{
weston_compositor_remove_output(output->compositor, output);
wl_list_remove(&output->link);
- weston_compositor_verify_pointers(output->compositor);
-
+ wl_signal_emit(&output->compositor->output_destroyed_signal, output);
wl_signal_emit(&output->destroy_signal, output);
free(output->name);
wl_signal_init(&ec->update_input_panel_signal);
wl_signal_init(&ec->seat_created_signal);
wl_signal_init(&ec->output_created_signal);
+ wl_signal_init(&ec->output_destroyed_signal);
wl_signal_init(&ec->session_signal);
ec->session_active = 1;
wl_fixed_t x, y;
uint32_t button_count;
+
+ struct wl_listener output_destroy_listener;
};
void
weston_pointer_set_default_grab(struct weston_pointer *pointer,
const struct weston_pointer_grab_interface *interface);
-void
-weston_pointer_verify(struct weston_pointer *pointer);
struct weston_keyboard *
weston_keyboard_create(void);
struct wl_signal seat_created_signal;
struct wl_signal output_created_signal;
+ struct wl_signal output_destroyed_signal;
struct wl_event_loop *input_loop;
struct wl_event_source *input_loop_source;
pointer->button_count = 0;
}
+static void
+weston_pointer_handle_output_destroy(struct wl_listener *listener, void *data);
+
WL_EXPORT struct weston_pointer *
weston_pointer_create(struct weston_seat *seat)
{
pointer->x = wl_fixed_from_int(100);
pointer->y = wl_fixed_from_int(100);
+ pointer->output_destroy_listener.notify =
+ weston_pointer_handle_output_destroy;
+ wl_signal_add(&seat->compositor->output_destroyed_signal,
+ &pointer->output_destroy_listener);
+
return pointer;
}
wl_list_remove(&pointer->focus_resource_listener.link);
wl_list_remove(&pointer->focus_view_listener.link);
+ wl_list_remove(&pointer->output_destroy_listener.link);
free(pointer);
}
/** Verify if the pointer is in a valid position and move it if it isn't.
*/
-WL_EXPORT void
-weston_pointer_verify(struct weston_pointer *pointer)
+static void
+weston_pointer_handle_output_destroy(struct wl_listener *listener, void *data)
{
- struct weston_compositor *ec = pointer->seat->compositor;
+ struct weston_pointer *pointer;
+ struct weston_compositor *ec;
struct weston_output *output, *closest = NULL;
int x, y, distance, min = INT_MAX;
wl_fixed_t fx, fy;
+ pointer = container_of(listener, struct weston_pointer,
+ output_destroy_listener);
+ ec = pointer->seat->compositor;
+
x = wl_fixed_to_int(pointer->x);
y = wl_fixed_to_int(pointer->y);