Compare commits

..

2 commits

Author SHA1 Message Date
6277c8837a Merge branch 'master' of ssh://forgejo.nishi.boats:2221/pyrite-dev/milsko
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
2026-03-23 12:36:12 -07:00
3d83e0ca64 wayland: fix cursor 2026-03-23 12:35:29 -07:00

View file

@ -2040,7 +2040,7 @@ static void MwLLForceRenderImpl(MwLL handle) {
} }
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) { static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
int x, y; int x, y, xs, ys;
if(handle->wayland.cursor.setup) { if(handle->wayland.cursor.setup) {
buffer_destroy(&handle->wayland.cursor); buffer_destroy(&handle->wayland.cursor);
@ -2049,11 +2049,15 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
buffer_setup(&handle->wayland.cursor, image->width, image->height); buffer_setup(&handle->wayland.cursor, image->width, image->height);
memset(handle->wayland.cursor.buf, 0, handle->wayland.cursor.buf_size); memset(handle->wayland.cursor.buf, 0, handle->wayland.cursor.buf_size);
xs = -mask->x + image->x;
ys = MwCursorDataHeight + mask->y;
ys = MwCursorDataHeight + image->y - ys;
for(y = 0; y < mask->height; y++) { for(y = 0; y < mask->height; y++) {
unsigned int d = mask->data[y]; unsigned int d = mask->data[y];
for(x = mask->width - 1; x >= 0; x--) { for(x = mask->width - 1; x >= 0; x--) {
int px = 0; int px = 0;
int idx = ((y * mask->width) + x) * 4; int idx = (((y + ys) * mask->width) + (x + xs)) * 4;
if(d & 1) { if(d & 1) {
handle->wayland.cursor.buf[idx + 3] = 255; handle->wayland.cursor.buf[idx + 3] = 255;
@ -2065,7 +2069,7 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
unsigned int d = image->data[y]; unsigned int d = image->data[y];
for(x = image->width - 1; x >= 0; x--) { for(x = image->width - 1; x >= 0; x--) {
int px = 0; int px = 0;
int idx = ((y * image->width) + x) * 4; int idx = (((y + ys) * image->width) + (x + xs)) * 4;
if(d & 1) { if(d & 1) {
px = 255; px = 255;