mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
Chase wlroots wlr-device-input refactoring
Rename wlroots input device events, for example 's/wlr_event_pointer_motion/wlr_pointer_motion_event/' seat.c: - In configure_libinput() use wlr_input_device->type rather than width_mm - In new_pointer() use wlr_input_device->type rather than output_name to check that device is pointer.
This commit is contained in:
parent
5fd5024ca6
commit
d844f6798b
3 changed files with 42 additions and 27 deletions
31
src/cursor.c
31
src/cursor.c
|
|
@ -405,7 +405,7 @@ cursor_motion(struct wl_listener *listener, void *data)
|
|||
*/
|
||||
struct seat *seat = wl_container_of(listener, seat, cursor_motion);
|
||||
struct server *server = seat->server;
|
||||
struct wlr_event_pointer_motion *event = data;
|
||||
struct wlr_pointer_motion_event *event = data;
|
||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||
|
|
@ -422,8 +422,8 @@ cursor_motion(struct wl_listener *listener, void *data)
|
|||
* NULL for the device if you want to move the cursor around
|
||||
* without any input.
|
||||
*/
|
||||
wlr_cursor_move(seat->cursor, event->device, event->delta_x,
|
||||
event->delta_y);
|
||||
wlr_cursor_move(seat->cursor, &event->pointer->base,
|
||||
event->delta_x, event->delta_y);
|
||||
}
|
||||
process_cursor_motion(seat->server, event->time_msec);
|
||||
}
|
||||
|
|
@ -453,12 +453,12 @@ cursor_motion_absolute(struct wl_listener *listener, void *data)
|
|||
*/
|
||||
struct seat *seat = wl_container_of(
|
||||
listener, seat, cursor_motion_absolute);
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
struct wlr_pointer_motion_absolute_event *event = data;
|
||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||
|
||||
double lx, ly;
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor, event->device,
|
||||
event->x, event->y, &lx, &ly);
|
||||
wlr_cursor_absolute_to_layout_coords(seat->cursor,
|
||||
&event->pointer->base, event->x, event->y, &lx, &ly);
|
||||
|
||||
double dx = lx - seat->cursor->x;
|
||||
double dy = ly - seat->cursor->y;
|
||||
|
|
@ -477,7 +477,8 @@ cursor_motion_absolute(struct wl_listener *listener, void *data)
|
|||
* NULL for the device if you want to move the cursor around
|
||||
* without any input.
|
||||
*/
|
||||
wlr_cursor_move(seat->cursor, event->device, dx, dy); }
|
||||
wlr_cursor_move(seat->cursor, &event->pointer->base, dx, dy);
|
||||
}
|
||||
|
||||
process_cursor_motion(seat->server, event->time_msec);
|
||||
}
|
||||
|
|
@ -612,7 +613,7 @@ cursor_button(struct wl_listener *listener, void *data)
|
|||
*/
|
||||
struct seat *seat = wl_container_of(listener, seat, cursor_button);
|
||||
struct server *server = seat->server;
|
||||
struct wlr_event_pointer_button *event = data;
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||
|
||||
double sx, sy;
|
||||
|
|
@ -729,7 +730,7 @@ cursor_axis(struct wl_listener *listener, void *data)
|
|||
* event, for example when you move the scroll wheel.
|
||||
*/
|
||||
struct seat *seat = wl_container_of(listener, seat, cursor_axis);
|
||||
struct wlr_event_pointer_axis *event = data;
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
|
|
@ -757,7 +758,7 @@ cursor_frame(struct wl_listener *listener, void *data)
|
|||
static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, pinch_begin);
|
||||
struct wlr_event_pointer_pinch_begin *event = data;
|
||||
struct wlr_pointer_pinch_begin_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_pinch_begin(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->fingers);
|
||||
}
|
||||
|
|
@ -765,7 +766,7 @@ static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
|
|||
static void handle_pointer_pinch_update(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, pinch_update);
|
||||
struct wlr_event_pointer_pinch_update *event = data;
|
||||
struct wlr_pointer_pinch_update_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_pinch_update(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->dx, event->dy,
|
||||
event->scale, event->rotation);
|
||||
|
|
@ -774,7 +775,7 @@ static void handle_pointer_pinch_update(struct wl_listener *listener, void *data
|
|||
static void handle_pointer_pinch_end(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, pinch_end);
|
||||
struct wlr_event_pointer_pinch_end *event = data;
|
||||
struct wlr_pointer_pinch_end_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_pinch_end(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->cancelled);
|
||||
}
|
||||
|
|
@ -782,7 +783,7 @@ static void handle_pointer_pinch_end(struct wl_listener *listener, void *data)
|
|||
static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, swipe_begin);
|
||||
struct wlr_event_pointer_swipe_begin *event = data;
|
||||
struct wlr_pointer_swipe_begin_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_begin(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->fingers);
|
||||
}
|
||||
|
|
@ -790,7 +791,7 @@ static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
|||
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, swipe_update);
|
||||
struct wlr_event_pointer_swipe_update *event = data;
|
||||
struct wlr_pointer_swipe_update_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_update(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->dx, event->dy);
|
||||
}
|
||||
|
|
@ -798,7 +799,7 @@ static void handle_pointer_swipe_update(struct wl_listener *listener, void *data
|
|||
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, swipe_end);
|
||||
struct wlr_event_pointer_swipe_end *event = data;
|
||||
struct wlr_pointer_swipe_end_event *event = data;
|
||||
wlr_pointer_gestures_v1_send_swipe_end(seat->pointer_gestures,
|
||||
seat->seat, event->time_msec, event->cancelled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
|||
struct server *server = seat->server;
|
||||
|
||||
if (server->cycle_view) {
|
||||
struct wlr_event_keyboard_key *event = data;
|
||||
struct wlr_keyboard_key_event *event = data;
|
||||
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||
if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
||||
&& !any_modifiers_pressed(keyboard)) {
|
||||
|
|
@ -91,7 +91,7 @@ static bool is_modifier_key(xkb_keysym_t sym)
|
|||
|
||||
static bool
|
||||
handle_compositor_keybindings(struct wl_listener *listener,
|
||||
struct wlr_event_keyboard_key *event)
|
||||
struct wlr_keyboard_key_event *event)
|
||||
{
|
||||
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
||||
struct server *server = seat->server;
|
||||
|
|
@ -185,7 +185,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
|
|||
/* This event is raised when a key is pressed or released. */
|
||||
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
||||
struct server *server = seat->server;
|
||||
struct wlr_event_keyboard_key *event = data;
|
||||
struct wlr_keyboard_key_event *event = data;
|
||||
struct wlr_seat *wlr_seat = server->seat.seat;
|
||||
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||
|
|
|
|||
32
src/seat.c
32
src/seat.c
|
|
@ -1,7 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "labwc.h"
|
||||
|
||||
|
|
@ -14,6 +16,19 @@ input_device_destroy(struct wl_listener *listener, void *data)
|
|||
free(input);
|
||||
}
|
||||
|
||||
static bool
|
||||
is_touch_device(struct wlr_input_device *wlr_input_device)
|
||||
{
|
||||
switch (wlr_input_device->type) {
|
||||
case WLR_INPUT_DEVICE_TOUCH:
|
||||
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||
{
|
||||
|
|
@ -29,16 +44,14 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
|||
}
|
||||
|
||||
enum device_type current_type;
|
||||
if (wlr_input_device->width_mm) {
|
||||
current_type = TOUCH_DEVICE;
|
||||
} else {
|
||||
current_type = NON_TOUCH_DEVICE;
|
||||
}
|
||||
current_type = is_touch_device(wlr_input_device)
|
||||
? TOUCH_DEVICE : NON_TOUCH_DEVICE;
|
||||
|
||||
struct libinput_category *device_category, *dc = NULL;
|
||||
wl_list_for_each(device_category, &rc.libinput_categories, link) {
|
||||
if (device_category->name) {
|
||||
if (!strcasecmp(wlr_input_device->name, device_category->name)) {
|
||||
if (!strcasecmp(wlr_input_device->name,
|
||||
device_category->name)) {
|
||||
dc = device_category;
|
||||
break;
|
||||
}
|
||||
|
|
@ -134,10 +147,11 @@ new_pointer(struct seat *seat, struct input *input)
|
|||
wlr_cursor_attach_input_device(seat->cursor, dev);
|
||||
|
||||
/* In support of running with WLR_WL_OUTPUTS set to >=2 */
|
||||
if (dev->output_name) {
|
||||
wlr_log(WLR_INFO, "map pointer to output %s\n", dev->output_name);
|
||||
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
|
||||
wlr_log(WLR_INFO, "map pointer to output %s\n",
|
||||
dev->pointer->output_name);
|
||||
struct wlr_output *output =
|
||||
output_by_name(seat->server, dev->output_name);
|
||||
output_by_name(seat->server, dev->pointer->output_name);
|
||||
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
||||
wlr_cursor_map_input_to_region(seat->cursor, dev, NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue