input: Rename wl_touch to weston_touch

This is now a weston object.
dev
Kristian Høgsberg 12 years ago
parent 02bbabbd56
commit e329f36533
  1. 38
      src/compositor.h
  2. 55
      src/input.c

@ -245,26 +245,26 @@ struct weston_keyboard_grab {
uint32_t key; uint32_t key;
}; };
struct wl_touch_grab; struct weston_touch_grab;
struct wl_touch_grab_interface { struct weston_touch_grab_interface {
void (*down)(struct wl_touch_grab *grab, void (*down)(struct weston_touch_grab *grab,
uint32_t time, uint32_t time,
int touch_id, int touch_id,
wl_fixed_t sx, wl_fixed_t sx,
wl_fixed_t sy); wl_fixed_t sy);
void (*up)(struct wl_touch_grab *grab, void (*up)(struct weston_touch_grab *grab,
uint32_t time, uint32_t time,
int touch_id); int touch_id);
void (*motion)(struct wl_touch_grab *grab, void (*motion)(struct weston_touch_grab *grab,
uint32_t time, uint32_t time,
int touch_id, int touch_id,
wl_fixed_t sx, wl_fixed_t sx,
wl_fixed_t sy); wl_fixed_t sy);
}; };
struct wl_touch_grab { struct weston_touch_grab {
const struct wl_touch_grab_interface *interface; const struct weston_touch_grab_interface *interface;
struct wl_touch *touch; struct weston_touch *touch;
struct wl_surface *focus; struct wl_surface *focus;
}; };
@ -311,7 +311,7 @@ struct weston_pointer {
}; };
struct wl_touch { struct weston_touch {
struct wl_seat *seat; struct wl_seat *seat;
struct wl_list resource_list; struct wl_list resource_list;
@ -321,8 +321,8 @@ struct wl_touch {
uint32_t focus_serial; uint32_t focus_serial;
struct wl_signal focus_signal; struct wl_signal focus_signal;
struct wl_touch_grab *grab; struct weston_touch_grab *grab;
struct wl_touch_grab default_grab; struct weston_touch_grab default_grab;
wl_fixed_t grab_x, grab_y; wl_fixed_t grab_x, grab_y;
uint32_t grab_serial; uint32_t grab_serial;
uint32_t grab_time; uint32_t grab_time;
@ -334,7 +334,7 @@ struct wl_seat {
struct weston_pointer *pointer; struct weston_pointer *pointer;
struct weston_keyboard *keyboard; struct weston_keyboard *keyboard;
struct wl_touch *touch; struct weston_touch *touch;
uint32_t selection_serial; uint32_t selection_serial;
struct wl_data_source *selection_data_source; struct wl_data_source *selection_data_source;
@ -365,7 +365,7 @@ 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 weston_touch *touch);
void void
weston_pointer_init(struct weston_pointer *pointer); weston_pointer_init(struct weston_pointer *pointer);
@ -398,14 +398,14 @@ void
weston_keyboard_end_grab(struct weston_keyboard *keyboard); weston_keyboard_end_grab(struct weston_keyboard *keyboard);
void void
wl_touch_init(struct wl_touch *touch); weston_touch_init(struct weston_touch *touch);
void void
wl_touch_release(struct wl_touch *touch); weston_touch_release(struct weston_touch *touch);
void void
wl_touch_start_grab(struct wl_touch *device, weston_touch_start_grab(struct weston_touch *device,
struct wl_touch_grab *grab); struct weston_touch_grab *grab);
void void
wl_touch_end_grab(struct wl_touch *touch); weston_touch_end_grab(struct weston_touch *touch);
void void
wl_data_device_set_keyboard_focus(struct wl_seat *seat); wl_data_device_set_keyboard_focus(struct wl_seat *seat);
@ -471,7 +471,7 @@ struct weston_seat {
int has_pointer; int has_pointer;
struct weston_keyboard keyboard; struct weston_keyboard keyboard;
int has_keyboard; int has_keyboard;
struct wl_touch touch; struct weston_touch touch;
int has_touch; int has_touch;
struct wl_signal destroy_signal; struct wl_signal destroy_signal;

@ -111,8 +111,8 @@ lose_keyboard_focus(struct wl_listener *listener, void *data)
static void static void
lose_touch_focus(struct wl_listener *listener, void *data) lose_touch_focus(struct wl_listener *listener, void *data)
{ {
struct wl_touch *touch = struct weston_touch *touch =
container_of(listener, struct wl_touch, focus_listener); container_of(listener, struct weston_touch, focus_listener);
touch->focus_resource = NULL; touch->focus_resource = NULL;
} }
@ -171,13 +171,11 @@ static const struct weston_pointer_grab_interface
default_grab_button default_grab_button
}; };
static void default_grab_touch_down(struct wl_touch_grab *grab, static void
uint32_t time, default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
int touch_id, int touch_id, wl_fixed_t sx, wl_fixed_t sy)
wl_fixed_t sx,
wl_fixed_t sy)
{ {
struct wl_touch *touch = grab->touch; struct weston_touch *touch = grab->touch;
struct wl_display *display; struct wl_display *display;
uint32_t serial; uint32_t serial;
@ -185,15 +183,16 @@ static void default_grab_touch_down(struct wl_touch_grab *grab,
display = wl_client_get_display(touch->focus_resource->client); display = wl_client_get_display(touch->focus_resource->client);
serial = wl_display_next_serial(display); serial = wl_display_next_serial(display);
wl_touch_send_down(touch->focus_resource, serial, time, wl_touch_send_down(touch->focus_resource, serial, time,
&touch->focus->resource, touch_id, sx, sy); &touch->focus->resource,
touch_id, sx, sy);
} }
} }
static void default_grab_touch_up(struct wl_touch_grab *grab, static void
uint32_t time, default_grab_touch_up(struct weston_touch_grab *grab,
int touch_id) uint32_t time, int touch_id)
{ {
struct wl_touch *touch = grab->touch; struct weston_touch *touch = grab->touch;
struct wl_display *display; struct wl_display *display;
uint32_t serial; uint32_t serial;
@ -204,13 +203,11 @@ static void default_grab_touch_up(struct wl_touch_grab *grab,
} }
} }
static void default_grab_touch_motion(struct wl_touch_grab *grab, static void
uint32_t time, default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
int touch_id, int touch_id, wl_fixed_t sx, wl_fixed_t sy)
wl_fixed_t sx,
wl_fixed_t sy)
{ {
struct wl_touch *touch = grab->touch; struct weston_touch *touch = grab->touch;
if (touch->focus_resource) { if (touch->focus_resource) {
wl_touch_send_motion(touch->focus_resource, time, wl_touch_send_motion(touch->focus_resource, time,
@ -218,7 +215,7 @@ static void default_grab_touch_motion(struct wl_touch_grab *grab,
} }
} }
static const struct wl_touch_grab_interface default_touch_grab_interface = { static const struct weston_touch_grab_interface default_touch_grab_interface = {
default_grab_touch_down, default_grab_touch_down,
default_grab_touch_up, default_grab_touch_up,
default_grab_touch_motion default_grab_touch_motion
@ -340,7 +337,7 @@ weston_keyboard_release(struct weston_keyboard *keyboard)
} }
WL_EXPORT void WL_EXPORT void
wl_touch_init(struct wl_touch *touch) weston_touch_init(struct weston_touch *touch)
{ {
memset(touch, 0, sizeof *touch); memset(touch, 0, sizeof *touch);
wl_list_init(&touch->resource_list); wl_list_init(&touch->resource_list);
@ -352,7 +349,7 @@ wl_touch_init(struct wl_touch *touch)
} }
WL_EXPORT void WL_EXPORT void
wl_touch_release(struct wl_touch *touch) weston_touch_release(struct weston_touch *touch)
{ {
/* XXX: What about touch->resource_list? */ /* XXX: What about touch->resource_list? */
if (touch->focus_resource) if (touch->focus_resource)
@ -383,7 +380,7 @@ wl_seat_release(struct wl_seat *seat)
if (seat->keyboard) if (seat->keyboard)
weston_keyboard_release(seat->keyboard); weston_keyboard_release(seat->keyboard);
if (seat->touch) if (seat->touch)
wl_touch_release(seat->touch); weston_touch_release(seat->touch);
} }
static void static void
@ -434,7 +431,7 @@ wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard)
} }
WL_EXPORT void WL_EXPORT void
wl_seat_set_touch(struct wl_seat *seat, struct wl_touch *touch) wl_seat_set_touch(struct wl_seat *seat, struct weston_touch *touch)
{ {
if (touch && (seat->touch || touch->seat)) if (touch && (seat->touch || touch->seat))
return; /* XXX: error? */ return; /* XXX: error? */
@ -609,14 +606,14 @@ weston_pointer_set_current(struct weston_pointer *pointer,
} }
WL_EXPORT void WL_EXPORT void
wl_touch_start_grab(struct wl_touch *touch, struct wl_touch_grab *grab) weston_touch_start_grab(struct weston_touch *touch, struct weston_touch_grab *grab)
{ {
touch->grab = grab; touch->grab = grab;
grab->touch = touch; grab->touch = touch;
} }
WL_EXPORT void WL_EXPORT void
wl_touch_end_grab(struct wl_touch *touch) weston_touch_end_grab(struct weston_touch *touch)
{ {
touch->grab = &touch->default_grab; touch->grab = &touch->default_grab;
} }
@ -1081,8 +1078,8 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
wl_fixed_t x, wl_fixed_t y, int touch_type) wl_fixed_t x, wl_fixed_t y, int touch_type)
{ {
struct weston_compositor *ec = seat->compositor; struct weston_compositor *ec = seat->compositor;
struct wl_touch *touch = seat->seat.touch; struct weston_touch *touch = seat->seat.touch;
struct wl_touch_grab *grab = touch->grab; struct weston_touch_grab *grab = touch->grab;
struct weston_surface *es; struct weston_surface *es;
wl_fixed_t sx, sy; wl_fixed_t sx, sy;
@ -1548,7 +1545,7 @@ weston_seat_init_touch(struct weston_seat *seat)
if (seat->has_touch) if (seat->has_touch)
return; return;
wl_touch_init(&seat->touch); weston_touch_init(&seat->touch);
wl_seat_set_touch(&seat->seat, &seat->touch); wl_seat_set_touch(&seat->seat, &seat->touch);
seat->has_touch = 1; seat->has_touch = 1;

Loading…
Cancel
Save