Merge pull request #5560 from vnen/os-request-attention
Add OS.request_attention() for Windows
This commit is contained in:
commit
d723e5a62f
6 changed files with 25 additions and 0 deletions
|
@ -944,6 +944,11 @@ void _OS::native_video_stop() {
|
|||
OS::get_singleton()->native_video_stop();
|
||||
};
|
||||
|
||||
void _OS::request_attention() {
|
||||
|
||||
OS::get_singleton()->request_attention();
|
||||
}
|
||||
|
||||
bool _OS::is_debug_build() const {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
@ -1042,6 +1047,7 @@ void _OS::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized);
|
||||
ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized);
|
||||
ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized);
|
||||
ObjectTypeDB::bind_method(_MD("request_attention"), &_OS::request_attention);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
|
||||
ObjectTypeDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window);
|
||||
|
|
|
@ -158,6 +158,7 @@ public:
|
|||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
virtual void request_attention();
|
||||
|
||||
virtual void set_borderless_window(bool p_borderless);
|
||||
virtual bool get_borderless_window() const;
|
||||
|
|
|
@ -174,6 +174,7 @@ public:
|
|||
virtual bool is_window_minimized() const { return false; }
|
||||
virtual void set_window_maximized(bool p_enabled) {}
|
||||
virtual bool is_window_maximized() const { return true; }
|
||||
virtual void request_attention() { }
|
||||
|
||||
virtual void set_borderless_window(int p_borderless) {}
|
||||
virtual bool get_borderless_window() { return 0; }
|
||||
|
|
|
@ -22877,6 +22877,11 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="request_attention">
|
||||
<description>
|
||||
Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_borderless_window">
|
||||
<argument index="0" name="borderless" type="bool">
|
||||
</argument>
|
||||
|
|
|
@ -1683,6 +1683,17 @@ bool OS_Windows::get_borderless_window() {
|
|||
return video_mode.borderless_window;
|
||||
}
|
||||
|
||||
void OS_Windows::request_attention() {
|
||||
|
||||
FLASHWINFO info;
|
||||
info.cbSize = sizeof(FLASHWINFO);
|
||||
info.hwnd = hWnd;
|
||||
info.dwFlags = FLASHW_TRAY;
|
||||
info.dwTimeout = 0;
|
||||
info.uCount = 2;
|
||||
FlashWindowEx(&info);
|
||||
}
|
||||
|
||||
void OS_Windows::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) {
|
||||
|
||||
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
|
|
@ -230,6 +230,7 @@ public:
|
|||
virtual bool is_window_minimized() const;
|
||||
virtual void set_window_maximized(bool p_enabled);
|
||||
virtual bool is_window_maximized() const;
|
||||
virtual void request_attention();
|
||||
|
||||
virtual void set_borderless_window(int p_borderless);
|
||||
virtual bool get_borderless_window();
|
||||
|
|
Loading…
Reference in a new issue