-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Fix cursor hiding on input #18445
Fix cursor hiding on input #18445
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1354,6 +1354,7 @@ PNMLINK | |
pntm | ||
POBJECT | ||
Podcast | ||
POINTERUPDATE | ||
POINTSLIST | ||
policheck | ||
POLYTEXTW | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,10 @@ class IslandWindow : | |
public BaseWindow<IslandWindow> | ||
{ | ||
public: | ||
static bool IsCursorHidden() noexcept; | ||
static void HideCursor() noexcept; | ||
static void ShowCursorMaybe(const UINT message) noexcept; | ||
|
||
IslandWindow() noexcept; | ||
virtual ~IslandWindow() override; | ||
|
||
|
@@ -143,7 +147,7 @@ class IslandWindow : | |
bool _minimizeToNotificationArea{ false }; | ||
|
||
std::unordered_map<UINT, SystemMenuItemInfo> _systemMenuItems; | ||
UINT _systemMenuNextItemId; | ||
UINT _systemMenuNextItemId = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This member was left uninitialized. |
||
void _resetSystemMenu(); | ||
|
||
private: | ||
|
@@ -154,4 +158,6 @@ class IslandWindow : | |
// though the total height will take into account the non-client area | ||
// and the requirements of components hosted in the client area | ||
static constexpr float minimumHeight = 0; | ||
|
||
inline static bool _cursorHidden; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,6 +417,16 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow) | |
_dispatchSpecialKey(msg); | ||
continue; | ||
} | ||
|
||
if (msg.message == WM_KEYDOWN) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or syskeydown right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I missed this comment. I think it should not be done on SYSKEYDOWN since that's for Alt-key combinations, which also doesn't hide the cursor in classic applications. |
||
{ | ||
IslandWindow::HideCursor(); | ||
} | ||
} | ||
|
||
if (IslandWindow::IsCursorHidden()) | ||
{ | ||
IslandWindow::ShowCursorMaybe(msg.message); | ||
} | ||
|
||
TranslateMessage(&msg); | ||
|
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.
do you need one for losing focus or "switching to other window"?
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.
should we hide the cursor only when we are active? (so that somebody sending us a WM_KEYDOWN remotely doesn't hide the cursor?)
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.
My assumption was that WM_ACTIVATE is a superset of WM_SETFOCUS. Is that not the case? (Not sure how to test that because I always focus a window by activating it…)
I think that hiding the cursor on an external/emulated WM_KEYDOWN is fine since the sender must've had a reason to send WM_KEYDOWN specifically and I think it should behave like any other keyboard input.
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.
fair enough