Skip to content

Conversation

@jjw24
Copy link
Member

@jjw24 jjw24 commented Jun 27, 2021

@jjw24 jjw24 added the bug Something isn't working label Jun 27, 2021
@jjw24 jjw24 self-assigned this Jun 27, 2021
@jjw24 jjw24 enabled auto-merge June 27, 2021 12:15
@taooceros
Copy link
Member

Why not enable Blur when blur theme is selected instead of prompting to restart?

@jjw24
Copy link
Member Author

jjw24 commented Jun 28, 2021

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

@taooceros
Copy link
Member

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.

@jjw24
Copy link
Member Author

jjw24 commented Jun 28, 2021

cant, blur can only be enabled by mainwindow's onloaded, if you force it else where you get this

image

@taooceros
Copy link
Member

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.

@jjw24
Copy link
Member Author

jjw24 commented Jun 28, 2021

oh right, good pick up thank you.

@taooceros
Copy link
Member

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.

@jjw24
Copy link
Member Author

jjw24 commented Jun 28, 2021

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

@jjw24 jjw24 changed the title auto disable shadow when blur is enabled auto disable shadow when blur is enabled and make query window width dynamic Jun 28, 2021
@jjw24
Copy link
Member Author

jjw24 commented Jun 28, 2021

all done

@taooceros taooceros added this to the 1.8.0 milestone Jun 29, 2021
Comment on lines +346 to +353
if (BlurEnabled)
{
SetWindowAccent(Application.Current.MainWindow, AccentState.ACCENT_ENABLE_BLURBEHIND);
}
else
{
SetWindowAccent(Application.Current.MainWindow, AccentState.ACCENT_DISABLED);
}
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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.

@jjw24 jjw24 merged commit 3bbffe8 into dev Jun 29, 2021
@jjw24 jjw24 deleted the auto_disable_shadow branch June 29, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

query window when shadow and blur effects enabled, extends outside of the window

3 participants