Implement DMRM message for relative mouse movement.
This commit is contained in:
parent
b52f2e0ca7
commit
2709ae48db
|
@ -166,6 +166,21 @@ static void sSendMouseCallback(uSynergyContext *context)
|
|||
|
||||
|
||||
|
||||
/**
|
||||
@brief Call mouse relative callback after a mouse event
|
||||
**/
|
||||
static void sSendMouseRelativeCallback(uSynergyContext *context, int16_t x, int16_t y)
|
||||
{
|
||||
// Skip if no callback is installed
|
||||
if (context->m_mouseRelativeCallback == 0L)
|
||||
return;
|
||||
|
||||
// Send callback
|
||||
context->m_mouseRelativeCallback(context->m_cookie, x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@brief Send keyboard callback when a key has been pressed or released
|
||||
**/
|
||||
|
@ -319,6 +334,12 @@ static void sProcessMessage(uSynergyContext *context, const uint8_t *message)
|
|||
context->m_mouseY = sNetToNative16(message+10);
|
||||
sSendMouseCallback(context);
|
||||
}
|
||||
else if (USYNERGY_IS_PACKET("DMRM"))
|
||||
{
|
||||
// Mouse relative. Reply with CNOP
|
||||
// kMsgDMouseRelMove = "DMRM%2i%2i"
|
||||
sSendMouseRelativeCallback(context, sNetToNative16(message+8), sNetToNative16(message+10));
|
||||
}
|
||||
else if (USYNERGY_IS_PACKET("DMWM"))
|
||||
{
|
||||
// Mouse wheel
|
||||
|
@ -437,7 +458,6 @@ static void sProcessMessage(uSynergyContext *context, const uint8_t *message)
|
|||
// kMsgCScreenSaver = "CSEC%1i"
|
||||
// kMsgDKeyRepeat = "DKRP%2i%2i%2i%2i"
|
||||
// kMsgDKeyRepeat1_0 = "DKRP%2i%2i%2i"
|
||||
// kMsgDMouseRelMove = "DMRM%2i%2i"
|
||||
// kMsgEIncompatible = "EICV%2i%2i"
|
||||
// kMsgEBusy = "EBSY"
|
||||
// kMsgEUnknown = "EUNK"
|
||||
|
|
|
@ -255,6 +255,19 @@ typedef void (*uSynergyMouseCallback)(uSynergyCookie cookie, uint16_t x, uint16
|
|||
|
||||
|
||||
|
||||
/**
|
||||
@brief Mouse relative callback
|
||||
|
||||
This callback is called when a mouse relative event happens.
|
||||
|
||||
@param cookie Cookie supplied in the Synergy context
|
||||
@param x Mouse X motion
|
||||
@param y Mouse Y motion
|
||||
**/
|
||||
typedef void (*uSynergyMouseRelativeCallback)(uSynergyCookie cookie, int16_t x, int16_t y);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@brief Key event callback
|
||||
|
||||
|
@ -332,6 +345,7 @@ typedef struct
|
|||
uSynergyTraceFunc m_traceFunc; /* Function for tracing status (can be NULL) */
|
||||
uSynergyScreenActiveCallback m_screenActiveCallback; /* Callback for entering and leaving screen */
|
||||
uSynergyMouseCallback m_mouseCallback; /* Callback for mouse events */
|
||||
uSynergyMouseRelativeCallback m_mouseRelativeCallback; /* Callback for mouse relative events */
|
||||
uSynergyKeyboardCallback m_keyboardCallback; /* Callback for keyboard events */
|
||||
uSynergyJoystickCallback m_joystickCallback; /* Callback for joystick events */
|
||||
uSynergyClipboardCallback m_clipboardCallback; /* Callback for clipboard events */
|
||||
|
|
Loading…
Reference in New Issue