Add the cell pointer shape

This commit is contained in:
Kovid Goyal 2023-10-16 20:33:12 +05:30
parent 870522a792
commit 187fa996f8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
13 changed files with 42 additions and 22 deletions

View File

@ -119,6 +119,7 @@ characters from the set ``a-z0-9_-``.
.. start list of shape css names (auto generated by gen-key-constants.py do not edit) .. start list of shape css names (auto generated by gen-key-constants.py do not edit)
#. alias #. alias
#. cell
#. copy #. copy
#. crosshair #. crosshair
#. default #. default

View File

@ -28,6 +28,7 @@ help help help,!question_arrow,whats_this help
wait wait wait,!clock,watch wait busybutclickable:arrowCursor wait wait wait,!clock,watch wait busybutclickable:arrowCursor
progress progress progress,half-busy,left_ptr_watch progress busybutclickable:arrowCursor progress progress progress,half-busy,left_ptr_watch progress busybutclickable:arrowCursor
crosshair crosshair crosshair,!tcross crosshair crosshairCursor crosshair crosshair crosshair,!tcross crosshair crosshairCursor
cell cell cell,!plus,!cross cell cell:crosshairCursor
vertical-text vertical-text vertical-text vertical-text IBeamCursorForVerticalLayout vertical-text vertical-text vertical-text vertical-text IBeamCursorForVerticalLayout
move move move,!fleur,pointer-move move move:openHandCursor move move move,!fleur,pointer-move move move:openHandCursor

View File

@ -2556,6 +2556,7 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, GLFWCursorShape shape
S(GLFW_WAIT_CURSOR, busybutclickable, arrowCursor); S(GLFW_WAIT_CURSOR, busybutclickable, arrowCursor);
S(GLFW_PROGRESS_CURSOR, busybutclickable, arrowCursor); S(GLFW_PROGRESS_CURSOR, busybutclickable, arrowCursor);
C(GLFW_CROSSHAIR_CURSOR, crosshairCursor); C(GLFW_CROSSHAIR_CURSOR, crosshairCursor);
S(GLFW_CELL_CURSOR, cell, crosshairCursor);
C(GLFW_VERTICAL_TEXT_CURSOR, IBeamCursorForVerticalLayout); C(GLFW_VERTICAL_TEXT_CURSOR, IBeamCursorForVerticalLayout);
S(GLFW_MOVE_CURSOR, move, openHandCursor); S(GLFW_MOVE_CURSOR, move, openHandCursor);
C(GLFW_E_RESIZE_CURSOR, resizeRightCursor); C(GLFW_E_RESIZE_CURSOR, resizeRightCursor);

1
glfw/glfw3.h vendored
View File

