Commit graph

126 commits

Author SHA1 Message Date
En-En
cdf405fac5 refactor: swap WaylandIncrInfo from range to start
Since the range end was always encoded in the data length, calculating
the end of the selection is a bit cleaner and removes a potentially
confusing slice operation on a slice.
2025-10-24 18:40:12 -04:00
En-En
cc011f3251 refactor: fix handle_selection_request 8/7 args
Resolve Clippy's `too_many_arguments` lint on
`handle_selection_request` by removing the `success` and `refuse`
parameters and returning a bool indicating which needs to be run.

Use the helper functions defined last commit to simplify
`incr_copy_from_x11`

Reduce the `match` statement checking if the target is the TARGET
atom to an if statement. Although using `match` statements as
`if`/`else if`/`else` chains occur elsewhere, this one is both only 2
cases, and already of particular relevance to the current work.

Refactor `paste_impl` to be much easier to read. I did this code algebra
way back while investigating #142, but since I never figured that out,
the change has just been sitting in my stash.

refactor: simplify paste_data logic, some unnests
2025-10-24 18:40:12 -04:00
En-En
1ec45141e6 feat: send huge Wayland-to-X selections via INCR
Since the connection handshake establishes the most data a request can
send, if the data length exceeds that limit, we can follow ICCCM 2.7.2
sending the INCR property and continuing to send data via PropertyNotify
events.

To test the changes, we create `XState::set_max_req_bytes` to forcefully
trigger the INCR mechanism in integration test runs with a constant,
substantially less amount of data.
2025-10-24 18:40:12 -04:00
En-En
bf745144ac fix: bump xcb-util-cursor to 0.3.5
xcb-util-cursor made another patch release to revert back to Rust 2021
edition, so we bump to that.

Also create a function, `timespec_from_millis` to make creating
`Timespec` for using in `poll` calls a lot more ergonomic.
2025-10-22 18:47:03 -04:00
En-En
e827c42d2d deps: bump rustix to version 1 2025-10-22 18:47:03 -04:00
ToxicMushroom
da6693c88a fix: don't print unapplicable warnings when a popup surface has its viewport set. 2025-10-02 19:52:48 -04:00
Shawn Wallace
03368548ba server: raise windows to top on tablet proximity_in
Fixes #238
2025-09-22 17:43:43 -04:00
Shawn Wallace
970728d0d9 Support client initiated window resizing
Closes #185
2025-09-06 13:29:18 -04:00
Shawn Wallace
0b94ae1eb8 Support client initiated window move (_NET_WM_MOVERESIZE)
Part of #185
2025-09-06 13:29:14 -04:00
Shawn Wallace
2c30ea7863 xstate: always stack newly mapped windows below
I can't figure out a way to actually test this, but this seems to work in manual testing.
Fixes #146
2025-09-02 23:08:00 -04:00
En-En
c0497c990d deps: use pretty_env_logger as env_logger dep 2025-08-31 18:30:14 -04:00
En-En
d759c64681 dep: bump xcb to 1.6.0
switch from the deprecated API we found unsoundness in to the one introduced in 1.6.0
2025-08-23 11:39:05 -04:00
Shawn Wallace
5a184d4359 Support primary selection
This was more tedious than expected.
Fixes #103
2025-08-14 20:59:01 -04:00
Shawn Wallace
13469566b0 Fix Rust 1.89 mismatched_lifetime_syntaxes lint
https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint
2025-08-14 01:29:17 -04:00
En-En
e0d1dad25a server: clean unneeded deref_mut calls 2025-08-06 22:32:00 -04:00
En-En
cbabd591a3 server: impl Deref(Mut) for ServerState to Inner coercion 2025-08-06 22:32:00 -04:00
En-En
fe28bcb880 fix(test): stabilize integration tests 2025-08-06 22:32:00 -04:00
En-En
be9d573fd6 server: make state's client and connection mandatory
The goal of the previous commits being to remove these unwraps. The `unwrap_or_skip_bad_window` changes needed to make a singular debug conditional
2025-08-06 22:32:00 -04:00
En-En
4280639df8 server: give uninitialized and initialized xstate with unique types 2025-08-06 22:32:00 -04:00
En-En
56d5cce2d0 server: split XConnection from rest of State refactor 2025-08-06 22:32:00 -04:00
Shawn Wallace
e4bb8c3f9d cargo clippy everywhere 2025-07-12 12:32:20 -04:00
Shawn Wallace
07847e11d7 server: unscale locked pointer cursor hint
Fix #199, fix #202, fix #204
2025-07-12 12:20:21 -04:00
Shawn Wallace
557ebeb616 xstate/settings: Clamp scale to >=1
Avoids crashing, and GTK apps also seem to generally dislike
when the reported DPI is less than the default.

Fixes #181
2025-06-29 16:24:45 -04:00
skyrelia
ef24bce5d9 Recognize drag and drop window type
Fixes #166
2025-06-29 16:15:20 -04:00
Shawn Wallace
0b2a139f98 server: verify window still exists when processing surface serial
Should fix #191
2025-06-29 16:02:02 -04:00
Shawn Wallace
91d463851e server: fix selection cancellation
oopsie
2025-06-29 01:49:11 -04:00
Shawn Wallace
cf1fae1eae server: verify selection offer is still valid when handling clipboard
Should fix #170, fix #183
2025-06-29 01:37:24 -04:00
Shawn Wallace
2e7c318ac2 server: check if connected to x server when output offset updates
Caused by the compositor reporting negative output coordinates to start.

