Samuel Mannehed [Wed, 2 Oct 2024 08:18:22 +0000 (10:18 +0200)]
Clear clipboard state when its not plain text
Commit 8a80c906b9f7c08b1c664569a97d327d62c6d8ae added a check to prevent
announcing clipboard when it's not plain text data. When this check
triggers and we want to ignore the non-plain text clipboard, we should
reset the state by no longer indicating pending clipboard, and by asking
the server to clear its clipboard. This ensures we don't end up in a
state where the server thinks the viewer has useful clipboard data, but
it doesn't.
Samuel Mannehed [Tue, 1 Oct 2024 10:49:40 +0000 (12:49 +0200)]
Only announce clipboard for plain text data
FLTK has support for both image and plain text clipboard data, we don't.
This means we only send plain text clipboard from the viewer to the
server. Some applications can get confused when we announce that
clipboard is available and later don't send anything. An example of such
an application is QGIS, in the remote session it froze when an image was
copied on the client side.
This fix means we only call announceClipboard() when the clipboard
contains plain text. That means TigerVNC is now more robust and doesn't
trigger freezes in buggy applications.
Pierre Ossman [Tue, 24 Sep 2024 07:03:53 +0000 (09:03 +0200)]
More carefully release mouse buttons on close
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.
Pierre Ossman [Fri, 30 Aug 2024 14:09:38 +0000 (16:09 +0200)]
Only read first password from file
Read just the first password and ignore anything else in the password
file. This allows you to reuse a password file from the server that also
includes a view-only password.
Andri Yngvason [Thu, 22 Aug 2024 21:26:59 +0000 (21:26 +0000)]
H264Libav: Use nearest-neighbour sampling in scaler
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.
Pierre Ossman [Tue, 13 Aug 2024 13:53:07 +0000 (15:53 +0200)]
Use proper gnutls_free() on Windows
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.
Pierre Ossman [Tue, 6 Aug 2024 12:53:30 +0000 (14:53 +0200)]
Avoid XKeysymToString() conflict with libX11
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.
Carlos Santos [Thu, 25 Jul 2024 21:39:59 +0000 (18:39 -0300)]
vncsession: use /bin/sh if the user shell is not set
An empty shell field in the password file is valid, although not common.
Use /bin/sh in this case, as documented in the passwd(5) man page, since
the vncserver script requires a non-empty SHELL environment variable.
Pierre Ossman [Fri, 5 Jul 2024 12:05:45 +0000 (14:05 +0200)]
Be more careful with ComparingUpdateTracker pointer
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.
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.
Pierre Ossman [Wed, 22 May 2024 09:44:41 +0000 (11:44 +0200)]
Fix late vncsession logging
The syslog file descriptor will be closed when we are cleaning up in
preparation for running the vncserver script, so we need to explicitly
reopen things in case we need to log errors.
At the same time, try to be polite and explicitly close the log when
appropriate.
Pierre Ossman [Mon, 20 May 2024 15:32:57 +0000 (17:32 +0200)]
Add comment that PAM configuration is an example
There is too much variation between distributions for us to have a good
PAM configuration that works everywhere. Try to make this more obvious
by having a comment at the top of the file.