diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-08-29 12:12:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-29 12:12:18 -0500 |
commit | 6daf9e9ab2bb6e11987d3b2562fc053fd0f489c1 (patch) | |
tree | 11b9bbe78deff0e4baa76bd00e1c13d16340ceb9 /backend | |
parent | c46168cf9acd360ae37b4d2a54ed1778f0b89c72 (diff) | |
parent | d9ab631f5d540d67d927e9d0975e2adb782e2e87 (diff) |
Merge pull request #120 from acrisci/feature/wlr-cursor
wlr_cursor
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 27 | ||||
-rw-r--r-- | backend/libinput/pointer.c | 4 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 4 | ||||
-rw-r--r-- | backend/libinput/touch.c | 4 | ||||
-rw-r--r-- | backend/wayland/wl_seat.c | 3 |
5 files changed, 42 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 332926b9..5b24e05f 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -598,6 +598,8 @@ static bool wlr_drm_output_set_cursor(struct wlr_output *_output, wlr_matrix_texture(plane->matrix, plane->width, plane->height, output->output.transform ^ WL_OUTPUT_TRANSFORM_FLIPPED_180); + // TODO the image needs to be rotated depending on the output rotation + plane->wlr_rend = wlr_gles2_renderer_create(&backend->backend); if (!plane->wlr_rend) { return false; @@ -651,6 +653,31 @@ static bool wlr_drm_output_move_cursor(struct wlr_output *_output, struct wlr_drm_output *output = (struct wlr_drm_output *)_output; struct wlr_drm_backend *backend = wl_container_of(output->renderer, backend, renderer); + + int width, height, tmp; + wlr_output_effective_resolution(_output, &width, &height); + + switch (_output->transform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + // nothing to do + break; + case WL_OUTPUT_TRANSFORM_270: + tmp = x; + x = y; + y = -(tmp - width); + break; + case WL_OUTPUT_TRANSFORM_90: + tmp = x; + x = -(y - height); + y = tmp; + break; + default: + // TODO other transformations + wlr_log(L_ERROR, "TODO: handle surface to crtc for transformation = %d", + _output->transform); + break; + } + return backend->iface->crtc_move_cursor(backend, output->crtc, x, y); } diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 8bda205d..005c9516 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -30,6 +30,7 @@ void handle_pointer_motion(struct libinput_event *event, struct libinput_event_pointer *pevent = libinput_event_get_pointer_event(event); struct wlr_event_pointer_motion wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_pointer_get_time(pevent); wlr_event.time_usec = libinput_event_pointer_get_time_usec(pevent); wlr_event.delta_x = libinput_event_pointer_get_dx(pevent); @@ -48,6 +49,7 @@ void handle_pointer_motion_abs(struct libinput_event *event, struct libinput_event_pointer *pevent = libinput_event_get_pointer_event(event); struct wlr_event_pointer_motion_absolute wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_pointer_get_time(pevent); wlr_event.time_usec = libinput_event_pointer_get_time_usec(pevent); wlr_event.x_mm = libinput_event_pointer_get_absolute_x(pevent); @@ -67,6 +69,7 @@ void handle_pointer_button(struct libinput_event *event, struct libinput_event_pointer *pevent = libinput_event_get_pointer_event(event); struct wlr_event_pointer_button wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_pointer_get_time(pevent); wlr_event.time_usec = libinput_event_pointer_get_time_usec(pevent); wlr_event.button = libinput_event_pointer_get_button(pevent); @@ -92,6 +95,7 @@ void handle_pointer_axis(struct libinput_event *event, struct libinput_event_pointer *pevent = libinput_event_get_pointer_event(event); struct wlr_event_pointer_axis wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_pointer_get_time(pevent); wlr_event.time_usec = libinput_event_pointer_get_time_usec(pevent); switch (libinput_event_pointer_get_axis_source(pevent)) { diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 8b3d34ed..472e8506 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -30,6 +30,7 @@ void handle_tablet_tool_axis(struct libinput_event *event, struct libinput_event_tablet_tool *tevent = libinput_event_get_tablet_tool_event(event); struct wlr_event_tablet_tool_axis wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent); wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent); libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); @@ -83,6 +84,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event, struct libinput_event_tablet_tool *tevent = libinput_event_get_tablet_tool_event(event); struct wlr_event_tablet_tool_proximity wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent); wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent); switch (libinput_event_tablet_tool_get_proximity_state(tevent)) { @@ -109,6 +111,7 @@ void handle_tablet_tool_tip(struct libinput_event *event, struct libinput_event_tablet_tool *tevent = libinput_event_get_tablet_tool_event(event); struct wlr_event_tablet_tool_tip wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent); wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent); switch (libinput_event_tablet_tool_get_tip_state(tevent)) { @@ -134,6 +137,7 @@ void handle_tablet_tool_button(struct libinput_event *event, struct libinput_event_tablet_tool *tevent = libinput_event_get_tablet_tool_event(event); struct wlr_event_tablet_tool_button wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent); wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent); wlr_event.button = libinput_event_tablet_tool_get_button(tevent); diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index 9e08d028..2f300482 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -30,6 +30,7 @@ void handle_touch_down(struct libinput_event *event, struct libinput_event_touch *tevent = libinput_event_get_touch_event(event); struct wlr_event_touch_down wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_touch_get_time(tevent); wlr_event.time_usec = libinput_event_touch_get_time_usec(tevent); wlr_event.slot = libinput_event_touch_get_slot(tevent); @@ -50,6 +51,7 @@ void handle_touch_up(struct libinput_event *event, struct libinput_event_touch *tevent = libinput_event_get_touch_event(event); struct wlr_event_touch_up wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_touch_get_time(tevent); wlr_event.time_usec = libinput_event_touch_get_time_usec(tevent); wlr_event.slot = libinput_event_touch_get_slot(tevent); @@ -67,6 +69,7 @@ void handle_touch_motion(struct libinput_event *event, struct libinput_event_touch *tevent = libinput_event_get_touch_event(event); struct wlr_event_touch_motion wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_touch_get_time(tevent); wlr_event.time_usec = libinput_event_touch_get_time_usec(tevent); wlr_event.slot = libinput_event_touch_get_slot(tevent); @@ -87,6 +90,7 @@ void handle_touch_cancel(struct libinput_event *event, struct libinput_event_touch *tevent = libinput_event_get_touch_event(event); struct wlr_event_touch_cancel wlr_event = { 0 }; + wlr_event.device = wlr_dev; wlr_event.time_sec = libinput_event_touch_get_time(tevent); wlr_event.time_usec = libinput_event_touch_get_time_usec(tevent); wlr_event.slot = libinput_event_touch_get_slot(tevent); diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index a4cc0ba5..3e6982a0 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -51,6 +51,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window, &width, &height); struct wlr_event_pointer_motion_absolute wlr_event; + wlr_event.device = dev; wlr_event.time_sec = time / 1000; wlr_event.time_usec = time * 1000; wlr_event.width_mm = width; @@ -66,6 +67,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, assert(dev && dev->pointer); struct wlr_event_pointer_button wlr_event; + wlr_event.device = dev; wlr_event.button = button; wlr_event.state = state; wlr_event.time_sec = time / 1000; @@ -80,6 +82,7 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer; struct wlr_event_pointer_axis wlr_event; + wlr_event.device = dev; wlr_event.delta = value; wlr_event.orientation = axis; wlr_event.time_sec = time / 1000; |