Commit graph

814 commits

Author SHA1 Message Date
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
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
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
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
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
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
sithlord48
acf865fa11 refactor(log): Convert LogLevel into a class using LogLevel::Level as its enum, store values as the Option string display as localized string' 2026-05-15 11:47:10 +01:00
sithlord48
b0413ed4ff refactor: move base/LogLevel -> common/LogLevel 2026-05-15 11:47:10 +01:00
sithlord48
8e469379e8 refactor(log): Squash all Debug1 And Debug2 logs into Verbose
fixes: #9725
BREAKING_CHANGE: log level values have changed settings for log level may need to be reset
2026-05-15 11:47:10 +01:00
Luiz Sardinha
426b43fc09 fix(mac): protect TIS API calls with a mutex (they are not thread safe) 2026-05-12 06:17:14 +01:00
Luiz Sardinha
44c5c15082 fix(mac): prevent cursor warps from outside quartz event loop (if active) 2026-05-12 05:54:49 +01:00
Ketan Patel
c3ecd0b806 fix(macos): recognize brightness media keys
Map macOS brightness media key events back to Deskflow key IDs so they
can be captured and forwarded from macOS servers.

Fixes #9709
2026-05-08 18:57:09 +01:00
Peter Hutterer
1c789fd6a9 feat: handle input capture session persistence
Use the new libportal API to start a CreateSession2, then set the
session persistence and read/write the tokens as required. This allows
us to start a server without a permission dialog - provided the portal
supports it and the user is ok with that.
2026-05-05 11:58:02 +01:00
Nick Bolton
69339b5bcc feat(daemon): add missing command info log line for daemon 2026-04-25 10:48:09 -04:00
Nick Bolton
5c480ca515 fix(cve): run switch commands as normal user on Windows to prevent privilege escalation
CVE-2026-41477
2026-04-25 10:48:09 -04:00
Luiz Sardinha
5a028c12d4 fix(mac): quit core if accessibility permissions are revoked 2026-04-21 06:54:05 -04:00
Nick Bolton
e4bafaf88f refactor(win32): More consistent Windows desk switch log line 2026-04-07 13:09:29 +01:00
Nick Bolton
aaef600ffa fix(mac): Remove Cocoa app loop and fix macOS event tap for Qt threading 2026-04-07 13:09:29 +01:00
sithlord48
41fcc1e815 refactor: add [[no_unique_address]] hint for XWindowsScreen::m_powerManager 2026-03-30 10:36:15 +01:00
Artturi Alm
469a238b04 fix: AltGr for clients w/windows+finnish-layout. 2026-03-26 10:52:45 +00:00
sithlord48
ebab0eb62e chore: remove unused ScreenException methods for reconnect timer 2026-03-25 14:54:57 +00:00
UberKitten
ac8cc42b7a fix: retry OpenClipboard() on Windows
OpenClipboard() can fail transiently when another process holds the
clipboard mutex. Add a retry loop (5 attempts, 5ms delay) so that
Deskflow handles brief contention gracefully instead of immediately
failing.
2026-03-12 08:19:43 -04:00
sithlord48
12cf55d4fc build: Replace WINAPI_CARBON with Q_OS_MAC 2026-03-06 08:57:31 -05:00
Luiz Sardinha
c80cd56f27 fix: properly handling infinite timeout for macOS on EventQueue 2026-02-27 19:47:59 -05:00
sithlord48
9188d4b1c1 build: require libportal 0.9.1 2026-02-26 12:52:03 +00:00
sithlord48
4c7f546c60 fix: XWindowScreen, do not send a scroll delta for 0
fixes: #9477
2026-02-18 18:11:38 +00:00
wake
e555b63931 fix: extra "a" with Rime and apply clang-format 2026-02-11 14:33:04 +00:00
sithlord48
a532f655c1 feat: support horizontal scrolling
fixes: #7220
based on 9f15b1bcf2
Co-authored-by: Evan Maddock <maddock.evan@vivaldi.net>
2026-02-11 11:59:28 +00:00
sithlord48
050cb649c2 refactor: use ScrollDelta for fakeMouseWheel 2026-02-09 09:02:21 +00:00
sithlord48
5612e99f1d refactor: Move the scrollModifiers to ISecondaryScreen 2026-02-09 09:02:21 +00:00
sithlord48
a520e3b2e9 refactor: check settigns for invertscroll in PlatformScreen 2026-02-06 12:51:39 +00:00
sithlord48
0f6ec6c196 refactor: XWindowsScreen use a fixed minimum step value in place of the scroll speed setting 2026-02-06 12:51:39 +00:00
sithlord48
857326b274 refactor: rename PlatformScreen::mapClientScrollDirection -> PlatformScreen::applyClientScrollModifier
prepare for horizontal scroll support by having it handle pairs of x and y values
2026-02-06 12:51:39 +00:00
sithlord48
84e1e722c0 fix: Send extra mouse buttons on mac os servers to clients 2026-02-04 09:56:10 +00:00
sithlord48
4200de66ee fix: scroll Issue on X11 by not checking for wheel in mapButtonToX 2026-02-04 09:45:25 +00:00
sithlord48
05c050b81e fix: handle back mouse on xwindows and windows
based on : 9f15b1bcf2
fixes: #5682
2026-02-03 09:41:22 +00:00
Johannes Berg
f065979b3f Fix: detect key repeat in libei input
For libei, there's no indication that a key is repeated.
However, sending repeated key down events (DKDN instead
of DKRP for the synergy protocol) can be confusing to
clients, which then causes issues like in #7971.

Detect repeated key down events in EiScreen server and
send them to the client with the repeat flag set, so in
e.g. synergy that causes the DKRP messages, to be less
confusing.

For me this fixes an issue where the synergy client is
creating a USB device, which requires repeated events
to be entirely dropped since the host OS where the USB
device is connected will do its own repeat when a key
is held down.
2026-01-30 12:19:29 +00:00
sithlord48
1ed394e3ef refactor: remove DEBUG3 and move DEBUG3 messages to DEBUG2 2026-01-26 12:35:00 +00:00
sithlord48
2cf4fc8d0a refactor: remove DEBUG4 level and move any DEBUG4 messages to DEBUG3 2026-01-26 12:35:00 +00:00
sithlord48
d6ffcd37d7 refactor: remove DEBUG5 level and move any DEBUG5 message to DEBUG4 2026-01-26 12:35:00 +00:00