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 b708a86d46
commit 949bdc209c
3 changed files with 35 additions and 4 deletions

View File

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

View File

@ -264,3 +264,31 @@ xcb_get_keyboard_mapping_reply_t *xnest_get_keyboard_mapping(
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 count);
void xnest_get_pointer_control(xcb_connection_t *conn, int *acc_num, int *acc_den, int *threshold);
#endif /* __XNEST__XCB_H */