Pierre Ossman [Thu, 2 Sep 2021 14:28:16 +0000 (16:28 +0200)]
Tolerate carriage return in config files
If the file has been transferred from a Windows system then it might
have \r\n line endings instead of \n. Make sure this doesn't leak in to
the parameter values.
Pierre Ossman [Tue, 20 Jul 2021 14:38:04 +0000 (16:38 +0200)]
Keep ownership of second selection when first is lost
This fixes regression introduced by the extended clipboard extension.
Previously it was possible for the server to hold on to the CLIPBOARD
selection even if another application took ownership of PRIMARY. This is
important to handle the common use case of selecting something in order
to paste over it.
The new request based model doesn't readily support this as we assume
the client has lost its data once we push the new PRIMARY selection to
it. So to handle this we have the maintain a cache of the client's data,
and make sure to fill that cache before we do anything that might cause
the client to lose the data.
Hugo Lundin [Fri, 16 Jul 2021 14:31:16 +0000 (16:31 +0200)]
Refresh MonitorArrangement on configuration change
MonitorArrangement (in the options dialog) never changes when the system
monitor configuration changes. Therefore, the user can get into a state
where the reality doesn't match what is shown (when a monitor is
added/removed, resolution or position changed etc).
All these changes triggers an event in FLTK
(FL_SCREEN_CONFIGURATION_CHANGED). This commit adds an event handler in
MonitorArrangement and refreshes the widget whenever that event occurs.
Because Fl_Handler does not have a void*-argument (and we must be able
to access the widget from our handler callback) a static set of
instances have been added, which all will receive the events.
Hugo Lundin [Tue, 13 Jul 2021 13:55:54 +0000 (15:55 +0200)]
Add monitor description to tooltip
It might be useful to have more information about a monitor when
configuring its settings in the Options menu. Therefore, this commit
adds support for showing additional information about a monitor
(resolution and platform-specific name).
Hugo Lundin [Thu, 15 Jul 2021 11:32:19 +0000 (13:32 +0200)]
Explicitly choose current monitor
There are no guarantees from the WM that calling `fullscreen_screens`
with all monitor indices set to `-1` results in the window's current
monitor being used. Because FullScreenMode uses the word "current"
we want to explicitly ask the WM to use that monitor.
Hugo Lundin [Tue, 13 Jul 2021 11:58:12 +0000 (13:58 +0200)]
Add fullscreen mode for selected monitors
The user might not always want to use all monitors when in fullscreen
mode, but instead only a few. This commit adds support for configuring
selected monitors from command line, in the config file and graphically
in the options menu.
Because it might be hard to guarantee the consistency of monitor
identifiers coming from third-parties (for example FLTK), it has been
decided to use our own numerical identifier. This identifier is based on
the monitor's positions. The mapping between this identifier and the
indices used by FLTK is done by MonitorIndicesParameter.
Hugo Lundin [Thu, 15 Jul 2021 10:52:56 +0000 (12:52 +0200)]
Add fullscreen mode parameter
Before this commit, `FullScreen` and `FullScreenAllMonitors` could be
used to configure whether to use the current monitor in fullscreen,
or all monitors in fullscreen.
This commit deprecates `FullScreenAllMonitors` in favour of
`FullScreenMode` (which can either be `current` or `all`). This allows
for additional modes to be added, without the risk of having invalid
states (for example two activate two different fullscreen modes at the
same time).
A new concept has been added; read-only parameters. They are parameters
that will be read, but never written back. This allows for migration
paths to be constructed, where a parameter can be taken to consideration
but then for example be discarded, logged or changed into something else.
This has been used for `FullScreenAllMonitors` to provide a migration
path. On startup of vncviewer, if `FullScreenAllMonitors` is enabled,
`FullScreenMode=all` will be automatically enabled instead. The next
time the configuration file is written to disk, `FullScreenAllMonitors`
will then be removed.
Hugo Lundin [Wed, 14 Jul 2021 12:55:56 +0000 (14:55 +0200)]
Calculate overlay position from window size
Previously, it was assumed that all monitors (and especially the primary
monitor, index 0) was inside the window when we calculate the position
of the overlay.
That might not always be the case, for example when using fullscreen
mode over a narrower set of monitors. This commit does so the overlay is
positioned correctly based on the actual window size, instead of what we
expect it to be.
Hugo Lundin [Fri, 16 Jul 2021 11:26:08 +0000 (13:26 +0200)]
Release displays not enclosed by the window
cocoa_capture_displays it captures all displays enclosed by the
window_rect. If a set of displays were captured, but the configuration of
what monitors to use changed, a second call would only add to the set
of captured displays. Therefore, if the user enabled
FullScreenAllMonitors (all displays captured) and then disabled it (only
one display captured) they would get into a state were monitors not used
for the VNC session still were captured (which on macOS for example,
results in displays being unusable for other things).
This has now been fixed, resulting in monitors outside the window_rect
not being unnecessarily captured.
Hugo Lundin [Tue, 13 Jul 2021 11:07:41 +0000 (13:07 +0200)]
Capture all displays inside the viewport (macOS)
It was only possible to capture either the current, or all displays
previously. This could become an issue if you want to show a vnc session
over only a selected set of displays, because then we only want to
capture those displays.
The solution in the commit was chosen because it handles all cases - by
looking at what monitors are enclosed by the viewport the implementation
is independent on any configuration, but instead captures the monitors
actually being used.
Alex Richardson [Wed, 14 Jul 2021 13:13:54 +0000 (14:13 +0100)]
Rename Input.h to vncInput.h to fix building on case-insensitive FS
I am cross-compiling from macOS for a FreeBSD-derived system so my host
file system is case insensitive but the target isn't. Without this change
I get the following warnings which show that the vnc "Input.h" is being
included from mi/mi.h instead of the xserver "input.h":
```
In file included from /Users/alex/cheri/xvnc-server/hw/vnc/Input.c:33:
/Users/alex/cheri/xvnc-server/mi/mi.h:55:10: warning: non-portable path to file '"Input.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "input.h"
^~~~~~~~~
"Input.h"
```
Alex Richardson [Wed, 14 Jul 2021 13:01:15 +0000 (14:01 +0100)]
Fix build on systems without HOST_NAME_MAX
Some operating systems such as FreeBSD don't define a HOST_NAME_MAX
macro. The portable approach to determine the real host name limit is
calling sysconf(_SC_HOST_NAME_MAX) so do that instead.
Pierre Ossman [Tue, 13 Jul 2021 10:42:56 +0000 (12:42 +0200)]
Remove vfb references from symbol names
Xvnc was originally based on Xvfb, but it's just confusing to keep the
names. So change all prefix to "vnc" instead to clearly mark things as
part of TigerVNC.
Pierre Ossman [Sun, 11 Jul 2021 18:59:48 +0000 (20:59 +0200)]
Handle X.org patch level features
With the 1.20.x releases there has been features and API changes even on
patch level versions, so we need to update our macros to handle these as
well.
Pierre Ossman [Thu, 17 Jun 2021 13:39:30 +0000 (15:39 +0200)]
Correctly handle screen layout with offset
We miscalculated the screen layout if the geometry had an offset as we
adjusted the real screen layout to account for the offset, but compared
it to the unadjusted geometry.
Pierre Ossman [Thu, 10 Jun 2021 14:32:29 +0000 (16:32 +0200)]
Remove early data check for TLSInStream
Having this early check means that we somewhat randomly get different
exception behaviours on errors in deeper layers as some exceptions are
allowed to propagate unhindered and some are not (since they are thrown
in the pull function).
Pierre Ossman [Mon, 7 Jun 2021 15:09:15 +0000 (17:09 +0200)]
Convert CI to GitHub Actions
Travis has unfortunately been severely rate limited by Docker Hub so we
have to switch to GitHub, which has an agreement with Docker to avoid
the rate limiting.
Jan Grulich [Tue, 25 May 2021 12:18:48 +0000 (14:18 +0200)]
CharArray: pre-fill empty array with zeroes
CharArray should always be null-terminated. There is a potential
scenario where this all might lead to crash. In Password we call
memset(), passing length of the array we get with strlen(), but
this won't return correct value when the array is not properly
null-terminated.
Zdenek Pytela [Tue, 18 May 2021 11:49:09 +0000 (13:49 +0200)]
Add vnc_home_t type
The new vnc_home_t type for HOME/.vnc directory was added to the policy,
backed by a name transition. The vnc_session_t domain can manage files
and directories of this type.
made full-screen edge scrolling smoother and faster
The old method used a very slow frame rate with small steps,
which made it obnoxious during use. The new method has a few
improvements:
- Calculates "edge" region width automatically, as a ratio of
the viewport size. Default is 1/16th.
- Uses a different edge width for x and y, which works better
on very wide or very tall screens.
- Increased default frame rate from 10 fps to 60 fps.
- Replaced hardcoded frame rate with a #define.
- Reduced maximum movement per frame slightly, because the
frame rate is so much faster. The overall result is still much
faster, but also easier to do small adjustments with.
- Fixed off-by-one error in scroll rate calculation formula. Left/up
scrolls were faster than down/right, but this is fixed.
This makes it more comfortable to use TigerVNC on a small screen
to work on a larger screen for hours at a time.