mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 20:28:49 -05:00
Wayland: Don’t reload the cursor on every pointer motion
Previously, any pointer motion in the window decorations when using the fallback implementation would obtain the wl_cursor again, and do the attach danse for no benefit. This will ultimately allow animated cursors to not reset to the first frame on motion, once these will be implemented.
This commit is contained in:
parent
b5d4f24f74
commit
a9f674e719
|
@ -169,6 +169,7 @@ static void setCursor(_GLFWwindow* window, const char* name)
|
||||||
wl_surface_damage(surface, 0, 0,
|
wl_surface_damage(surface, 0, 0,
|
||||||
image->width, image->height);
|
image->width, image->height);
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
|
_glfw.wl.cursorPreviousName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointerHandleMotion(void* data,
|
static void pointerHandleMotion(void* data,
|
||||||
|
@ -178,7 +179,7 @@ static void pointerHandleMotion(void* data,
|
||||||
wl_fixed_t sy)
|
wl_fixed_t sy)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
_GLFWwindow* window = _glfw.wl.pointerFocus;
|
||||||
const char* cursorName;
|
const char* cursorName = NULL;
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
@ -227,7 +228,8 @@ static void pointerHandleMotion(void* data,
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
setCursor(window, cursorName);
|
if (_glfw.wl.cursorPreviousName != cursorName)
|
||||||
|
setCursor(window, cursorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointerHandleButton(void* data,
|
static void pointerHandleButton(void* data,
|
||||||
|
|
|
@ -247,6 +247,7 @@ typedef struct _GLFWlibraryWayland
|
||||||
struct wl_cursor_theme* cursorTheme;
|
struct wl_cursor_theme* cursorTheme;
|
||||||
struct wl_cursor_theme* cursorThemeHiDPI;
|
struct wl_cursor_theme* cursorThemeHiDPI;
|
||||||
struct wl_surface* cursorSurface;
|
struct wl_surface* cursorSurface;
|
||||||
|
const char* cursorPreviousName;
|
||||||
int cursorTimerfd;
|
int cursorTimerfd;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user