aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/libinput/tablet_tool.c2
-rw-r--r--include/wlr/types/wlr_output.h5
-rw-r--r--rootston/cursor.c9
-rw-r--r--types/wlr_cursor.c4
-rw-r--r--types/wlr_output.c6
5 files changed, 20 insertions, 6 deletions
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index 3caaf3f7..3d5fafc3 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -70,6 +70,8 @@ void handle_tablet_tool_axis(struct libinput_event *event,
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
}
+ wlr_log(L_DEBUG, "Tablet tool axis event %d @ %f,%f",
+ wlr_event.updated_axes, wlr_event.x_mm, wlr_event.y_mm);
wl_signal_emit(&wlr_dev->tablet_tool->events.axis, &wlr_event);
}
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index e6323f9c..df123639 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -14,7 +14,7 @@ struct wlr_output_mode {
struct wlr_output_cursor {
struct wlr_output *output;
- int32_t x, y;
+ double x, y;
bool enabled;
uint32_t width, height;
int32_t hotspot_x, hotspot_y;
@@ -95,7 +95,8 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
int32_t hotspot_x, int32_t hotspot_y);
void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
-bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y);
+bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
+ double x, double y);
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
#endif
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 31001a9f..aa8e5122 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -378,11 +378,20 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
static void handle_tool_axis(struct wl_listener *listener, void *data) {
struct roots_input *input = wl_container_of(listener, input, cursor_tool_axis);
struct wlr_event_tablet_tool_axis *event = data;
+
if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) &&
(event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) {
wlr_cursor_warp_absolute(input->cursor, event->device,
event->x_mm / event->width_mm, event->y_mm / event->height_mm);
cursor_update_position(input, event->time_msec);
+ } else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) {
+ wlr_cursor_warp_absolute(input->cursor, event->device,
+ event->x_mm / event->width_mm, -1);
+ cursor_update_position(input, event->time_msec);
+ } else if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) {
+ wlr_cursor_warp_absolute(input->cursor, event->device,
+ -1, event->y_mm / event->height_mm);
+ cursor_update_position(input, event->time_msec);
}
}
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index 83d36d14..dfaccb53 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -261,8 +261,8 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
mapping = wlr_output_layout_get_box(cur->state->layout, NULL);
}
- double x = mapping->width * x_mm + mapping->x;
- double y = mapping->height * y_mm + mapping->y;
+ double x = x_mm > 0 ? mapping->width * x_mm + mapping->x : cur->x;
+ double y = y_mm > 0 ? mapping->height * y_mm + mapping->y : cur->y;
wlr_cursor_warp_unchecked(cur, x, y);
}
diff --git a/types/wlr_output.c b/types/wlr_output.c
index ff8b07be..3ad69ce3 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -472,9 +472,11 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
}
}
-bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
+bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
+ double x, double y) {
x *= cursor->output->scale;
y *= cursor->output->scale;
+ wlr_log(L_DEBUG, "Moving cursor to %f,%f", x, y);
cursor->x = x;
cursor->y = y;
@@ -486,7 +488,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
if (!cursor->output->impl->move_cursor) {
return false;
}
- return cursor->output->impl->move_cursor(cursor->output, x, y);
+ return cursor->output->impl->move_cursor(cursor->output, (int)x, (int)y);
}
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {