Fix CWB borderless compat and fractional scaling click offset#86
Open
jdkeke142 wants to merge 1 commit intonot-coded:multiloaderfrom
Open
Fix CWB borderless compat and fractional scaling click offset#86jdkeke142 wants to merge 1 commit intonot-coded:multiloaderfrom
jdkeke142 wants to merge 1 commit intonot-coded:multiloaderfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
updateWindowRegionruns 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.