Commit graph

848 commits

Author SHA1 Message Date
rNoz
dd3944cabc feat(macos): preserve the left/right side of modifier keys on the client
The macOS client mapped every right-hand modifier (Control_R, Shift_R,
Alt_R, Super/Meta_R) to its left-hand virtual key and always emitted the
left device-dependent event flags, so a remote right-side modifier
arrived on the client as the left one. Apps that distinguish the two
(input methods that need Right Shift, hotkeys bound to Right Control,
etc.) never saw the right key.

Map the right-hand KeyIDs to their macOS right virtual keys, teach
isModifier() and setKeyboardModifiers() about them, track which side is
held, and emit the matching NX_DEVICER*KEYMASK device flag. This change
is client-only; the macOS server key map is unchanged.

fixes: #8486
Signed-off-by: rNoz <rnoz.commits@gmail.com>
2026-08-10 17:33:48 -04:00
barrelltitor
6740d30051 fix: release keys before x11 kb map refresh 2026-08-10 22:07:00 +01:00
barrelltitor
141779be1d fix: resync Windows keys from low-level hook state 2026-08-10 21:52:37 +01:00
barrelltitor
079dee7682 fix: preserve resolved Windows key button 2026-08-10 21:52:37 +01:00
barrelltitor
5094580606 fix: from windows side send a key up if it was down before 2026-08-10 21:52:37 +01:00
Daniel Gräfe
f765e829f2 fix(mac): invalidate event tap CFMachPort on disable 2026-08-08 12:31:15 -04:00
Momoyama
9c18070b17 fix(macos): avoid non-selectable IME layouts for remote keys
macOS input methods can expose non-user-selectable keyboard layouts bundled with the input method rather than the user's real selectable keyboard layout. Translating remote key events through those layouts can send IME punctuation semantics to clients instead of the expected ASCII punctuation.

Use the current ASCII-capable keyboard layout when the active input source has no Unicode key layout data and the reported keyboard layout is not directly selectable. Normal selectable keyboard layouts continue to use the existing translation path.

This affects macOS servers forwarding keyboard input to remote clients while an input-method-bundled layout is active.
2026-08-07 13:37:03 +01:00
sithlord48
86a970a90a build: simplify link for platform library
Add Public and Private links, simplify needed libs for general unix
2026-08-06 13:59:27 +01:00
Charles Jones
f8edc7b0ae fix: preserve locked modifiers on ei backend 2026-08-04 14:33:05 -04:00
piterpunk
0d21f54cb2 fix(wayland): Corrects the cursor coordinates mapping at primary desktop
Remapping the cursor coordinates to the portal edge size makes the mouse
position being relative to the edge size, in a multi-monitor environment
this edge can be in only one of the monitors and the cursor coordinates
got wrong.

This changes uses the full height and the full width of the combined
monitors to set the mouse cursor position, cropped by the portal edge
size.
2026-08-04 09:42:22 -04:00
Mustafa Senoglu
40f743fb37 fix: handle top-down DIB images in clipboard bitmap converter
A BITMAPINFOHEADER with negative biHeight (top-down DIB) caused
std::length_error crash in toIClipboard because 4 * w * h went
negative and wrapped to a huge size_t in string::append.

Fix: use abs(height) for buffer size and SetDIBitsToDevice, and
add null check for CreateDIBSection.

fixes: #9869
2026-08-03 22:17:26 +01: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
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
sithlord48
8266fbbe6a fix: Check options array is always an even size 2026-07-01 17:02:09 +01:00
sithlord48
f3fb31914d refactor: replace use of insert for std::maps with try_emplace 2026-06-22 10:27:35 -04: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
5eb1d7068e refactor: declare vars where they are used in if statements 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
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