wangwenx190 / framelesshelper

Project moved to: https://github.com/stdware/qwindowkit Cross-platform window customization framework for Qt Widgets and Qt Quick. Supports Windows, Linux and macOS.
MIT License
846 stars 203 forks source link

[Windows] [>= Win10 1803] Dragging & Resizing is laggy when the Acrylic effect is enabled #27

Closed wangwenx190 closed 2 years ago

wangwenx190 commented 4 years ago

It's a bug of Windows itself. Not fixable from my side.

wangwenx190 commented 4 years ago

Win7, Win8 and Win8.1 are not affected because only from Win10 1803 can the normal Win32 windows enable the Acrylic effect.

wangwenx190 commented 4 years ago

The only workaround for this issue is switching back to use the classic blur instead of the Acrylic effect, however, unfortunately, they don't look exactly the same.

Or maybe you can solve this in a pure Qt way: draw the blurred background yourself, through QPainter or whatever.

JulienMaille commented 4 years ago

Maybe @SelastinGeorge has some ideas? We could freeze the background when moving and disable transparency until it's released?

wangwenx190 commented 4 years ago

We could freeze the background when moving and disable transparency until it's released?

I don't have much knowledge about the Acrylic effect. It's a bit beyond my limit.

selastingeorge commented 4 years ago

Ok no problem

On Wed, 21 Oct, 2020, 6:30 am Yuhang Zhao, notifications@github.com wrote:

We could freeze the background when moving and disable transparency until it's released?

I don't have much knowledge about the Acrylic effect. It's a bit beyond my limit.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wangwenx190/framelesshelper/issues/27#issuecomment-713225451, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKGWVM2CPL3B3BD33KBRDLSLYXDHANCNFSM4STC7GBQ .

wangwenx190 commented 4 years ago

Ok no problem

@SelastinGeorge You know how to fix the laggy dragging?

selastingeorge commented 4 years ago

The only way to fix the laggy dragging in acrylic blur is to disable the transparency effect of windows 10 from the personalization settings

selastingeorge commented 4 years ago

and that's a very bad move

selastingeorge commented 4 years ago

i need to find a way to capture the visual behind a window and thats the only way to bring a perfectly working acrylic blur to win32 and wpf

wangwenx190 commented 4 years ago

and that's a very bad move

Very bad indeed.

selastingeorge commented 4 years ago

there is one last option, use DWM blur behind capture the hwnd using directx, use gaussian blur from DirectX and redraw it to window

selastingeorge commented 4 years ago

and its a very difficult task

wangwenx190 commented 4 years ago

Ah, so complex!

selastingeorge commented 4 years ago

ya microsoft should fix this. have you tried xaml islands

selastingeorge commented 4 years ago

we can use acrylic effect using xaml islands and it is not laggy but flickers a lot.

wangwenx190 commented 4 years ago

have you tried xaml islands

I know about it but I don't know whether I can integrate it with Qt or not. I haven't tried it yet. But I think it's not hard to use it in normal Win32 applications, Microsoft's Terminal is a good example.

but flickers a lot.

It's not caused by the xaml island I'm afraid. Maybe it can be solved by your WM_NCCALCSIZE trick.

selastingeorge commented 4 years ago

no i tried it doesnt work

selastingeorge commented 4 years ago

are you good at QT? do you have any idea how to create a desktop environment using qt qml

wangwenx190 commented 4 years ago

no i tried it doesnt work

So sad.

I'm also wondering why the standard title bar doesn't flicker. It's drawn on the non-client area as what we do, but the title bar drawn by ourselves flicker a lot.

wangwenx190 commented 4 years ago

are you good at QT?

Not very bad at least. But not very professional as well.

create a desktop environment using qt qml

I don't quite understand what does it mean. Can you explain it more clearly?

selastingeorge commented 4 years ago

ya windows keeps secrets. the won't let anyone to touch their source codes. if they would have published windows as opensource then windows 10 would be as better as linux.

wangwenx190 commented 4 years ago

ya windows keeps secrets. the won't let anyone to touch their source codes. if they would have published windows as opensource then windows 10 would be as better as linux.

Ha ha, sounds sensible.

selastingeorge commented 4 years ago

are you good at QT?

Not very bad at least. But not very professional as well.

create a desktop environment using qt qml

I don't quite understand what does it mean. Can you explain it more clearly?

i mean like a gnome or sway, i was working on a project for creating an os,i finished building up the kernel and i was trying to build the desktop for my os. i have searched and found that it can be done using qtwayland.

selastingeorge commented 4 years ago

but i don't know how to create a gridview in qml with multiple selection. like this image, i need to select multiple items using the rectangle. bar

wangwenx190 commented 4 years ago

i was working on a project for creating an os

Wow, that's awesome!

i was trying to build the desktop for my os

Have you ever heard about the Deepin Desktop Environment (aka DDE) ? It's written in C++/Qt and it's open source. Maybe it can help you. Building a desktop is far beyond my limit😂

