aboutsummaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* More carefully release mouse buttons on closePierre Ossman2024-10-222-4/+4
| | | | | | | | | | | | | | | Only the client that currently has buttons pressed should actually send a release event as the client might not be currently in control of the pointer state. This is most clearly seen in a client that hasn't event authenticated properly yet. Approximate this from the server by using the last known server cursor position. It should hopefully not differ much from the last client provided position. Follow-up to 986280b382d57ef4f68d2d4afb13b26772e5acb0. (cherry picked from commit 704f9724d8af58314c4fafc8930666bb2be46722)
* Add missing config.h includesPierre Ossman2024-10-225-0/+19
| | | | (cherry picked from commit 1f3e77d75a912b30f554d745a56f5da1e4de966e)
* Correctly handle ZRLE cursorsPierre Ossman2024-10-221-2/+2
| | | | | | | | Cursor data has a depth of 32 bits and hence cannot use CPIXELs. This is a regression from baca73d. (cherry picked from commit 6d9017eeb364491cf2acdf1c7e61aee8dd198527)
* H264Libav: Use nearest-neighbour sampling in scalerAndri Yngvason2024-10-221-1/+1
| | | | | | | | | | | | | sws_getCachedContext will set a default sampling method if 0 is passed to the flags argument. This means that when it is called again, the flags argument will not match the flags in the context, so a new one will be allocated every time. To get around this problem, we assign an explicit sampling method, one that also happens to be more efficient and just as good for this use-case as the default one, which is bicubic interpolation. (cherry picked from commit c68714aee15f1e6c75d53c398ea9b9178f64fcfb)
* H264Libav: Handle colour space conversionAndri Yngvason2024-10-221-0/+15
| | | | | | | The scaler is now informed of the colour space encoded into the stream so that it may do the proper conversion. (cherry picked from commit 28cc17e309fc6117370b38ec11d803dc36e8ef01)
* H264Libav: Clean up sws contextAndri Yngvason2024-10-221-0/+1
| | | | | | This fixes a memory leak (cherry picked from commit 35966469bc3410ba1573126300a19bf47d370910)
* H264Libav: Use AVFrame for pixel format conversion bufferAndri Yngvason2024-10-222-12/+20
| | | | | | | | | | This ensures that the buffer is allocated with the correct alignment and padding for use with sws_scale. This fixes out-of-bounds writes which would in some cases cause segmentation faults and/or heap corruption. (cherry picked from commit fff17cae7738d6b3d65426a0ce7df76e8034ad1c)
* Use proper gnutls_free() on WindowsPierre Ossman2024-10-182-10/+4
| | | | | | | | The underlying issue requiring this hack was fixed ages ago. Unfortunately, the fixed GnuTLS doesn't consider static linking. So we need to add a new hack that permits that. (cherry picked from commit cfa4cc7dd223641176488dc3b41a53e6a81dade4)
* Include key code for fake key eventsPierre Ossman2024-10-181-6/+6
| | | | | | Let's try to mimic a real event as much as possible to avoid bugs. (cherry picked from commit 6111c0587aec6ea4700a91a460c7027572ab5011)
* Don't parse empty fence messagesPierre Ossman2024-10-181-1/+3
| | | | | | | We need to return here or we'll do an out-of-bounds access on the data array. (cherry picked from commit 7af69eb4a7a52d6baf4d09f79ccbec76bd1fcee1)
* Avoid XKeysymToString() conflict with libX11Pierre Ossman2024-10-181-0/+3
| | | | | | | | | | | | | We implement our own version of this, and because of this we carry our lookup table generated by the same tool that libX11 uses. Unfortunately, that table is a global symbol and as such there might be a mismatch of which table should be used. Make sure we get our own copy by changing the name of it. We use a define rather than modifying ks_tables.h as that file is automatically generated. (cherry picked from commit 01cf61b4e0f4cd5031794f0a82fdf603d20a7852)
* Add missing comma in default security type listPierre Ossman2024-10-181-1/+1
| | | | | | | Otherwise it merges with the next entry, removing both of them from the default list. (cherry picked from commit 4f6a3521874da5a67fd746389cfa9b6199eb3582)
* Use std::min replace minKang Lin2024-10-183-9/+9
| | | | (cherry picked from commit 9aaea93b2d1012b05ea24a15f4269cb9f356c3d9)
* Fix overflow; "Timer: gettimeofday is broken"Pierre Ossman2024-07-231-1/+4
| | | | | | | | The rounding misbehaved when the tv_usec calculation overflows. Fixes issue #1782. (cherry picked from commit 422444acf3a519b75709fb14c02118b75ecbc898)
* Be more careful with ComparingUpdateTracker pointerPierre Ossman2024-07-051-4/+13
| | | | | | | | As of 28c3f12, we might now be running the frame clock even without a framebuffer present. This means we need to be more careful accessing the ComparingUpdateTracker, as it might be NULL. (cherry picked from commit c4075860579ad33011fafee32f34c5d3da71a910)
* Round up expiration time for timersPierre Ossman2024-07-051-1/+1
| | | | | | | Otherwise we won't properly guarantee that we'll wait *at least* as long as the specified time. (cherry picked from commit c831c9084afffdf10fa5dda865a6df5d643d83dd)
* Merge branch 'present' of github.com:CendioOssman/tigervncPierre Ossman2024-06-1913-115/+173
|\
| * Slow down fake clock when no clientsPierre Ossman2024-06-191-11/+32
| | | | | | | | | | | | | | | | | | | | Run the frame clock at a slow 1 Hz if there are no clients connected. This is similar to what a normal X server does when the screen is blanked, and should keep applications waiting for the frame tick happy. Note that we still only keep the frame clock running if there is any application that are interested in it. Otherwise we still stop it completely.
| * Keep frame clock running if waiting for frame tickPierre Ossman2024-06-193-5/+19
| | | | | | | | | | | | | | | | | | | | | | If there is something interested in synchronizing to a frame tick, then keep the frame clock running, even if there are no updates. This is need mainly when something starts rendering, but also when something renders much slower than the frame clock (so it is essentially constantly "starting"). Such an application will not draw anything until it gets a new frame tick, which it won't get as the frame clock is waiting for something to start drawing.
| * Restart the frame timer immediatelyPierre Ossman2024-06-191-3/+3
| | | | | | | | | | | | This marks the timer as started again, before we call out to various external places that might be confused by the frame timer reporting that it is stopped.
| * Add support for X Present extensionPierre Ossman2024-06-194-2/+18
| | | | | | | | | | | | | | This makes it possible for applications to synchronize their updates to the updates sent out to clients. This avoids tearing, and could in the future also help with rate limiting applications to what the client can actually show.
| * Make SDesktop::start()/stop() optionalPierre Ossman2024-06-191-8/+2
| | | | | | | | | | Let's avoid requring these as a desktop implementation can now set up everything in the init() method.
| * Maintain a constant VNCServer/SDesktop connectionPierre Ossman2024-06-192-8/+13
| | | | | | | | | | | | | | | | | | 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.
| * Make it easier to change timer intervalPierre Ossman2024-06-193-6/+8
| |
| * Explicitly request timer repetitionPierre Ossman2024-06-1910-56/+53
| | | | | | | | | | | | One-shot timers are more common, so let's change the API a bit to make that use case simpler. This API also makes it more clear what is happening.
| * Fix up Timer commentsPierre Ossman2024-06-191-27/+34
| | | | | | | | They were badly formatted, way longer than the normal 72 columns.
| * Add safety check to getNextTimeout()Pierre Ossman2024-06-191-0/+6
| | | | | | | | | | | | It currently won't ever be called with an empty list of timers, but it is a public function so that might happen in the future. Make sure this case is handled without crashes.
| * Stop treating "0" as "no timeouts"Pierre Ossman2024-06-192-14/+4
| | | | | | | | | | 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.
| * Detect conflicting timer reschedulingPierre Ossman2024-06-191-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Repeating a timer can be done in two ways: * Returning true from the handler * Calling start() again in the handler The latter is useful if you want to change the timer interval. If both are used, then it becomes ambiguous when the timer should fire again. Detect this case and warn about it. Current implementation will respect the new interval given to start(), rather than the interval set before running the handler.
* | Create common recursive mkdir()Pierre Ossman2024-05-302-0/+41
| | | | | | | | | | | | | | Avoid duplicating this complexity in too many places. At the same time make the interface more identical to regular mkdir(), for familiarity.
* | Use $XDG_STATE_HOME for known hosts storagePierre Ossman2024-05-301-2/+2
| | | | | | | | | | This is an often changed database, so it is better suited for $XDG_STATE_HOME rather than the more static $XDG_DATA_HOME.
* | Merge branch 'casantos-rhbz_2180903' of https://github.com/casantos/tigervncPierre Ossman2024-05-2020-98/+153
|\ \
| * | vncconfig: add option to force view-only remote client connectionsCarlos Santos2024-04-267-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | Specifies that the server must ignore all keyboard or mouse events sent by the client. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2180903 Signed-off-by: Carlos Santos <casantos@redhat.com>
| * | Remove the network::SocketServer interface.Carlos Santos2024-04-264-46/+37
| | | | | | | | | | | | | | | | | | | | | 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>
| * | Move the AccessRights type and constants to the rfb namespaceCarlos Santos2024-04-2315-43/+99
| |/ | | | | | | | | | | | | | | | | They must belong to the rfb namespace, not to the SConnection class. Also add an AccessNone constant, since it's better to use a mnemonic symbol rather than zero to initialize the accessRights members. Signed-off-by: Carlos Santos <casantos@redhat.com>
* | Don't check pointers for zero length buffersPierre Ossman2024-05-202-4/+4
| | | | | | | | | | It's perfectly fine to give a NULL pointer if the length has explicitly been specified as zero.
* | Implement XDG Base Directory paths, deprecate ~/.vnc902024-04-263-44/+45
| |
* | Begin work on XDGBDS compliance and overrideable configs902024-03-153-23/+69
|/
* Clarify AcceptPointerEvents settingPierre Ossman2024-02-061-1/+1
| | | | | It doesn't just control button events, but all types of pointer events, including movement.
* Increase time required to override pointerClientSamuel Mannehed2024-01-261-1/+1
| | | | | | | | | | | | | | | | | | Mouse events in shared connections are locked to one viewer at a time. If the a mouse drag is happening in the first viewer, the second viewer can't interfere unless the first viewer has been inactive for a set amount of time. This timeout was put in place in 71c83b479335337b25dc331d3fb4a6e29382ceb5 to handle the case where the first viewer disconnects while the mouse drag is happening. Prior to the timeout, this resulted in all input being blocked. This commit increases this timeout from 3 seconds to 10 seconds. This is to minimize the risk of this happening during "normal" use. With this change, the first viewer has to be inactive for 10 seconds before the second viewer can take control again. In the case where the first viewer disconnects, a waiting time of 10 seconds for the second viewer seems very reasonable.
* Break long lines in new pointerEvent logicSamuel Mannehed2024-01-261-3/+4
|
* Fix bad variable reference in file loggerPierre Ossman2024-01-251-1/+1
|
* VNCServerST: Add a timeout to pointer button ownershipMike Looijmans2024-01-222-2/+8
| | | | | | | | | | | | | | | | | | | When one clients holds down a button on the pointer device (probably dragging something), other clients' attempts at pointer operations are denied. This yields a sane user experience, but with limits. When one clients starts dragging, and then his network connection fails, other clients are denied access to the pointer until the VNC server finally discovers that the connection is dead and closes it. This can take about 15 minutes. Add a timeout to this policy: If we don't hear from the client for 3 seconds, other clients are allowed to control the pointer once more. This solves the problem that one failing network could make the server completely deaf to other clients for a long time. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
* VNCSConnectionST: Release mouse button(s) on closeMike Looijmans2024-01-151-0/+3
| | | | | | | | | | | | | | | | | | | | | When the connection is severed, release all mouse buttons. This fixes an issue with x0vncserver where the local display would stop responding to mouse events if the connection closes while the remote user was holding down a mouse button. To reproduce, start a VNC client, press and hold a mouse button and then kill the connection (e.g. close client, kill server, yank network cable). This caused the local screen to no longer respond to any mouse-down events until a VNC client reconnects and clicks anywhere. This may inject a "mouse release" event while closing, however, if you click on your screen and then yank the mouse cable, a mouse release event also would not come unexpectedly, so the cure's side effects aren't as bad as the disease. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
* Merge branch 'keysym' of github.com:CendioOssman/tigervncPierre Ossman2023-12-139-1599/+6306
|\
| * Update keysym header filesPierre Ossman2023-11-162-1594/+2772
| | | | | | | | This make sure we have any new defines, in case we want to use them.
| * Add own keysym to name functionPierre Ossman2023-11-167-5/+3534
| | | | | | | | | | | | | | | | | | This is mainly a copy of XKeysymToString() from libX11. We've also added a wrapper that still gives a string, even if there is no name for the requested keysym. This grows the binaries a bit, but not with any extreme amount so is hopefully worth it to get better debug logging.
* | Fix logging when no working VeNCrypt typesPierre Ossman2023-12-121-3/+3
| | | | | | | | Otherwise it will log that we chose the (invalid) type 0.
* | Merge branch 'zrlee-compression-level' of ↵Pierre Ossman2023-11-202-2/+17
|\ \ | |/ |/| | | https://github.com/adamhalim/tigervnc-suite
| * Use compressionLevel in ZRLEEncoderAdam Halim2023-11-202-2/+17
| | | | | | | | | | | | This change makes the ZRLEEncoder respect a client's desired compressionLevel. The ZlibLevel option is marked deprecated and removed from the manpages.