mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2026-07-17 16:36:49 +00:00
VNC-14 addressed code review comments
This commit is contained in:
parent
f1a1bd5557
commit
763a6f4972
6 changed files with 55 additions and 13 deletions
|
|
@ -28,9 +28,6 @@
|
|||
#include "vncExtInit.h"
|
||||
#include "RFBGlue.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#endif
|
||||
|
||||
#include "inputstr.h"
|
||||
#if XORG >= 110
|
||||
#include "inpututils.h"
|
||||
|
|
@ -767,7 +764,6 @@ static void vncKeysymKeyboardEvent(KeySym keysym, int down)
|
|||
mieqProcessInputEvents();
|
||||
}
|
||||
|
||||
|
||||
#if INPUTTHREAD
|
||||
/** This function is called in Xserver/os/inputthread.c when starting
|
||||
the input thread. */
|
||||
|
|
|
|||
|
|
@ -513,18 +513,49 @@ void XserverDesktop::pointerEvent(const Point& pos, int buttonMask,
|
|||
|
||||
void XserverDesktop::directMouseEvent(int dx, int dy, int buttonMask,
|
||||
int scrollX, int scrollY)
|
||||
{
|
||||
directMouseEventWithPosition(dx, dy, buttonMask, scrollX, scrollY);
|
||||
}
|
||||
|
||||
rfb::Point XserverDesktop::directMouseEventWithPosition(int dx, int dy,
|
||||
int buttonMask, int scrollX, int scrollY)
|
||||
{
|
||||
// Move the X11 cursor via XTest (relative injection).
|
||||
// buttonMask uses standard VNC convention (bit 0=left, 1=middle, 2=right)
|
||||
// which matches X11 button numbering directly — no remapping needed.
|
||||
// which matches X11 button numbering directly, so no remapping is needed.
|
||||
int cursorX, cursorY;
|
||||
vncGetPointerPos(&cursorX, &cursorY);
|
||||
|
||||
if (scrollX == 0 && scrollY == 0) {
|
||||
vncPointerMoveRelative(dx, dy,
|
||||
vncGetScreenX(screenIndex),
|
||||
vncGetScreenY(screenIndex));
|
||||
const int screenX = vncGetScreenX(screenIndex);
|
||||
const int screenY = vncGetScreenY(screenIndex);
|
||||
const int maxX = screenX + width() - 1;
|
||||
const int maxY = screenY + height() - 1;
|
||||
|
||||
cursorX += dx;
|
||||
cursorY += dy;
|
||||
|
||||
if (cursorX < screenX)
|
||||
cursorX = screenX;
|
||||
else if (cursorX > maxX)
|
||||
cursorX = maxX;
|
||||
|
||||
if (cursorY < screenY)
|
||||
cursorY = screenY;
|
||||
else if (cursorY > maxY)
|
||||
cursorY = maxY;
|
||||
|
||||
vncPointerMoveRelative(dx, dy, cursorX, cursorY);
|
||||
vncPointerButtonAction(buttonMask, false, false);
|
||||
} else {
|
||||
vncScroll(scrollX, scrollY);
|
||||
}
|
||||
|
||||
rfb::Point cursorPos(cursorX - vncGetScreenX(screenIndex),
|
||||
cursorY - vncGetScreenY(screenIndex));
|
||||
oldCursorPos = cursorPos;
|
||||
server->setCursorPos(cursorPos, false);
|
||||
return cursorPos;
|
||||
}
|
||||
|
||||
unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height,
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public:
|
|||
virtual void pointerEvent(const rfb::Point& pos, int buttonMask,
|
||||
const bool skipClick, const bool skipRelease, int scrollX = 0, int scrollY = 0);
|
||||
virtual void directMouseEvent(int dx, int dy, int buttonMask, int scrollX, int scrollY);
|
||||
virtual rfb::Point directMouseEventWithPosition(int dx, int dy, int buttonMask, int scrollX, int scrollY);
|
||||
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
||||
virtual unsigned int setScreenLayout(int fb_width, int fb_height,
|
||||
const rfb::ScreenSet& layout);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue