mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-01-08 15:08:47 +01:00
Merge branch 'toggle-game-mode' into 'master'
Toggle game mode See merge request kasm-technologies/internal/KasmVNC!42
This commit is contained in:
commit
2959156a25
@ -36,6 +36,7 @@ namespace rfb {
|
|||||||
rdr::U32 __unused_attr keycode,
|
rdr::U32 __unused_attr keycode,
|
||||||
bool __unused_attr down) { }
|
bool __unused_attr down) { }
|
||||||
virtual void pointerEvent(const Point& __unused_attr pos,
|
virtual void pointerEvent(const Point& __unused_attr pos,
|
||||||
|
const Point& __unused_attr abspos,
|
||||||
int __unused_attr buttonMask,
|
int __unused_attr buttonMask,
|
||||||
const bool __unused_attr skipClick,
|
const bool __unused_attr skipClick,
|
||||||
const bool __unused_attr skipRelease,
|
const bool __unused_attr skipRelease,
|
||||||
|
@ -226,7 +226,8 @@ void SMsgReader::readPointerEvent()
|
|||||||
int y = is->readU16();
|
int y = is->readU16();
|
||||||
int scrollX = is->readS16();
|
int scrollX = is->readS16();
|
||||||
int scrollY = is->readS16();
|
int scrollY = is->readS16();
|
||||||
handler->pointerEvent(Point(x, y), mask, false, false, scrollX, scrollY);
|
|
||||||
|
handler->pointerEvent(Point(x, y), Point(0, 0), mask, false, false, scrollX, scrollY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ void VNCSConnectionST::setPixelFormat(const PixelFormat& pf)
|
|||||||
setCursor();
|
setCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY)
|
void VNCSConnectionST::pointerEvent(const Point& pos, const Point& abspos, int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY)
|
||||||
{
|
{
|
||||||
pointerEventTime = lastEventTime = time(0);
|
pointerEventTime = lastEventTime = time(0);
|
||||||
server->lastUserInputTime = lastEventTime;
|
server->lastUserInputTime = lastEventTime;
|
||||||
@ -725,7 +725,45 @@ void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool
|
|||||||
}
|
}
|
||||||
if (!rfb::Server::acceptPointerEvents) return;
|
if (!rfb::Server::acceptPointerEvents) return;
|
||||||
if (!server->pointerClient || server->pointerClient == this) {
|
if (!server->pointerClient || server->pointerClient == this) {
|
||||||
pointerEventPos = pos;
|
Point newpos = pos;
|
||||||
|
if (pos.x & 0x4000) {
|
||||||
|
newpos.x &= ~0x4000;
|
||||||
|
newpos.y &= ~0x4000;
|
||||||
|
|
||||||
|
if (newpos.x & 0x8000) {
|
||||||
|
newpos.x &= ~0x8000;
|
||||||
|
newpos.x = -newpos.x;
|
||||||
|
}
|
||||||
|
if (newpos.y & 0x8000) {
|
||||||
|
newpos.y &= ~0x8000;
|
||||||
|
newpos.y = -newpos.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newpos.x < 0) {
|
||||||
|
if (pointerEventPos.x + newpos.x >= 0)
|
||||||
|
pointerEventPos.x += newpos.x;
|
||||||
|
else
|
||||||
|
pointerEventPos.x = 0;
|
||||||
|
} else {
|
||||||
|
pointerEventPos.x += newpos.x;
|
||||||
|
if (pointerEventPos.x >= cp.width)
|
||||||
|
pointerEventPos.x = cp.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newpos.y < 0) {
|
||||||
|
if (pointerEventPos.y + newpos.y >= 0)
|
||||||
|
pointerEventPos.y += newpos.y;
|
||||||
|
else
|
||||||
|
pointerEventPos.y = 0;
|
||||||
|
} else {
|
||||||
|
pointerEventPos.y += newpos.y;
|
||||||
|
if (pointerEventPos.y >= cp.height)
|
||||||
|
pointerEventPos.y = cp.height;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pointerEventPos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
if (buttonMask)
|
if (buttonMask)
|
||||||
server->pointerClient = this;
|
server->pointerClient = this;
|
||||||
else
|
else
|
||||||
@ -746,7 +784,7 @@ void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server->desktop->pointerEvent(pointerEventPos, buttonMask, skipclick, skiprelease, scrollX, scrollY);
|
server->desktop->pointerEvent(newpos, pointerEventPos, buttonMask, skipclick, skiprelease, scrollX, scrollY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ namespace rfb {
|
|||||||
virtual void queryConnection(const char* userName);
|
virtual void queryConnection(const char* userName);
|
||||||
virtual void clientInit(bool shared);
|
virtual void clientInit(bool shared);
|
||||||
virtual void setPixelFormat(const PixelFormat& pf);
|
virtual void setPixelFormat(const PixelFormat& pf);
|
||||||
virtual void pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY);
|
virtual void pointerEvent(const Point& pos, const Point& abspos,int buttonMask, const bool skipClick, const bool skipRelease, int scrollX, int scrollY);
|
||||||
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
||||||
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
|
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
|
||||||
virtual void setDesktopSize(int fb_width, int fb_height,
|
virtual void setDesktopSize(int fb_width, int fb_height,
|
||||||
|
2
kasmweb
2
kasmweb
@ -1 +1 @@
|
|||||||
Subproject commit 6c708d8254103594b0435663eb73f3b0dba2b2e3
|
Subproject commit 41e9ae92c137ce07559c94a5abcf5cf29ef15ca6
|
@ -239,6 +239,40 @@ void vncPointerMove(int x, int y)
|
|||||||
cursorPosY = y;
|
cursorPosY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vncPointerMoveRelative(int x, int y, int absx, int absy)
|
||||||
|
{
|
||||||
|
int valuators[2];
|
||||||
|
#if XORG < 111
|
||||||
|
int n;
|
||||||
|
#endif
|
||||||
|
#if XORG >= 110
|
||||||
|
ValuatorMask mask;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// if (cursorPosX == absx && cursorPosY == absy)
|
||||||
|
// return;
|
||||||
|
|
||||||
|
valuators[0] = x;
|
||||||
|
valuators[1] = y;
|
||||||
|
#if XORG < 110
|
||||||
|
n = GetPointerEvents(eventq, vncPointerDev, MotionNotify, 0,
|
||||||
|
POINTER_RELATIVE, 0, 2, valuators);
|
||||||
|
enqueueEvents(vncPointerDev, n);
|
||||||
|
#elif XORG < 111
|
||||||
|
valuator_mask_set_range(&mask, 0, 2, valuators);
|
||||||
|
n = GetPointerEvents(eventq, vncPointerDev, MotionNotify, 0,
|
||||||
|
POINTER_RELATIVE, &mask);
|
||||||
|
enqueueEvents(vncPointerDev, n);
|
||||||
|
#else
|
||||||
|
valuator_mask_set_range(&mask, 0, 2, valuators);
|
||||||
|
QueuePointerEvents(vncPointerDev, MotionNotify, 0,
|
||||||
|
POINTER_RELATIVE, &mask);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cursorPosX = absx;
|
||||||
|
cursorPosY = absy;
|
||||||
|
}
|
||||||
|
|
||||||
void vncScroll(int x, int y) {
|
void vncScroll(int x, int y) {
|
||||||
ValuatorMask mask;
|
ValuatorMask mask;
|
||||||
valuator_mask_zero(&mask);
|
valuator_mask_zero(&mask);
|
||||||
|
@ -36,6 +36,8 @@ void vncInitInputDevice(bool freeKeyMappings);
|
|||||||
void vncPointerButtonAction(int buttonMask, const unsigned char skipclick,
|
void vncPointerButtonAction(int buttonMask, const unsigned char skipclick,
|
||||||
const unsigned char skiprelease);
|
const unsigned char skiprelease);
|
||||||
void vncPointerMove(int x, int y);
|
void vncPointerMove(int x, int y);
|
||||||
|
void vncPointerMoveRelative(int x, int y, int absx, int absy);
|
||||||
|
|
||||||
void vncScroll(int x, int y);
|
void vncScroll(int x, int y);
|
||||||
void vncGetPointerPos(int *x, int *y);
|
void vncGetPointerPos(int *x, int *y);
|
||||||
|
|
||||||
|
@ -461,12 +461,17 @@ void XserverDesktop::approveConnection(uint32_t opaqueId, bool accept,
|
|||||||
//
|
//
|
||||||
// SDesktop callbacks
|
// SDesktop callbacks
|
||||||
|
|
||||||
|
void XserverDesktop::pointerEvent(const Point& pos, const Point& abspos, int buttonMask,
|
||||||
void XserverDesktop::pointerEvent(const Point& pos, int buttonMask,
|
|
||||||
const bool skipClick, const bool skipRelease, int scrollX, int scrollY)
|
const bool skipClick, const bool skipRelease, int scrollX, int scrollY)
|
||||||
{
|
{
|
||||||
if (scrollX == 0 && scrollY == 0) {
|
if (scrollX == 0 && scrollY == 0) {
|
||||||
vncPointerMove(pos.x + vncGetScreenX(screenIndex), pos.y + vncGetScreenY(screenIndex));
|
if (pos.equals(abspos)) {
|
||||||
|
vncPointerMove(pos.x + vncGetScreenX(screenIndex), pos.y + vncGetScreenY(screenIndex));
|
||||||
|
} else {
|
||||||
|
vncPointerMoveRelative(pos.x, pos.y,
|
||||||
|
abspos.x + vncGetScreenX(screenIndex),
|
||||||
|
abspos.y + vncGetScreenY(screenIndex));
|
||||||
|
}
|
||||||
vncPointerButtonAction(buttonMask, skipClick, skipRelease);
|
vncPointerButtonAction(buttonMask, skipClick, skipRelease);
|
||||||
} else {
|
} else {
|
||||||
vncScroll(scrollX, scrollY);
|
vncScroll(scrollX, scrollY);
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
const char* rejectMsg=0);
|
const char* rejectMsg=0);
|
||||||
|
|
||||||
// rfb::SDesktop callbacks
|
// rfb::SDesktop callbacks
|
||||||
virtual void pointerEvent(const rfb::Point& pos, int buttonMask,
|
virtual void pointerEvent(const rfb::Point& pos, const rfb::Point& abspos, int buttonMask,
|
||||||
const bool skipClick, const bool skipRelease, int scrollX = 0, int scrollY = 0);
|
const bool skipClick, const bool skipRelease, int scrollX = 0, int scrollY = 0);
|
||||||
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
||||||
virtual unsigned int setScreenLayout(int fb_width, int fb_height,
|
virtual unsigned int setScreenLayout(int fb_width, int fb_height,
|
||||||
|
Loading…
Reference in New Issue
Block a user