aboutsummaryrefslogtreecommitdiffstats
path: root/win/rfb_win32
Commit message (Collapse)AuthorAgeFilesLines
* Subclass exceptions from std::exceptionPierre Ossman2024-11-069-20/+20
| | | | | Make sure our exceptions are part of the standard exception class hierarchy.
* Use what() to access exception descriptionPierre Ossman2024-11-067-16/+16
| | | | Harmonize with the standard C++ exceptions.
* Split SystemException to handle WindowsPierre Ossman2024-10-0923-92/+92
| | | | | | | | | | | | | Windows has (at least) two error namespaces, both errno and GetLastResult(). These overlap, so it is important we keep track of which one we are dealing with. To make things extra problematic, the BSD socket API normally uses errno, but on Windows it has been mapped in to the GetLastResult() namespace. Try to keep better control of this by using separate classes for the namespaces.
* Consistently use SocketException for socket errorsPierre Ossman2024-10-091-5/+5
| | | | | | The behaviour is not consistent as Windows doesn't use errno for socket errors, but Unix systems do. Always use the same exception to keep things somewhat sane.
* Better type for pointer button maskPierre Ossman2024-08-124-4/+4
| | | | | This is a very limited bit field, so use an 8 bit type to clearly show how many bits are available.
* Avoid shadowing variablesPierre Ossman2024-06-245-36/+36
| | | | | It's a source of confusion and possibly bugs to reuse the same variable name for multiple things.
* Simplify code using range-based for loopsPierre Ossman2024-06-241-6/+4
| | | | | | | | | These are often more readable as they avoid a lot of the boilerplate of iterating over fixed arrays or STL containers. Note that this change is very conservative to avoid noise in "git blame". Only loops where this is a clear improvement have been converted.
* Mark overridden virtual functionsPierre Ossman2024-06-2413-35/+35
| | | | | Use the new "override" keyword to properly differentiate between new virtual methods, and existing virtual methods being overridden.
* Use nullptr in all C++ codePierre Ossman2024-06-2436-179/+186
| | | | | It's more readable than 0, and a bit safer than NULL, so let's try to follow modern norms.
* Merge branch 'present' of github.com:CendioOssman/tigervncPierre Ossman2024-06-194-12/+15
|\
| * Maintain a constant VNCServer/SDesktop connectionPierre Ossman2024-06-192-6/+9
| | | | | | | | | | | | | | | | | | The desktop isn't completely paused just because there are no clients, so it might still need some support from the server object. This is primarily an issue for headless servers, where they need to continue emulating things even without clients. A scraping server can generally go completely passive if there are no clients.
| * Stop treating "0" as "no timeouts"Pierre Ossman2024-06-192-4/+6
| | | | | | | | | | It is much more sane to treat "0" as "a timer is ready NOW", so let's change to using -1 as the invalid timeout value.
| * Remove unneeded iterationPierre Ossman2024-06-191-3/+1
| | | | | | | | This should have been done in a4308c9.
* | Remove the network::SocketServer interface.Carlos Santos2024-04-262-17/+27
|/ | | | | | | Move these RFB specific things to rfb::VNCServer, for clarity. Signed-off-by: Pierre Ossman <ossman@cendio.se> Signed-off-by: Carlos Santos <casantos@redhat.com>
* Use operator overloading for comparisonPierre Ossman2023-02-044-5/+5
| | | | | It is much more natural than custom methods for this very common operation.
* Remove unused rfb/util.h includesPierre Ossman2023-02-042-2/+0
| | | | | | | | These files don't use anything from this header, so remove the include. This exposes some missing includes in other places, though. So add an explicit include in the files that were relying on an indirect inclusion.
* Remove "str" prefix from string helpersPierre Ossman2023-02-042-2/+2
| | | | | This matches the naming in STL, which is what we are mostly mimicing now that we are using std::string for these functions.
* Use std::string instead of CharArrayPierre Ossman2023-02-0413-56/+63
| | | | | Let's use a more common type instead of something homegrown. Should be more familiar to new developers.
* Use std::vector for temporary char arraysPierre Ossman2023-02-041-9/+9
| | | | | | | | It's more standard and familiar than our custom CharArray type, and it still gives us automatic freeing of the buffer. We could probably have used std::unique_ptr instead, but we are currently targeting older compilers where C++11 isn't standard yet.
* Free char buffer directlyPierre Ossman2023-02-044-16/+24
| | | | | It's extreme overkill to inherit from CharArray just to get the automatic freeing of the buffer when the object is destroyed.
* Make strSplit() simpler and saferPierre Ossman2023-02-043-8/+3
| | | | | | | Get rid of all the magical re-allocation and shuffling and instead just return a new set of strings that is fully splitted. Will consume a bit more memory, but is a lot safer to use as there is less confusion about ownership of memory.
* Return std::string instead of dynamic allocationsPierre Ossman2023-02-047-55/+40
| | | | | | We mostly use classical C strings, but the memory management around them can get confusing and error prone. Let's use std::string for the cases where we need to return a newly allocated string.
* Use fixed size character bufferPierre Ossman2023-02-042-7/+6
| | | | | We know the needed space here, so let's keep it simple with a constant size string buffer.
* Return static char buffer from some methodsPierre Ossman2023-02-044-15/+14
| | | | | | | | | This mimics how some system functions (like inet_ntop()) work, and avoids complexity around ownership of the returned string buffer. The downside is that the string must be consumed directly as it will be overwritten on the next call, but that is not an issue with the current usage.
* Remove unneeded CharArray:sPierre Ossman2023-02-042-10/+9
| | | | | Avoid complicating things by moving things in to a second buffer here as there is no need for it.
* Use StringParameters directlyPierre Ossman2023-02-041-9/+7
| | | | | We don't need to make extra copies of the string in most cases, so let's simplify the code and access the string directly when we can.
* Get rid of TCHAR magicPierre Ossman2023-02-0442-486/+254
| | | | | We never use Windows' "UNICODE" mode anyway, so let's get rid of this complexity.
* Return std::vector instead of dynamic allocationPierre Ossman2023-02-042-15/+9
| | | | | This makes memory management more clear and robust when using these helper functions.
* Move hex conversion helpers to utilPierre Ossman2023-02-042-5/+7
| | | | | These are used here and there so let's make them more general rather than hiding them in the stream classes.
* Use std::vector for basic data arraysPierre Ossman2023-02-013-30/+31
| | | | | Avoid our own custom types in favour of what's already included with C++.
* Use stdint typesPierre Ossman2023-02-0111-41/+42
| | | | | Avoid having our own custom stuff and instead use the modern, standard types, for familiarity.
* Work around -Wcast-function-typePierre Ossman2023-01-051-9/+9
| | | | | That warning doesn't play well with Windows' GetProcAddress(), so add some extra casting to work around it.
* Fix incorrect typesPierre Ossman2023-01-051-1/+1
| | | | | These types caused an incorrect signed/unsigned behaviour, so let's make sure we use the appropriate type.
* Remove useless checksPierre Ossman2023-01-051-1/+1
| | | | These are all truisms because of the valid range of the types.
* Explicitly mark unused parametersPierre Ossman2023-01-045-7/+8
| | | | | This allows us to separate accidentally unused, from explicitly unused parameters, which allows us to turn on such checks in the compiler.
* Avoid temporary cmake variablesPierre Ossman2022-06-071-4/+2
| | | | | Modern cmake has better support for adding source files and libraries incrementally, so let's use that to clean things up.
* Be consistent in including config.hPierre Ossman2021-12-3031-0/+123
| | | | | | The generally recommended way is to include it from source files, not headers. We had a mix of both. Let's try to be consistent and follow the recommended way.
* Add support for notifying clients about pointer movementslhchavez2021-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* Merge branch 'noblock' of https://github.com/CendioOssman/tigervncPierre Ossman2021-01-191-5/+32
|\
| * Change streams to be asynchronousPierre Ossman2020-05-211-5/+32
| | | | | | | | | | | | | | | | | | | | 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).
* | Don't clear complex objects using memset()Pierre Ossman2020-05-312-4/+2
|/ | | | This is fine for simple structs but not class based objects.
* Clean up initialization of DIBSectionBufferPierre Ossman2020-01-034-35/+8
| | | | | | We had an unintentional conflict with PixelBuffer::setSize() here. But we can simplify this further as this initialization is only used by the subclass DeviceFrameBuffer, and only once.
* Use size_t for lengths in stream objectsPierre Ossman2019-11-152-6/+6
| | | | | | | | Provides safety against them accidentally becoming negative because of bugs in the calculations. Also does the same to CharArray and friends as they were strongly connection to the stream objects.
* Encapsulate PixelBuffer internal detailsPierre Ossman2019-11-151-25/+16
| | | | | | Don't allow subclasses to just override dimensions or buffer details directly and instead force them to go via methods. This allows us to do sanity checks on the new values and catch bugs and attacks.
* Use display polling by default in WinVNCPierre Ossman2019-09-061-1/+1
| | | | | Window hooks aren't working well on modern systems so switch the default to polling until we can fix things.
* Use UTF-8 in clipboard APIPierre Ossman2019-07-011-54/+19
| | | | | In prepartion for better clipboard extensions that can send Unicode data between the client and server.
* Improved clipboard APIPierre Ossman2019-07-014-36/+65
| | | | | Change the internal clipboard API to use a request based model in order to be prepared for more advanced clipboard transfers.
* Clean up internal clipboard handlingPierre Ossman2019-07-014-12/+12
| | | | | | We now filter incoming data, which means we can start assuming the clipboard data is always null terminated. This allows us to clean up a lot of the internal handling.
* Make sure clipboard uses \n line endingsPierre Ossman2019-07-011-14/+2
| | | | | | This is required by the protocol so we should make sure it is enforced. We are tolerant of clients that violate this though and convert incoming clipboard data.
* Add missing throws for exceptionPierre Ossman2019-03-261-1/+1
| | | | | It is not enough to create an exception object, you need to throw it as well.