Commit graph

3126 commits

Author SHA1 Message Date
ElCruncharino
59d41b906e fix(win): stop TLS sockets busy-spinning the socket poll loop
pollSocket() caches a socket's writability and skips waiting once it's
known writable, relying on writeSocket() to clear the cache on
WSAEWOULDBLOCK. SecureSocket writes via SSL_write(), bypassing
writeSocket() entirely, so the cache never clears and the multiplexer
spins at a zero timeout instead of blocking whenever TLS hits
backpressure.

Add IArchNetwork::resetPollWriteOnSocket() and call it from
checkResult()'s SSL_ERROR_WANT_WRITE case, mirroring writeSocket()'s
existing WSAEWOULDBLOCK handling.
2026-07-28 09:06:06 -04:00
ZeroSegFault
0d7414d89a fix(mac): preserve mouse event numbers when dragging on macOS 27 2026-07-27 12:28:35 +01:00
thiago
831f9cb044 fix all keyboard shortcuts send the same keystroke 2026-07-26 21:11:40 -04:00
sithlord48
778950c247 build: remove glib2 dependency 2026-07-23 12:16:22 +01:00
sithlord48
d9c01486e8 build: remove libm links 2026-07-23 12:16:22 +01:00
ElCruncharino
6d48d3663e fix: release EIS emulation grab when idle so client screens can sleep 2026-07-20 12:52:21 -04:00
Luiz Sardinha
d38c69c05d fix(mac): ensure background clicks work correctly on macOS 27 2026-07-20 12:11:22 +01:00
tehreet
96f544de6d fix: capture the mouse on macOS while the cursor is on a client
On the server, while the cursor is on a client, every physical mouse move
warped the local cursor back to screen center and the tap callback returned
the mouse-move event instead of consuming it. That leaked continuous motion
to whatever local app sat under the centered cursor (e.g. a fullscreen game
or a centered video reacting to the phantom movement).

Capture the mouse the way macOS games do instead: dissociate the hardware
mouse from the cursor in leave() so the cursor freezes and hides, read raw
deltas from the event in onMouseMove(), consume off-screen moves in the tap
callback, and re-associate in enter() (disable() already does via
showCursor()). This retires the center-warp and the "bogus motion" edge
heuristic that only existed to paper over the warp.

