Closed Rain623 closed 4 months ago
@Rain623 I know this is a problem, but it works smoother after adding some widget and frames. Aero is much smoother than acrylic. For me the GPU uses decreases by 40% after adding elements in the window. (i.e 60%--> 20%)
@Akascape Even after adding some widget and frames, acrylic and transparency still experience lag, but Aero does not lag (in fact, Aero doesn't lag even without adding widget and frames).There is no significant change in GPU usage.
@Rain623 there will be lag in blurred windows, can't do anything for now. Maybe disable the resizability of the window if you are worried too much.
It is just a problem of the win32 api, actually, "SetWindowCompositionAttribute" is a undocumented function and it will cause many problem just like the laggy window. (Both windows 10 & 11)
Also it won't be too much laggy on windows 11, acrylic and aero are the same effect.
It only use %5 on windows 11 ( I am just using Arc A750 GPU)
And it seems that the titlebar can not show very well.
@littlewhitecloud So there is no solution for now.
many problem just like the laggy window
what other problems? Not serious I guess.
They are hard too describe, maybe not serious.
I just found a new way to fix it and it won't be lagyyyyyyyyy
@littlewhitecloud Wow, please share the code.
It is c++ and the code is here:
void ApplyAcrylic(HWND hwnd, bool extend = false)
{
pfnSetWindowCompositionAttribute SetWindowCompositionAttribute = (pfnSetWindowCompositionAttribute)GetProcAddress(GetModuleHandle("user32.dll"), "SetWindowCompositionAttribute");
ApplyDarkMode(hwnd);
ACCENT_POLICY accentpolicy = {};
accentpolicy.AccentState = 3;
accentpolicy.GradientColor = gradientcolor;
// Set the WindowCompositionArrtibuteData
WINDOWCOMPOSITIONATTRIBDATA data;
data.Attrib = 30;
data.pvData = &accentpolicy;
data.cbData = sizeof(accentpolicy);
// Set the window's backdrop and extend to the frame
SetWindowCompositionAttribute(hwnd, &data);
if (extend)
ExtendFrameIntoClientArea(hwnd);
}
There may be a bit different in the repo, that's okay. Clone this repo https://github.com/littlewhitecloud/win32style And copy this code:
from ctypes import c_char_p, windll
from win32style import *
from tkinter import Tk
w = Tk()
w.title("example")
w.geometry("1080x570")
w.iconbitmap("")
w.config(background="black")
hwnd = windll.user32.FindWindowW(c_char_p(None), "example")
ApplyAcrylic(hwnd, True)
w.mainloop()
Then it won't be laggy when you dragging or resizing the window. It also use no GPU and I don't know why.
It does these:
Does it fix the problem?
@littlewhitecloud I will let you know, I am currently not working on this. But will fix it with your method.
@littlewhitecloud I will let you know, I am currently not working on this. But will fix it with your method.
Let me do that. I'm already fixed it.
I am not sure about that this patch will work on windows 10?
System: Windows 10 22H2 19045.3448 GPU: NVIDIA GeForce RTX 3060 Python:3.11.5 Enabling the "Transparency Effects" option in Personalization > Colors leads to severe lag when using transparent themes (acrylic, aero, transparent). When dragging windows, there is a significant delay, with windows gradually moving to the mouse's position. Even after releasing the mouse, the windows continue to move until they reach the final release point. Additionally, the GPU usage of the Desktop Window Manager (dwm.exe) ranges from approximately 5% to 30%. Disabling the "Transparency Effects" option doesn't result in a noticeable difference in GPU usage by the Desktop Window Manager (dwm.exe), but the lag issue disappears.
code: