input: Rename wl_pointer to weston_pointer

This is now a weston object.
dev
Kristian Høgsberg 12 years ago
parent a71e8b2e4d
commit 02bbabbd56
  1. 10
      src/compositor.c
  2. 48
      src/compositor.h
  3. 16
      src/data-device.c
  4. 86
      src/input.c
  5. 102
      src/shell.c
  6. 4
      tests/weston-test.c

@ -122,7 +122,7 @@ weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode
/* If a pointer falls outside the outputs new geometry, move it to its /* If a pointer falls outside the outputs new geometry, move it to its
* lower-right corner */ * lower-right corner */
wl_list_for_each(seat, &output->compositor->seat_list, link) { wl_list_for_each(seat, &output->compositor->seat_list, link) {
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
int32_t x, y; int32_t x, y;
if (!pointer) if (!pointer)
@ -951,10 +951,10 @@ weston_surface_unmap(struct weston_surface *surface)
weston_keyboard_set_focus(seat->seat.keyboard, NULL); weston_keyboard_set_focus(seat->seat.keyboard, NULL);
if (seat->seat.pointer && if (seat->seat.pointer &&
seat->seat.pointer->focus == &surface->surface) seat->seat.pointer->focus == &surface->surface)
wl_pointer_set_focus(seat->seat.pointer, weston_pointer_set_focus(seat->seat.pointer,
NULL, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0),
wl_fixed_from_int(0)); wl_fixed_from_int(0));
} }
weston_surface_schedule_repaint(surface); weston_surface_schedule_repaint(surface);

@ -208,23 +208,23 @@ struct weston_output {
uint16_t *b); uint16_t *b);
}; };
struct wl_pointer_grab; struct weston_pointer_grab;
struct wl_pointer_grab_interface { struct weston_pointer_grab_interface {
void (*focus)(struct wl_pointer_grab *grab, void (*focus)(struct weston_pointer_grab *grab,
struct wl_surface *surface, struct wl_surface *surface,
wl_fixed_t x, wl_fixed_t x,
wl_fixed_t y); wl_fixed_t y);
void (*motion)(struct wl_pointer_grab *grab, void (*motion)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t time,
wl_fixed_t x, wl_fixed_t x,
wl_fixed_t y); wl_fixed_t y);
void (*button)(struct wl_pointer_grab *grab, void (*button)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state); uint32_t time, uint32_t button, uint32_t state);
}; };
struct wl_pointer_grab { struct weston_pointer_grab {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct wl_pointer *pointer; struct weston_pointer *pointer;
struct wl_surface *focus; struct wl_surface *focus;
wl_fixed_t x, y; wl_fixed_t x, y;
}; };
@ -285,7 +285,7 @@ struct wl_data_source {
void (*cancel)(struct wl_data_source *source); void (*cancel)(struct wl_data_source *source);
}; };
struct wl_pointer { struct weston_pointer {
struct wl_seat *seat; struct wl_seat *seat;
struct wl_list resource_list; struct wl_list resource_list;
@ -295,8 +295,8 @@ struct wl_pointer {
uint32_t focus_serial; uint32_t focus_serial;
struct wl_signal focus_signal; struct wl_signal focus_signal;
struct wl_pointer_grab *grab; struct weston_pointer_grab *grab;
struct wl_pointer_grab default_grab; struct weston_pointer_grab default_grab;
wl_fixed_t grab_x, grab_y; wl_fixed_t grab_x, grab_y;
uint32_t grab_button; uint32_t grab_button;
uint32_t grab_serial; uint32_t grab_serial;
@ -332,7 +332,7 @@ struct wl_seat {
struct wl_list base_resource_list; struct wl_list base_resource_list;
struct wl_signal destroy_signal; struct wl_signal destroy_signal;
struct wl_pointer *pointer; struct weston_pointer *pointer;
struct weston_keyboard *keyboard; struct weston_keyboard *keyboard;
struct wl_touch *touch; struct wl_touch *touch;
@ -348,7 +348,7 @@ struct wl_seat {
struct wl_surface *drag_focus; struct wl_surface *drag_focus;
struct wl_resource *drag_focus_resource; struct wl_resource *drag_focus_resource;
struct wl_listener drag_focus_listener; struct wl_listener drag_focus_listener;
struct wl_pointer_grab drag_grab; struct weston_pointer_grab drag_grab;
struct wl_surface *drag_surface; struct wl_surface *drag_surface;
struct wl_listener drag_icon_listener; struct wl_listener drag_icon_listener;
struct wl_signal drag_icon_signal; struct wl_signal drag_icon_signal;
@ -361,26 +361,28 @@ void
wl_seat_release(struct wl_seat *seat); wl_seat_release(struct wl_seat *seat);
void void
wl_seat_set_pointer(struct wl_seat *seat, struct wl_pointer *pointer); wl_seat_set_pointer(struct wl_seat *seat, struct weston_pointer *pointer);
void void
wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard); wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard);
void void
wl_seat_set_touch(struct wl_seat *seat, struct wl_touch *touch); wl_seat_set_touch(struct wl_seat *seat, struct wl_touch *touch);
void void
wl_pointer_init(struct wl_pointer *pointer); weston_pointer_init(struct weston_pointer *pointer);
void void
wl_pointer_release(struct wl_pointer *pointer); weston_pointer_release(struct weston_pointer *pointer);
void void
wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface, weston_pointer_set_focus(struct weston_pointer *pointer,
wl_fixed_t sx, wl_fixed_t sy); struct wl_surface *surface,
wl_fixed_t sx, wl_fixed_t sy);
void void
wl_pointer_start_grab(struct wl_pointer *pointer, weston_pointer_start_grab(struct weston_pointer *pointer,
struct wl_pointer_grab *grab); struct weston_pointer_grab *grab);
void void
wl_pointer_end_grab(struct wl_pointer *pointer); weston_pointer_end_grab(struct weston_pointer *pointer);
void void
wl_pointer_set_current(struct wl_pointer *pointer, struct wl_surface *surface); weston_pointer_set_current(struct weston_pointer *pointer,
struct wl_surface *surface);
void void
weston_keyboard_init(struct weston_keyboard *keyboard); weston_keyboard_init(struct weston_keyboard *keyboard);
@ -465,7 +467,7 @@ struct weston_keyboard {
struct weston_seat { struct weston_seat {
struct wl_seat seat; struct wl_seat seat;
struct wl_pointer pointer; struct weston_pointer pointer;
int has_pointer; int has_pointer;
struct weston_keyboard keyboard; struct weston_keyboard keyboard;
int has_keyboard; int has_keyboard;

@ -165,7 +165,7 @@ destroy_drag_focus(struct wl_listener *listener, void *data)
} }
static void static void
drag_grab_focus(struct wl_pointer_grab *grab, drag_grab_focus(struct weston_pointer_grab *grab,
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab);
@ -211,7 +211,7 @@ drag_grab_focus(struct wl_pointer_grab *grab,
} }
static void static void
drag_grab_motion(struct wl_pointer_grab *grab, drag_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab);
@ -233,14 +233,14 @@ data_device_end_drag_grab(struct wl_seat *seat)
drag_grab_focus(&seat->drag_grab, NULL, drag_grab_focus(&seat->drag_grab, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0)); wl_fixed_from_int(0), wl_fixed_from_int(0));
wl_pointer_end_grab(seat->pointer); weston_pointer_end_grab(seat->pointer);
seat->drag_data_source = NULL; seat->drag_data_source = NULL;
seat->drag_client = NULL; seat->drag_client = NULL;
} }
static void static void
drag_grab_button(struct wl_pointer_grab *grab, drag_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab); struct wl_seat *seat = container_of(grab, struct wl_seat, drag_grab);
@ -259,7 +259,7 @@ drag_grab_button(struct wl_pointer_grab *grab,
} }
} }
static const struct wl_pointer_grab_interface drag_grab_interface = { static const struct weston_pointer_grab_interface drag_grab_interface = {
drag_grab_focus, drag_grab_focus,
drag_grab_motion, drag_grab_motion,
drag_grab_button, drag_grab_button,
@ -317,9 +317,9 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
wl_signal_emit(&seat->drag_icon_signal, icon_resource); wl_signal_emit(&seat->drag_icon_signal, icon_resource);
} }
wl_pointer_set_focus(seat->pointer, NULL, weston_pointer_set_focus(seat->pointer, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0)); wl_fixed_from_int(0), wl_fixed_from_int(0));
wl_pointer_start_grab(seat->pointer, &seat->drag_grab); weston_pointer_start_grab(seat->pointer, &seat->drag_grab);
} }
static void static void

