-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the abillity for vnc to use 9 mouse buttons instead of 7. #1711
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ namespace rfb { | |
virtual void fence(uint32_t flags, unsigned len, const uint8_t data[]); | ||
virtual void endOfContinuousUpdates(); | ||
virtual void supportsQEMUKeyEvent(); | ||
virtual void supportExtendedMouseButtons(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supports |
||
virtual void serverInit(int width, int height, | ||
const PixelFormat& pf, | ||
const char* name) = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,9 @@ bool CMsgReader::readMsg() | |
case msgTypeEndOfContinuousUpdates: | ||
ret = readEndOfContinuousUpdates(); | ||
break; | ||
case msgTypeExtendedMouseSupport: | ||
ret = readSupportExtendedMouseButton(); | ||
break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can avoid having to allocate both a pseudo-encoding and a message type by sending an empty rect instead. See how QEMU extended key events are handled. |
||
default: | ||
throw Exception("Unknown message type %d", currentMsgType); | ||
} | ||
|
@@ -454,6 +457,12 @@ bool CMsgReader::readEndOfContinuousUpdates() | |
return true; | ||
} | ||
|
||
bool CMsgReader::readSupportExtendedMouseButton() | ||
{ | ||
handler->supportExtendedMouseButtons(); | ||
return true; | ||
} | ||
|
||
bool CMsgReader::readFramebufferUpdate() | ||
{ | ||
if (!is->hasData(1 + 2)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,13 +182,28 @@ void CMsgWriter::writePointerEvent(const Point& pos, int buttonMask) | |
if (p.x >= server->width()) p.x = server->width() - 1; | ||
if (p.y >= server->height()) p.y = server->height() - 1; | ||
|
||
if (server->supportsExtendedMouseButtons) | ||
{ | ||
writePointerEventExt(pos,buttonMask); | ||
return; | ||
} | ||
|
||
startMsg(msgTypePointerEvent); | ||
os->writeU8(buttonMask); | ||
os->writeU16(p.x); | ||
os->writeU16(p.y); | ||
endMsg(); | ||
} | ||
|
||
void CMsgWriter::writePointerEventExt(const Point& p, int buttonMask) | ||
{ | ||
startMsg(msgTypePointerEventExt); | ||
os->writeU16(buttonMask); | ||
os->writeU16(p.x); | ||
os->writeU16(p.y); | ||
endMsg(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks small enough that we can hopefully keep things in the same method? Like we do for key events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for sure. I had it in different methods to lessen merge conflicts since i was just running this locally. it makes sense to make the main method handle both cases if it's going to be in master. |
||
|
||
|
||
void CMsgWriter::writeClientCutText(const char* str) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,9 @@ bool SMsgReader::readMsg() | |
case msgTypePointerEvent: | ||
ret = readPointerEvent(); | ||
break; | ||
case msgTypePointerEventExt: | ||
ret = readPointerEvenExt(); | ||
break; | ||
case msgTypeClientCutText: | ||
ret = readClientCutText(); | ||
break; | ||
|
@@ -281,6 +284,16 @@ bool SMsgReader::readPointerEvent() | |
return true; | ||
} | ||
|
||
bool SMsgReader::readPointerEvenExt() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A missing |
||
{ | ||
if (!is->hasData(2 + 2 + 2)) | ||
return false; | ||
int mask = is->readU16(); | ||
int x = is->readU16(); | ||
int y = is->readU16(); | ||
handler->pointerEvent(Point(x, y), mask); | ||
return true; | ||
} | ||
|
||
bool SMsgReader::readClientCutText() | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ namespace rfb { | |
|
||
const int pseudoEncodingXCursor = -240; | ||
const int pseudoEncodingCursor = -239; | ||
const int pseudoEncodingExtendedMouseButtons = -241; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These need to be allocated with IANA before we can merge things: https://www.iana.org/form/protocol-assignment I'd also like to see a PR for documenting this new extension: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, i had no idea what these numbers were haha. |
||
const int pseudoEncodingDesktopSize = -223; | ||
const int pseudoEncodingLEDState = -261; | ||
const int pseudoEncodingExtendedDesktopSize = -308; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not with all the other stuff further up?