(!1654) Xnest: replace XGetPointerControl() by xcb_get_pointer_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 18:33:20 +02:00
parent 08dcfe0270
commit ce7e99afb5
3 changed files with 35 additions and 4 deletions

View File

@ -74,10 +74,11 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff)
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
XGetPointerControl(xnestDisplay, xnest_get_pointer_control(xnestUpstreamInfo.conn,
&defaultPointerControl.num, &defaultPointerControl.num,
&defaultPointerControl.den, &defaultPointerControl.den,
&defaultPointerControl.threshold); &defaultPointerControl.threshold);
InitPointerDeviceStruct(&pDev->public, map, nmap, btn_labels, InitPointerDeviceStruct(&pDev->public, map, nmap, btn_labels,
xnestChangePointerControl, xnestChangePointerControl,
GetMotionHistorySize(), 2, axes_labels); GetMotionHistorySize(), 2, axes_labels);

View File

@ -264,3 +264,31 @@ xcb_get_keyboard_mapping_reply_t *xnest_get_keyboard_mapping(
return reply; return reply;
} }
void xnest_get_pointer_control(
xcb_connection_t *conn,
int *acc_num,
int *acc_den,
int *threshold)
{
xcb_generic_error_t *err = NULL;
xcb_get_pointer_control_reply_t *reply = xcb_get_pointer_control_reply(
xnestUpstreamInfo.conn,
xcb_get_pointer_control(xnestUpstreamInfo.conn),
&err);
if (err) {
ErrorF("error retrieving pointer control data: %d\n", err->error_code);
free(err);
}
if (!reply) {
ErrorF("error retrieving pointer control data: no reply\n");
return;
}
*acc_num = reply->acceleration_numerator;
*acc_den = reply->acceleration_denominator;
*threshold = reply->threshold;
free(reply);
}

View File

@ -41,4 +41,6 @@ xcb_get_keyboard_mapping_reply_t *xnest_get_keyboard_mapping(xcb_connection_t *c
int min_keycode, int min_keycode,
int count); int count);
void xnest_get_pointer_control(xcb_connection_t *conn, int *acc_num, int *acc_den, int *threshold);
#endif /* __XNEST__XCB_H */ #endif /* __XNEST__XCB_H */