Martins Mozeiko [Tue, 7 Jun 2022 07:37:54 +0000 (00:37 -0700)]
Workaround for MFT cropping in H264 decoding
It seems MFT h264 decoder does not support frame cropping. Which
means that if frame width or height is not multiple of 16 then
decoded output can potentially be used with wrong offset. This
code adds explicit parsing of SPS to extract cropping information
to use, and will apply cropping if reported size differs from
expected.
Pierre Ossman [Wed, 6 Apr 2022 13:45:36 +0000 (15:45 +0200)]
Ignore socket whilst processing data
FLTK has a lot of synchronous stuff (like dialogs), which mean that the
main loop might be run recursively in some cases. If there is data
available on our socket then CConn::socketEvent() will be called
constantly in a busy loop.
Avoid this by removing socket notifications whilst we are processing
data.
Pierre Ossman [Wed, 6 Apr 2022 13:38:45 +0000 (15:38 +0200)]
Enable stream sanity checks in debug builds
Enable this automatically for developers so we increase the chance of
these problems getting caught. There is a risk of overhead though so
keep them disabled for release builds.
Pierre Ossman [Wed, 6 Apr 2022 13:23:50 +0000 (15:23 +0200)]
Don't trust GNUTLS_E_AGAIN
Unfortunately this error can be given by GnuTLS even though the
underlying stream still has data available. So stop trusting this value
and keep track of the underlying stream explicitly.
Pierre Ossman [Fri, 11 Mar 2022 07:31:25 +0000 (08:31 +0100)]
Change vncsession startup error message
We need to get to the point of starting the session script before we
consider things a success. So this can fail in many different ways, not
just the daemonization. Adjust the error message to something more
generic to reflect this.
Zdenek Pytela [Mon, 7 Feb 2022 09:45:41 +0000 (10:45 +0100)]
SELinux: use /root/.vnc in file context specification
Instead of HOME_ROOT/.vnc, /root/.vnc should be used
for user root's home to specify default file context
as HOME_ROOT actually means base for home dirs (usually /home).
Pierre Ossman [Tue, 25 Jan 2022 08:56:31 +0000 (09:56 +0100)]
Improve logging around screen resizing
Avoid duplication, and add logging for some more error conditions so
it's possible to see in the logs why a resize has failed or produced
unexpected results.
William Sjöblom [Wed, 19 Jan 2022 09:04:53 +0000 (10:04 +0100)]
Fix session resize after mirroring on Linux vncviewer
If monitor mirroring was enabled while in a session with vncviewer
running on Linux, the session would not be properly resized on the
server. This was a consequence of only looking at the size and
coordinates of each screen when matching against existing screens after
the screen layout was changed, when in fact we have two (or more)
monitors with the same coordinates and size (but differing ids). This
led to the same monitor being added twice to the layout which would
later fail layout validation, resulting in no resize request being sent
to the server.
When matching, we now also check if the existing screen is not already
present in the layout before considering it a match.
Pierre Ossman [Tue, 18 Jan 2022 12:38:41 +0000 (13:38 +0100)]
Fix handling of VMware cursors
This is a regression from ad0f061. If a VMware cursor rect was split up
over multiple read()s then the stream would become corrupted as we set
the restore point at the wrong place.
Pierre Ossman [Wed, 12 Jan 2022 16:44:20 +0000 (17:44 +0100)]
Improve full-screen workaround on connect
If we've explicitly requested a position (using -geometry) then we were
still triggering legacy full-screen request logic. This is very counter
intuitive as having a position that doesn't align with a monitor should
disqualify us for that.
It turns out that at least marco (and probably everything
metacity-derived) ends up ignoring the requested position and we go back
to triggering the legacy logic again.
Work around this by assuming that the window manager will adjust our
initial position and don't consider that in the workaround logic.
Samuel Mannehed [Fri, 7 Jan 2022 17:46:17 +0000 (18:46 +0100)]
Update MonitorArrangement widget after change
If the options dialog was open when a screen configuration happened the
widget could get out of sync from the settings. A scenario when this
happened was:
1) 3 monitors, fullscreen selected on the two right-most screens
2) disconnect the left-most screen (the one not selected)
In this case, using GNOME, vncviewer would appear in fullscreen on the
right of the two remaining monitors, but the widget would show both
monitors selected. The reason was that the MonitorArragement index
doesn't work the same way as FLTK's screen index.
It's debatable how vncviewer should behave here, but the GUI should at
least match the actual setting.
Pierre Ossman [Thu, 30 Dec 2021 12:03:46 +0000 (13:03 +0100)]
Don't move window in full-screen workaround
If this is done before the window is shown then it can accidentally
override the window manager's placement of the window. Reducing the size
should be sufficient to avoid trigger a full-screen request.
Pierre Ossman [Thu, 30 Dec 2021 09:20:13 +0000 (10:20 +0100)]
Be consistent in including config.h
The generally recommended way is to include it from source files, not
headers. We had a mix of both. Let's try to be consistent and follow the
recommended way.
Pierre Ossman [Thu, 30 Dec 2021 09:16:45 +0000 (10:16 +0100)]
Only restore level if it is wrong
Tweak the workaround from 9023a2e so that it only triggers if there
actually is a problem to fix. This is important since changing levels
also has the side effect of raising the window to the top of the level.
Pierre Ossman [Mon, 27 Dec 2021 11:29:59 +0000 (12:29 +0100)]
Relicense MonitorArrangement widget
This was designed as a general FLTK widget and we want to encourage
others to use it and improve it. So relicense these particular files in
a way that allows it to be used by anyone using FLTK.
As part of this we need to stop using other parts of TigerVNC as that
code is still covered by the GPL.
Pierre Ossman [Thu, 23 Dec 2021 14:58:00 +0000 (15:58 +0100)]
Fix typo in mirror monitor detection
Bug introduced in fb561eb but still somehow passed manual testing.
Resulted in some stray reads off the end of the stack, which were
hopefully harmless.
Pierre Ossman [Fri, 10 Dec 2021 09:05:25 +0000 (10:05 +0100)]
Simplify screen settings
Try to focus on the commonly used settings here in order to keep things
understandable. The uncommon settings will need to be specified as
command line arguments instead.
William Sjöblom [Wed, 24 Nov 2021 11:55:44 +0000 (12:55 +0100)]
Be consistent in "full screen" and "full-screen" use
Previously, there were a number of inconsistencies in the use of
"full-screen" and "full screen" in logs, documentation, and user
interfaces. The consensus seems to be that "full screen" is correct when
used as a noun while "full-screen" is correct when used as an
adjective. These inconsistencies have now been adjusted to follow
consensus.
Pierre Ossman [Fri, 5 Nov 2021 11:53:11 +0000 (12:53 +0100)]
Raise CMake requirement to 3.10
It's difficult to support both old and new versions, so raise the
requirement to the oldest that is commonly used, which is CMake 3.10.2
on Ubuntu 18.04.
Pierre Ossman [Fri, 5 Nov 2021 12:06:07 +0000 (13:06 +0100)]
Don't specify SOURCE in custom targets
They don't really contribute to anything as the command line is fixed,
and it makes CMake 3.20+ upset since it cannot find that file and
instead thinks we meant maketarball.in (CMP0115).
Pierre Ossman [Thu, 4 Nov 2021 08:01:08 +0000 (09:01 +0100)]
Increase maximum input buffer
macOS' built in VNC server unfortunately sends the entire monitor in a
single rect, so we need to be prepared to buffer a lot of data in case
the monitor has a large resolution.
Pierre Ossman [Thu, 14 Oct 2021 10:42:05 +0000 (12:42 +0200)]
Fix closing reconnect dialog logic
If you close the reconnect dialog then we should assume that you want to
close things, not that you want to reconnect. Unfortunately FLTK returns
the first choice when closing the dialog, so that needs to be the
"Cancel" alternative.
Samuel Mannehed [Wed, 6 Oct 2021 12:06:22 +0000 (14:06 +0200)]
Workaround options window appearing behind viewer
FLTK's fullscreen_x() function will always put the window on a high
level (NSStatusWindowLevel = 25), even if the window doesn't have focus.
This causes the OptionsDialog to end up behind the DesktopWindow when
the fullscreen function is called. Until we can rest assured that most
people building TigerVNC will use a fixed version of FLTK, we will need
this workaround.
Samuel Mannehed [Tue, 5 Oct 2021 14:28:59 +0000 (16:28 +0200)]
Remove modal property from ServerDialog
Modal windows are meant to be child windows such as menus or popups that
are intended to always appear in front of its parent.
Modal FLTK windows without a parent seem to behave strangely on macOS.
Such windows can appear in front of their modal children windows.
When opening OptionsDialog from ServerDialog, it was easy to get to a
broken state by then switching focus back to the ServerDialog. This
would cause the ServerDialog to appear in front, but not be useable as
the options window would still have control of mouse and keyboard.
Additionally, modal windows without parents appear in front of other
normal applications on macOS. This means that the ServerDialog couldn't
be put behind Safari for example.
The fact that ServerDialog was a "modal" window was a bit strange,
seeing as it doesn't have any parent windows. Removing the modal
property from this window causes all the strange-ness to go away.
Samuel Mannehed [Thu, 23 Sep 2021 14:31:59 +0000 (16:31 +0200)]
Only grab keyboard when we have focus
There was an issue with the new grabs that were introduced in commit 2289342de7222e4ff2483eae95bb9898830e6097. On macOS when running
vncviewer in fullscreen on one monitor, we saw that we sometimes got
resize and fullscreen events when switching the focus away from
vncviewer. With the changes in the commit mentioned above this meant
that we immediately grabbed the keyboard again, thus never releasing it.