Skip to content

Fix CWB borderless compat and fractional scaling click offset#86

Open
jdkeke142 wants to merge 1 commit intonot-coded:multiloaderfrom
jdkeke142:wayland-fixes
Open

Fix CWB borderless compat and fractional scaling click offset#86
jdkeke142 wants to merge 1 commit intonot-coded:multiloaderfrom
jdkeke142:wayland-fixes

Conversation

@jdkeke142
Copy link
Copy Markdown

@jdkeke142 jdkeke142 commented Apr 17, 2026

Fixes two issues I ran into on Wayland with fractional scaling + Cubes Without Borders:

Borderless always targeting the primary monitor: CWB's cancellable HEAD inject on updateWindowRegion runs before WayFix's, so the kdotool correction never happens. Setting priority to 500 fixes the ordering. Borderless now fullscreens on the correct monitor with CWB.

Click offset after fullscreen transitions: on fractional scaling (tested 1.75x), MC writes physical dimensions (2560x1440) to window.width/height but GLFW cursor coords are in logical space (1463x823). Clicks land in the wrong place until you manually resize. The fix queries glfwGetWindowSize each frame in swapBuffers and corrects when they diverge.

Both are common complaints for anyone running Wayland + KDE + multi-monitor + fractional scaling. Tested on MC 1.21.11, Plasma 6.3.6, NVIDIA, CWB 3.0.0-build.14.

Side note: the README currently links BoyOrigin/glfw-wayland for the custom GLFW, but that repo crashes on newer MC versions and hasn't been updated for LWJGL-CI's fork. I maintain an updated patchset based on LWJGL-CI/glfw that works on 1.21.11+ here: https://github.com/jdkeke142/glfw-wayland-minecraft (fixes the windowed blur from glfw#2713, cursor-shape-v1, glfwSetCursorPos fallback for KDE <6.5, etc). Might be worth pointing users there.

Two changes to MonitorFixWindowMixin:

1. Set mixin priority to 500 (lower than default 1000) so the HEAD
   inject on updateWindowRegion runs before CWB's cancellable HEAD
   inject. Without this, CWB cancels the method before WayFix can
   correct the window position via kdotool, causing borderless
   fullscreen to always target the primary monitor.

2. Add a per-frame reconciliation in swapBuffers that queries GLFW
   for the actual logical window size and corrects MC's width/height
   fields when they diverge. On Wayland with fractional scaling, MC
   and mods like CWB write physical monitor dimensions (e.g. 2560)
   to these fields, but GLFW reports cursor coords in logical surface
   coords (e.g. 1463 at 1.75x scale). This mismatch causes persistent
   click offset after fullscreen transitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant