Commit Graph

1433 Commits

Author SHA1 Message Date
DreamMaoMao 636060972d opt: change some default config 2026-03-07 17:29:37 +08:00
DreamMaoMao b1d744ad1f feat: export drag interval to able configure 2026-03-07 17:22:06 +08:00
DreamMaoMao 75c888bbe4 opt: optimize resizewin setp with keyboard 2026-03-07 16:17:10 +08:00
DreamMaoMao 89a4ec83a0 fix: avoid mutual influence of monitor rules 2026-03-07 14:03:59 +08:00
DreamMaoMao fd68f188c6 opt: add some comment 2026-03-07 14:03:59 +08:00
DreamMaoMao 63b9ffb1a4 opt: opt the old size per init 2026-03-07 12:54:37 +08:00
DreamMaoMao 95481623cb Merge pull request #742 from kanvolu/main
Added cycling both ways for switch_proportion_preset
2026-03-07 12:44:51 +08:00
kanvolu 10d7e5c6e3 Added cycling both ways for switch_proportion_preset
Now switch_proportion_preset requires an argument "prev" or "next" to
determine cycle direction
2026-03-07 12:36:59 +08:00
DreamMaoMao 9a17a0279c feat: add custom option to monitorrule 2026-03-06 18:21:49 +08:00
DreamMaoMao 11b4bb03bf feat: support the repeated exchange of the same two clients 2026-03-06 14:27:24 +08:00
DreamMaoMao 6522e18d08 opt: fix potential issues caused by uninitialization 2026-03-06 13:25:24 +08:00
DreamMaoMao 9df273cdf9 opt: clear some comment 2026-03-05 23:03:01 +08:00
DreamMaoMao 0f68187cd0 opt: support restore size per when master change 2026-03-05 20:59:34 +08:00
DreamMaoMao bf10fabfc2 fix: popup unconstrain cross monitor 2026-03-05 08:27:59 +08:00
DreamMaoMao 7f99b5ff48 feat: use monitor spec to match windowrule monitor field 2026-03-04 12:17:44 +08:00
DreamMaoMao 1e1d41e626 feat: add windowrule option indleinhibit_when_focus 2026-03-03 14:51:32 +08:00
DreamMaoMao 9aa2d3cd33 opt: rename hide_source var to hide_cursor_source 2026-03-03 13:03:35 +08:00
DreamMaoMao 46e867deb9 opt: always arrangelayers if layer commit 2026-03-02 20:53:52 +08:00
DreamMaoMao ad754167b7 fix: last_cursor surface destroy detect error 2026-03-02 09:40:50 +08:00
DreamMaoMao 0673a9241d Merge pull request #724 from hboetes/fix-last-cursor-use-after-free
Fix use-after-free crash in cursor surface handling
2026-03-02 09:04:43 +08:00
DreamMaoMao 20dbffdfaf opt: avoid unnecessary action when layer surface commit 2026-03-02 08:35:32 +08:00
DreamMaoMao 263b1845bb opt: optimize layer focus change logic 2026-03-02 08:15:52 +08:00
Han Boetes c403a47894 Fix use-after-free crash in cursor surface handling
### Problem

`setcursor()` stores the client-provided `wlr_surface` pointer in
`last_cursor.surface`, but never registers a destroy listener on it.
When the client exits (e.g. closing a launcher like fuzzel), the surface
is destroyed, but `last_cursor.surface` still holds the stale pointer.

If the cursor hide timeout fires while the cursor surface is alive, and
the client then exits, the next mouse movement calls
`handlecursoractivity()`, which passes the dangling pointer to
`wlr_cursor_set_surface()`. This causes a SIGSEGV in `wl_list_insert()`
inside libwayland-server, as the `wl_list` embedded in the destroyed
surface struct has been freed.

A secondary issue exists in `setcursorshape()`: when a client switches
from a custom cursor surface to a shape cursor, `last_cursor.surface` is
set to NULL but the destroy listener (if registered) is not removed,
leaving a dangling listener on the destroyed surface.

The crash only manifests when `cursor_hidden` is true at the moment of
the mouse movement, which is why it is intermittent and difficult to
reproduce.

### Root cause

Confirmed via `coredumpctl debug` and `bt full`:

```
#0  wl_list_insert (libwayland-server.so)
#1  wlr_cursor_set_surface (libwlroots)
#2  handlecursoractivity (mango.c)
#3  motionnotify (mango.c)
#4  motionrelative (mango.c)
#5  wl_signal_emit_mutable
#6  handle_libinput_readable
```

### Fix

- Add a `wl_listener` (`last_cursor_surface_destroy_listener`) that
clears `last_cursor.surface` and removes itself when the surface is
destroyed.
- Initialize the listener's link in `setup()` so `wl_list_empty()`
checks are reliable from the start.
- In `setcursor()`, remove any existing listener before registering a
new one on the incoming surface.
- In `setcursorshape()`, remove the destroy listener when switching to a
shape cursor.
- Add a NULL guard in `handlecursoractivity()` as a safety net.
2026-03-01 21:58:03 +01:00
DreamMaoMao 6cc7d16281 opt: only set on_demand layer focus when it request in init_commit 2026-03-02 00:56:47 +08:00
DreamMaoMao 9922ed26c7 update readme 2026-03-01 18:13:40 +08:00