Pierre Ossman [Thu, 6 Jun 2024 12:51:52 +0000 (14:51 +0200)]
Automatically pick a suitable DRI3 render node
Lay the groundwork for a more intelligent selection of GPU in systems
that have multiple cards. This initial implementation simply picks the
first GPU that we have permission to open.
Pierre Ossman [Wed, 21 Feb 2024 16:07:36 +0000 (17:07 +0100)]
Add basic DRI3 support
This provides buffer sync with the primary render node of the system (if
available). By doing so, OpenGL and Vulkan can use the render node for
acceleration.
This first implementation is extremely pessimistic and synchronises
buffers whenever there's even a slight chance they will be used.
Pierre Ossman [Tue, 18 Jun 2024 14:01:55 +0000 (16:01 +0200)]
Avoid VNC updates for offscreen windows
Windows aren't always directly shown, e.g. when the desktop is
composited. We should not be sending screen updates for these as the
framebuffer didn't actually change.
In the case of CopyWindow, we're even sending the wrong screen data,
which is how this bug was discovered.
Pierre Ossman [Mon, 19 Feb 2024 14:28:12 +0000 (15:28 +0100)]
Slow down fake clock when no clients
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.
Pierre Ossman [Wed, 28 Feb 2024 13:20:54 +0000 (14:20 +0100)]
Keep frame clock running if waiting for frame tick
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.
Pierre Ossman [Thu, 29 Feb 2024 16:33:43 +0000 (17:33 +0100)]
Restart the frame timer immediately
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.
Pierre Ossman [Fri, 16 Feb 2024 13:31:54 +0000 (14:31 +0100)]
Add support for X Present extension
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.
Pierre Ossman [Wed, 28 Feb 2024 12:54:23 +0000 (13:54 +0100)]
Maintain a constant VNCServer/SDesktop connection
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.
Pierre Ossman [Tue, 3 Jan 2023 08:27:46 +0000 (09:27 +0100)]
Add safety check to getNextTimeout()
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.
Pierre Ossman [Thu, 29 Feb 2024 08:23:01 +0000 (09:23 +0100)]
Detect conflicting timer rescheduling
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.
Samuel Mannehed [Fri, 26 Jan 2024 12:49:04 +0000 (13:49 +0100)]
Increase time required to override pointerClient
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.
Pierre Ossman [Wed, 24 Jan 2024 08:43:02 +0000 (09:43 +0100)]
Allow combining socket activation and extra ports
The common use case is probably to only listem to the systemd provided
socket when using socket activation, but it might not be the only use
case. Make sure things can be combined if explicitly requested.
Mike Looijmans [Tue, 16 Jan 2024 15:27:43 +0000 (16:27 +0100)]
VNCServerST: Add a timeout to pointer button ownership
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>
Mike Looijmans [Thu, 11 Jan 2024 10:16:27 +0000 (11:16 +0100)]
VNCSConnectionST: Release mouse button(s) on close
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>
Pierre Ossman [Thu, 28 Dec 2023 08:39:08 +0000 (09:39 +0100)]
Prevent incorrect cmake usage
It's a reoccurring issue that users try to build individual components
by pointing cmake at a specific subdirectory, e.g. 'cmake vncviewer'.
CMake, unfortunately, has insufficient protection against this so we'll
need to add a manual check.
This commit only adds it to the most likely places for misuse so we
don't have to pollute every CMakeLists.txt.
Florian Weimer [Wed, 22 Nov 2023 11:41:53 +0000 (12:41 +0100)]
Replace INITARGS with void in function parameter list
Most compilers currently accept arbitrary identifiers in this place
and ignore then, but this is going to change and turn into an error.
(It prevents compilers from diagnosing misspelled type names,
and the resulting declaration is not a prototype, so no type
errors will be reported at call sites.)
Adam Halim [Mon, 10 Jul 2023 09:15:33 +0000 (11:15 +0200)]
Use compressionLevel in ZRLEEncoder
This change makes the ZRLEEncoder respect a client's desired
compressionLevel. The ZlibLevel option is marked deprecated and removed
from the manpages.
Pierre Ossman [Tue, 7 Dec 2021 19:46:20 +0000 (20:46 +0100)]
Add own keysym to name function
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.
Carlos Santos [Wed, 4 Oct 2023 14:40:56 +0000 (11:40 -0300)]
Fix description of "%u" in manual pages.
We user the real, not the effective user ID, to check if the user is
allowed to log in with the "Plain" security types. Otherwise it would be
necessary to log in as root when Xvnc is installed with the set-user-id
bit on.
Signed-off-by: Carlos Santos <casantos@redhat.com>
Pierre Ossman [Mon, 11 Sep 2023 11:05:25 +0000 (13:05 +0200)]
Completely ignore server clipboard when unfocused
We can get races with clipboard managers in the server that is very
confusing to the user.
When the clipboard changes locally, we tell the server to drop the old
clipboard (as it is now lost). But we don't send over the new clipboard
until we get focus again, in order to not leak more data than necessary.
This causes some clibpoard managers to take over ownership in order to
avoid an empty clipboard. And this takes precedence over the new client
clipboard as it happened later. Effectively reverting the clipboard the
user sees.
Avoid all of this by simply ignoring the server when we don't have
focus. This is likely what users expect anyway as they expect their
currently focused application to control the clipboard, not vncviewer in
the background.
Pierre Ossman [Fri, 8 Sep 2023 12:31:31 +0000 (14:31 +0200)]
More graceful handling of disabled listeners
Don't assume a lack of TCP listeners means the server will be
unreachable. There might be other methods of access, so let the higher
levels do that sanity check instead.
Pierre Ossman [Wed, 23 Aug 2023 14:51:19 +0000 (16:51 +0200)]
Improve log message when mapping keysyms
It was a poor choice of words to call these keysyms "unknown" as they
are likely perfectly normal keysyms, they just cannot be found in the
currently loaded keyboard layout. This log message has confused users,
so let's get rid of the "unknown" part.
We already use the verb "add" heavily in the other log messages, so
let's keep that rather than switch to some for of "map".
Pierre Ossman [Fri, 14 Jul 2023 11:10:27 +0000 (13:10 +0200)]
Workaround for broken fl_arc()/fl_pie()
There is something broken with these FLTK draw routines on Windows. They
leave gaps at the start and end of the arc/pie rather than filling the
whole specified span. So we need to nudge the numbers a bit to work
around this.