@ -1107,6 +1107,7 @@ typedef enum {
GLFW_WAIT_CURSOR, GLFW_WAIT_CURSOR,
GLFW_PROGRESS_CURSOR, GLFW_PROGRESS_CURSOR,
GLFW_CROSSHAIR_CURSOR, GLFW_CROSSHAIR_CURSOR,
GLFW_CELL_CURSOR,
GLFW_VERTICAL_TEXT_CURSOR, GLFW_VERTICAL_TEXT_CURSOR,
GLFW_MOVE_CURSOR, GLFW_MOVE_CURSOR,
GLFW_E_RESIZE_CURSOR, GLFW_E_RESIZE_CURSOR,

1
glfw/wl_window.c vendored
View File

@ -839,6 +839,7 @@ struct wl_cursor* _glfwLoadCursor(GLFWCursorShape shape, struct wl_cursor_theme*
C(GLFW_WAIT_CURSOR, "wait", "clock", "watch"); C(GLFW_WAIT_CURSOR, "wait", "clock", "watch");
C(GLFW_PROGRESS_CURSOR, "progress", "half-busy", "left_ptr_watch"); C(GLFW_PROGRESS_CURSOR, "progress", "half-busy", "left_ptr_watch");
C(GLFW_CROSSHAIR_CURSOR, "crosshair", "tcross"); C(GLFW_CROSSHAIR_CURSOR, "crosshair", "tcross");
C(GLFW_CELL_CURSOR, "cell", "plus", "cross");
C(GLFW_VERTICAL_TEXT_CURSOR, "vertical-text"); C(GLFW_VERTICAL_TEXT_CURSOR, "vertical-text");
C(GLFW_MOVE_CURSOR, "move", "fleur", "pointer-move"); C(GLFW_MOVE_CURSOR, "move", "fleur", "pointer-move");
C(GLFW_E_RESIZE_CURSOR, "e-resize", "right_side"); C(GLFW_E_RESIZE_CURSOR, "e-resize", "right_side");

1
glfw/x11_window.c vendored
View File

@ -2854,6 +2854,7 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, GLFWCursorShape shape
case GLFW_WAIT_CURSOR: return set_cursor_from_font(cursor, XC_clock); case GLFW_WAIT_CURSOR: return set_cursor_from_font(cursor, XC_clock);
case GLFW_PROGRESS_CURSOR: return try_cursor_names(cursor, 3, "progress", "half-busy", "left_ptr_watch"); case GLFW_PROGRESS_CURSOR: return try_cursor_names(cursor, 3, "progress", "half-busy", "left_ptr_watch");
case GLFW_CROSSHAIR_CURSOR: return set_cursor_from_font(cursor, XC_tcross); case GLFW_CROSSHAIR_CURSOR: return set_cursor_from_font(cursor, XC_tcross);
case GLFW_CELL_CURSOR: return set_cursor_from_font(cursor, XC_plus);
case GLFW_VERTICAL_TEXT_CURSOR: return try_cursor_names(cursor, 1, "vertical-text"); case GLFW_VERTICAL_TEXT_CURSOR: return try_cursor_names(cursor, 1, "vertical-text");
case GLFW_MOVE_CURSOR: return set_cursor_from_font(cursor, XC_fleur); case GLFW_MOVE_CURSOR: return set_cursor_from_font(cursor, XC_fleur);
case GLFW_E_RESIZE_CURSOR: return set_cursor_from_font(cursor, XC_right_side); case GLFW_E_RESIZE_CURSOR: return set_cursor_from_font(cursor, XC_right_side);

View File

@ -78,6 +78,7 @@ typedef enum MouseShapes {
WAIT_POINTER, WAIT_POINTER,
PROGRESS_POINTER, PROGRESS_POINTER,
CROSSHAIR_POINTER, CROSSHAIR_POINTER,
CELL_POINTER,
VERTICAL_TEXT_POINTER, VERTICAL_TEXT_POINTER,
MOVE_POINTER, MOVE_POINTER,
E_RESIZE_POINTER, E_RESIZE_POINTER,

1
kitty/glfw-wrapper.h generated
View File

@ -845,6 +845,7 @@ typedef enum {
GLFW_WAIT_CURSOR, GLFW_WAIT_CURSOR,
GLFW_PROGRESS_CURSOR, GLFW_PROGRESS_CURSOR,
GLFW_CROSSHAIR_CURSOR, GLFW_CROSSHAIR_CURSOR,
GLFW_CELL_CURSOR,
GLFW_VERTICAL_TEXT_CURSOR, GLFW_VERTICAL_TEXT_CURSOR,
GLFW_MOVE_CURSOR, GLFW_MOVE_CURSOR,
GLFW_E_RESIZE_CURSOR, GLFW_E_RESIZE_CURSOR,

View File

@ -703,6 +703,7 @@ set_mouse_cursor(MouseShape type) {
case WAIT_POINTER: set_glfw_mouse_cursor(w, GLFW_WAIT_CURSOR); break; case WAIT_POINTER: set_glfw_mouse_cursor(w, GLFW_WAIT_CURSOR); break;
case PROGRESS_POINTER: set_glfw_mouse_cursor(w, GLFW_PROGRESS_CURSOR); break; case PROGRESS_POINTER: set_glfw_mouse_cursor(w, GLFW_PROGRESS_CURSOR); break;
case CROSSHAIR_POINTER: set_glfw_mouse_cursor(w, GLFW_CROSSHAIR_CURSOR); break; case CROSSHAIR_POINTER: set_glfw_mouse_cursor(w, GLFW_CROSSHAIR_CURSOR); break;
case CELL_POINTER: set_glfw_mouse_cursor(w, GLFW_CELL_CURSOR); break;
case VERTICAL_TEXT_POINTER: set_glfw_mouse_cursor(w, GLFW_VERTICAL_TEXT_CURSOR); break; case VERTICAL_TEXT_POINTER: set_glfw_mouse_cursor(w, GLFW_VERTICAL_TEXT_CURSOR); break;
case MOVE_POINTER: set_glfw_mouse_cursor(w, GLFW_MOVE_CURSOR); break; case MOVE_POINTER: set_glfw_mouse_cursor(w, GLFW_MOVE_CURSOR); break;
case E_RESIZE_POINTER: set_glfw_mouse_cursor(w, GLFW_E_RESIZE_CURSOR); break; case E_RESIZE_POINTER: set_glfw_mouse_cursor(w, GLFW_E_RESIZE_CURSOR); break;
@ -1740,6 +1741,7 @@ pointer_name_to_glfw_name(const char *name) {
if (strcmp(name, "wait") == 0) return GLFW_WAIT_CURSOR; if (strcmp(name, "wait") == 0) return GLFW_WAIT_CURSOR;
if (strcmp(name, "progress") == 0) return GLFW_PROGRESS_CURSOR; if (strcmp(name, "progress") == 0) return GLFW_PROGRESS_CURSOR;
if (strcmp(name, "crosshair") == 0) return GLFW_CROSSHAIR_CURSOR; if (strcmp(name, "crosshair") == 0) return GLFW_CROSSHAIR_CURSOR;
if (strcmp(name, "cell") == 0) return GLFW_CELL_CURSOR;
if (strcmp(name, "vertical-text") == 0) return GLFW_VERTICAL_TEXT_CURSOR; if (strcmp(name, "vertical-text") == 0) return GLFW_VERTICAL_TEXT_CURSOR;
if (strcmp(name, "move") == 0) return GLFW_MOVE_CURSOR; if (strcmp(name, "move") == 0) return GLFW_MOVE_CURSOR;
if (strcmp(name, "e-resize") == 0) return GLFW_E_RESIZE_CURSOR; if (strcmp(name, "e-resize") == 0) return GLFW_E_RESIZE_CURSOR;
@ -1787,6 +1789,7 @@ glfw_name_to_css_pointer_name(GLFWCursorShape q) {
case GLFW_WAIT_CURSOR: return "wait"; case GLFW_WAIT_CURSOR: return "wait";
case GLFW_PROGRESS_CURSOR: return "progress"; case GLFW_PROGRESS_CURSOR: return "progress";
case GLFW_CROSSHAIR_CURSOR: return "crosshair"; case GLFW_CROSSHAIR_CURSOR: return "crosshair";
case GLFW_CELL_CURSOR: return "cell";
case GLFW_VERTICAL_TEXT_CURSOR: return "vertical-text"; case GLFW_VERTICAL_TEXT_CURSOR: return "vertical-text";
case GLFW_MOVE_CURSOR: return "move"; case GLFW_MOVE_CURSOR: return "move";
case GLFW_E_RESIZE_CURSOR: return "e-resize"; case GLFW_E_RESIZE_CURSOR: return "e-resize";

View File

@ -601,6 +601,7 @@ pointer_shape_names = (
'wait', 'wait',
'progress', 'progress',
'crosshair', 'crosshair',
'cell',
'vertical-text', 'vertical-text',
'move', 'move',
'e-resize', 'e-resize',

View File

@ -144,6 +144,7 @@ pointer_shape(PyObject *shape_name) {
else if (strcmp(name, "wait") == 0) return WAIT_POINTER; else if (strcmp(name, "wait") == 0) return WAIT_POINTER;
else if (strcmp(name, "progress") == 0) return PROGRESS_POINTER; else if (strcmp(name, "progress") == 0) return PROGRESS_POINTER;
else if (strcmp(name, "crosshair") == 0) return CROSSHAIR_POINTER; else if (strcmp(name, "crosshair") == 0) return CROSSHAIR_POINTER;
else if (strcmp(name, "cell") == 0) return CELL_POINTER;
else if (strcmp(name, "vertical-text") == 0) return VERTICAL_TEXT_POINTER; else if (strcmp(name, "vertical-text") == 0) return VERTICAL_TEXT_POINTER;
else if (strcmp(name, "move") == 0) return MOVE_POINTER; else if (strcmp(name, "move") == 0) return MOVE_POINTER;
else if (strcmp(name, "e-resize") == 0) return E_RESIZE_POINTER; else if (strcmp(name, "e-resize") == 0) return E_RESIZE_POINTER;

View File

@ -1164,6 +1164,7 @@ current_pointer_shape(Screen *self, PyObject *args UNUSED) {
case WAIT_POINTER: ans = "wait"; break; case WAIT_POINTER: ans = "wait"; break;
case PROGRESS_POINTER: ans = "progress"; break; case PROGRESS_POINTER: ans = "progress"; break;
case CROSSHAIR_POINTER: ans = "crosshair"; break; case CROSSHAIR_POINTER: ans = "crosshair"; break;
case CELL_POINTER: ans = "cell"; break;
case VERTICAL_TEXT_POINTER: ans = "vertical-text"; break; case VERTICAL_TEXT_POINTER: ans = "vertical-text"; break;
case MOVE_POINTER: ans = "move"; break; case MOVE_POINTER: ans = "move"; break;
case E_RESIZE_POINTER: ans = "e-resize"; break; case E_RESIZE_POINTER: ans = "e-resize"; break;
@ -1212,6 +1213,7 @@ change_pointer_shape(Screen *self, PyObject *args) {
else if (strcmp("wait", css_name) == 0) s = WAIT_POINTER; else if (strcmp("wait", css_name) == 0) s = WAIT_POINTER;
else if (strcmp("progress", css_name) == 0) s = PROGRESS_POINTER; else if (strcmp("progress", css_name) == 0) s = PROGRESS_POINTER;
else if (strcmp("crosshair", css_name) == 0) s = CROSSHAIR_POINTER; else if (strcmp("crosshair", css_name) == 0) s = CROSSHAIR_POINTER;
else if (strcmp("cell", css_name) == 0) s = CELL_POINTER;
else if (strcmp("vertical-text", css_name) == 0) s = VERTICAL_TEXT_POINTER; else if (strcmp("vertical-text", css_name) == 0) s = VERTICAL_TEXT_POINTER;
else if (strcmp("move", css_name) == 0) s = MOVE_POINTER; else if (strcmp("move", css_name) == 0) s = MOVE_POINTER;
else if (strcmp("e-resize", css_name) == 0) s = E_RESIZE_POINTER; else if (strcmp("e-resize", css_name) == 0) s = E_RESIZE_POINTER;
@ -1247,6 +1249,8 @@ change_pointer_shape(Screen *self, PyObject *args) {
else if (strcmp("half-busy", css_name) == 0) s = PROGRESS_POINTER; else if (strcmp("half-busy", css_name) == 0) s = PROGRESS_POINTER;
else if (strcmp("left_ptr_watch", css_name) == 0) s = PROGRESS_POINTER; else if (strcmp("left_ptr_watch", css_name) == 0) s = PROGRESS_POINTER;
else if (strcmp("tcross", css_name) == 0) s = CROSSHAIR_POINTER; else if (strcmp("tcross", css_name) == 0) s = CROSSHAIR_POINTER;
else if (strcmp("plus", css_name) == 0) s = CELL_POINTER;
else if (strcmp("cross", css_name) == 0) s = CELL_POINTER;
else if (strcmp("fleur", css_name) == 0) s = MOVE_POINTER; else if (strcmp("fleur", css_name) == 0) s = MOVE_POINTER;
else if (strcmp("pointer-move", css_name) == 0) s = MOVE_POINTER; else if (strcmp("pointer-move", css_name) == 0) s = MOVE_POINTER;
else if (strcmp("right_side", css_name) == 0) s = E_RESIZE_POINTER; else if (strcmp("right_side", css_name) == 0) s = E_RESIZE_POINTER;

View File

@ -45,28 +45,29 @@ const (
WAIT_POINTER PointerShape = 4 WAIT_POINTER PointerShape = 4
PROGRESS_POINTER PointerShape = 5 PROGRESS_POINTER PointerShape = 5
CROSSHAIR_POINTER PointerShape = 6 CROSSHAIR_POINTER PointerShape = 6
VERTICAL_TEXT_POINTER PointerShape = 7 CELL_POINTER PointerShape = 7
MOVE_POINTER PointerShape = 8 VERTICAL_TEXT_POINTER PointerShape = 8
E_RESIZE_POINTER PointerShape = 9 MOVE_POINTER PointerShape = 9
NE_RESIZE_POINTER PointerShape = 10 E_RESIZE_POINTER PointerShape = 10
NW_RESIZE_POINTER PointerShape = 11 NE_RESIZE_POINTER PointerShape = 11
N_RESIZE_POINTER PointerShape = 12 NW_RESIZE_POINTER PointerShape = 12
SE_RESIZE_POINTER PointerShape = 13 N_RESIZE_POINTER PointerShape = 13
SW_RESIZE_POINTER PointerShape = 14 SE_RESIZE_POINTER PointerShape = 14
S_RESIZE_POINTER PointerShape = 15 SW_RESIZE_POINTER PointerShape = 15
W_RESIZE_POINTER PointerShape = 16 S_RESIZE_POINTER PointerShape = 16
EW_RESIZE_POINTER PointerShape = 17 W_RESIZE_POINTER PointerShape = 17
NS_RESIZE_POINTER PointerShape = 18 EW_RESIZE_POINTER PointerShape = 18
NESW_RESIZE_POINTER PointerShape = 19 NS_RESIZE_POINTER PointerShape = 19
NWSE_RESIZE_POINTER PointerShape = 20 NESW_RESIZE_POINTER PointerShape = 20
ZOOM_IN_POINTER PointerShape = 21 NWSE_RESIZE_POINTER PointerShape = 21
ZOOM_OUT_POINTER PointerShape = 22 ZOOM_IN_POINTER PointerShape = 22
ALIAS_POINTER PointerShape = 23 ZOOM_OUT_POINTER PointerShape = 23
COPY_POINTER PointerShape = 24 ALIAS_POINTER PointerShape = 24
NOT_ALLOWED_POINTER PointerShape = 25 COPY_POINTER PointerShape = 25
NO_DROP_POINTER PointerShape = 26 NOT_ALLOWED_POINTER PointerShape = 26
GRAB_POINTER PointerShape = 27 NO_DROP_POINTER PointerShape = 27
GRABBING_POINTER PointerShape = 28 GRAB_POINTER PointerShape = 28
GRABBING_POINTER PointerShape = 29
// end pointer shape enum // end pointer shape enum
) )
@ -88,6 +89,8 @@ func (e PointerShape) String() string {
return "progress" return "progress"
case CROSSHAIR_POINTER: case CROSSHAIR_POINTER:
return "crosshair" return "crosshair"
case CELL_POINTER:
return "cell"
case VERTICAL_TEXT_POINTER: case VERTICAL_TEXT_POINTER:
return "vertical-text" return "vertical-text"
case MOVE_POINTER: case MOVE_POINTER: