diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c index 0ccdd58fc..315e415f4 100644 --- a/hw/xnest/Pointer.c +++ b/hw/xnest/Pointer.c @@ -74,10 +74,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); diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index f02f1a17d..39d868dd6 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -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); +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index bf2c80203..410145a18 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -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 */