Rationalize mouse cursor shape handling

Now can use the full range of standard mouse cursor shapes similar to
those supported by browsers via the CSS cursor property.

Still needs to be fully implemented for cocoa backend.
This commit is contained in:
Kovid Goyal
2023-10-15 09:05:05 +05:30
parent a8a1571ed1
commit 4f1971c480
17 changed files with 493 additions and 122 deletions

12
glfw/wl_init.c vendored
View File

@@ -177,7 +177,7 @@ static void pointerHandleMotion(void* data UNUSED,
wl_fixed_t sy)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
GLFWCursorShape cursorShape = GLFW_ARROW_CURSOR;
GLFWCursorShape cursorShape = GLFW_DEFAULT_CURSOR;
if (!window)
return;
@@ -197,21 +197,21 @@ static void pointerHandleMotion(void* data UNUSED,
return;
case TOP_DECORATION:
if (y < window->wl.decorations.metrics.width)
cursorShape = GLFW_VRESIZE_CURSOR;
cursorShape = GLFW_N_RESIZE_CURSOR;
else
cursorShape = GLFW_ARROW_CURSOR;
cursorShape = GLFW_DEFAULT_CURSOR;
break;
case LEFT_DECORATION:
if (y < window->wl.decorations.metrics.width)
cursorShape = GLFW_NW_RESIZE_CURSOR;
else
cursorShape = GLFW_HRESIZE_CURSOR;
cursorShape = GLFW_W_RESIZE_CURSOR;
break;
case RIGHT_DECORATION:
if (y < window->wl.decorations.metrics.width)
cursorShape = GLFW_NE_RESIZE_CURSOR;
else
cursorShape = GLFW_HRESIZE_CURSOR;
cursorShape = GLFW_E_RESIZE_CURSOR;
break;
case BOTTOM_DECORATION:
if (x < window->wl.decorations.metrics.width)
@@ -219,7 +219,7 @@ static void pointerHandleMotion(void* data UNUSED,
else if (x > window->wl.width + window->wl.decorations.metrics.width)
cursorShape = GLFW_SE_RESIZE_CURSOR;
else
cursorShape = GLFW_VRESIZE_CURSOR;
cursorShape = GLFW_S_RESIZE_CURSOR;
break;
default:
assert(0);