fixes: #5871
2026-07-18 13:25:30 -04:00
ElCruncharino
89a6c7f2ed fix(wayland): stop EiScreen cursor from following transient shape churn
updateShape() unconditionally recentered the cursor and notified the
server on every call, even mid-churn when no device reports a region
yet. Only touch tracked state once a real region is found, and only
notify the server when the shape actually changed.
2026-07-17 22:34:09 +01:00
TSUMUGI-XE
e8e9d1c193 fix(wayland): only add input-capture barriers on the outer desktop edge
On a multi-monitor server the portal reports one input-capture zone per
output. handleZonesChanged added a pointer barrier on every active side of
every zone, including edges that sit on an internal seam between two adjacent
monitors. The portal rejects such a barrier ("adjacent to multiple monitor
edges"), and because a single rejected barrier fails the whole
set_pointer_barriers request, input capture never engaged on multi-monitor
Wayland servers.

Compute the union (bounding box) of all zones first, then add a barrier for a
given side only when that zone edge lies on the outer boundary of the union,
skipping internal seams.
2026-07-17 22:11:03 +01:00
开心
6592dab84e fix: defer client disconnect cleanup 2026-07-15 11:45:02 +00:00
开心
6934dbe62b fix: keep event handlers alive during dispatch 2026-07-15 11:45:02 +00:00
sithlord48
8acf76c5d1 refactor: simplify Config::readSectionOptions to look for only keystroke mousepress and end 2026-07-13 09:55:11 +01:00
sithlord48
06b7fe1691 refactor(settings): do not read address from old settings 2026-07-13 09:55:11 +01:00
Nick Bolton
1995423cb8 fix: improve fingerprint handling 2026-07-10 15:12:42 +00:00
Nick Bolton
74392eea6c fix: rename updateLocalFingerprint to updateFingerprintButton for clarity
The function name didn't make it's actual side effects clear to me
2026-07-10 15:12:42 +00:00
Nick Bolton
4cb5c3ec9c fix: disconnect portal selection-transfer from parent session
Wrong session logged a glib critical on teardown.
2026-07-10 12:07:46 +00:00
Nick Bolton
f0f3428d50 fix: stop portal input capture thread on server exit
Server aborted with "pure virtual method called" when the bind address
was in use: EiScreen's PortalInputCapture glib thread outlived Arch and
hit its freed vtable. ~EiScreen never deleted m_portalInputCapture, and
a fatal startup threw past cleanupServer(). Fix both.
2026-07-10 12:07:46 +00:00
SASANO Takayoshi
2c37169f73 fix: reivse scoped_lock to avoid deadlock for XWindowsClipboard
fix #9890
2026-07-08 13:27:50 +01:00
Nick Bolton
3f2571dfa3 fix: simplify key translation logic by removing clamping 2026-07-06 12:16:05 +01:00
Nick Bolton
fc44b0bb18 fix: restore client protocol downgrade message 2026-07-04 15:58:17 +01:00
BeaCox
bcd3a658fc fix: use local clipboard limit for client receive 2026-07-04 00:53:42 +01:00
BeaCox
8a535fd5dd fix: enforce clipboard receive size limits 2026-07-04 00:53:42 +01:00
sithlord48
205a3c803e fix: clamp mapped modifiers 2026-07-03 13:44:59 +01:00
sithlord48
b21f5a7ca8 i18n: make sure log levels text is translated 2026-07-02 12:07:44 +00:00
sithlord48
8266fbbe6a fix: Check options array is always an even size 2026-07-01 17:02:09 +01:00
sithlord48
570c9a494b refactor: upgrade server options section setting to new format 2026-06-25 12:08:33 +01:00
sithlord48
f66dbf69f3 chore: remove unused Config methods removeScreen removeScreens removeAllScreens removeOption removeOptions 2026-06-24 21:03:26 +01:00
sithlord48
a45e81fb15 refactor: Remove undocumented hold modifiers to switch code 2026-06-24 20:46:15 +01:00
sithlord48
55b6789728 refactor: save aliases without restarting the core. remove unknown screens when saving the server config 2026-06-23 19:28:35 +01:00
sithlord48
8010d8a8b2 refactor: move saving of screen aliases to general deskflow.conf 2026-06-23 19:28:35 +01:00
sithlord48
2d5cf33f16 chore: remove unused removeAlias methods 2026-06-23 19:28:35 +01:00
sithlord48
f3fb31914d refactor: replace use of insert for std::maps with try_emplace 2026-06-22 10:27:35 -04:00
sithlord48
a54d4d6754 refactor: remove server dead corners. instead set per screen 2026-06-22 10:10:47 -04:00
sithlord48
95ffe1ba03 fix: set new options before reading old ones 2026-06-22 13:52:03 +01:00
sithlord48
161b72e43d refactor: Use mutex to protect m_time in MSWindowsClipboard 2026-06-19 08:26:51 -04:00
sithlord48
698ebc30b3 refactor: Use mutex to protect m_open / m_time in EiClipboard 2026-06-19 08:26:51 -04:00
sithlord48
0042b43bac refactor: use Mutex to protect vars in XWindowClipboard 2026-06-19 08:26:51 -04:00
sithlord48
81e6e13d94 refactor: Use Mutex to protect m_open and m_time in Clipboard.cpp 2026-06-19 08:26:51 -04:00
sithlord48
5eb1d7068e refactor: declare vars where they are used in if statements 2026-06-19 08:14:54 -04:00
sithlord48
31018910f8 refactor KeySqquenceWidget::event join identical cases 2026-06-19 08:14:54 -04:00
sithlord48
f52fdec236 refactor: make PortalRemoteDesktop:handleSessionTransfer a const 2026-06-19 08:14:54 -04:00
sithlord48
a42b6cf897 refactor: make PortalRemoteDesktop:handleSessionOwnerChanged a const 2026-06-19 08:14:54 -04:00
sithlord48
710aae5f3f refactor: make PortalRemoteDesktop::claimClipboard a const 2026-06-19 08:14:54 -04:00
sithlord48
e800512160 refactor: PortalInputCapture remove extra private section in header 2026-06-19 08:14:54 -04:00
sithlord48
cc35a3dc7d refactor: make PortalInputCapture::HandleSelectionTransfer const 2026-06-19 08:14:54 -04:00
sithlord48
9196b23f50 refactor: make PortalInputCapture::claimClipbaordOwnership const 2026-06-19 08:14:54 -04:00
sithlord48
cd1652b758 reactor: mark that session var maybe unused 2026-06-19 08:14:54 -04:00
sithlord48
4f5fdbca11 refactor: make PortalInputCapture::readClipboardSelection const 2026-06-19 08:14:54 -04:00
sithlord48
9f7dbe46ef refactor: make ServerConfigDialog::initConnections const 2026-06-19 08:14:54 -04:00
sithlord48
3fc0aaec5e refactor: change server clipboard grab messages to DEBUG level 2026-06-19 08:13:24 -04:00
sithlord48
ace44500d0 fix: do add existing aliases to the alias list, correctly remove items in the list before saving 2026-06-19 12:39:47 +01:00
sithlord48
e58c41ac5e refactor(Settings): Move clipboard size to the general config , store as a mb value convert to expected size on when adding the option 2026-06-19 12:25:28 +01:00
sithlord48
4fd0bf7e1e refactor(Settings): move clipboardSharing -> enableClipboard and to main config 2026-06-19 12:25:28 +01:00
sithlord48
df3746777b chore: remove unused wl-clipboard support 2026-06-18 22:06:37 +01:00
sithlord48
16cd4695cc refactor: do not save empty xdgtokens 2026-06-18 22:06:37 +01:00
Nick Bolton
03a4800677 feat: clipboard support for portal remote desktop
Add libportal clipboard handling to the remote desktop.
Supports both directions (server to Wayland client paste,
and copy from the Wayland client back to the server)
for UTF-8 text, plain text, and PNG/BMP images.

The shared mime-type table, BMP/DIB and PNG encode/decode helpers, and
portal selection read/write live in a new PortalClipboard
helper used by both PortalInputCapture and PortalRemoteDesktop.

If the portal returns a restored RemoteDesktop session without clipboard
enabled (a token persisted before clipboard support existed), discard
the restore token and reconnect so the user gets a fresh permission
dialog. Otherwise the session would loop with a clipboard-less token
forever.
2026-06-18 22:06:37 +01:00
Nick Bolton
66cb367473 fix: skip clipboard selection transfer if clipboard is active 2026-06-18 22:06:37 +01:00
Nick Bolton
67f6f893fa refactor: drop redundant clipboard read on selection owner change 2026-06-18 22:06:37 +01:00
Peter Hutterer
d7d3f8d4c8 feat: inputcapture clipboard support
Send the clipboard over the libportal InputCapture portal. Only built
if the installed libportal has clipboard support.

AI disclosure: Claude was used on both sides of this work.
- Peter Hutterer: "The second commit was purely written by Claude
  after I stared at this for too long without seeing any hope of
  getting started. Turns out Claude wrote something that at least
  looks correct and it does work. It needs review but also needs
  knowledge of deskflow's internals that I don't have..."
- Nick Bolton: Claude also assisted with the follow-up work listed
  below (image copy/paste, session re-request, race fixes, size/mime
  validation, and CMake detection).

Server side (Wayland host, Peter Hutterer):
- Initial scaffolding for inputcapture clipboard support, guarded so it
  only builds when the portal exposes the clipboard API.
- Integrate clipboard data into the inputcapture session so the host
  clipboard can be offered to the remote (the Claude-written commit
  referenced above).

Client side (Wayland receiver, KoljaFrahm):
- Receive clipboard data from the server and feed it into the local
  clipboard through libportal. Built on the reference code by Peter:
  https://github.com/whot/libportal-clipboard-test/tree/main

Build integration and rebase (Chris Rizzitello, sithlord48):
- Add the original CMake check for libportal/clipboard.h to define
  HAVE_LIBPORTAL_CLIPBOARD, and guard the libportal clipboard use on
  it.
- Update the code style and rebase onto the updated input capture
  session persistence: https://github.com/deskflow/deskflow/pull/9415

Image support and reliability fixes (Nick Bolton):
- Support image copy/paste in addition to text, so screenshots and
  other image clipboard contents work both ways through inputcapture.
- Re-request the input capture session when it comes up without a
  clipboard, so new testers with existing sessions can get clipboard
  functionality without needing to clear the session.
- Defer clipboard reads until the input capture session is active,
  avoiding races where reads happen before the portal is ready.
- Fix assorted style issues in original commit to match conventions.
- Check the configured clipboard size limit and validate incoming
  mime types before forwarding inputcapture clipboard data.
- Switch the CMake clipboard probe to check_symbol_exists so detection
  matches what the compiler actually sees in the headers.

Co-authored-by: Nick Bolton <nick@symless.com>
Co-authored-by: KoljaFrahm <GitHub.Kolja@dfgh.net>
Co-authored-by: Chris Rizzitello <sithlord48@gmail.com>
2026-06-18 22:06:37 +01:00
Nick Bolton
f2a3fc6596 fix: resend only the grabbed clipboard, not all clipboards
fixes assert fail in `src/lib/server/Server.cpp` `onClipboardChanged`:
`assert(sender == m_clients.find(clipboard.m_clipboardOwner)->second);`
2026-06-18 22:06:37 +01:00
Nick Bolton
1b27a5405d fix: simplify clipboard size limit logging 2026-06-18 22:06:37 +01:00
Charles Le (cle-air-m3)
13f98475a2 fix: remove ClipboardSending handler in proxy destructors (UAF)
fixes: #9842
2026-06-17 12:28:51 +01:00
sithlord48
750fdbeb34 refactor: rename the defaultLockToScreenState checkbox to defaultLockToComputerState 2026-06-17 10:59:37 +01:00
sithlord48
eb6930a062 refactor(Settings): move defaultLockToScreenState to general settings 2026-06-16 09:59:51 +01:00
sithlord48
b665c730b7 refactor(Settings): move disableLockToComputer to general settings 2026-06-16 09:59:51 +01:00
sithlord48
69b9baaaeb refactor(Settings): move win32keepForeground to general settings 2026-06-16 09:59:51 +01:00
sithlord48
46e90e12ff refactor(Settings): move relative Mouse movement setting to general settings 2026-06-16 09:59:51 +01:00
sithlord48
ba37ff854f chore: remove unused clientAddress var in ServerConfig 2026-06-16 09:59:51 +01:00
sithlord48
261335d6c3 refactor(Settings): move switchDoubleTap to general settings 2026-06-16 09:59:51 +01:00
sithlord48
ea8f3881fe refactor(Settings): move switchDelay to general settings 2026-06-16 09:59:51 +01:00
sithlord48
488d620b3b refactor(Settings): Move heartbeat to general settings 2026-06-16 09:59:51 +01:00
sithlord48
f51fb4affb refactor: move hasSwitchDoubleTap to general settings 2026-06-12 17:51:41 +01:00
sithlord48
f686e3c503 refactor: mv hasSwitchDelay to general settings 2026-06-12 17:51:41 +01:00
sithlord48
d665b55111 refactor: move hasHeartbeat to general settings 2026-06-12 17:51:41 +01:00
sithlord48
c66c356665 refactor(ServerConfigDialog): add new init connections method to centeralize all connections 2026-06-12 17:51:41 +01:00
sithlord48
493e2f374c refactor(ServerConfigDialog): Add a loadFromConfig method to centeralize loading 2026-06-12 17:51:41 +01:00
sithlord48
76673b8cc3 refactor(ServerSettingsDialog): Always allow configuration of server protocol 2026-06-10 17:37:56 +01:00
sithlord48
516f24a0ba refactor(Settings): add helper method to get network protocol as NetworkProtocol directly 2026-06-10 17:37:56 +01:00
sithlord48
b91a39492f refactor(settings): exclusively read proto from the general settings 2026-06-10 17:37:56 +01:00
sithlord48
c4f65c04a3 refactor: remove public access to serverConfig row and column info 2026-06-10 15:52:17 +01:00
sithlord48
6105e4025a refactor: move numRows to general configuation server/gridHeight 2026-06-10 15:52:17 +01:00
sithlord48
cd1ceccda5 refactor: move numColumns to general configuation server/gridWidth 2026-06-10 15:52:17 +01:00
Momoyama
16141d7156 fix(client): restore relative cursor positions locally
Avoid stale server enter coordinates in relative mouse mode by saving and reusing the client's local cursor position around leave and enter.

Store Windows restore positions per desktop so UAC and secure desktop transitions do not reuse normal desktop coordinates. This affects relative mouse movement restore behavior while preserving the existing center-on-leave path.
2026-06-10 15:34:27 +01:00
Nick Bolton
4e121dac30 chore: update 'Synergy App Ltd' copyright (company renamed) 2026-06-09 00:06:11 -04:00
Kentaro Hayashi
faf83d7824 fix: drop misleading SSL_set1_host for OpenSSL 4.0.0
It will fix the following warning:

  In member function 'int SecureSocket::secureConnect(int)':
  /build/deskflow.work/src/lib/net/SecureSocket.cpp:479:16: warning: 'int SSL_set1_host(SSL*, const char*)' is deprecated: Since OpenSSL 4.0 [
  -Wdeprecated-declarations]
    479 |   SSL_set1_host(m_ssl->m_ssl, name.c_str());
        |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /build/deskflow.work/src/lib/net/SslLogger.h:8,
                   from /build/deskflow.work/src/lib/net/SecureSocket.cpp:20:
  /usr/include/openssl/ssl.h:1922:34: note: declared here
   1922 | OSSL_DEPRECATEDIN_4_0 __owur int SSL_set1_host(SSL *s, const char *host);
        |                                  ^~~~~~~~~~~~~

NOTE: It seems that SSL_set1_host setup params for hostname verification, but
it will not be used correctly afterward (See
SSL_CTX_set_cert_verify_callback
in SecureSocket::initContext). This implicit behavior cause misleading
and harmful.

Signed-off-by: Kentaro Hayashi <kenhys@xdump.org>
2026-06-05 10:59:58 +01:00
Kentaro Hayashi
fdb100649b fix: invalid type conversion for OpenSSL 4.0.0
Since OpenSSL 4.0.0, X509_get_subject_name returns const X509_NAME
pointer, thus X509_NAME_add_entry_by_txt does not accept it anymore.

See /usr/include/openssl/x509.h.

Instead, explicitly operates it via mutable X509_NAME object.

It is safe operation without using X509_get_subject_name() because
subject name was not modified after cert = X509_new() assignment.

It will fix the following error.

  error: invalid conversion from 'const X509_name_st*' to 'X509_NAME*' {aka 'X509_name
  _st*'} [-fpermissive]
     87 |   X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, reinterpret_cast<const unsigned char *>("Deskflow"), -1, -1, 0);
        |                              ^~~~
        |                              |
        |                              const X509_name_st*

Signed-off-by: Kentaro Hayashi <kenhys@xdump.org>
2026-06-05 10:59:58 +01:00
sithlord48
19a7dc622c refactor(FingerprintDialog): Adjust header to span the dialog 2026-06-05 10:32:06 +01:00
sithlord48
8ed7a3efe1 refactor(FingerprintPreview): Adjust width so hash is not longer slighty cutoff in some cases 2026-06-05 10:32:06 +01:00
sithlord48
8d1b33b9f1 refactor: move fixed font to styleUtils, use this where fixed fonts are used 2026-06-05 10:32:06 +01:00
sithlord48
6bbf5338ef refactor(FingerprintPreview): remove unneeded innsersha256layout 2026-06-05 10:32:06 +01:00
extra-salad
5e79e49966 fix(wayland): map portal activations by barrier id
Track InputCapture pointer barrier metadata so activation callbacks can identify the fired edge. Portal activations may report cursor positions on zone boundaries, while Deskflow switches using aggregate screen coordinates. Clamp the activation position to the portal zone, then project the fired edge onto Deskflow's aggregate screen before dispatching primary motion.

Keep barrier metadata in sync when zones are rebuilt or when the compositor rejects a requested barrier.
2026-06-02 13:17:01 +01:00
extra-salad
be3cc0ff7a refactor(wayland): factor portal barrier creation
Move repeated InputCapture pointer barrier construction into a helper and add a small side-to-name utility for logging. This keeps the existing barrier geometry and activation handling unchanged while making later barrier metadata changes easier to review.
2026-06-02 13:17:01 +01:00
sithlord48
babef9c307 fix: crash on windows if fixed font is missing 2026-06-01 14:36:12 +01:00
sithlord48
80cc64c238 fix: use Qt localized path for open cert
fixes: #9764
2026-06-01 13:21:20 +01:00
Momoyama
e8a474ba7d fix(macos): warp cursor to center on leave to fix first-move jump
When macOS is the primary screen, hotkey switching to a secondary screen can leave the local cursor baseline away from the hidden-cursor center. The first physical mouse movement is then interpreted as a large secondary-screen delta.

Align macOS primary leave behavior with the Windows and X11 implementations by logging and warping the cursor to the primary-screen center before marking the screen off screen. OSXScreen::warpCursor also updates m_xCursor and m_yCursor, so the next motion delta starts from the expected center baseline.

Impact is limited to macOS primary/server leave handling; macOS secondary/client leave behavior and non-macOS builds are unchanged.
2026-06-01 11:35:39 +01:00
Nick Bolton
bf65080b8b fix: change QString to QByteArray for exception message handling 2026-05-26 12:25:56 -04:00
alfredo1491
6212f9bec6 refactor(win32): update MSWindowsSession and MsWindowsWatchdog to use MsWindowsHandle 2026-05-26 16:58:02 +01:00
Nick Bolton
62a8ee749f fix(macos): update BMP handling to support extended headers and improve pixel offset calculation 2026-05-19 17:48:58 +01:00
SASANO Takayoshi
53903016b1 fix: remove unneeded EVP_PKEY_new() (causes memory leak) 2026-05-19 11:56:14 -04:00