mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-20 20:22:10 +00:00
Also output pointer shape changes when debugging
This commit is contained in:
parent
db3a49fc4b
commit
006a047276
1 changed files with 12 additions and 6 deletions
18
glfw/wl_window.c
vendored
18
glfw/wl_window.c
vendored
|
|
@ -156,9 +156,14 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image, bool is_opaque,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static int
|
||||
typedef struct wayland_cursor_shape {
|
||||
int which; const char *name;
|
||||
} wayland_cursor_shape;
|
||||
|
||||
static wayland_cursor_shape
|
||||
glfw_cursor_shape_to_wayland_cursor_shape(GLFWCursorShape g) {
|
||||
#define C(g, w) case g: return w;
|
||||
wayland_cursor_shape ans = {-1, ""};
|
||||
#define C(g, w) case g: ans.which = w; ans.name = #w; return ans;
|
||||
switch(g) {
|
||||
/* start glfw to wayland mapping (auto generated by gen-key-constants.py do not edit) */
|
||||
C(GLFW_DEFAULT_CURSOR, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT);
|
||||
|
|
@ -192,7 +197,7 @@ glfw_cursor_shape_to_wayland_cursor_shape(GLFWCursorShape g) {
|
|||
C(GLFW_GRAB_CURSOR, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRAB);
|
||||
C(GLFW_GRABBING_CURSOR, WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRABBING);
|
||||
/* end glfw to wayland mapping */
|
||||
default: return -1;
|
||||
default: return ans;
|
||||
}
|
||||
#undef C
|
||||
}
|
||||
|
|
@ -217,9 +222,10 @@ setCursorImage(_GLFWwindow* window, bool on_theme_change) {
|
|||
_GLFWcursorWayland defaultCursor = {.shape = GLFW_DEFAULT_CURSOR};
|
||||
_GLFWcursorWayland* cursorWayland = window->cursor ? &window->cursor->wl : &defaultCursor;
|
||||
if (_glfw.wl.wp_cursor_shape_device_v1) {
|
||||
int which = glfw_cursor_shape_to_wayland_cursor_shape(cursorWayland->shape);
|
||||
if (which > -1) {
|
||||
wp_cursor_shape_device_v1_set_shape(_glfw.wl.wp_cursor_shape_device_v1, _glfw.wl.pointer_enter_serial, (uint32_t)which);
|
||||
wayland_cursor_shape s = glfw_cursor_shape_to_wayland_cursor_shape(cursorWayland->shape);
|
||||
if (s.which > -1) {
|
||||
debug("Changing cursor shape to: %s with serial: %u\n", s.name, _glfw.wl.pointer_enter_serial);
|
||||
wp_cursor_shape_device_v1_set_shape(_glfw.wl.wp_cursor_shape_device_v1, _glfw.wl.pointer_enter_serial, (uint32_t)s.which);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue