input: Remove exported function weston_pointer_verify()

Instead, add a compositor signal that an output has been destroyed and
handle that case locally in input.c.
dev
Ander Conselvan de Oliveira 11 years ago committed by Kristian Høgsberg
parent adaa20c017
commit f84327aef2
  1. 17
      src/compositor.c
  2. 5
      src/compositor.h
  3. 20
      src/input.c

@ -3170,19 +3170,6 @@ weston_compositor_remove_output(struct weston_compositor *compositor,
}
}
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)
{
@ -3191,8 +3178,7 @@ 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);
@ -3654,6 +3640,7 @@ weston_compositor_init(struct weston_compositor *ec,
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;

@ -329,6 +329,8 @@ struct weston_pointer {
wl_fixed_t x, y;
uint32_t button_count;
struct wl_listener output_destroy_listener;
};
@ -375,8 +377,6 @@ weston_pointer_move(struct weston_pointer *pointer,
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);
@ -579,6 +579,7 @@ struct weston_compositor {
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;

@ -438,6 +438,9 @@ weston_pointer_reset_state(struct weston_pointer *pointer)
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)
{
@ -465,6 +468,11 @@ 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;
}
@ -478,6 +486,7 @@ weston_pointer_destroy(struct weston_pointer *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);
}
@ -871,14 +880,19 @@ weston_pointer_move(struct weston_pointer *pointer, wl_fixed_t x, wl_fixed_t y)
/** 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);

Loading…
Cancel
Save