mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-09-06 09:56:14 +00:00
input: Keep track of number of touch points inside touch struct
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
37d38d932c
commit
9484b695b9
|
@ -346,7 +346,7 @@ weston_compositor_run_touch_binding(struct weston_compositor *compositor,
|
||||||
{
|
{
|
||||||
struct weston_binding *b;
|
struct weston_binding *b;
|
||||||
|
|
||||||
if (seat->num_tp != 1 || touch_type != WL_TOUCH_DOWN)
|
if (seat->touch->num_tp != 1 || touch_type != WL_TOUCH_DOWN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_list_for_each(b, &compositor->touch_binding_list, link) {
|
wl_list_for_each(b, &compositor->touch_binding_list, link) {
|
||||||
|
|
|
@ -340,6 +340,8 @@ struct weston_touch {
|
||||||
uint32_t focus_serial;
|
uint32_t focus_serial;
|
||||||
struct wl_signal focus_signal;
|
struct wl_signal focus_signal;
|
||||||
|
|
||||||
|
uint32_t num_tp;
|
||||||
|
|
||||||
struct weston_touch_grab *grab;
|
struct weston_touch_grab *grab;
|
||||||
struct weston_touch_grab default_grab;
|
struct weston_touch_grab default_grab;
|
||||||
int grab_touch_id;
|
int grab_touch_id;
|
||||||
|
@ -493,8 +495,6 @@ struct weston_seat {
|
||||||
struct wl_listener selection_data_source_listener;
|
struct wl_listener selection_data_source_listener;
|
||||||
struct wl_signal selection_signal;
|
struct wl_signal selection_signal;
|
||||||
|
|
||||||
uint32_t num_tp;
|
|
||||||
|
|
||||||
void (*led_update)(struct weston_seat *ws, enum weston_led leds);
|
void (*led_update)(struct weston_seat *ws, enum weston_led leds);
|
||||||
|
|
||||||
struct weston_xkb_info *xkb_info;
|
struct weston_xkb_info *xkb_info;
|
||||||
|
|
13
src/input.c
13
src/input.c
|
@ -1365,12 +1365,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
||||||
case WL_TOUCH_DOWN:
|
case WL_TOUCH_DOWN:
|
||||||
weston_compositor_idle_inhibit(ec);
|
weston_compositor_idle_inhibit(ec);
|
||||||
|
|
||||||
seat->num_tp++;
|
touch->num_tp++;
|
||||||
|
|
||||||
/* the first finger down picks the view, and all further go
|
/* the first finger down picks the view, and all further go
|
||||||
* to that view for the remainder of the touch session i.e.
|
* to that view for the remainder of the touch session i.e.
|
||||||
* until all touch points are up again. */
|
* until all touch points are up again. */
|
||||||
if (seat->num_tp == 1) {
|
if (touch->num_tp == 1) {
|
||||||
ev = weston_compositor_pick_view(ec, x, y, &sx, &sy);
|
ev = weston_compositor_pick_view(ec, x, y, &sx, &sy);
|
||||||
weston_touch_set_focus(seat, ev);
|
weston_touch_set_focus(seat, ev);
|
||||||
} else if (touch->focus) {
|
} else if (touch->focus) {
|
||||||
|
@ -1381,12 +1381,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
||||||
* there is no focused surface.
|
* there is no focused surface.
|
||||||
*/
|
*/
|
||||||
weston_log("touch event received with %d points down"
|
weston_log("touch event received with %d points down"
|
||||||
"but no surface focused\n", seat->num_tp);
|
"but no surface focused\n", touch->num_tp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
grab->interface->down(grab, time, touch_id, sx, sy);
|
grab->interface->down(grab, time, touch_id, sx, sy);
|
||||||
if (seat->num_tp == 1) {
|
if (touch->num_tp == 1) {
|
||||||
touch->grab_serial =
|
touch->grab_serial =
|
||||||
wl_display_get_serial(ec->wl_display);
|
wl_display_get_serial(ec->wl_display);
|
||||||
touch->grab_touch_id = touch_id;
|
touch->grab_touch_id = touch_id;
|
||||||
|
@ -1406,10 +1406,10 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
||||||
break;
|
break;
|
||||||
case WL_TOUCH_UP:
|
case WL_TOUCH_UP:
|
||||||
weston_compositor_idle_release(ec);
|
weston_compositor_idle_release(ec);
|
||||||
seat->num_tp--;
|
touch->num_tp--;
|
||||||
|
|
||||||
grab->interface->up(grab, time, touch_id);
|
grab->interface->up(grab, time, touch_id);
|
||||||
if (seat->num_tp == 0)
|
if (touch->num_tp == 0)
|
||||||
weston_touch_set_focus(seat, NULL);
|
weston_touch_set_focus(seat, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2062,7 +2062,6 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
|
||||||
|
|
||||||
seat->compositor = ec;
|
seat->compositor = ec;
|
||||||
seat->modifier_state = 0;
|
seat->modifier_state = 0;
|
||||||
seat->num_tp = 0;
|
|
||||||
seat->seat_name = strdup(seat_name);
|
seat->seat_name = strdup(seat_name);
|
||||||
|
|
||||||
wl_list_insert(ec->seat_list.prev, &seat->link);
|
wl_list_insert(ec->seat_list.prev, &seat->link);
|
||||||
|
|
|
@ -1457,7 +1457,7 @@ touch_move_grab_up(struct weston_touch_grab *grab, uint32_t time, int touch_id)
|
||||||
(struct weston_touch_move_grab *) container_of(
|
(struct weston_touch_move_grab *) container_of(
|
||||||
grab, struct shell_touch_grab, grab);
|
grab, struct shell_touch_grab, grab);
|
||||||
|
|
||||||
if (grab->touch->seat->num_tp == 0) {
|
if (grab->touch->num_tp == 0) {
|
||||||
shell_touch_grab_end(&move->base);
|
shell_touch_grab_end(&move->base);
|
||||||
free(move);
|
free(move);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue