(!1654) Xnest: replace XGetKeyboardControl() by xcb_get_keyboard_control()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-08-13 19:21:16 +02:00
parent 0606dce445
commit 1f54e50281

View File

@ -98,7 +98,6 @@ int
xnestKeyboardProc(DeviceIntPtr pDev, int onoff) xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
{ {
int i, j; int i, j;
XKeyboardState values;
switch (onoff) { switch (onoff) {
case DEVICE_INIT: case DEVICE_INIT:
@ -240,10 +239,27 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
} }
return Success; return Success;
XkbError: XkbError:
XGetKeyboardControl(xnestDisplay, &values); {
memmove((char *) defaultKeyboardControl.autoRepeats, xcb_generic_error_t *ctrl_err = NULL;
(char *) values.auto_repeats, sizeof(values.auto_repeats)); xcb_get_keyboard_control_reply_t *ctrl_reply =
xcb_get_keyboard_control_reply(xnestUpstreamInfo.conn,
xcb_get_keyboard_control(xnestUpstreamInfo.conn),
&ctrl_err);
if (ctrl_err) {
ErrorF("failed retrieving keyboard control: %d\n", ctrl_err->error_code);
free(ctrl_err);
}
else if (!ctrl_reply) {
ErrorF("failed retrieving keyboard control: no reply\n");
}
else {
memcpy(defaultKeyboardControl.autoRepeats,
ctrl_reply->auto_repeats,
sizeof(ctrl_reply->auto_repeats));
free(ctrl_reply);
}
}
InitKeyboardDeviceStruct(pDev, NULL, xnestBell, xnestChangeKeyboardControl); InitKeyboardDeviceStruct(pDev, NULL, xnestBell, xnestChangeKeyboardControl);
return Success; return Success;