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.
Pierre Ossman [Fri, 14 Jul 2023 08:08:25 +0000 (10:08 +0200)]
Apply custom theme to FLTK
Inspired by modern Windows appearance, and to some extent macOS. They
have flat boxes and use white, or very light, colors for interactive
elements. Unfortunately we can't directly control the colors of
widgets, so instead we just lighten everything that uses this box type.
GNOME uses a different design, both their older and newer style. But UI
look is less consistent on Linux, so hopefully our new look is decent
enough there as well.
Pierre Ossman [Wed, 5 Jul 2023 14:23:58 +0000 (16:23 +0200)]
Unbreak -Wformat warnings when gettext is used
gettext replaces all *printf() functions on platforms that don't fully
conform to the POSIX behaviour. Unfortunately, gettext fails to tag
these replacement functions properly so that -Wformat can still do its
thing.
Resolve this by adding a redudant declaration of the relevant functions,
with the attribute tagging in place.
Pierre Ossman [Wed, 5 Jul 2023 14:22:35 +0000 (16:22 +0200)]
Use smaller, stable, int for history index
The size of size_t depends on the architecture, so we need to have
different conversion to and from strings. But we don't really need that
range, so avoid the issue by using a standard integer size.
Pierre Ossman [Wed, 5 Jul 2023 08:22:42 +0000 (10:22 +0200)]
Make sure we handle all certificate issues
We don't want to proceed unless we've made sure the user has approved
the issues with the certificate. So add an extra check that all status
flags have been dealt with.
Pierre Ossman [Sat, 18 Mar 2023 13:59:27 +0000 (14:59 +0100)]
Don't allow surrugate code points in UTF-8
These are not valid outside of UTF-16 so seeing them in a UTF-8 sequence
means that something is wrong with that sequence. Best to filter them
out rather than letting them propagate and have unknown effects.
Pierre Ossman [Sat, 18 Mar 2023 12:53:26 +0000 (13:53 +0100)]
Clean up string encoding handling
We should handle this in the low-level protocol code as much as possible
to avoid mistakes. This way the rest of the code can assume that strings
are always UTF-8 with \n line endings.
Pierre Ossman [Wed, 21 Jun 2023 11:58:57 +0000 (13:58 +0200)]
Move where -nodefaultlibs is specified
The previous method isn't compatible with CMake's try_compile() as it
will respect CMAKE_EXE_LINKER_FLAGS, but not CMAKE_C_LINK_EXECUTABLE and
friends. This results in the default libraries being completely missing,
and the compile test failing.
Pierre Ossman [Wed, 8 Mar 2023 17:15:33 +0000 (18:15 +0100)]
Detect leaving window on zaphod systems
The coordinates we get are relative the root window of each screen, so
we can only trust them if we are on the same screen. So let's explicitly
check that we are still getting events from the expected screen by
checking the root window field of the event.
Pierre Ossman [Tue, 28 Feb 2023 15:00:15 +0000 (16:00 +0100)]
Throw exception instead on bad access check
An assert will kill the entire server, which is overly harsh when there
is a problem with a single connection. Instead, throw an exception which
will just disconnect that specific client.
Mark Mielke [Mon, 20 Feb 2023 05:38:52 +0000 (00:38 -0500)]
VNCSConnectionST clipboard functions should check state before access.
Clipboard functions may run on connections that are not yet at
RFBSTATE_NORMAL. Due to recent hardening of the accessCheck() function,
it is important to validate that the state is RFBSTATE_NORMAL before
calling accessCheck().
Pierre Ossman [Thu, 12 Jan 2023 06:58:18 +0000 (07:58 +0100)]
Warn if Point/Rect/Region methods are used wrong
It is easy to get confused if these methods modify the existing object,
or return a new one. So let's mark the return value as critical so the
compiler can help out if someone gets it wrong.
Pierre Ossman [Sun, 20 Nov 2022 12:25:23 +0000 (13:25 +0100)]
Avoid redefining errno
This can have unexpected consequences as some code may rely on it being
a simple variable. Instead to what we do in Socket, which is to define a
unique name for getting socket error numbers.