}
#endif /* XORG < 111 */
-InputDevice::InputDevice(rfb::VNCServerST *_server)
- : server(_server), initialized(false), oldButtonMask(0)
+InputDevice::InputDevice()
+ : initialized(false), oldButtonMask(0)
{
int i;
cursorPos = pos;
}
-void InputDevice::PointerSync(void)
+const rfb::Point &InputDevice::getPointerPos(void)
{
- if (cursorPos.equals(oldCursorPos))
- return;
-
- oldCursorPos = cursorPos;
- server->setCursorPos(cursorPos);
+ return cursorPos;
}
static int pointerProc(DeviceIntPtr pDevice, int onoff)
#include <list>
-#include <rfb/VNCServerST.h>
+#include <rdr/types.h>
+#include <rfb/Rect.h>
extern "C" {
#include "input.h"
+/* The Xorg headers define macros that wreak havoc with STL */
+#undef max
};
#include "xorg-version.h"
class InputDevice {
public:
/* Create new InputDevice instance */
- InputDevice(rfb::VNCServerST *_server);
+ InputDevice();
/*
* Press or release buttons. Relationship between buttonMask and
/* Move pointer to target location (point coords are absolute). */
void PointerMove(const rfb::Point &point);
- /*
- * Send pointer position to clients. If not called then Move() calls
- * won't be visible to VNC clients.
- */
- void PointerSync(void);
+ /* Get current known location of the pointer */
+ const rfb::Point &getPointerPos(void);
+ /* Press or release one or more keys to get the given symbol */
void KeyboardPress(rdr::U32 keysym) { keyEvent(keysym, true); }
void KeyboardRelease(rdr::U32 keysym) { keyEvent(keysym, false); }
#endif
private:
- rfb::VNCServerST *server;
bool initialized;
DeviceIntPtr keyboardDev;
DeviceIntPtr pointerDev;
int oldButtonMask;
- rfb::Point cursorPos, oldCursorPos;
+ rfb::Point cursorPos;
KeySym pressedKeys[256];
};
}
}
- inputDevice->PointerSync();
+ // We are responsible for propagating mouse movement between clients
+ if (!oldCursorPos.equals(inputDevice->getPointerPos())) {
+ oldCursorPos = inputDevice->getPointerPos();
+ server->setCursorPos(oldCursorPos);
+ }
}
// Then let the timers do some processing. Rescheduling is done in