aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-17 16:01:17 -0400
committerTony Crisci <tony@dubstepdish.com>2017-10-17 16:01:17 -0400
commitb7c622a319aff00a1c825a4f16bd9443faa6b7c4 (patch)
tree873b760bd9288724028841159fdad22d18e62fb3 /backend
parent09f16058c890cc3329c8aa39593f229b2bf31443 (diff)
parent9129687ad6dcf162b3af8d91b2fc582f185d0943 (diff)
Merge branch 'master' into feature/data-device-selection
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c10
-rw-r--r--backend/wayland/output.c19
2 files changed, 23 insertions, 6 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 9e5346a1..ff4dc7f6 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -470,7 +470,7 @@ static void wlr_drm_connector_transform(struct wlr_output *output,
static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
- int32_t hotspot_x, int32_t hotspot_y) {
+ int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = conn->drm;
struct wlr_drm_renderer *renderer = &drm->renderer;
@@ -478,7 +478,8 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
struct wlr_drm_crtc *crtc = conn->crtc;
struct wlr_drm_plane *plane = crtc->cursor;
- if (!buf) {
+ if (!buf && update_pixels) {
+ // Hide the cursor
return drm->iface->crtc_set_cursor(drm, crtc, NULL);
}
@@ -566,6 +567,11 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
break;
}
+ if (!update_pixels) {
+ // Only update the cursor hotspot
+ return true;
+ }
+
struct gbm_bo *bo = plane->cursor_bo;
uint32_t bo_width = gbm_bo_get_width(bo);
uint32_t bo_height = gbm_bo_get_height(bo);
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 03b43b35..d308b907 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -54,13 +54,24 @@ static void wlr_wl_output_transform(struct wlr_output *_output,
static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
- int32_t hotspot_x, int32_t hotspot_y) {
+ int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
struct wlr_wl_backend *backend = output->backend;
+ if (!update_pixels) {
+ // Update hotspot without changing cursor image
+ wlr_wl_output_update_cursor(output, output->enter_serial, hotspot_x,
+ hotspot_y);
+ return true;
+ }
if (!buf) {
- wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
- NULL, 0, 0);
+ // Hide cursor
+ wl_surface_destroy(output->cursor_surface);
+ munmap(output->cursor_data, output->cursor_buf_size);
+ output->cursor_surface = NULL;
+ output->cursor_buf_size = 0;
+ wlr_wl_output_update_cursor(output, output->enter_serial, hotspot_x,
+ hotspot_y);
return true;
}
@@ -153,7 +164,7 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output,
uint32_t serial, int32_t hotspot_x, int32_t hotspot_y) {
- if (output->cursor_surface && output->backend->pointer && serial) {
+ if (output->backend->pointer && serial) {
wl_pointer_set_cursor(output->backend->pointer, serial,
output->cursor_surface, hotspot_x, hotspot_y);
}