input: Rename wl_touch to weston_touch

This is now a weston object.
This commit is contained in:
Kristian Høgsberg 2013-05-06 22:19:57 -04:00
parent 02bbabbd56
commit e329f36533
2 changed files with 46 additions and 49 deletions

View file

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

View file

@ -111,8 +111,8 @@ lose_keyboard_focus(struct wl_listener *listener, void *data)
static void
lose_touch_focus(struct wl_listener *listener, void *data)
{
struct wl_touch *touch =
container_of(listener, struct wl_touch, focus_listener);
struct weston_touch *touch =
container_of(listener, struct weston_touch, focus_listener);
touch->focus_resource = NULL;
}
@ -171,13 +171,11 @@ static const struct weston_pointer_grab_interface
default_grab_button
};
static void default_grab_touch_down(struct wl_touch_grab *grab,
uint32_t time,
int touch_id,
wl_fixed_t sx,
wl_fixed_t sy)
static void
default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time,
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
{
struct wl_touch *touch = grab->touch;
struct weston_touch *touch = grab->touch;
struct wl_display *display;
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);
serial = wl_display_next_serial(display);
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,
uint32_t time,
int touch_id)
static void
default_grab_touch_up(struct weston_touch_grab *grab,
uint32_t time, int touch_id)
{
struct wl_touch *touch = grab->touch;
struct weston_touch *touch = grab->touch;
struct wl_display *display;
uint32_t serial;
@ -204,21 +203,19 @@ static void default_grab_touch_up(struct wl_touch_grab *grab,
}
}
static void default_grab_touch_motion(struct wl_touch_grab *grab,
uint32_t time,
int touch_id,
wl_fixed_t sx,
wl_fixed_t sy)
static void
default_grab_touch_motion(struct weston_touch_grab *grab, uint32_t time,
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
{
struct wl_touch *touch = grab->touch;
struct weston_touch *touch = grab->touch;
if (touch->focus_resource) {
wl_touch_send_motion(touch->focus_resource, time,
touch_id, sx, sy);
touch_id, sx, sy);
}
}
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_up,
default_grab_touch_motion
@ -340,7 +337,7 @@ weston_keyboard_release(struct weston_keyboard *keyboard)
}
WL_EXPORT void
wl_touch_init(struct wl_touch *touch)
weston_touch_init(struct weston_touch *touch)
{
memset(touch, 0, sizeof *touch);
wl_list_init(&touch->resource_list);
@ -352,7 +349,7 @@ wl_touch_init(struct wl_touch *touch)
}
WL_EXPORT void
wl_touch_release(struct wl_touch *touch)
weston_touch_release(struct weston_touch *touch)
{
/* XXX: What about touch->resource_list? */
if (touch->focus_resource)
@ -383,7 +380,7 @@ wl_seat_release(struct wl_seat *seat)
if (seat->keyboard)
weston_keyboard_release(seat->keyboard);
if (seat->touch)
wl_touch_release(seat->touch);
weston_touch_release(seat->touch);
}
static void
@ -434,7 +431,7 @@ wl_seat_set_keyboard(struct wl_seat *seat, struct weston_keyboard *keyboard)
}
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))
return; /* XXX: error? */
@ -609,14 +606,14 @@ weston_pointer_set_current(struct weston_pointer *pointer,
}
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;
grab->touch = touch;
}
WL_EXPORT void
wl_touch_end_grab(struct wl_touch *touch)
weston_touch_end_grab(struct weston_touch *touch)
{
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)
{
struct weston_compositor *ec = seat->compositor;
struct wl_touch *touch = seat->seat.touch;
struct wl_touch_grab *grab = touch->grab;
struct weston_touch *touch = seat->seat.touch;
struct weston_touch_grab *grab = touch->grab;
struct weston_surface *es;
wl_fixed_t sx, sy;
@ -1548,7 +1545,7 @@ weston_seat_init_touch(struct weston_seat *seat)
if (seat->has_touch)
return;
wl_touch_init(&seat->touch);
weston_touch_init(&seat->touch);
wl_seat_set_touch(&seat->seat, &seat->touch);
seat->has_touch = 1;