aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/DesktopWindow.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Always log screen layout if validation failsWilliam Sjöblom2022-01-191-3/+5
| | | | | Unconditionally log the erroneous screen layout if it fails to validate to simplify debugging.
* Fix session resize after mirroring on Linux vncviewerWilliam Sjöblom2022-01-191-2/+6
| | | | | | | | | | | | | | | 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.
* Improve full-screen workaround on connectPierre Ossman2022-01-121-5/+11
| | | | | | | | | | | | | | 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.
* Avoid creating windows larger than current monitorPierre Ossman2021-12-301-0/+23
| | | | | Many window managers don't have proper logic to restrict the window size to something sane, so we have to take care of that ourselves.
* Don't move window in full-screen workaroundPierre Ossman2021-12-301-1/+0
| | | | | | 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.
* Only restore level if it is wrongPierre Ossman2021-12-301-1/+2
| | | | | | 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.
* Avoid leaking overlay memoryPierre Ossman2021-12-231-0/+1
| | | | | Fl_RGB_Image doesn't take ownership of the pixel data, so we have to explicitly free this as well once we are done.
* Be consistent in "full screen" and "full-screen" useWilliam Sjöblom2021-11-241-1/+1
| | | | | | | | | 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.
* Workaround options window appearing behind viewerSamuel Mannehed2021-10-061-4/+12
| | | | | | | | | 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.
* Only grab keyboard when we have focusSamuel Mannehed2021-09-241-1/+15
| | | | | | | | | | | 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. Fixes #1332.
* Create helper function for grabKeyboard conditionsSamuel Mannehed2021-09-241-18/+12
|
* Clean up global event handler structurePierre Ossman2021-09-061-36/+47
| | | | | Let's separate the standard global event handling from the hacky workarounds, for clarity.
* Restore FLTK event dispatcher on exitPierre Ossman2021-09-061-0/+2
|
* Merge branch 'fullscreens-added-removed' of https://github.com/x11clone/x11clonePierre Ossman2021-09-021-0/+39
|\
| * Recreate fullscreen window if screens are removed or addedPeter Åstrand (astrand)2018-05-071-0/+39
| |
* | Retry connection in case of an errorJohannes2021-07-231-1/+1
| |
* | Clean up style in recent monitor codePierre Ossman2021-07-191-11/+11
| | | | | | | | | | | | | | Fix some indentation issues and make sure everything* uses CamelCase. * MonitorArrangement is left as snake_case in order to pretend it is an independent FLTK widget class.
* | Explicitly choose current monitorHugo Lundin2021-07-161-3/+4
| | | | | | | | | | | | | | 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.
* | Add fullscreen mode for selected monitorsHugo Lundin2021-07-161-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add fullscreen mode parameterHugo Lundin2021-07-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Calculate overlay position from window sizeHugo Lundin2021-07-161-2/+27
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Release displays not enclosed by the windowHugo Lundin2021-07-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Capture all displays inside the viewport (macOS)Hugo Lundin2021-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | made full-screen edge scrolling smoother and fasterSelene ToyKeeper2021-04-301-20/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Support the VMware Cursor Position extension on vncviewerlhchavez2021-03-111-0/+32
| | | | | | | | | | | | | | | | This change makes it possible for re-synchronizing the remote cursor on the vncviewer when in fullscreen mode. This is done by locally moving the cursor position to what the server thinks it should be. Now SDL games should work!
* | Implement X Input pointer handling for UnixAaron Sowry2020-05-291-15/+7
| | | | | | | | | | | | | | | | Switch from using Core events to using X Input events for pointer devices in order to differentiate between mouse events and touch events. Because FLTK doesn't understand X Input 2, we intercept these events and translate them to core events where possible.
* | Ignore bogus FL_MOVE events from FLTKSamuel Mannehed2020-05-261-0/+6
| |
* | Do maximize more properly on macOSPierre Ossman2020-03-261-7/+1
| |
* | Don't resize viewer window when maximizedPierre Ossman2020-03-261-1/+38
| | | | | | | | | | Most window managers won't like this, and it tends to provoke bugs in FLTK, so let's avoid it. It's probably not what the user wants anyway.
* | Don't show the context menu hint when no hotkeySamuel Mannehed2019-10-251-2/+5
| |
* | Merge branch 'exclipboard' of https://github.com/CendioOssman/tigervncPierre Ossman2019-07-011-6/+16
|\ \
| * | Improved clipboard APIPierre Ossman2019-07-011-6/+16
| | | | | | | | | | | | | | | Change the internal clipboard API to use a request based model in order to be prepared for more advanced clipboard transfers.
| * | Clean up internal clipboard handlingPierre Ossman2019-07-011-2/+2
| | | | | | | | | | | | | | | | | | We now filter incoming data, which means we can start assuming the clipboard data is always null terminated. This allows us to clean up a lot of the internal handling.
* | | Request keyboard grab ability under XwaylandPierre Ossman2019-06-181-0/+22
|/ / | | | | | | | | We're usually white listed, but let's be a good citizen and formally request the keyboard grab ability from the compositor.
* | Merge branch 'connparams' of https://github.com/CendioOssman/tigervncPierre Ossman2018-12-101-14/+14
|\ \
| * | Split out ServerParams from ConnParamsPierre Ossman2018-11-011-13/+13
| | | | | | | | | | | | | | | | | | We need to track different things in the server and client, so separate things to two independent structures to keep things more clear.
| * | Encapsulate screen layout storage in ConnParamsPierre Ossman2018-11-011-12/+12
| | | | | | | | | | | | | | | | | | | | | Avoid direct access to the screen dimensions and layout so that we can make sure it stays sane. This also makes sure the layout is properly updated when we only get the screen dimensions from the server.
* | | Fix memory leaksJan Grulich2018-11-201-2/+2
|/ /
* | Fix multi-head placement of overlay (again)Pierre Ossman2018-09-111-11/+4
| | | | | | | | | | We should be looking at the physical monitor layout, not the current RFB layout. The latter might not be in sync with the local monitors.
* | Remove dead overlay codePierre Ossman2018-09-111-5/+0
| | | | | | | | Remnants from an earlier version of the code.
* | Center overlay on primary screenPierre Ossman2018-08-161-2/+21
| | | | | | | | | | Makes sure it is readable in a multi screen configuration, as otherwise it might end up crossing multiple screens.
* | Reduce size of context menu hintPierre Ossman2018-07-191-5/+8
| | | | | | | | | | It can get a bit intrusive for experienced users, so try to reduce the impact of it.
* | Ignore fake focus events from XGrabKeyboard()Pierre Ossman2018-06-121-0/+44
| | | | | | | | | | | | | | | | Grabbing (and ungrabbing) the keyboard generates fake focus events with modern versions of Xorg. This causes an infinite loop since we update the grab status on focus events. Work around this by ignoring these fake events.
* | Update comment about keyboard grab on focus changesPierre Ossman2018-06-121-9/+4
|/ | | | It is no longer a workaround but rather intended behaviour.
* Update fullscreen window if changing fullScreenAllMonitors optionPeter Åstrand (astrand)2018-05-021-2/+5
|
* Handle LED state sync entirely in ViewportPierre Ossman2018-03-261-4/+0
| | | | | Apply workaround for FLTK's bad focus handling so that we can let Viewport handle LED synchronisation without help from DesktopWindow.
* Move server cut text handler to ViewportPierre Ossman2018-03-261-0/+6
| | | | | That way both incoming and outgoing clipboard are both in the same place, making things clearer.
* Replace "frames" with "updates" in statsPierre Ossman2018-03-261-13/+13
| | | | | | The VNC servers aren't great at getting full frames with each update, so avoid calling it "frames per second" in the statistics as that can be misleading.
* Fix incorrect numbers in performance debug graphPierre Ossman2018-02-261-3/+3
| | | | | | | | | Copy paste errors/brain fart: - Pixels do not need a factor 8 for any conversion - Multiplying bytes by 8 gives bits, so lower case 'b', and bits use SI prefixes, not IEC
* Use current server time for XUngrabPointerPeter Åstrand (astrand)2018-01-151-1/+1
| | | | | | Similar to 841e9f32d5952d6f16f67294c2da8bf395066a9b but for the pointer. Fixes a problem where the desktop environment is unresponsive (to the mouse) after fullscreen exit; Fixes #579.