diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c index 5978332d3..d4e1037c4 100644 --- a/hw/xnest/Pointer.c +++ b/hw/xnest/Pointer.c @@ -76,10 +76,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); + xnestGetPointerControl(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 d995dcd21..a95b35b3f 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -364,3 +364,31 @@ xcb_get_keyboard_mapping_reply_t *xnestGetKeyboardMapping( return reply; } + +void xnestGetPointerControl( + 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 b60fd9f1a..9c51c1c5e 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -115,4 +115,6 @@ xcb_get_keyboard_mapping_reply_t *xnestGetKeyboardMapping( int count ); +void xnestGetPointerControl(xcb_connection_t *conn, int *acc_num, int *acc_den, int *threshold); + #endif /* __XNEST__XCB_H */