-
Notifications
You must be signed in to change notification settings - Fork 25
Release 2.4.8 #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 2.4.8 #280
Changes from all commits
61a62aa
98d0e70
ea17c7b
3e23e7f
2df4305
4ab40df
f145589
7717c70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,7 @@ public Layout() | |
| InitializeComponent(); | ||
| AddLayer(); | ||
|
|
||
| ClampSavedWindowScaleToCurrentScreen(); | ||
| OnSettingChanged(SettingsService.SAVED_WINDOW_SCALE); | ||
| _settingsSignalSubscription = SettingsSignalBus.Subscribe(OnSettingSignal); | ||
| UpdateTestingButtonVisibility(); | ||
|
|
@@ -148,7 +149,7 @@ private void OnSettingChanged(Setting setting) | |
| // Note that this method will also be called whenever the setting changes | ||
| if (setting == SettingsService.WINDOW_SCALE || setting == SettingsService.SAVED_WINDOW_SCALE) | ||
| { | ||
| var scaleFactor = (double)setting.Get(); | ||
| var scaleFactor = GetUsableWindowScale((double)setting.Get()); | ||
| Height = WindowHeight * scaleFactor; | ||
| Width = WindowWidth * scaleFactor; | ||
| CompleteGrid.RenderTransform = new ScaleTransform(scaleFactor, scaleFactor); | ||
|
|
@@ -163,6 +164,17 @@ private void OnSettingChanged(Setting setting) | |
| UpdateTestingButtonVisibility(); | ||
| } | ||
|
|
||
| private void ClampSavedWindowScaleToCurrentScreen() | ||
| { | ||
| var savedScale = SettingsService.Get<double>(SettingsService.SAVED_WINDOW_SCALE); | ||
| var usableScale = GetUsableWindowScale(savedScale); | ||
| if (!savedScale.Equals(usableScale)) | ||
| SettingsService.Set(SettingsService.SAVED_WINDOW_SCALE, usableScale); | ||
| } | ||
|
|
||
| private double GetUsableWindowScale(double requestedScale) => | ||
| ViewUtils.GetUsableWindowScale(requestedScale, new Size(WindowWidth, WindowHeight), this); | ||
|
Comment on lines
+167
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In Avalonia 11.2.5, the Window.Screens.ScreenFromWindow(window) method is not reliable or may not return valid screen information before a window has been shown (i.e., before it has a valid platform implementation) [1][2]. The ScreenFromWindow method requires a TopLevel (or WindowBase) instance that has been initialized with a platform-specific implementation [2][3]. Before the window is shown, the PlatformImpl property is often null or uninitialized, which can lead to unexpected results or exceptions depending on the specific platform and state [2]. If you need to access screen information before a window is shown, consider these alternatives: 1. Use the static Screens API: You can access the general Screens collection via TopLevel.Screens or by using the global screen management services available in Avalonia to query primary or available displays without needing a specific window instance [4]. 2. Defer logic: If you need to position or size a window based on a specific screen, perform this logic in the Window's Opened event or an equivalent lifecycle hook where the PlatformImpl is guaranteed to be available [1][4]. 3. Platform-specific APIs: If you strictly require display information before any Avalonia UI elements are initialized, you may need to use platform-native APIs (such as Win32 APIs on Windows) or cross-platform libraries that operate independently of the Avalonia framework [5]. Citations:
🏁 Script executed: rg -n "GetUsableWindowScale" -S .Repository: TeamWheelWizard/WheelWizard Length of output: 1055 🏁 Script executed: rg -n "GetUsableWindowScale" -S .Repository: TeamWheelWizard/WheelWizard Length of output: 1055 🏁 Script executed: rg -n "GetUsableWindowScale" -S .Repository: TeamWheelWizard/WheelWizard Length of output: 1055 🏁 Script executed: sed -n '1,120p' WheelWizard/Views/ViewUtils.csRepository: TeamWheelWizard/WheelWizard Length of output: 4997 🏁 Script executed: sed -n '120,220p' WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 4105 🏁 Script executed: rg -n "ClampSavedWindowScaleToCurrentScreen\\(" WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 182 🏁 Script executed: rg -n "ClampSavedWindowScaleToCurrentScreen\\(" WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 182 🏁 Script executed: sed -n '50,110p' WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 2197 🏁 Script executed: sed -n '50,110p' WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 2197 🏁 Script executed: head -n 40 WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 1461 🏁 Script executed: head -n 40 WheelWizard/Views/Layout.axaml.csRepository: TeamWheelWizard/WheelWizard Length of output: 1461 🏁 Script executed: rg -n "MinWindowScale|MaxWindowScale" WheelWizardRepository: TeamWheelWizard/WheelWizard Length of output: 739 🏁 Script executed: sed -n '1,80p' WheelWizard/Features/Settings/Types/SettingConstants.csRepository: TeamWheelWizard/WheelWizard Length of output: 2367 🏁 Script executed: rg -n "class BaseWindow" -S WheelWizardRepository: TeamWheelWizard/WheelWizard Length of output: 147 🏁 Script executed: sed -n '1,80p' WheelWizard/Features/Settings/Types/SettingConstants.csRepository: TeamWheelWizard/WheelWizard Length of output: 2367 🏁 Script executed: rg -n "Avalonia\\.?|PackageReference.*Avalonia" -S . --glob '*.csproj' --glob '*.props' --glob '*.targets'Repository: TeamWheelWizard/WheelWizard Length of output: 1199 🏁 Script executed: rg -n "Avalonia\\.?|PackageReference.*Avalonia" -S . --glob '*.csproj' --glob '*.props' --glob '*.targets'Repository: TeamWheelWizard/WheelWizard Length of output: 1199 Defer screen-based clamping until the window is opened
🤖 Prompt for AI Agents |
||
|
|
||
| private void UpdateModsButtonText() | ||
| { | ||
| ModsButton.Text = Common.PageTitle_Patches; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Robustness refactor looks correct; consider logging the swallowed exception.
Routing
DeserializeCoreexceptions (including the impossible-date case from line 187) into a failureOperationResultis the right call for parsing untrusted Mii data. One caveat:catch (Exception ex)also absorbs genuine programming errors (e.g.IndexOutOfRangeException) and reports them as generic "invalid data". The message is preserved in the result, but a debug-level log here would aid diagnosis without changing behavior.🤖 Prompt for AI Agents