aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Clear clipboard state when its not plain textSamuel Mannehed2024-10-221-0/+3
| | | | | | | | | | | | 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. (cherry picked from commit 6f6d9406035d59b6a9f59ff0f38206c0c98a0266)
* Only announce clipboard for plain text dataSamuel Mannehed2024-10-221-0/+5
| | | | | | | | | | | | | | | 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. (cherry picked from commit 8a80c906b9f7c08b1c664569a97d327d62c6d8ae)
* Apple only: exit FL_Window fullscreen if active in order to minimize.Rudimar Ronsoni Jr2024-10-221-0/+4
| | | | (cherry picked from commit a1bd5cf795d36dd4ce17e980b5cb0a7f200756b5)
* Add own keysym to name functionPierre Ossman2023-11-161-10/+3
| | | | | | | | | 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.
* Completely ignore server clipboard when unfocusedPierre Ossman2023-09-111-19/+4
| | | | | | | | | | | | | | | | | | 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.
* Change accelerator for "Disconnect" entryPierre Ossman2023-08-211-1/+1
| | | | | | | Using "c" is in conflict the the "Ctrl" entry, so we need to pick something else here. This was a regression introduced in 44b085a.
* Merge branch 'types2' of https://github.com/CendioOssman/tigervncPierre Ossman2023-06-301-0/+5
|\
| * Clean up string encoding handlingPierre Ossman2023-06-301-0/+5
| | | | | | | | | | | | 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.
* | Remove unneeded "using namespace"Pierre Ossman2023-06-141-1/+0
|/ | | | The need for these must have got lost somewhere in the type cleanup.
* Remove unused rfb/util.h includesPierre Ossman2023-02-041-0/+1
| | | | | | | | These files don't use anything from this header, so remove the include. This exposes some missing includes in other places, though. So add an explicit include in the files that were relying on an indirect inclusion.
* Return std::string instead of dynamic allocationsPierre Ossman2023-02-041-5/+3
| | | | | | We mostly use classical C strings, but the memory management around them can get confusing and error prone. Let's use std::string for the cases where we need to return a newly allocated string.
* Use stdint typesPierre Ossman2023-02-011-6/+6
| | | | | Avoid having our own custom stuff and instead use the modern, standard types, for familiarity.
* Explicitly mark unused parametersPierre Ossman2023-01-041-1/+1
| | | | | This allows us to separate accidentally unused, from explicitly unused parameters, which allows us to turn on such checks in the compiler.
* Merge branch 'newoptions' of https://github.com/CendioOssman/tigervncPierre Ossman2022-12-221-1/+2
|\
| * Split out FLTK utility functionsPierre Ossman2022-09-071-0/+1
| | | | | | | | | | These have nothing to do with layout, so let's split them to their own file.
| * Move general FLTK stuff to own directoryPierre Ossman2022-09-071-1/+1
| | | | | | | | | | | | | | Let's separate TigerVNC specific things from stuff that could be part of upstream FLTK. These are files that we would like to collaborate with other FLTK users, so they are more liberally licensed and avoid using TigerVNC specific things.
* | Handle macOS keyboard stealingPierre Ossman2022-12-131-4/+16
|/ | | | | | | | | | The system steals keyboard events for certain system keyboard shortcuts, e.g. Cmd+Tab. Unfortunately this isn't considered a focus loss, so we don't realise we've lost a few keyboard events and can end up in a confused state. Fortunately it is possible to detect when this happens and reset the keyboard state, just like we do when focus is lost.
* Add missing FLTK include statementsAlbrecht Schlosser2022-07-071-0/+1
| | | | Add also missing <stdlib.h> where required.
* Deduplicate vncviewer error messagesWilliam Sjöblom2021-11-231-24/+8
| | | | | vncviewer previously had a the same localized error message duplicated on a bunch of places. Pull these duplicates out into a single function.
* Retry connection in case of an errorJohannes2021-07-231-21/+29
|
* Merge branch 'autoclip' of https://github.com/CendioOssman/tigervncPierre Ossman2021-02-031-5/+7
|\
| * Improve clipboard debug logging in viewerPierre Ossman2021-01-041-5/+7
| |
* | Merge branch 'noblock' of https://github.com/CendioOssman/tigervncPierre Ossman2021-01-191-8/+16
|\ \ | |/ |/|
| * Better error messages when terminatingPierre Ossman2020-05-211-8/+16
| | | | | | | | | | Include something more user friendly when we need to fail fatally and not just the technical error.
* | Fake key release events for some Japanese keysPierre Ossman2020-11-201-0/+10
| | | | | | | | | | Windows either completely omits WM_KEYUP for these, or only sends it just before the next WM_KEYDOWN for the key.
* | Cancel AltGr timeout on mouse events as wellSamuel Mannehed2020-05-291-16/+32
|/ | | | | | | | | | We have a timer after Ctrl is pressed in order to see if an Alt will come right after. Ctrl + Alt is what windows sends for AltGr. If a key other than Alt was pressed we knew that we could cancel this timer, this commit extends that to mouse events too. Since this detection breaks the true order of events we want to make a decision as fast as possible.
* Add emulated middle mouse buttonAlex Tanskanen2020-01-161-16/+21
| | | | | | | | Not every mouse has three buttons e.g. laptops. Some OS might not have support for middle mouse button emulation. This commit adds emulation for middle mouse button when pressing both left and right mouse button simultaneously.
* Remove "Dismiss menu" from context menuAlex Tanskanen2020-01-091-8/+2
| | | | | This was not necessary since you could use ESC key or simply just clicking outside of the context menu to close the menu.
* Set initial blank cursorPierre Ossman2019-12-231-3/+6
| | | | | | | | If the server doesn't support local cursors and want to render them itself then we need to make sure the local cursor is invisible. This also makes sure we always have some cursor allocated, so we can remove the checks in some places.
* Use UTF-8 in clipboard APIPierre Ossman2019-07-011-11/+5
| | | | | In prepartion for better clipboard extensions that can send Unicode data between the client and server.
* Improved clipboard APIPierre Ossman2019-07-011-62/+81
| | | | | Change the internal clipboard API to use a request based model in order to be prepared for more advanced clipboard transfers.
* Add UTF-8 to/from ISO 8859-1 conversion routinesPierre Ossman2019-07-011-29/+13
| | | | | We convert between UTF-8 and ISO 8859-1 (latin 1) in several places so create some common routines for this.
* Clean up internal clipboard handlingPierre Ossman2019-07-011-5/+5
| | | | | | 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.
* Make sure clipboard uses \n line endingsPierre Ossman2019-07-011-6/+10
| | | | | | This is required by the protocol so we should make sure it is enforced. We are tolerant of clients that violate this though and convert incoming clipboard data.
* Hide setPrimary parameter on non-X11 platformsPierre Ossman2019-04-011-0/+4
| | | | | | It is already hidden in the UI, so make sure it also is gone as a command line parameter. This follows the behaviour of the similar sendPrimary parameter.
* Only do initial LED sync if focusedPierre Ossman2019-02-281-3/+5
| | | | | | | | | | We always sync when we get focus, so this code path is really only for when the server announces LED state support after we already have focus. Make sure we only handle this specific scenario as otherwise we could end up syncing twice, which just toggles things back and forth and ends up syncing incorrectly.
* Merge branch 'connparams' of https://github.com/CendioOssman/tigervncPierre Ossman2018-12-101-5/+5
|\
| * Split out ServerParams from ConnParamsPierre Ossman2018-11-011-5/+5
| | | | | | | | | | | | We need to track different things in the server and client, so separate things to two independent structures to keep things more clear.
* | Fixed handling of AltGr from Windows' touch keyboardPierre Ossman2018-11-061-7/+13
| | | | | | | | | | | | We need to test this always in order to catch Ctrl+AltGr, and to handle release of the key properly. Hopefully there isn't any other case where VK_MENU is sent without a scan code.
* | Handle AltGr from Windows' touch keyboardPierre Ossman2018-11-061-0/+7
|/
* Ignore buttons in mouse leave eventsPierre Ossman2018-07-311-1/+4
| | | | | | | | For KDE we can sometimes get a bunch of stray FL_LEAVE events before gaining focus. Sending their included button information gets things in the incorrect order with regard to other synchronisation we do on focus. So just ignore buttons as the only information we want out of the leave information is a position update.
* Fix try/catch for flushPendingClipboard()Pierre Ossman2018-07-111-10/+10
| | | | | We put the try/catch as close as possible to the writes in all other case, so make sure this code also follows that pattern.
* viewer: reset ctrl / alt to menu state on focusDominique Martinet2018-07-081-0/+6
| | | | | | Setting Ctrl or Alt key on menu only sends the key press, and the state is lost when focus is lost and recovered. This checks the menu variable and sends the keys again if needed.
* Properly sync LED state on connectPierre Ossman2018-06-071-0/+10
| | | | | | We should start by getting the remote end in sync with the actual keyboard state. This would work randomly before depending on if we got the first LED state message before or after we got focus.
* Merge branch 'clipfocus' of https://github.com/CendioOssman/tigervncPierre Ossman2018-04-201-17/+104
|\
| * Avoid clipboard updates when not focusedPierre Ossman2018-03-261-0/+46
| | | | | | | | | | | | | | We don't want to surprise the user with unexpected clipboard changes when vncviewer is in the background, and it is both wasteful and possibly insecure to inform the server of every clipboard update when the user isn't interacting with it.
| * Add focus test helper for ViewportPierre Ossman2018-03-261-17/+13
| |
| * Handle LED state sync entirely in ViewportPierre Ossman2018-03-261-0/+15
| | | | | | | | | | 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/+30
| | | | | | | | | | That way both incoming and outgoing clipboard are both in the same place, making things clearer.
* | Stop abusing InputHandler class for write classPierre Ossman2018-03-281-7/+8
|/ | | | | | The handler is for incoming data and we should not be abusing that class for the writer class. Do proper write prototypes for the relevant functions.