Refactor AutoDropShadow logic for clarity and correctness#4330
Refactor AutoDropShadow logic for clarity and correctness#4330Jack251970 wants to merge 1 commit intodevfrom
Conversation
Simplified the AutoDropShadow method to avoid redundant operations and improve readability. Now, window corner preference and drop shadow effects are set based on blur and backdrop support, with clear comments explaining each case. Removed convoluted branching for more direct logic.
|
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
There was a problem hiding this comment.
Pull request overview
Refactors the window corner + drop shadow toggle logic in Theme.AutoDropShadow to be more explicit about blur vs non-blur behavior and to avoid rendering artifacts on blurred themes.
Changes:
- Reworks
AutoDropShadowbranching to explicitly handle blur-supported themes by rounding corners and removing WPF drop shadow. - Simplifies the “drop shadow disabled” path to always reset corner preference and remove the shadow effect.
- Adds inline comments documenting the intended behavior differences between blur and non-blur themes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughRefactors AutoDropShadow logic in Theme.cs to simplify corner preference and drop-shadow application based on blur enablement and backdrop support conditions. Centralizes behavior around useDropShadowEffect with conditional handling for blurred versus non-blurred themes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Flow.Launcher.Core/Resource/Theme.cs (1)
709-723: Logic is correct; consider simplifying redundant condition.The refactored structure clearly separates the three scenarios. However, the condition on line 711
BlurEnabled && Win32Helper.IsBackdropSupported()is redundant—BlurEnabledis only set totruewhenIsBackdropSupported()returnstrue(see line 435).You could simplify to just
if (BlurEnabled):♻️ Optional simplification
if (useDropShadowEffect) { - if (BlurEnabled && Win32Helper.IsBackdropSupported()) + if (BlurEnabled) { // For themes with blur enabled, the window border is rendered by the system, // so we set corner preference to round and remove drop shadow effect to avoid rendering issues.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Flow.Launcher.Core/Resource/Theme.cs` around lines 709 - 723, The if condition inside the useDropShadowEffect block redundantly checks "BlurEnabled && Win32Helper.IsBackdropSupported()" even though BlurEnabled is only set true when IsBackdropSupported() is true; simplify the condition to just "if (BlurEnabled)" in the block that calls SetWindowCornerPreference, RemoveDropShadowEffectFromCurrentTheme, and AddDropShadowEffectToCurrentTheme so behavior remains identical but the check is clearer and less redundant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Flow.Launcher.Core/Resource/Theme.cs`:
- Around line 709-723: The if condition inside the useDropShadowEffect block
redundantly checks "BlurEnabled && Win32Helper.IsBackdropSupported()" even
though BlurEnabled is only set true when IsBackdropSupported() is true; simplify
the condition to just "if (BlurEnabled)" in the block that calls
SetWindowCornerPreference, RemoveDropShadowEffectFromCurrentTheme, and
AddDropShadowEffectToCurrentTheme so behavior remains identical but the check is
clearer and less redundant.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 50fe9948-6917-4f1b-886a-145f9874788c
📒 Files selected for processing (1)
Flow.Launcher.Core/Resource/Theme.cs
Separated from #4302.
TEST
Summary by cubic
Summary of changes
Refactors AutoDropShadow to remove redundant calls and make the blur/backdrop vs. shadow behavior explicit and correct. Improves readability and avoids rendering glitches when blur is enabled.
Written for commit b5d372e. Summary will update on new commits.