Wayland: Obtain keyboard repeat_info

This had to bump the seat version, we now may get the seat name but we
don’t do anything with it.
This commit is contained in:
Emmanuel Gil Peyrot 2017-11-17 01:24:01 +00:00 committed by linkmauve
parent f4cd470bcb
commit c14a35e21e
2 changed files with 27 additions and 2 deletions

View File

@ -422,12 +422,25 @@ static void keyboardHandleModifiers(void* data,
_glfw.wl.xkb.modifiers = modifiers; _glfw.wl.xkb.modifiers = modifiers;
} }
static void keyboardHandleRepeatInfo(void* data,
struct wl_keyboard* keyboard,
int32_t rate,
int32_t delay)
{
if (keyboard != _glfw.wl.keyboard)
return;
_glfw.wl.keyboardRepeatRate = rate;
_glfw.wl.keyboardRepeatDelay = delay;
}
static const struct wl_keyboard_listener keyboardListener = { static const struct wl_keyboard_listener keyboardListener = {
keyboardHandleKeymap, keyboardHandleKeymap,
keyboardHandleEnter, keyboardHandleEnter,
keyboardHandleLeave, keyboardHandleLeave,
keyboardHandleKey, keyboardHandleKey,
keyboardHandleModifiers, keyboardHandleModifiers,
keyboardHandleRepeatInfo,
}; };
static void seatHandleCapabilities(void* data, static void seatHandleCapabilities(void* data,
@ -457,8 +470,15 @@ static void seatHandleCapabilities(void* data,
} }
} }
static void seatHandleName(void* data,
struct wl_seat* seat,
const char* name)
{
}
static const struct wl_seat_listener seatListener = { static const struct wl_seat_listener seatListener = {
seatHandleCapabilities seatHandleCapabilities,
seatHandleName,
}; };
static void wmBaseHandlePing(void* data, static void wmBaseHandlePing(void* data,
@ -503,8 +523,10 @@ static void registryHandleGlobal(void* data,
{ {
if (!_glfw.wl.seat) if (!_glfw.wl.seat)
{ {
_glfw.wl.seatVersion = min(4, version);
_glfw.wl.seat = _glfw.wl.seat =
wl_registry_bind(registry, name, &wl_seat_interface, 1); wl_registry_bind(registry, name, &wl_seat_interface,
_glfw.wl.seatVersion);
wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL);
} }
} }

View File

@ -200,11 +200,14 @@ typedef struct _GLFWlibraryWayland
struct zwp_idle_inhibit_manager_v1* idleInhibitManager; struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
int compositorVersion; int compositorVersion;
int seatVersion;
struct wl_cursor_theme* cursorTheme; struct wl_cursor_theme* cursorTheme;
struct wl_surface* cursorSurface; struct wl_surface* cursorSurface;
uint32_t pointerSerial; uint32_t pointerSerial;
int32_t keyboardRepeatRate;
int32_t keyboardRepeatDelay;
short int keycodes[256]; short int keycodes[256];
short int scancodes[GLFW_KEY_LAST + 1]; short int scancodes[GLFW_KEY_LAST + 1];