Fixes #187
2025-06-24 23:21:20 -04:00
En-En
117af56a83 Refactor double let else blocks to use as_mut 2025-06-23 09:54:29 -04:00
En-En
8dc4538662 Removed additional dubious unwraps
The wl_keyboard Enter event, wl_keyboard Leave event, the wl_touch
Self::Down event and the ServerState::reconfigure_window function had
similar uses of `unwrap` which appear to not consider the distinct
query preparation and query execution stages.
2025-06-23 09:54:29 -04:00
En-En
da3b2838d2 Fixed stale surface check unwrapping
Regression from 799027d1. Unwraps on a None value when doing the stale surface generation technique in Chatterino7 as described in #74, very consistent
2025-06-23 09:54:29 -04:00
Shawn Wallace
03cbb2ee3a server: scale tablet_tool motion events
Also add missing Distance event handler.
Closes #179, closes #123
2025-06-19 23:05:15 -04:00
Shawn Wallace
70f15d5085 server: scale wl_touch events
Fixes #172
2025-06-19 21:06:51 -04:00
Shawn Wallace
b98fa84524 Use fractional scaling when setting scale through xsettings
Fixes #168
2025-06-19 17:02:42 -04:00
Shawn Wallace
799027d1ae server: refactor to use ECS
This should simplify how some of the code reads, as well as allowing for future
feature additions to be accomplished in a less restrictive manner. The slotmap +
Object enum pattern was kind of like a really bad ecs in a way anyway. Also I
was looking for an excuse to use an ecs.
2025-06-19 00:55:08 -04:00
Ivan Molodetskikh
da2ecb5be8 Add --test-listenfd-support flag
Just exits with 0. Useful to test whether xwayland-satellite supports -listenfd
before setting up the X11 sockets and stuff on the compositor side. Versions
before this commit panic and exit with nonzero code.
2025-06-07 12:59:01 -04:00
Ivan Molodetskikh
9e48795087 Accept -listenfd and pass on to Xwayland 2025-06-07 12:59:01 -04:00
Ivan Molodetskikh
ac391db415 xstate: Set WM_S0 atom at startup
Xwayland waits for this before starting to listen on the -listenfd descriptors
if either -wm or -initfd is set.

- https://gitlab.freedesktop.org/xorg/xserver/-/blob/xwayland-24.1.6/hw/xwayland/xwayland.c?ref_type=tags#L463-472
- https://gitlab.freedesktop.org/xorg/xserver/-/blob/xwayland-24.1.6/hw/xwayland/xwayland.c?ref_type=tags#L300-317
2025-06-07 12:59:01 -04:00
Shawn Wallace
de6790934b Add git revision to log 2025-05-28 23:10:53 -04:00
Shawn Wallace
ae1759077e Don't pass invalid positioner size on popup reconfigure
Mentioned in #144
2025-05-28 22:24:54 -04:00
Shawn Wallace
d7bc38e6e7 xstate: mark _NET_WM_WINDOW_TYPE_MENU/TOOLTIP as popups
Fixes #161
2025-05-27 20:01:12 -04:00
Shawn Wallace
9261c278af server: only update outputs for current mode events
Fixes #164
2025-05-27 19:43:37 -04:00
Shawn Wallace
5c0351ff33 Properly handle rotated outputs
Fixes #160
2025-05-27 19:35:10 -04:00
Shawn Wallace
572fa4a2bf Add Xsettings support, for setting scaling related settings
This allows for most GTK and Qt apps to be scaled properly.
In the case of mixed DPI, it will default to using the smallest monitor scale.
2025-05-23 23:25:33 -04:00
Shawn Wallace
ec9ff64c1e Mark WM_TRANSIENT_FOR windows as toplevel parents 2025-05-13 00:46:02 -04:00
Shawn Wallace
4671f27282 Use _MOTIF_WM_HINTS to determine if window should be popup
Surely this won't go horribly wrong...
Fixes #155
2025-05-12 23:25:17 -04:00
Shawn Wallace
51300780f8 Allow toplevels to reconfigure themselves 2025-05-11 11:46:29 -04:00
Shawn Wallace
378421d356 xstate: add _NET_WM_STATE{_FULLSCREEN} to _NET_SUPPORTED
Fixes #157
2025-05-11 11:30:54 -04:00
Shawn Wallace
56a681bfec Mark windows with _NET_WM_STATE_SKIP_TASKBAR as popups
Also includes some light refactoring of the popup flow in general
and trimming down some unused code.

I suspect this may cause some windows to unexpectedly become popups when they
otherwise shouldn't, but that's a bridge we'll cross when we get there.

Fixes #110 and #112.
2025-04-27 01:10:55 -04:00
Shawn Wallace
d1639eca87 server: don't try to activate a window on creation 2025-04-26 22:26:29 -04:00