mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 18:39:48 +01:00
rootston: seat/cursor 80col cleanup
This commit is contained in:
parent
f277f28eef
commit
f17c3947ea
2 changed files with 35 additions and 17 deletions
|
@ -28,7 +28,8 @@ void roots_cursor_destroy(struct roots_cursor *cursor) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static void roots_cursor_update_position(struct roots_cursor *cursor, uint32_t time) {
|
static void roots_cursor_update_position(struct roots_cursor *cursor,
|
||||||
|
uint32_t time) {
|
||||||
struct roots_desktop *desktop = cursor->seat->input->server->desktop;
|
struct roots_desktop *desktop = cursor->seat->input->server->desktop;
|
||||||
struct roots_seat *seat = cursor->seat;
|
struct roots_seat *seat = cursor->seat;
|
||||||
struct roots_view *view;
|
struct roots_view *view;
|
||||||
|
@ -137,7 +138,9 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
struct roots_view *view = view_at(desktop, lx, ly, &surface, &sx, &sy);
|
struct roots_view *view = view_at(desktop, lx, ly, &surface, &sx, &sy);
|
||||||
|
|
||||||
if (state == WLR_BUTTON_PRESSED && view && roots_seat_has_meta_pressed(seat)) {
|
if (state == WLR_BUTTON_PRESSED &&
|
||||||
|
view &&
|
||||||
|
roots_seat_has_meta_pressed(seat)) {
|
||||||
roots_seat_focus_view(seat, view);
|
roots_seat_focus_view(seat, view);
|
||||||
|
|
||||||
uint32_t edges;
|
uint32_t edges;
|
||||||
|
@ -170,7 +173,8 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
|
||||||
if (is_touch) {
|
if (is_touch) {
|
||||||
serial = wl_display_get_serial(desktop->server->wl_display);
|
serial = wl_display_get_serial(desktop->server->wl_display);
|
||||||
} else {
|
} else {
|
||||||
serial = wlr_seat_pointer_notify_button(seat->seat, time, button, state);
|
serial =
|
||||||
|
wlr_seat_pointer_notify_button(seat->seat, time, button, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -251,7 +255,8 @@ void roots_cursor_handle_touch_down(struct roots_cursor *cursor,
|
||||||
|
|
||||||
void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
|
void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
|
||||||
struct wlr_event_touch_up *event) {
|
struct wlr_event_touch_up *event) {
|
||||||
struct wlr_touch_point *point = wlr_seat_touch_get_point(cursor->seat->seat, event->touch_id);
|
struct wlr_touch_point *point =
|
||||||
|
wlr_seat_touch_get_point(cursor->seat->seat, event->touch_id);
|
||||||
if (!point) {
|
if (!point) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +266,8 @@ void roots_cursor_handle_touch_up(struct roots_cursor *cursor,
|
||||||
BTN_LEFT, 0, cursor->seat->touch_x, cursor->seat->touch_y);
|
BTN_LEFT, 0, cursor->seat->touch_x, cursor->seat->touch_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_seat_touch_notify_up(cursor->seat->seat, event->time_msec, event->touch_id);
|
wlr_seat_touch_notify_up(cursor->seat->seat, event->time_msec,
|
||||||
|
event->touch_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
|
void roots_cursor_handle_touch_motion(struct roots_cursor *cursor,
|
||||||
|
@ -331,7 +337,8 @@ void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
|
||||||
struct wlr_seat_pointer_request_set_cursor_event *event) {
|
struct wlr_seat_pointer_request_set_cursor_event *event) {
|
||||||
struct wlr_surface *focused_surface =
|
struct wlr_surface *focused_surface =
|
||||||
event->seat_client->seat->pointer_state.focused_surface;
|
event->seat_client->seat->pointer_state.focused_surface;
|
||||||
bool has_focused = focused_surface != NULL && focused_surface->resource != NULL;
|
bool has_focused =
|
||||||
|
focused_surface != NULL && focused_surface->resource != NULL;
|
||||||
struct wl_client *focused_client = NULL;
|
struct wl_client *focused_client = NULL;
|
||||||
if (has_focused) {
|
if (has_focused) {
|
||||||
focused_client = wl_resource_get_client(focused_surface->resource);
|
focused_client = wl_resource_get_client(focused_surface->resource);
|
||||||
|
|
|
@ -31,7 +31,8 @@ static void handle_cursor_motion(struct wl_listener *listener, void *data) {
|
||||||
roots_cursor_handle_motion(cursor, event);
|
roots_cursor_handle_motion(cursor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_cursor_motion_absolute(struct wl_listener *listener, void *data) {
|
static void handle_cursor_motion_absolute(struct wl_listener *listener,
|
||||||
|
void *data) {
|
||||||
struct roots_cursor *cursor =
|
struct roots_cursor *cursor =
|
||||||
wl_container_of(listener, cursor, motion_absolute);
|
wl_container_of(listener, cursor, motion_absolute);
|
||||||
struct wlr_event_pointer_motion_absolute *event = data;
|
struct wlr_event_pointer_motion_absolute *event = data;
|
||||||
|
@ -127,7 +128,8 @@ static void handle_touch_grab_end(struct wl_listener *listener,
|
||||||
roots_cursor_handle_touch_grab_end(cursor, grab);
|
roots_cursor_handle_touch_grab_end(cursor, grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_reset_device_mappings(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_reset_device_mappings(struct roots_seat *seat,
|
||||||
|
struct wlr_input_device *device) {
|
||||||
struct wlr_cursor *cursor = seat->cursor->cursor;
|
struct wlr_cursor *cursor = seat->cursor->cursor;
|
||||||
struct roots_config *config = seat->input->config;
|
struct roots_config *config = seat->input->config;
|
||||||
|
|
||||||
|
@ -233,10 +235,12 @@ static void roots_seat_init_cursor(struct roots_seat *seat) {
|
||||||
wl_signal_add(&wlr_cursor->events.touch_up, &seat->cursor->touch_up);
|
wl_signal_add(&wlr_cursor->events.touch_up, &seat->cursor->touch_up);
|
||||||
seat->cursor->touch_up.notify = handle_touch_up;
|
seat->cursor->touch_up.notify = handle_touch_up;
|
||||||
|
|
||||||
wl_signal_add(&wlr_cursor->events.touch_motion, &seat->cursor->touch_motion);
|
wl_signal_add(&wlr_cursor->events.touch_motion,
|
||||||
|
&seat->cursor->touch_motion);
|
||||||
seat->cursor->touch_motion.notify = handle_touch_motion;
|
seat->cursor->touch_motion.notify = handle_touch_motion;
|
||||||
|
|
||||||
wl_signal_add(&wlr_cursor->events.tablet_tool_axis, &seat->cursor->tool_axis);
|
wl_signal_add(&wlr_cursor->events.tablet_tool_axis,
|
||||||
|
&seat->cursor->tool_axis);
|
||||||
seat->cursor->tool_axis.notify = handle_tool_axis;
|
seat->cursor->tool_axis.notify = handle_tool_axis;
|
||||||
|
|
||||||
wl_signal_add(&wlr_cursor->events.tablet_tool_tip, &seat->cursor->tool_tip);
|
wl_signal_add(&wlr_cursor->events.tablet_tool_tip, &seat->cursor->tool_tip);
|
||||||
|
@ -304,9 +308,11 @@ void roots_seat_destroy(struct roots_seat *seat) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_add_keyboard(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_add_keyboard(struct roots_seat *seat,
|
||||||
|
struct wlr_input_device *device) {
|
||||||
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
||||||
struct roots_keyboard *keyboard = roots_keyboard_create(device, seat->input);
|
struct roots_keyboard *keyboard =
|
||||||
|
roots_keyboard_create(device, seat->input);
|
||||||
if (keyboard == NULL) {
|
if (keyboard == NULL) {
|
||||||
wlr_log(L_ERROR, "could not allocate keyboard for seat");
|
wlr_log(L_ERROR, "could not allocate keyboard for seat");
|
||||||
return;
|
return;
|
||||||
|
@ -327,7 +333,8 @@ static void seat_add_keyboard(struct roots_seat *seat, struct wlr_input_device *
|
||||||
wlr_seat_set_keyboard(seat->seat, device);
|
wlr_seat_set_keyboard(seat->seat, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_add_pointer(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_add_pointer(struct roots_seat *seat,
|
||||||
|
struct wlr_input_device *device) {
|
||||||
struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1);
|
struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1);
|
||||||
if (!pointer) {
|
if (!pointer) {
|
||||||
wlr_log(L_ERROR, "could not allocate pointer for seat");
|
wlr_log(L_ERROR, "could not allocate pointer for seat");
|
||||||
|
@ -342,7 +349,8 @@ static void seat_add_pointer(struct roots_seat *seat, struct wlr_input_device *d
|
||||||
roots_seat_configure_cursor(seat);
|
roots_seat_configure_cursor(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_add_touch(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_add_touch(struct roots_seat *seat,
|
||||||
|
struct wlr_input_device *device) {
|
||||||
struct roots_touch *touch = calloc(sizeof(struct roots_touch), 1);
|
struct roots_touch *touch = calloc(sizeof(struct roots_touch), 1);
|
||||||
if (!touch) {
|
if (!touch) {
|
||||||
wlr_log(L_ERROR, "could not allocate touch for seat");
|
wlr_log(L_ERROR, "could not allocate touch for seat");
|
||||||
|
@ -357,12 +365,15 @@ static void seat_add_touch(struct roots_seat *seat, struct wlr_input_device *dev
|
||||||
roots_seat_configure_cursor(seat);
|
roots_seat_configure_cursor(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_add_tablet_pad(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_add_tablet_pad(struct roots_seat *seat,
|
||||||
|
struct wlr_input_device *device) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_add_tablet_tool(struct roots_seat *seat, struct wlr_input_device *device) {
|
static void seat_add_tablet_tool(struct roots_seat *seat,
|
||||||
struct roots_tablet_tool *tablet_tool = calloc(sizeof(struct roots_tablet_tool), 1);
|
struct wlr_input_device *device) {
|
||||||
|
struct roots_tablet_tool *tablet_tool =
|
||||||
|
calloc(sizeof(struct roots_tablet_tool), 1);
|
||||||
if (!tablet_tool) {
|
if (!tablet_tool) {
|
||||||
wlr_log(L_ERROR, "could not allocate tablet_tool for seat");
|
wlr_log(L_ERROR, "could not allocate tablet_tool for seat");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue