mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
types/wlr_touch: add base wlr_input_device
wlr_touch now owns its wlr_input_device. It will be initialized when the tablet tool is initialized, and finished when the touch is destroyed.
This commit is contained in:
parent
7dfee50350
commit
edfb332b24
8 changed files with 24 additions and 15 deletions
|
|
@ -72,7 +72,7 @@ static void send_pointer_position_event(struct wlr_x11_output *output,
|
|||
static void send_touch_down_event(struct wlr_x11_output *output,
|
||||
int16_t x, int16_t y, int32_t touch_id, xcb_timestamp_t time) {
|
||||
struct wlr_event_touch_down ev = {
|
||||
.device = &output->touch_dev,
|
||||
.device = &output->touch.base,
|
||||
.time_msec = time,
|
||||
.x = (double)x / output->wlr_output.width,
|
||||
.y = (double)y / output->wlr_output.height,
|
||||
|
|
@ -85,7 +85,7 @@ static void send_touch_down_event(struct wlr_x11_output *output,
|
|||
static void send_touch_motion_event(struct wlr_x11_output *output,
|
||||
int16_t x, int16_t y, int32_t touch_id, xcb_timestamp_t time) {
|
||||
struct wlr_event_touch_motion ev = {
|
||||
.device = &output->touch_dev,
|
||||
.device = &output->touch.base,
|
||||
.time_msec = time,
|
||||
.x = (double)x / output->wlr_output.width,
|
||||
.y = (double)y / output->wlr_output.height,
|
||||
|
|
@ -98,7 +98,7 @@ static void send_touch_motion_event(struct wlr_x11_output *output,
|
|||
static void send_touch_up_event(struct wlr_x11_output *output,
|
||||
int32_t touch_id, xcb_timestamp_t time) {
|
||||
struct wlr_event_touch_up ev = {
|
||||
.device = &output->touch_dev,
|
||||
.device = &output->touch.base,
|
||||
.time_msec = time,
|
||||
.touch_id = touch_id,
|
||||
};
|
||||
|
|
@ -341,6 +341,8 @@ bool wlr_input_device_is_x11(struct wlr_input_device *wlr_dev) {
|
|||
return wlr_dev->keyboard->impl == &keyboard_impl;
|
||||
case WLR_INPUT_DEVICE_POINTER:
|
||||
return wlr_dev->pointer->impl == &pointer_impl;
|
||||
case WLR_INPUT_DEVICE_TOUCH:
|
||||
return wlr_dev->touch->impl == &touch_impl;
|
||||
default:
|
||||
return wlr_dev->impl == &input_device_impl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static void output_destroy(struct wlr_output *wlr_output) {
|
|||
pixman_region32_fini(&output->exposed);
|
||||
|
||||
wlr_pointer_destroy(&output->pointer);
|
||||
wlr_input_device_destroy(&output->touch_dev);
|
||||
wlr_touch_destroy(&output->touch);
|
||||
|
||||
struct wlr_x11_buffer *buffer, *buffer_tmp;
|
||||
wl_list_for_each_safe(buffer, buffer_tmp, &output->buffers, link) {
|
||||
|
|
@ -576,16 +576,13 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
|||
wlr_pointer_init(&output->pointer, &pointer_impl, "x11-pointer");
|
||||
output->pointer.base.output_name = strdup(wlr_output->name);
|
||||
|
||||
wlr_input_device_init(&output->touch_dev, WLR_INPUT_DEVICE_TOUCH,
|
||||
&input_device_impl, "X11 touch");
|
||||
wlr_touch_init(&output->touch, &touch_impl);
|
||||
output->touch_dev.touch = &output->touch;
|
||||
output->touch_dev.output_name = strdup(wlr_output->name);
|
||||
wlr_touch_init(&output->touch, &touch_impl, "x11-touch");
|
||||
output->touch.base.output_name = strdup(wlr_output->name);
|
||||
wl_list_init(&output->touchpoints);
|
||||
|
||||
wlr_signal_emit_safe(&x11->backend.events.new_output, wlr_output);
|
||||
wlr_signal_emit_safe(&x11->backend.events.new_input, &output->pointer.base);
|
||||
wlr_signal_emit_safe(&x11->backend.events.new_input, &output->touch_dev);
|
||||
wlr_signal_emit_safe(&x11->backend.events.new_input, &output->touch.base);
|
||||
|
||||
// Start the rendering loop by requesting the compositor to render a frame
|
||||
wlr_output_schedule_frame(wlr_output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue