mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Allow to update the cursor hotspot without its pixels
This commit is contained in:
parent
5c6a933890
commit
92daa790bb
5 changed files with 34 additions and 11 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -54,11 +54,18 @@ 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) {
|
||||
// Hide cursor
|
||||
wl_pointer_set_cursor(output->backend->pointer, output->enter_serial,
|
||||
NULL, 0, 0);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue