dfct/TrueFramelessWindow

Strange Rendering Issue with Qt 5.9

adam-hartshorne opened this issue · 6 comments

The code worked perfectly for Qt 5.8, but upon upgrading to Qt 5.9, I get a strange white box that flickers around the windowless window. You also can't grab the edge of the window and resize it.

qt_windowless_rendering_issue

I am having the same problem.

dfct commented

Thanks for the report & screenshot! I'm looking into this now, will update again later today. Cheers

dfct commented

Fixed in master now! The issue was tied to this bugfix: https://bugreports.qt.io/browse/QTBUG-40578 . An patchset in it landed in Qt 5.9 and reworked a lot of the window size/frame calculation logic, breaking TrueFramelessWindow.

After literally five hours of painful debugging, I can confidently state the fix is moving the FramelessWindowHint up five lines. 💯

dfct commented

Best I understand now, for anyone stumbling across this with a similar issue in the future, the frameless window hint must be set before the window is created by Qt, otherwise it calculates the margins and doesn't ever let that go. In my case, I was setting the hint after calling winId which creates the window.

Qt has some internal mechanisms to otherwise set custom margins with QWindowsWindow::setCustomMargins() and the _q_windowsCustomMargins property, but I'm not sure they're fully implemented / intended to be exposed. I couldn't figure out a way to make use of those.

But when the window is in full screen mode, it leaves a small border that goes beyond the windows task
bar.

dfct commented

@Moussa-Ball , can you open a new issue for the small border beyond the windows task bar? I can't reproduce that on my machine at the moment.