@ -46,9 +46,9 @@ static void unbind_resource(struct wl_resource *resource)
void void
weston_seat_repick(struct weston_seat *seat) weston_seat_repick(struct weston_seat *seat)
{ {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_surface *surface, *focus; struct weston_surface *surface, *focus;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
if (!pointer) if (!pointer)
return; return;
@ -61,7 +61,7 @@ weston_seat_repick(struct weston_seat *seat)
if (&surface->surface != pointer->current) { if (&surface->surface != pointer->current) {
interface = pointer->grab->interface; interface = pointer->grab->interface;
wl_pointer_set_current(pointer, &surface->surface); weston_pointer_set_current(pointer, &surface->surface);
interface->focus(pointer->grab, &surface->surface, interface->focus(pointer->grab, &surface->surface,
pointer->current_x, pointer->current_x,
pointer->current_y); pointer->current_y);
@ -93,8 +93,8 @@ weston_compositor_idle_release(struct weston_compositor *compositor)
static void static void
lose_pointer_focus(struct wl_listener *listener, void *data) lose_pointer_focus(struct wl_listener *listener, void *data)
{ {
struct wl_pointer *pointer = struct weston_pointer *pointer =
container_of(listener, struct wl_pointer, focus_listener); container_of(listener, struct weston_pointer, focus_listener);
pointer->focus_resource = NULL; pointer->focus_resource = NULL;
} }
@ -118,19 +118,19 @@ lose_touch_focus(struct wl_listener *listener, void *data)
} }
static void static void
default_grab_focus(struct wl_pointer_grab *grab, default_grab_focus(struct weston_pointer_grab *grab,
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
if (pointer->button_count > 0) if (pointer->button_count > 0)
return; return;
wl_pointer_set_focus(pointer, surface, x, y); weston_pointer_set_focus(pointer, surface, x, y);
} }
static void static void
default_grab_motion(struct wl_pointer_grab *grab, default_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct wl_resource *resource; struct wl_resource *resource;
@ -141,10 +141,10 @@ default_grab_motion(struct wl_pointer_grab *grab,
} }
static void static void
default_grab_button(struct wl_pointer_grab *grab, default_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct wl_resource *resource; struct wl_resource *resource;
uint32_t serial; uint32_t serial;
enum wl_pointer_button_state state = state_w; enum wl_pointer_button_state state = state_w;
@ -159,11 +159,12 @@ default_grab_button(struct wl_pointer_grab *grab,
if (pointer->button_count == 0 && if (pointer->button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) state == WL_POINTER_BUTTON_STATE_RELEASED)
wl_pointer_set_focus(pointer, pointer->current, weston_pointer_set_focus(pointer, pointer->current,
pointer->current_x, pointer->current_y); pointer->current_x,
pointer->current_y);
} }
static const struct wl_pointer_grab_interface static const struct weston_pointer_grab_interface
default_pointer_grab_interface = { default_pointer_grab_interface = {
default_grab_focus, default_grab_focus,
default_grab_motion, default_grab_motion,
@ -262,7 +263,7 @@ default_grab_modifiers(struct weston_keyboard_grab *grab, uint32_t serial,
uint32_t mods_locked, uint32_t group) uint32_t mods_locked, uint32_t group)
{ {
struct weston_keyboard *keyboard = grab->keyboard; struct weston_keyboard *keyboard = grab->keyboard;
struct wl_pointer *pointer = keyboard->seat->pointer; struct weston_pointer *pointer = keyboard->seat->pointer;
struct wl_resource *resource, *pr; struct wl_resource *resource, *pr;
resource = keyboard->focus_resource; resource = keyboard->focus_resource;
@ -293,7 +294,7 @@ static const struct weston_keyboard_grab_interface
}; };
WL_EXPORT void WL_EXPORT void
wl_pointer_init(struct wl_pointer *pointer) weston_pointer_init(struct weston_pointer *pointer)
{ {
memset(pointer, 0, sizeof *pointer); memset(pointer, 0, sizeof *pointer);
wl_list_init(&pointer->resource_list); wl_list_init(&pointer->resource_list);
@ -309,7 +310,7 @@ wl_pointer_init(struct wl_pointer *pointer)
} }
WL_EXPORT void WL_EXPORT void
wl_pointer_release(struct wl_pointer *pointer) weston_pointer_release(struct weston_pointer *pointer)
{ {
/* XXX: What about pointer->resource_list? */ /* XXX: What about pointer->resource_list? */
if (pointer->focus_resource) if (pointer->focus_resource)
@ -378,7 +379,7 @@ wl_seat_release(struct wl_seat *seat)
wl_signal_emit(&seat->destroy_signal, seat); wl_signal_emit(&seat->destroy_signal, seat);
if (seat->pointer) if (seat->pointer)
wl_pointer_release(seat->pointer); weston_pointer_release(seat->pointer);
if (seat->keyboard) if (seat->keyboard)
weston_keyboard_release(seat->keyboard); weston_keyboard_release(seat->keyboard);
if (seat->touch) if (seat->touch)
@ -403,7 +404,7 @@ seat_send_updated_caps(struct wl_seat *seat)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_pointer(struct wl_seat *seat, struct wl_pointer *pointer) wl_seat_set_pointer(struct wl_seat *seat, struct weston_pointer *pointer)
{ {
if (pointer && (seat->pointer || pointer->seat)) if (pointer && (seat->pointer || pointer->seat))
return; /* XXX: error? */ return; /* XXX: error? */
@ -448,8 +449,9 @@ wl_seat_set_touch(struct wl_seat *seat, struct wl_touch *touch)
} }
WL_EXPORT void WL_EXPORT void
wl_pointer_set_focus(struct wl_pointer *pointer, struct wl_surface *surface, weston_pointer_set_focus(struct weston_pointer *pointer,
wl_fixed_t sx, wl_fixed_t sy) struct wl_surface *surface,
wl_fixed_t sx, wl_fixed_t sy)
{ {
struct weston_keyboard *kbd = pointer->seat->keyboard; struct weston_keyboard *kbd = pointer->seat->keyboard;
struct wl_resource *resource, *kr; struct wl_resource *resource, *kr;
@ -555,9 +557,10 @@ weston_keyboard_end_grab(struct weston_keyboard *keyboard)
} }
WL_EXPORT void WL_EXPORT void
wl_pointer_start_grab(struct wl_pointer *pointer, struct wl_pointer_grab *grab) weston_pointer_start_grab(struct weston_pointer *pointer,
struct weston_pointer_grab *grab)
{ {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
pointer->grab = grab; pointer->grab = grab;
interface = pointer->grab->interface; interface = pointer->grab->interface;
@ -569,9 +572,9 @@ wl_pointer_start_grab(struct wl_pointer *pointer, struct wl_pointer_grab *grab)
} }
WL_EXPORT void WL_EXPORT void
wl_pointer_end_grab(struct wl_pointer *pointer) weston_pointer_end_grab(struct weston_pointer *pointer)
{ {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
pointer->grab = &pointer->default_grab; pointer->grab = &pointer->default_grab;
interface = pointer->grab->interface; interface = pointer->grab->interface;
@ -582,14 +585,15 @@ wl_pointer_end_grab(struct wl_pointer *pointer)
static void static void
current_surface_destroy(struct wl_listener *listener, void *data) current_surface_destroy(struct wl_listener *listener, void *data)
{ {
struct wl_pointer *pointer = struct weston_pointer *pointer =
container_of(listener, struct wl_pointer, current_listener); container_of(listener, struct weston_pointer, current_listener);
pointer->current = NULL; pointer->current = NULL;
} }
WL_EXPORT void WL_EXPORT void
wl_pointer_set_current(struct wl_pointer *pointer, struct wl_surface *surface) weston_pointer_set_current(struct weston_pointer *pointer,
struct wl_surface *surface)
{ {
if (pointer->current) if (pointer->current)
wl_list_remove(&pointer->current_listener.link); wl_list_remove(&pointer->current_listener.link);
@ -660,7 +664,7 @@ static void
move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y) move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
{ {
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
struct weston_output *output; struct weston_output *output;
int32_t ix, iy; int32_t ix, iy;
@ -694,9 +698,9 @@ WL_EXPORT void
notify_motion(struct weston_seat *seat, notify_motion(struct weston_seat *seat,
uint32_t time, wl_fixed_t dx, wl_fixed_t dy) uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
{ {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
weston_compositor_wake(ec); weston_compositor_wake(ec);
@ -711,9 +715,9 @@ WL_EXPORT void
notify_motion_absolute(struct weston_seat *seat, notify_motion_absolute(struct weston_seat *seat,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
const struct wl_pointer_grab_interface *interface; const struct weston_pointer_grab_interface *interface;
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
weston_compositor_wake(ec); weston_compositor_wake(ec);
@ -743,7 +747,7 @@ notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
enum wl_pointer_button_state state) enum wl_pointer_button_state state)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
struct weston_surface *focus = struct weston_surface *focus =
(struct weston_surface *) pointer->focus; (struct weston_surface *) pointer->focus;
uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t serial = wl_display_next_serial(compositor->wl_display);
@ -779,7 +783,7 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis,
wl_fixed_t value) wl_fixed_t value)
{ {
struct weston_compositor *compositor = seat->compositor; struct weston_compositor *compositor = seat->compositor;
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
struct weston_surface *focus = struct weston_surface *focus =
(struct weston_surface *) pointer->focus; (struct weston_surface *) pointer->focus;
uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t serial = wl_display_next_serial(compositor->wl_display);
@ -954,7 +958,7 @@ notify_pointer_focus(struct weston_seat *seat, struct weston_output *output,
compositor->focus = 1; compositor->focus = 1;
} else { } else {
compositor->focus = 0; compositor->focus = 0;
/* FIXME: We should call wl_pointer_set_focus(seat, /* FIXME: We should call weston_pointer_set_focus(seat,
* NULL) here, but somehow that breaks re-entry... */ * NULL) here, but somehow that breaks re-entry... */
} }
} }
@ -1271,10 +1275,10 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource,
seat->seat.pointer->y, seat->seat.pointer->y,
&sx, &sx,
&sy); &sy);
wl_pointer_set_focus(seat->seat.pointer, weston_pointer_set_focus(seat->seat.pointer,
seat->seat.pointer->focus, seat->seat.pointer->focus,
sx, sx,
sy); sy);
} }
} }
@ -1532,7 +1536,7 @@ weston_seat_init_pointer(struct weston_seat *seat)
if (seat->has_pointer) if (seat->has_pointer)
return; return;
wl_pointer_init(&seat->pointer); weston_pointer_init(&seat->pointer);
wl_seat_set_pointer(&seat->seat, &seat->pointer); wl_seat_set_pointer(&seat->seat, &seat->pointer);
seat->has_pointer = 1; seat->has_pointer = 1;

@ -227,10 +227,10 @@ struct shell_surface {
}; };
struct shell_grab { struct shell_grab {
struct wl_pointer_grab grab; struct weston_pointer_grab grab;
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct wl_listener shsurf_destroy_listener; struct wl_listener shsurf_destroy_listener;
struct wl_pointer *pointer; struct weston_pointer *pointer;
}; };
struct weston_move_grab { struct weston_move_grab {
@ -252,7 +252,7 @@ struct shell_seat {
struct wl_listener seat_destroy_listener; struct wl_listener seat_destroy_listener;
struct { struct {
struct wl_pointer_grab grab; struct weston_pointer_grab grab;
struct wl_list surfaces_list; struct wl_list surfaces_list;
struct wl_client *client; struct wl_client *client;
int32_t initial_up; int32_t initial_up;
@ -304,13 +304,13 @@ destroy_shell_grab_shsurf(struct wl_listener *listener, void *data)
} }
static void static void
popup_grab_end(struct wl_pointer *pointer); popup_grab_end(struct weston_pointer *pointer);
static void static void
shell_grab_start(struct shell_grab *grab, shell_grab_start(struct shell_grab *grab,
const struct wl_pointer_grab_interface *interface, const struct weston_pointer_grab_interface *interface,
struct shell_surface *shsurf, struct shell_surface *shsurf,
struct wl_pointer *pointer, struct weston_pointer *pointer,
enum desktop_shell_cursor cursor) enum desktop_shell_cursor cursor)
{ {
struct desktop_shell *shell = shsurf->shell; struct desktop_shell *shell = shsurf->shell;
@ -326,10 +326,10 @@ shell_grab_start(struct shell_grab *grab,
grab->pointer = pointer; grab->pointer = pointer;
grab->grab.focus = &shsurf->surface->surface; grab->grab.focus = &shsurf->surface->surface;
wl_pointer_start_grab(pointer, &grab->grab); weston_pointer_start_grab(pointer, &grab->grab);
desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor); desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor);
wl_pointer_set_focus(pointer, &shell->grab_surface->surface, weston_pointer_set_focus(pointer, &shell->grab_surface->surface,
wl_fixed_from_int(0), wl_fixed_from_int(0)); wl_fixed_from_int(0), wl_fixed_from_int(0));
} }
static void static void
@ -338,7 +338,7 @@ shell_grab_end(struct shell_grab *grab)
if (grab->shsurf) if (grab->shsurf)
wl_list_remove(&grab->shsurf_destroy_listener.link); wl_list_remove(&grab->shsurf_destroy_listener.link);
wl_pointer_end_grab(grab->pointer); weston_pointer_end_grab(grab->pointer);
} }
static void static void
@ -1017,18 +1017,18 @@ bind_workspace_manager(struct wl_client *client,
} }
static void static void
noop_grab_focus(struct wl_pointer_grab *grab, noop_grab_focus(struct weston_pointer_grab *grab,
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
{ {
grab->focus = NULL; grab->focus = NULL;
} }
static void static void
move_grab_motion(struct wl_pointer_grab *grab, move_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct weston_move_grab *move = (struct weston_move_grab *) grab; struct weston_move_grab *move = (struct weston_move_grab *) grab;
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = move->base.shsurf; struct shell_surface *shsurf = move->base.shsurf;
struct weston_surface *es; struct weston_surface *es;
int dx = wl_fixed_to_int(pointer->x + move->dx); int dx = wl_fixed_to_int(pointer->x + move->dx);
@ -1046,12 +1046,12 @@ move_grab_motion(struct wl_pointer_grab *grab,
} }
static void static void
move_grab_button(struct wl_pointer_grab *grab, move_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct shell_grab *shell_grab = container_of(grab, struct shell_grab, struct shell_grab *shell_grab = container_of(grab, struct shell_grab,
grab); grab);
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
enum wl_pointer_button_state state = state_w; enum wl_pointer_button_state state = state_w;
if (pointer->button_count == 0 && if (pointer->button_count == 0 &&
@ -1061,7 +1061,7 @@ move_grab_button(struct wl_pointer_grab *grab,
} }
} }
static const struct wl_pointer_grab_interface move_grab_interface = { static const struct weston_pointer_grab_interface move_grab_interface = {
noop_grab_focus, noop_grab_focus,
move_grab_motion, move_grab_motion,
move_grab_button, move_grab_button,
@ -1116,11 +1116,11 @@ struct weston_resize_grab {
}; };
static void static void
resize_grab_motion(struct wl_pointer_grab *grab, resize_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = resize->base.shsurf; struct shell_surface *shsurf = resize->base.shsurf;
int32_t width, height; int32_t width, height;
wl_fixed_t from_x, from_y; wl_fixed_t from_x, from_y;
@ -1168,11 +1168,11 @@ static const struct weston_shell_client shell_client = {
}; };
static void static void
resize_grab_button(struct wl_pointer_grab *grab, resize_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab; struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
enum wl_pointer_button_state state = state_w; enum wl_pointer_button_state state = state_w;
if (pointer->button_count == 0 && if (pointer->button_count == 0 &&
@ -1182,7 +1182,7 @@ resize_grab_button(struct wl_pointer_grab *grab,
} }
} }
static const struct wl_pointer_grab_interface resize_grab_interface = { static const struct weston_pointer_grab_interface resize_grab_interface = {
noop_grab_focus, noop_grab_focus,
resize_grab_motion, resize_grab_motion,
resize_grab_button, resize_grab_button,
@ -1237,7 +1237,7 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
} }
static void static void
busy_cursor_grab_focus(struct wl_pointer_grab *base, busy_cursor_grab_focus(struct weston_pointer_grab *base,
struct wl_surface *surface, int32_t x, int32_t y) struct wl_surface *surface, int32_t x, int32_t y)
{ {
struct shell_grab *grab = (struct shell_grab *) base; struct shell_grab *grab = (struct shell_grab *) base;
@ -1249,13 +1249,13 @@ busy_cursor_grab_focus(struct wl_pointer_grab *base,
} }
static void static void
busy_cursor_grab_motion(struct wl_pointer_grab *grab, busy_cursor_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y) uint32_t time, int32_t x, int32_t y)
{ {
} }
static void static void
busy_cursor_grab_button(struct wl_pointer_grab *base, busy_cursor_grab_button(struct weston_pointer_grab *base,
uint32_t time, uint32_t button, uint32_t state) uint32_t time, uint32_t button, uint32_t state)
{ {
struct shell_grab *grab = (struct shell_grab *) base; struct shell_grab *grab = (struct shell_grab *) base;
@ -1275,14 +1275,14 @@ busy_cursor_grab_button(struct wl_pointer_grab *base,
} }
} }
static const struct wl_pointer_grab_interface busy_cursor_grab_interface = { static const struct weston_pointer_grab_interface busy_cursor_grab_interface = {
busy_cursor_grab_focus, busy_cursor_grab_focus,
busy_cursor_grab_motion, busy_cursor_grab_motion,
busy_cursor_grab_button, busy_cursor_grab_button,
}; };
static void static void
set_busy_cursor(struct shell_surface *shsurf, struct wl_pointer *pointer) set_busy_cursor(struct shell_surface *shsurf, struct weston_pointer *pointer)
{ {
struct shell_grab *grab; struct shell_grab *grab;
@ -1295,7 +1295,7 @@ set_busy_cursor(struct shell_surface *shsurf, struct wl_pointer *pointer)
} }
static void static void
end_busy_cursor(struct shell_surface *shsurf, struct wl_pointer *pointer) end_busy_cursor(struct shell_surface *shsurf, struct weston_pointer *pointer)
{ {
struct shell_grab *grab = (struct shell_grab *) pointer->grab; struct shell_grab *grab = (struct shell_grab *) pointer->grab;
@ -1367,7 +1367,7 @@ ping_handler(struct weston_surface *surface, uint32_t serial)
static void static void
handle_pointer_focus(struct wl_listener *listener, void *data) handle_pointer_focus(struct wl_listener *listener, void *data)
{ {
struct wl_pointer *pointer = data; struct weston_pointer *pointer = data;
struct weston_surface *surface = struct weston_surface *surface =
(struct weston_surface *) pointer->focus; (struct weston_surface *) pointer->focus;
struct weston_compositor *compositor; struct weston_compositor *compositor;
@ -1409,7 +1409,7 @@ shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
struct desktop_shell *shell = shsurf->shell; struct desktop_shell *shell = shsurf->shell;
struct weston_seat *seat; struct weston_seat *seat;
struct weston_compositor *ec = shsurf->surface->compositor; struct weston_compositor *ec = shsurf->surface->compositor;
struct wl_pointer *pointer; struct weston_pointer *pointer;
int was_unresponsive; int was_unresponsive;
if (shsurf->ping_timer == NULL) if (shsurf->ping_timer == NULL)
@ -1856,7 +1856,7 @@ shell_surface_set_fullscreen(struct wl_client *client,
set_fullscreen(shsurf, method, framerate, output); set_fullscreen(shsurf, method, framerate, output);
} }
static const struct wl_pointer_grab_interface popup_grab_interface; static const struct weston_pointer_grab_interface popup_grab_interface;
static void static void
destroy_shell_seat(struct wl_listener *listener, void *data) destroy_shell_seat(struct wl_listener *listener, void *data)
@ -1867,7 +1867,7 @@ destroy_shell_seat(struct wl_listener *listener, void *data)
struct shell_surface *shsurf, *prev = NULL; struct shell_surface *shsurf, *prev = NULL;
if (shseat->popup_grab.grab.interface == &popup_grab_interface) { if (shseat->popup_grab.grab.interface == &popup_grab_interface) {
wl_pointer_end_grab(shseat->popup_grab.grab.pointer); weston_pointer_end_grab(shseat->popup_grab.grab.pointer);
shseat->popup_grab.client = NULL; shseat->popup_grab.client = NULL;
wl_list_for_each(shsurf, &shseat->popup_grab.surfaces_list, popup.grab_link) { wl_list_for_each(shsurf, &shseat->popup_grab.surfaces_list, popup.grab_link) {
@ -1919,29 +1919,29 @@ get_shell_seat(struct weston_seat *seat)
} }
static void static void
popup_grab_focus(struct wl_pointer_grab *grab, popup_grab_focus(struct weston_pointer_grab *grab,
struct wl_surface *surface, struct wl_surface *surface,
wl_fixed_t x, wl_fixed_t x,
wl_fixed_t y) wl_fixed_t y)
{ {
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct shell_seat *shseat = struct shell_seat *shseat =
container_of(grab, struct shell_seat, popup_grab.grab); container_of(grab, struct shell_seat, popup_grab.grab);
struct wl_client *client = shseat->popup_grab.client; struct wl_client *client = shseat->popup_grab.client;
if (surface && surface->resource.client == client) { if (surface && surface->resource.client == client) {
wl_pointer_set_focus(pointer, surface, x, y); weston_pointer_set_focus(pointer, surface, x, y);
grab->focus = surface; grab->focus = surface;
} else { } else {
wl_pointer_set_focus(pointer, NULL, weston_pointer_set_focus(pointer, NULL,
wl_fixed_from_int(0), wl_fixed_from_int(0),
wl_fixed_from_int(0)); wl_fixed_from_int(0));
grab->focus = NULL; grab->focus = NULL;
} }
} }
static void static void
popup_grab_motion(struct wl_pointer_grab *grab, popup_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t sx, wl_fixed_t sy) uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
{ {
struct wl_resource *resource; struct wl_resource *resource;
@ -1952,7 +1952,7 @@ popup_grab_motion(struct wl_pointer_grab *grab,
} }
static void static void
popup_grab_button(struct wl_pointer_grab *grab, popup_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct wl_resource *resource; struct wl_resource *resource;
@ -1977,23 +1977,23 @@ popup_grab_button(struct wl_pointer_grab *grab,
shseat->popup_grab.initial_up = 1; shseat->popup_grab.initial_up = 1;
} }
static const struct wl_pointer_grab_interface popup_grab_interface = { static const struct weston_pointer_grab_interface popup_grab_interface = {
popup_grab_focus, popup_grab_focus,
popup_grab_motion, popup_grab_motion,
popup_grab_button, popup_grab_button,
}; };
static void static void
popup_grab_end(struct wl_pointer *pointer) popup_grab_end(struct weston_pointer *pointer)
{ {
struct wl_pointer_grab *grab = pointer->grab; struct weston_pointer_grab *grab = pointer->grab;
struct shell_seat *shseat = struct shell_seat *shseat =
container_of(grab, struct shell_seat, popup_grab.grab); container_of(grab, struct shell_seat, popup_grab.grab);
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct shell_surface *prev = NULL; struct shell_surface *prev = NULL;
if (pointer->grab->interface == &popup_grab_interface) { if (pointer->grab->interface == &popup_grab_interface) {
wl_pointer_end_grab(grab->pointer); weston_pointer_end_grab(grab->pointer);
shseat->popup_grab.client = NULL; shseat->popup_grab.client = NULL;
shseat->popup_grab.grab.interface = NULL; shseat->popup_grab.grab.interface = NULL;
assert(!wl_list_empty(&shseat->popup_grab.surfaces_list)); assert(!wl_list_empty(&shseat->popup_grab.surfaces_list));
@ -2025,7 +2025,7 @@ add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat)
if (shseat->seat->pointer.button_count > 0) if (shseat->seat->pointer.button_count > 0)
shseat->popup_grab.initial_up = 0; shseat->popup_grab.initial_up = 0;
wl_pointer_start_grab(seat->pointer, &shseat->popup_grab.grab); weston_pointer_start_grab(seat->pointer, &shseat->popup_grab.grab);
} }
wl_list_insert(&shseat->popup_grab.surfaces_list, &shsurf->popup.grab_link); wl_list_insert(&shseat->popup_grab.surfaces_list, &shsurf->popup.grab_link);
} }
@ -2038,7 +2038,7 @@ remove_popup_grab(struct shell_surface *shsurf)
wl_list_remove(&shsurf->popup.grab_link); wl_list_remove(&shsurf->popup.grab_link);
wl_list_init(&shsurf->popup.grab_link); wl_list_init(&shsurf->popup.grab_link);
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) { if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
wl_pointer_end_grab(shseat->popup_grab.grab.pointer); weston_pointer_end_grab(shseat->popup_grab.grab.pointer);
shseat->popup_grab.grab.interface = NULL; shseat->popup_grab.grab.interface = NULL;
} }
} }
@ -2668,12 +2668,12 @@ terminate_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
} }
static void static void
rotate_grab_motion(struct wl_pointer_grab *grab, rotate_grab_motion(struct weston_pointer_grab *grab,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
struct rotate_grab *rotate = struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab); container_of(grab, struct rotate_grab, base.grab);
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = rotate->base.shsurf; struct shell_surface *shsurf = rotate->base.shsurf;
struct weston_surface *surface; struct weston_surface *surface;
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r; float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
@ -2734,12 +2734,12 @@ rotate_grab_motion(struct wl_pointer_grab *grab,
} }
static void static void
rotate_grab_button(struct wl_pointer_grab *grab, rotate_grab_button(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state_w) uint32_t time, uint32_t button, uint32_t state_w)
{ {
struct rotate_grab *rotate = struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab); container_of(grab, struct rotate_grab, base.grab);
struct wl_pointer *pointer = grab->pointer; struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = rotate->base.shsurf; struct shell_surface *shsurf = rotate->base.shsurf;
enum wl_pointer_button_state state = state_w; enum wl_pointer_button_state state = state_w;
@ -2753,7 +2753,7 @@ rotate_grab_button(struct wl_pointer_grab *grab,
} }
} }
static const struct wl_pointer_grab_interface rotate_grab_interface = { static const struct weston_pointer_grab_interface rotate_grab_interface = {
noop_grab_focus, noop_grab_focus,
rotate_grab_motion, rotate_grab_motion,
rotate_grab_button, rotate_grab_button,

@ -68,7 +68,7 @@ static void
notify_pointer_position(struct weston_test *test, struct wl_resource *resource) notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
{ {
struct weston_seat *seat = get_seat(test); struct weston_seat *seat = get_seat(test);
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
wl_test_send_pointer_position(resource, pointer->x, pointer->y); wl_test_send_pointer_position(resource, pointer->x, pointer->y);
} }
@ -119,7 +119,7 @@ move_pointer(struct wl_client *client, struct wl_resource *resource,
{ {
struct weston_test *test = resource->data; struct weston_test *test = resource->data;
struct weston_seat *seat = get_seat(test); struct weston_seat *seat = get_seat(test);
struct wl_pointer *pointer = seat->seat.pointer; struct weston_pointer *pointer = seat->seat.pointer;
test->compositor->focus = 1; test->compositor->focus = 1;

Loading…
Cancel
Save