mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Hide Shortcut Guide when screenshots are taken (#605)
This commit is contained in:
parent
b767773742
commit
e6afd33621
@ -385,6 +385,16 @@ void D2DOverlayWindow::set_theme(const std::wstring& theme) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide the window but do not call on_hide(). Use this to quickly hide the window when needed.
|
||||
Note, that a proper hide should be made after this before showing the window again.
|
||||
*/
|
||||
void D2DOverlayWindow::quick_hide() {
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
if (thumbnail) {
|
||||
DwmUnregisterThumbnail(thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
float D2DOverlayWindow::get_overlay_opacity() {
|
||||
return overlay_opacity;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
~D2DOverlayWindow();
|
||||
void apply_overlay_opacity(float opacity);
|
||||
void set_theme(const std::wstring& theme);
|
||||
void quick_hide();
|
||||
private:
|
||||
void animate(int vk_code, int offset);
|
||||
bool show_thumbnail(const RECT& rect, double alpha);
|
||||
|
@ -146,6 +146,10 @@ void OverlayWindow::on_held_press(DWORD vkCode) {
|
||||
winkey_popup->animate(vkCode);
|
||||
}
|
||||
|
||||
void OverlayWindow::quick_hide() {
|
||||
winkey_popup->quick_hide();
|
||||
}
|
||||
|
||||
void OverlayWindow::was_hidden() {
|
||||
target_state->was_hiden();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
|
||||
void on_held();
|
||||
void on_held_press(DWORD vkCode);
|
||||
void quick_hide();
|
||||
void was_hidden();
|
||||
|
||||
virtual void destroy() override;
|
||||
|
@ -11,6 +11,12 @@ bool TargetState::signal_event(unsigned vk_code, bool key_down) {
|
||||
if (!events.empty() && events.back().key_down == key_down && events.back().vk_code == vk_code) {
|
||||
return false;
|
||||
}
|
||||
// Hide the overlay when WinKey + Shift + S is pressed. 0x53 is the VK code of the S key
|
||||
if (key_down && state == Shown && vk_code == 0x53 && (GetKeyState(VK_LSHIFT) || GetKeyState(VK_RSHIFT))) {
|
||||
// We cannot use normal hide() here, there is stuff that needs deinitialization.
|
||||
// It can be safely done when the user releases the WinKey.
|
||||
instance->quick_hide();
|
||||
}
|
||||
bool supress = false;
|
||||
if (!key_down && (vk_code == VK_LWIN || vk_code == VK_RWIN) &&
|
||||
state == Shown &&
|
||||
|
Loading…
Reference in New Issue
Block a user