Draft
Conversation
TODO: docs TODO: I don't like the extra flag in viewport event, should this be separate? TODO: resizing directly from inside the event handler on GLFW causes a loop where the window switches between the DPIs several times and then gets resized to something extremely wide at the end, how to prevent this? Is that due to window borders being differently thick? TODO: there's a GLFW_SCALE_TO_MONITOR that makes the resizing somehow automagic but it's too automagic for my taste, and should be under app control instead TODO: SDL halts all event processing while the window is dragged, meaning the window only gets resized *after* it jumps to the other display, which is freaking bad TODO: Windows supply a "desired window rectangle" in the WM_DPICHANGED event and it should probably get used, how to hammer it out of GLFW? Interesting is that GLFW actually calls this but it does nothing unless GLFW_SCALE_TO_MONITOR is enabled as well. Huh? TODO: I guess because of the different window border sizes, even under SDL whers is no feedback loop going back and forth between two monitors several times causes the window to not be sized as expected anymore, being a bunch of pixels off (803x607 and such). Not good for my OCD. Solutions? GLFW is doing some calculations in its GLFW_SCALE_TO_MONITOR routine, maybe that could get used? TODO: WM_DPICHANGED can be caught by enabling SDL_SYSWMEVENT that's disabled by default. Should this one be propagated to anyEvent() as well? It generates *a lot* of events, however not propagating it might be limiting for the user :/
30 tasks
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #423 +/- ##
==========================================
+ Coverage 72.31% 75.96% +3.65%
==========================================
Files 367 367
Lines 19120 18755 -365
==========================================
+ Hits 13827 14248 +421
+ Misses 5293 4507 -786 ☔ View full report in Codecov by Sentry. |
This was referenced Feb 16, 2020
Closed
Closed
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.
Related to #243. As usual, doesn't seem to be as straightforward as I would think, and I'm actually not sure about the workflow at all.
The simple goal at first was to detect when an app goes to a differently dense display and emitting a
viewportEvent()so the app can rescale itself according to the new DPI. However, not so easy:Typeenum that differentiates between resize and DPI scaling change. An alternative could be having the DPI scaling event separate, however in 90% cases the app needs to do some relayouting based either on the new size or the new density (which also implies new size), so having two separate events for this would mean the app needs to duplicate all that code (ugh) or put it in a helper function that's called from both (also ugh).Cause? Rename this whole thing towindowEvent()?accept()or some such, and ignore the DPI change otherwise? How does the user code calculate it? What if the user just always wants the physical DPI (to have the content match some physical size or whatever) while they always get just the virtual DPI from the WM?accept()?)WM_DPICHANGEDin SDL (which is actually easy to grab when SysWMEvent is enabled), I discovered it's possible to "subclass" theWndProc(source, docs, getting the procedure out of a window handle), catch the relevant events, do what I need and pass the rest to GLFW. Ugly but possibly doable?GLFW_SCALE_TO_MONITORhint that makes the resizing somehow automagic (and without this feedback loop) but it's too automagic for my taste, and should be under app control instead -- i.e., the app might only work well on particular sizes and it needs to "snap" to one of themWM_DPICHANGEDrectangle hint to position+size the window both whenGLFW_SCALE_TO_MONITORis used and when it isn't, but it only does something in the first case .. why?GLFW_SCALE_TO_MONITORautomagic, provide a way to do this on a per-event basis, depending on what the app actually needs? Again by supplying something toaccept()?GLFW_SCALE_TO_MONITOR. Not good for my OCD. Solutions? GLFW is doing some calculations in its WM_GETDPISCALEDSIZE handler in order to keep the window the same size whenGLFW_SCALE_TO_MONITORis not enabled, maybe I could get inspired by that to ensure proper scaling?WM_DPICHANGEDcan be caught on SDL (which doesn't support it natively) by enabling SDL_SYSWMEVENT that's disabled by default. Should this one be propagated toanyEvent()as well? It generates a lot of noise, however not propagating it might be limiting for the user :/And then ... the final
bossbosses:viewDidChangeBackingProperties?