wangwenx190 commented 4 years ago

Or KDE? It's written in Qt as well.

selastingeorge commented 4 years ago

ya but not fully qml. anyway i will check it out

wangwenx190 commented 4 years ago

the Deepin Desktop Environment (aka DDE)

Sorry, I forgot to write the link: https://github.com/linuxdeepin

wangwenx190 commented 4 years ago

but not fully qml

I don't think it makes sense to build a desktop environment entirely with QML, as QML is not mature enough and until Qt 5.15 there were still quite a few bugs. If only a few components use QML, this is a good choice.

selastingeorge commented 4 years ago

This is far more complicated, let's just check our windows 10 acrylic blur itself. if i find a solution to implement acrylic blur i will let you know.

thank you.

wangwenx190 commented 4 years ago

if i find a solution to implement acrylic blur i will let you know.

Thanks!

wangwenx190 commented 4 years ago

The only way to fix the laggy dragging in acrylic blur is to disable the transparency effect of windows 10 from the personalization settings

Yes it fixed the laggy dragging indeed. But the resizing is also very laggy and can't be fixed in this way.

But I have an interesting finding: although I have turned off the transparency effect in the personalization settings, our own Acrylic effect is not affected by it -> it still has the transparency effect. But the dragging is not laggy anymore.

Could this be a breakthrough point?

selastingeorge commented 4 years ago

Ya it wont affect our acrylic effect. i noticed it before and that's why i mentioned it earlier

wangwenx190 commented 4 years ago

Maybe there are some APIs (even undocumented APIs) to adjust this, just like SetWindowCompositionAttribute?

selastingeorge commented 4 years ago

yes there might be.

wangwenx190 commented 4 years ago

@SelastinGeorge See here for more detailed discussion. No solutions yet but at least why the window laggs is known.

selastingeorge commented 4 years ago

@wangwenx190, We have got a good lead, check out this SetWindowDisplayAffinity

there is a new DWORD value added to this function called WDA_EXCLUDEFROMCAPTURE, this one help us to exclude a window from screen capture, which means we will be able to capture the visual behind window by just capturing the area where window is placed. now i'm currently working to integrate it.

wangwenx190 commented 4 years ago

@wangwenx190, We have got a good lead, check out this SetWindowDisplayAffinity

there is a new DWORD value added to this function called WDA_EXCLUDEFROMCAPTURE, this one help us to exclude a window from screen capture, which means we will be able to capture the visual behind window by just capturing the area where window is placed. now i'm currently working to integrate it.

It’s introduced in win10 2004. Isn’t this too new?

selastingeorge commented 4 years ago

ya but that's the only hope

selastingeorge commented 4 years ago

well i ran into a new problem. it is really tough to understand the dxgi desktop duplication code. it captures the entire desktop. i need to get only the part where my window is placed

wangwenx190 commented 4 years ago

ya but that's the only hope

You are right. Let’s fix the issue first.

wangwenx190 commented 4 years ago

well i ran into a new problem. it is really tough to understand the dxgi desktop duplication code. it captures the entire desktop. i need to get only the part where my window is placed

https://github.com/robmikh/Win32CaptureSample

https://github.com/robmikh/CaptureGifEncoder

https://github.com/robmikh/SimpleRecorder

They show how to use dxgi to capture windows.

selastingeorge commented 4 years ago

all of these uses winrt and it's well complicated than desktop duplication

selastingeorge commented 4 years ago

any way i'm posting a question in stack overflow i think some one will help us.

JulienMaille commented 3 years ago

I just tried today on my latest insider build and moving isn't laggy anymore. I have not tried for a while on that computer so I can't tell exactly when it was fixed. image

selastingeorge commented 3 years ago

Ya i have seen some post stating the same thing that the acrylic blur is working in insider builds. But they haven't yet rolled it into production.

On Sat, 14 Nov, 2020, 3:32 pm Julien, notifications@github.com wrote:

I just tried today on my latest insider build and moving isn't laggy anymore. I have not tried for a while on that computer so I can't they exactly when it was fixed. [image: image] https://user-images.githubusercontent.com/182520/99144759-d7912500-2668-11eb-891c-75f3e6ad2941.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wangwenx190/framelesshelper/issues/27#issuecomment-727179002, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKGWVOKSMUF2GXDFFUP4QLSPZITFANCNFSM4STC7GBQ .

wangwenx190 commented 3 years ago

@JulienMaille @SelastinGeorge Great news! Thanks for telling me about this!

JulienMaille commented 3 years ago

the gif doesn't show it so well, but it's smooth test2

JulienMaille commented 3 years ago

Ya i have seen some post stating the same thing that the acrylic blur is working in insider builds. But they haven't yet rolled it into production.

would be nice to know if we can ship a specific dll in the meantime, or if its a much deeper system fix

wangwenx190 commented 3 years ago

the gif doesn't show it so well, but it's smooth test2

Thanks! Looks awesome!