-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Return correct hit-test values for title bar buttons on Windows #4994
Conversation
43d4cc4
to
d8b1b62
Compare
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.
I'm not a huge fan of Q_ASSERT*, can you confirm Q_ASSERT_X doesn't fire in our CI-built windows artefacts?
I've confirmed Q_ASSERT* works as expected on my machine on Linux by just adding a Q_ASSERT at the top of main.cpp
Once you've confirmed it works, I'm fine to leave it here and would be more comfortable using it for future GUI code
I will test this on Windows11 now
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.
Works as expected on Windows 11, thank you!
Description
This Pr returns the correct hit-test values for the title bar buttons (minimize, maximize/restore, and close). This will allow Windows 11 snap layouts to work with Chatterino (and possibly other OS features).
I adapted the implementation from https://github.com/desktop-app/lib_ui/blob/44161f183c255dc0dac7ebe9558a1ca48f5e5258/ui/platform/win/ui_window_win.cpp#L755-L810.
WM_NCMOUSE{MOVE, HOVER}
, we simulate move events for the title bar buttons, as Qt doesn't generate those.WM_NCMOUSELEAVE
(and the firstWM_MOUSEMOVE
after a move in the non-client area), we clear/leave all hovered buttons.WM_NCLBUTTON{UP, DOWN}
, we simulate a click on a button.From my testing, it seems that we don't need to handle
WM_NC{L, M, R, X}BUTTONDBLCLK
andWM_NC{M, R, X}BUTTON{DOWN, UP}
.For some future PR (maybe):
QWidget::nativeEvent
always returnsfalse
and does nothing else - we don't need to call it.When testing, please test as many native gestures/tricks/…, like double-clicking the title bar, as you can.
Closes #4991.
Addresses #1967 (as the window can be dragged in the top left corner now - not 100% sure why).
TODO
Check what the tooltips are aboutSeems like they're from the OSAs for high-dpi, this needs to be changed if #4868 ever lands.