-
-
Notifications
You must be signed in to change notification settings - Fork 455
auto disable shadow when blur is enabled and make query window width dynamic #498
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
Conversation
|
Why not enable Blur when blur theme is selected instead of prompting to restart? |
|
Can't enable it with the current implementation of blur, you can call the set blur function but it comes out with wider blur width, hence the original comment about it being in mainwindow's on_loaded function call |
I know, but the extra boarder will only be enabled when shadow effect is on. I mean if that's not on, we can enable the blur effect so that user won't see a blur theme without blur effect. |
|
I take a debug check. It is behaving weird if we set blur after onload because the width of the main window is changed to 1440 instead of expected 750 with unknown reason. If we change it back to 750 (or the dynamic width setting in #374), it seems work correctly. |
|
oh right, good pick up thank you. |
private void SetWindowAccent(Window w, AccentState state)
{
var windowHelper = new WindowInteropHelper(w);
w.Width = 750;
windowHelper.EnsureHandle();
var accent = new AccentPolicy { AccentState = state };
var accentStructSize = Marshal.SizeOf(accent);
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
Marshal.StructureToPtr(accent, accentPtr, false);
var data = new WindowCompositionAttributeData
{
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
SizeOfData = accentStructSize,
Data = accentPtr
};
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
Marshal.FreeHGlobal(accentPtr);
}This will work, because the setting window will hide the main window, so we need to ensure the mainwindow is rendered successfully before assigning it with a shadow effect. |
|
Let's make that width dynamically passed in from theme xmal, should work well since we are making width dynamic in the other pr as well |
|
all done |
| if (BlurEnabled) | ||
| { | ||
| SetWindowAccent(Application.Current.MainWindow, AccentState.ACCENT_ENABLE_BLURBEHIND); | ||
| } | ||
| else | ||
| { | ||
| SetWindowAccent(Application.Current.MainWindow, AccentState.ACCENT_DISABLED); | ||
| } |
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.
Maybe only change this if blur state is changed?
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.
in the original code this state is always set though via on_loaded everytime when flow is started, not sure if we really need to manage this
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.
@taooceros did you want to show me what you mean?
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.
Oh sorry I forget to reply. I mean only call this method when we switch from Blur to non-blur or non-blur to Blur. Also maybe remove the call of this method in MainWindow.OnLoaded and move that to ChangeTheme
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.
call this method when we switch from Blur to non-blur or non-blur to Blur
there's not really a good way to tell what state blur was previously. is this just so the call is not done multiple times when user cycles through themes? i tested current way there hasnt been any issues.
remove the call of this method in MainWindow.OnLoaded and move that to ChangeTheme
this is already removed.

shadow does not work when blur is enabled via the theme file. This automatically disables shadow when blur is enabled
close query window when shadow and blur effects enabled, extends outside of the window #478
make query window width dynamic