summaryrefslogtreecommitdiffstats
path: root/common/rfb
Commit message (Collapse)AuthorAgeFilesLines
...
| * Add support for notifying clients about pointer movementslhchavez2021-03-0210-7/+104
|/ | | | | | | | | | | | | | | | | | | | | | | This change adds support for the VMware Mouse Position pseudo-encoding[1], which is used to notify VNC clients when X11 clients call `XWarpPointer()`[2]. This function is called by SDL (and other similar libraries) when they detect that the server does not support native relative motion, like some RFB clients. With this, RFB clients can choose to adjust the local cursor position under certain circumstances to match what the server has set. For instance, if pointer lock has been enabled on the client's machine and the cursor is not being drawn locally, the local position of the cursor is irrelevant, so the RFB client can use what the server sends as the canonical absolute position of the cursor. This ultimately enables the possibility of games (especially FPS games) to behave how users expect (if the clients implement the corresponding change). Part of: #619 1: https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#vmware-cursor-position-pseudo-encoding 2: https://tronche.com/gui/x/xlib/input/XWarpPointer.html 3: https://hg.libsdl.org/SDL/file/28e3b60e2131/src/events/SDL_mouse.c#l804
* Fix some incorrect data waitsPierre Ossman2021-03-022-17/+17
| | | | | | | | Some of these were incorrectly calculated so the server or client would wait too long before proceeding with decoding. Change all of these to be a more explicit calculation to avoid such issues in the future.
* Merge branch 'autoclip' of https://github.com/CendioOssman/tigervncPierre Ossman2021-02-0311-26/+202
|\
| * Update desktop if clipboard client goes awayPierre Ossman2021-01-051-1/+1
| | | | | | | | | | So the current clipboard state is properly reflected in the desktop session.
| * Add debug logging for ignored clipboard eventsPierre Ossman2021-01-053-7/+21
| |
| * Fix clipboard state tracking in serverPierre Ossman2021-01-051-2/+7
| | | | | | | | This was out of sync with the client handling for no good reason.
| * Handle clipboard peek with missing dataPierre Ossman2021-01-052-6/+2
| | | | | | | | | | The peer expects a response, so we should also be able to respond that there is no clipboard data currently available.
| * Handle unsolicited clipboard transfersPierre Ossman2021-01-048-10/+86
| | | | | | | | | | | | The extended clipboard protocol has the ability for the peer to request things to be sent automatically, without a request message. Make sure we honor such settings.
| * Log client/server clipboard capabilitiesPierre Ossman2021-01-042-0/+85
| |
* | Merge branch 'noblock' of https://github.com/CendioOssman/tigervncPierre Ossman2021-01-1945-425/+1021
|\ \
| * | Change streams to be asynchronousPierre Ossman2020-05-2137-318/+844
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major restructuring of how streams work. Neither input nor output streams are now blocking. This avoids stalling the rest of the client or server when a peer is slow or unresponsive. Note that this puts an extra burden on users of streams to make sure they are allowed to do their work once the underlying transports are ready (e.g. monitoring fds).
| * | Remove readString()/writeString()Pierre Ossman2020-05-215-19/+37
| | | | | | | | | | | | | | | These are not universal in the protocol so having functions for them only obfuscates things.
| * | Don't read invalid TLS auth reasonPierre Ossman2020-05-211-9/+2
| | | | | | | | | | | | | | | The specification only states a single result byte and not any reason after a TLS authentication failure.
| * | Make direct stream API a bit saferPierre Ossman2020-05-211-7/+7
| | | | | | | | | | | | | | | Provide some safety checks when directly accessing the underlying pointer of streams.
| * | Make sure TLS is allowed to terminate gracefullyPierre Ossman2020-05-215-17/+39
| | | | | | | | | | | | | | | | | | Some systems (like TLS) need to send some final data before closing a connection. Make sure this is properly handled by cleaning up the security object before closing the underlying network socket.
| * | Separate query and authentication handlingPierre Ossman2020-05-211-6/+6
| | | | | | | | | | | | Otherwise we might send duplicate result codes and other weird things.
| * | Check buffer usage with a simply booleanPierre Ossman2020-05-211-4/+4
| | | | | | | | | | | | | | | External callers don't need to know the exact details, only if there is data that needs to be flushed or not.
| * | Generalise corking to all output streamsPierre Ossman2020-05-212-6/+8
| | | | | | | | | | | | | | | The principle can be used in a more general fashion than just TCP streams.
| * | Remove unused bufSize argument from streamsPierre Ossman2020-05-211-1/+1
| | |
| * | Remove special functions from JPEG compressorPierre Ossman2020-05-212-7/+1
| | | | | | | | | | | | We can do what we want with the standard methods.
| * | Simplify stream availability handlingPierre Ossman2020-05-212-3/+3
| | | | | | | | | | | | | | | Just have a simply number of bytes argument to avoid a lot of complexity.
| * | Add stream avail() methodsPierre Ossman2020-05-211-2/+2
| | | | | | | | | | | | | | | Makes it more readable to write code that needs to know how much data/space is available in a stream.
| * | Remove OutStream::skip()Pierre Ossman2020-05-211-1/+1
| | | | | | | | | | | | | | | It might leak data depending on what's in the buffer. Use pad() instead where blank space is needed.
| * | Throw more descriptive error on decode errorPierre Ossman2020-05-211-2/+7
| | | | | | | | | | | | We need to be able to tell this exception came from a decoder.
| * | Flush data on closePierre Ossman2020-05-211-0/+11
| | | | | | | | | | | | | | | There might be some final handshake data that is still stuck in the buffers, so make a best effort attempt at getting it to the client.
| * | Fix connection close logPierre Ossman2020-05-192-2/+4
| | | | | | | | | | | | | | | The socket is closed at this point so we have to rely on a cached value for the logging.
| * | Move auth failure delay to SConnectionPierre Ossman2020-05-194-46/+54
| | | | | | | | | | | | | | | It's a generic feature that is better handled as part of SConnection's state machine.
| * | Support calling methods from timersPierre Ossman2020-05-191-0/+15
| | | | | | | | | | | | | | | | | | We can't safely use the normal timers in base classes as we cannot guarantee that subclasses will call the base class' handleTimeout() properly if the subclass overrides it.
* | | Fix handling of bad update requestsPierre Ossman2021-01-141-1/+1
| |/ |/| | | | | | | | | We computed a safe area if a client gave us a bogus one, but we didn't actually use it. Fix this properly and make sure we don't pass on bad coordinates further.
* | Correctly clear out output UTF-16 bufferPierre Ossman2020-10-051-1/+1
| | | | | | | | | | Each character is more than one byte, so adjust the clearing of the buffer to reflect that.
* | Correctly handle invalid UTF-16 code pointsPierre Ossman2020-10-051-1/+1
| | | | | | | | | | Some code points are reserved for the UTF-16 coding itself and must not appear as input data to the algorithm.
* | Fix conversion of latin-1 to UTF-8Pierre Ossman2020-10-051-2/+2
| | | | | | | | Signed bug prevented anything not ASCII from being coded correctly.
* | Fix UTF-16 encoding/decoding of high code pointsPierre Ossman2020-10-051-3/+4
| | | | | | | | | | Everything outside of BMP was handled incorrectly and was coded as completely different code points.
* | Return the correct number of consumed UTF-8 bytesPierre Ossman2020-10-051-0/+2
| | | | | | | | | | | | | | | | This would mess up most conversions from UTF-8 as the caller wouldn't know how far to step to get to the next valid character, resulting in markers for invalid data to be injected here and there. Also add some unit tests to avoid this reoccurring.
* | Merge branch 'tlstofu' of https://github.com/CendioOssman/tigervncPierre Ossman2020-09-081-90/+73
|\ \
| * | Properly store certificate exceptionsPierre Ossman2020-05-211-90/+73
| |/ | | | | | | | | | | | | | | | | | | The previous method stored the certificates as authorities, meaning that the owner of that certificate could impersonate any server it wanted after a client had added an exception. Handle this more properly by only storing exceptions for specific hostname/certificate combinations, the same way browsers or SSH does things.
* | Hide base SConnection methods from VNCServerSTPierre Ossman2020-08-212-2/+4
| | | | | | | | | | It should be using the safe wrappers for everything so make sure it cannot bypass those and call the SConnection methods directly.
* | Call correct wrappers for clipboard handlingPierre Ossman2020-08-211-3/+3
| | | | | | | | | | | | | | We incorrectly called the underlying functions instead of the safe wrappers for the new clipboard functions. This had the effect of a) crashing the entire server if one of these functions failed, and b) not respecting the settings disabling the clipboard.
* | Enhanced ComparingUpdateTracker to crop changed blocksMark Mielke2020-07-221-4/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 64x64 changed block can be large for fine changes such as cursor movement and typing in terminal windows, or an update to a clock. If the block can be efficiently cropped, this will reduce latency and bandwidth. Every pixel cropped is a pixel less to analyze, encode, transmit, and decode. The previous code already detected the top of the change in order to determine if the block had changed. However, it did not use this information to reduce the size of the change rectangle, nor did it calculate any of the other edges. The new code introduces detection of the other edges, and uses the information to build a reduced area change rectangle. This has the additional effect of reducing the number of discrete pixel values in the change block which may allow a more efficient encoding algorithm to be selected. As this section of code is performance sensitive, the method of detecting the edges has been optimized to quickly fall back to pessimistic values as soon as a single comparison fails on each edge. In the case that full 64x64 block are changing, there will be three extra comparisons per block. In cases where the change rectangle can be reduced from 64x64, the reduced size of the change rectangle represents reduced effort to encode, transfer, and decode the contained pixels. In the case of images with high frequency changes, which specifically includes text, the lossy JPEG encoding can be highly distorted, especially with JPEG level 6 or less. The quick flash from a distorted JPEG to a lossless JPEG can appear as a flickering to some people. This effect was more obvious when the surrounding area is not expected to change, but is being distorted anyways due to being part of the 64x64 blocking algorithm. In the case of a user typing in a terminal window, this change may commonly reduce the number of pixels updated with every character typed from 4096 pixels (64x64) to 640 pixels (32x20) or less.
* | Fix non-functional MaxDisconnectionTimePierre Ossman2020-06-181-5/+5
| | | | | | | | | | | | Since 8e09912 this wasn't triggered properly as we checked if all clients were gone before we actually removed the last client from our list.
* | Merge branch 'regions' of https://github.com/CendioOssman/tigervncPierre Ossman2020-06-154-143/+60
|\ \
| * | Get rid of magical assignment to RegionPierre Ossman2020-05-183-36/+2
| | | | | | | | | | | | Might as well make these explicit so the cost is apparent.
| * | Switch region code to pixmanPierre Ossman2020-05-013-114/+65
| |/ | | | | | | | | This is the current upstream so let's make use of it to get the latest in features and fixes.
* | Remove unused variablePierre Ossman2020-05-311-1/+0
| |
* | Fix JpegCompressor::overrun() type changePierre Ossman2020-05-311-1/+1
| | | | | | | | | | The method it overloads got tweaked some time ago, so we need to make sure this method follows suit.
* | Send response for refused SetDesktopSizematt3356722020-05-291-3/+4
| | | | | | | | | | Sends response for SetDesktopSize as per the community wiki specification
* | Reject too large screen resize requestsPierre Ossman2020-05-231-0/+5
|/ | | | | We'll just crash later if we try to use such a large screen, so reject the request from the client instead and keep the server running.
* Make PAM mandatoryPierre Ossman2020-03-125-24/+6
| | | | | It is present on all UNIX systems anyway, so let's simplify things. We will need it for more proper session startup anyway.
* Use sys/time.h on Windows as wellPierre Ossman2020-01-161-4/+0
| | | | | | Modern MinGW seems to provide this, so simplify things a bit. This also side steps some of the issue of the windows.h/winsock2.h include ordering.
* Allow XK_Scroll_Lock when LED state isn't supportedPierre Ossman2020-01-031-9/+1
| | | | | Otherwise such clients cannot use Scroll Lock at all, and that is probably worse than any effects we might get from getting out of sync.