| 1 | # Bug Fixes Summary - bugfixes-floating-fullscreen branch |
| 2 | |
| 3 | ## Branch Info |
| 4 | - **Location**: `~/repos/oxwm-worktrees/bugfixes-floating-fullscreen` |
| 5 | - **Based on**: `lua-config-test` branch |
| 6 | - **Status**: Ready for testing on bare metal |
| 7 | |
| 8 | ## Bugs Fixed |
| 9 | |
| 10 | ### ✅ 1. Kill Client Killing All Firefox Instances |
| 11 | **Problem**: Pressing `Mod+Q` killed ALL Firefox windows, not just the focused one. |
| 12 | |
| 13 | **Solution**: Implemented proper EWMH window closing protocol (src/window_manager.rs:1489-1547) |
| 14 | - First tries to send `WM_DELETE_WINDOW` message (graceful close) |
| 15 | - Only forcefully kills window if it doesn't support WM_DELETE_WINDOW |
| 16 | - Matches dwm behavior |
| 17 | |
| 18 | **Test**: Open 2-3 Firefox windows, focus one, press `Mod+Q` → should only close that window |
| 19 | |
| 20 | --- |
| 21 | |
| 22 | ### ✅ 2. Fullscreen Not Working in Floating Mode |
| 23 | **Problem**: Fullscreen only hid the bar, didn't actually fullscreen windows |
| 24 | |
| 25 | **Solution**: Implemented proper per-window EWMH fullscreen (src/window_manager.rs:1549-1610) |
| 26 | - Added `_NET_WM_STATE` and `_NET_WM_STATE_FULLSCREEN` atoms |
| 27 | - Saves window geometry before fullscreening |
| 28 | - Removes borders and makes window cover entire monitor |
| 29 | - Restores geometry when exiting fullscreen |
| 30 | - Added smart context-aware behavior: |
| 31 | - In normie (floating) layout → fullscreens the focused window |
| 32 | - With explicitly floating window → fullscreens that window |
| 33 | - In tiling layout → hides bar (monitor-level fullscreen) |
| 34 | |
| 35 | **Test**: |
| 36 | 1. Switch to normie layout (`Mod+F`) |
| 37 | 2. Press `Mod+Shift+F` → window should fullscreen properly |
| 38 | 3. In tiling mode, press `Mod+Shift+F` → should hide bar |
| 39 | |
| 40 | --- |
| 41 | |
| 42 | ### ✅ 3. YouTube Fullscreen (F key) Not Working |
| 43 | **Problem**: Applications couldn't request fullscreen via EWMH protocol |
| 44 | |
| 45 | **Solution**: Implemented ClientMessage event handler (src/window_manager.rs:1909-1930) |
| 46 | - Listens for `_NET_WM_STATE` change requests from clients |
| 47 | - Handles add/remove/toggle fullscreen actions |
| 48 | - Added `PROPERTY_CHANGE` to window event mask |
| 49 | |
| 50 | **Test**: |
| 51 | 1. Open Firefox, go to YouTube |
| 52 | 2. Press `F` on a video → should properly fullscreen |
| 53 | 3. Press `F` or `Esc` to exit → should return to previous size |
| 54 | |
| 55 | --- |
| 56 | |
| 57 | ### ✅ 4. Modal Windows Not Auto-Floating |
| 58 | **Problem**: Dialogs like Discord loading screens required manual floating |
| 59 | |
| 60 | **Solution**: Implemented transient window detection (src/window_manager.rs:1612-1628, 1900-1903) |
| 61 | - Checks `WM_TRANSIENT_FOR` hint during MapRequest |
| 62 | - Automatically floats transient windows (dialogs, modals, popups) |
| 63 | - Matches dwm behavior |
| 64 | |
| 65 | **Test**: Open Discord → loading modal should automatically float |
| 66 | |
| 67 | --- |
| 68 | |
| 69 | ### ⏸️ 5. Firefox Cursor Bug (NOT YET FIXED) |
| 70 | **Problem**: Cursor gets "stuck" in one state (e.g., pointer/hand) when hovering over Firefox. The cursor won't update to show different states (arrow, text cursor, etc.) even though clicks/hovers still work functionally. **This is intermittent and hard to reproduce.** |
| 71 | |
| 72 | **Current Status**: Need more info to diagnose |
| 73 | - Only happens in Firefox (so far) |
| 74 | - Random/semi-reproducible |
| 75 | - Not tested if it happens in Xephyr or only bare metal |
| 76 | |
| 77 | **Debug Steps** (when it happens next): |
| 78 | 1. Does it happen more in floating or tiling mode? |
| 79 | 2. Does switching tags fix it? |
| 80 | 3. Does `Mod+Shift+R` (restart WM) fix it? |
| 81 | 4. Does it only happen with certain Firefox actions (opening menus, hovering specific elements)? |
| 82 | 5. Does moving cursor out of Firefox and back in fix it? |
| 83 | |
| 84 | **Possible Causes**: |
| 85 | - Race condition during cursor changes |
| 86 | - Focus-related timing issue |
| 87 | - Firefox-specific cursor handling |
| 88 | - Event propagation issue |
| 89 | |
| 90 | **Investigation Notes**: |
| 91 | - DWM sets cursor with `CWCursor` flag on root window (dwm.c:1705) |
| 92 | - OXWM already does this correctly |
| 93 | - Event masks look correct (ENTER_WINDOW, STRUCTURE_NOTIFY, PROPERTY_CHANGE) |
| 94 | - Likely needs more investigation with reproducible steps |
| 95 | |
| 96 | --- |
| 97 | |
| 98 | ## Files Modified |
| 99 | |
| 100 | ### Core Changes |
| 101 | - `src/window_manager.rs`: |
| 102 | - Added atoms: `wm_protocols`, `wm_delete_window`, `net_wm_state`, `net_wm_state_fullscreen` |
| 103 | - Added `fullscreen_windows: HashSet<Window>` to track fullscreen state |
| 104 | - Added `kill_client()` - graceful window closing |
| 105 | - Added `send_event()` - send WM protocol messages |
| 106 | - Added `set_window_fullscreen()` - per-window EWMH fullscreen |
| 107 | - Added `is_transient_window()` - detect modal/dialog windows |
| 108 | - Modified `ToggleFullScreen` handler - smart context-aware behavior |
| 109 | - Added `ClientMessage` event handler - handle fullscreen requests |
| 110 | - Modified `MapRequest` handler - auto-float transient windows |
| 111 | - Modified `remove_window()` - clean up fullscreen state |
| 112 | |
| 113 | ### Config Support |
| 114 | - `src/config/lua.rs`: |
| 115 | - Added `"ToggleWindowFullscreen"` to string_to_key_action() |
| 116 | |
| 117 | - `src/keyboard/handlers.rs`: |
| 118 | - Added `ToggleWindowFullscreen` enum variant |
| 119 | |
| 120 | - `src/overlay/keybind.rs`: |
| 121 | - Added description for `ToggleWindowFullscreen` |
| 122 | |
| 123 | ### Test Config |
| 124 | - `resources/test-config.lua`: |
| 125 | - Uses smart `ToggleFullScreen` (`Mod+Shift+F`) |
| 126 | |
| 127 | --- |
| 128 | |
| 129 | ## How to Test on Bare Metal |
| 130 | |
| 131 | ```bash |
| 132 | cd ~/repos/oxwm-worktrees/bugfixes-floating-fullscreen |
| 133 | cargo build --release |
| 134 | cp target/release/oxwm ~/.local/bin/oxwm # or wherever you install it |
| 135 | ``` |
| 136 | |
| 137 | Then reload WM with `Mod+Shift+R` |
| 138 | |
| 139 | --- |
| 140 | |
| 141 | ## Next Steps |
| 142 | |
| 143 | 1. **Test all fixes on bare metal** (except cursor bug) |
| 144 | 2. **Gather more info on cursor bug** when it happens |
| 145 | 3. **If all tests pass**: Merge into `lua-config-test` branch |
| 146 | 4. **If issues found**: Iterate on fixes |
| 147 | |
| 148 | --- |
| 149 | |
| 150 | ## Notes |
| 151 | |
| 152 | - `ToggleWindowFullscreen` action exists but is unused in config (smart `ToggleFullScreen` covers it) |
| 153 | - May want to add `strum` crate to auto-generate enum string parsing (see conversation notes) |
| 154 | - Consider dropping `ron` as dependency eventually |