Commit graph

68 commits

Author SHA1 Message Date
En-En
979eab242e refactor: clean ECS queries to PendingSurfaceState 2025-12-16 20:31:56 -05:00
En-En
e81e787e1a fix: dragging pop-ups causes them to stutter
Dragging a pop-up surface around regularly updates it via
`SurfaceEvents::xdg_event`. This called `XConnection::set_window_dims`,
which was enqueueing many `ConfigureRequest` events. These outdated
events would still be processed by XWayland and responded to with
`ConfigureNotify`, which updated the surface to an old position,
resulting in glitchy behavior.

This fix replaces the call of `set_window_dims` in `xdg_event`, instead
inserting the new position of the window into the ECS. Then, after all
Wayland events have been read, the pending position is popped from the ECS
and used to call `set_window_dims` for each window with it.

A solution to the issue posed in #314.
2025-12-16 20:31:56 -05:00
Shawn Wallace
f0ad674b70 server: don't die if flushing events would block
Fixes #210
2025-12-10 00:13:01 -05:00
Shawn Wallace
f997e81ee7 server: remove no decoration warning
We now always have decorations! :D
2025-11-28 16:53:06 -05:00
Shawn Wallace
83e4aab4d5 server: adjust minimum and maximum window sizes to account for decorations
Fixes #271
2025-11-27 11:14:37 -05:00
busyo
ae98f974e0
fix: popup position (#281) 2025-11-27 10:48:34 -05:00
Shawn Wallace
f379ff5722 server: redraw decorations on window reconfigure
Fixes #270
2025-11-21 00:55:21 -05:00
Shawn Wallace
b39388d91a Add client side decorations to toplevels
These simple decorations will be rendered only when the host compositor doesn't
support server side decorations and the X11 window does not render its own
decorations.

Closes #31
2025-11-06 22:32:10 -05:00
Shawn Wallace
2dd40ecfe8 server: add SlideX/Y constraint adjustment to popups
Allows popups that would normally go offscreen to stay visible. X11 doesn't seem
to like windows whose bounds go less than 0x0, so we adjust the position
reported to X11 to make it happy.

I am worried this will have some other implications with popups, but we'll see
what happens.
2025-10-25 15:57:30 -04:00
Shawn Wallace
52cc06e6c6 server: activate toplevels after mapping
This behavior was removed a while back, because we were also trying to activate
popups and this was causing issues on some compositors. However, I think
activating toplevels after they're mapped is the behavior that X11 apps tend to
expect - in Steam Big Picture for example, when launching a game in Niri while
fullscreened, the focus doesn't automatically switch to the game. This may need
to be reevaluated and refined in the future though.
2025-10-25 11:50:46 -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
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
5a184d4359 Support primary selection
This was more tedious than expected.
Fixes #103
2025-08-14 20:59:01 -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
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
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
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
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
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
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
Shawn Wallace
c31679aa41 Avoid parenting popups to other popups
Fixes #36
2025-04-22 21:39:20 -04:00
Shawn Wallace
555f9492ad Properly scale surfaces with fractional scale 2025-04-11 14:09:13 -04:00
Shawn Wallace
8188df0e70 Force buffers to be unscaled
Satellite will now force Xwayland to always render with the native
display resolution, and just scale surface sizes accordingly. As a result,
applications won't really respect DPI, but this can be adjusted through
the same means as with normal X11.

Part of #28.
2025-04-09 00:32:20 -04:00
bbb651
45c0556964 Destroy zxdg_toplevel_decoration_v1 object with toplevel
This is a protocol violation and crashes dwl.
On niri it causes the toplevel to "leak".
2025-03-30 11:03:13 -04:00
bbb651
0559ace758 Support xdg decorations 2025-03-29 23:09:32 -04:00
bbb651
467f3014fb Fix surface data unwrap crash in pending activations handling
Fixes #127.
2025-03-22 13:54:03 -04:00
bbb651
1d98ee089c Fix typos 2025-03-20 09:05:24 -04:00
bbb651
180efb0ba9 Support XDG Activation
Test XDG Activation
2025-03-20 09:05:24 -04:00
En-En
cca74a5f6b Remove paste dependency
https://rustsec.org/advisories/RUSTSEC-2024-0436.html
2025-03-17 18:03:50 -04:00
Shawn Wallace
beb7c3ebe0 Offset output positions to always have positive coordinates
Honestly, this is something that should probably be fixed in Xwayland itself,
but they don't seem interested in fixing it:
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/395#note_555613

Fixes #15
2025-03-16 16:00:10 -04:00
Shawn Wallace
7df3daba70 Remove ExtraData type from XConnection trait
This was being used to pass the X11 atoms all over the place, but I
realize this is no longer necessary - we can just pass them directly to
our RealConnection when creating it.
2025-03-12 00:55:39 -04:00
Shawn Wallace
653391c7c9 server: auto-fullscreen windows that match an output's dimensions
Fixes #93
2025-02-10 23:08:39 -05:00
Shawn Wallace
3a981c5249 server: don't crash if set_fullscreen fails.
Gotta stop assuming that the X server has my best interests at heart.
Fixes #95
2025-01-25 15:24:11 -05:00
Shawn Wallace
ba9c1a6a3e cargo fmt + cargo clippy 2025-01-09 00:08:07 -05:00