mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Make touch depend on cursor to prevent racing
This commit is contained in:
parent
8d0812d45a
commit
5e1562fae6
5 changed files with 18 additions and 14 deletions
10
include/input/touch.h
Normal file
10
include/input/touch.h
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef LABWC_TOUCH_H
|
||||||
|
#define LABWC_TOUCH_H
|
||||||
|
|
||||||
|
struct seat;
|
||||||
|
|
||||||
|
void touch_init(struct seat *seat);
|
||||||
|
void touch_finish(struct seat *seat);
|
||||||
|
|
||||||
|
#endif /* LABWC_TOUCH_H */
|
||||||
|
|
@ -418,9 +418,6 @@ void keyboard_init(struct seat *seat);
|
||||||
bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
|
bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
|
||||||
void keyboard_finish(struct seat *seat);
|
void keyboard_finish(struct seat *seat);
|
||||||
|
|
||||||
void touch_init(struct seat *seat);
|
|
||||||
void touch_finish(struct seat *seat);
|
|
||||||
|
|
||||||
void seat_init(struct server *server);
|
void seat_init(struct server *server);
|
||||||
void seat_finish(struct server *server);
|
void seat_finish(struct server *server);
|
||||||
void seat_reconfigure(struct server *server);
|
void seat_reconfigure(struct server *server);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "dnd.h"
|
#include "dnd.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "input/gestures.h"
|
#include "input/gestures.h"
|
||||||
|
#include "input/touch.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
#include "regions.h"
|
#include "regions.h"
|
||||||
|
|
@ -1201,6 +1202,7 @@ cursor_init(struct seat *seat)
|
||||||
wl_signal_add(&seat->cursor->events.frame, &seat->cursor_frame);
|
wl_signal_add(&seat->cursor->events.frame, &seat->cursor_frame);
|
||||||
|
|
||||||
gestures_init(seat);
|
gestures_init(seat);
|
||||||
|
touch_init(seat);
|
||||||
|
|
||||||
seat->request_cursor.notify = request_cursor_notify;
|
seat->request_cursor.notify = request_cursor_notify;
|
||||||
wl_signal_add(&seat->seat->events.request_set_cursor,
|
wl_signal_add(&seat->seat->events.request_set_cursor,
|
||||||
|
|
@ -1226,6 +1228,7 @@ void cursor_finish(struct seat *seat)
|
||||||
wl_list_remove(&seat->cursor_frame.link);
|
wl_list_remove(&seat->cursor_frame.link);
|
||||||
|
|
||||||
gestures_finish(seat);
|
gestures_finish(seat);
|
||||||
|
touch_finish(seat);
|
||||||
|
|
||||||
wl_list_remove(&seat->request_cursor.link);
|
wl_list_remove(&seat->request_cursor.link);
|
||||||
wl_list_remove(&seat->request_set_selection.link);
|
wl_list_remove(&seat->request_set_selection.link);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
#include "idle.h"
|
|
||||||
#include "labwc.h"
|
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
|
#include "idle.h"
|
||||||
|
#include "input/touch.h"
|
||||||
|
#include "labwc.h"
|
||||||
|
|
||||||
/* Holds layout -> surface offsets to report motion events in relative coords */
|
/* Holds layout -> surface offsets to report motion events in relative coords */
|
||||||
struct touch_point {
|
struct touch_point {
|
||||||
|
|
|
||||||
11
src/seat.c
11
src/seat.c
|
|
@ -417,9 +417,8 @@ seat_init(struct server *server)
|
||||||
}
|
}
|
||||||
wlr_cursor_attach_output_layout(seat->cursor, server->output_layout);
|
wlr_cursor_attach_output_layout(seat->cursor, server->output_layout);
|
||||||
|
|
||||||
keyboard_init(seat);
|
|
||||||
cursor_init(seat);
|
cursor_init(seat);
|
||||||
touch_init(seat);
|
keyboard_init(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -434,14 +433,8 @@ seat_finish(struct server *server)
|
||||||
input_device_destroy(&input->destroy, NULL);
|
input_device_destroy(&input->destroy, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard_finish(seat);
|
|
||||||
/*
|
|
||||||
* Caution - touch_finish() unregisters event listeners from
|
|
||||||
* seat->cursor and must come before cursor_finish(), otherwise
|
|
||||||
* a use-after-free occurs.
|
|
||||||
*/
|
|
||||||
touch_finish(seat);
|
|
||||||
cursor_finish(seat);
|
cursor_finish(seat);
|
||||||
|
keyboard_finish(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue