diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-10 13:37:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-10 13:37:26 +0200 |
commit | 055ac8bb78dcd5e4496fc8c9b46fe05621a0fd94 (patch) | |
tree | b89ee2ef8d28c217691eb5adb3d02537689495ca | |
parent | 5dae0cba1648d2155921e6aa9b58721b82f0672a (diff) | |
parent | b268c4b4bc8a1c246984249b2ce88277df47fe78 (diff) |
Merge pull request #60916 from bruvzg/win_save_icon
-rw-r--r-- | platform/windows/display_server_windows.cpp | 12 | ||||
-rw-r--r-- | platform/windows/display_server_windows.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index b548277f95..93cab85441 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1106,6 +1106,10 @@ void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repain SetWindowLongPtr(wd.hWnd, GWL_STYLE, style); SetWindowLongPtr(wd.hWnd, GWL_EXSTYLE, style_ex); + if (icon.is_valid()) { + set_icon(icon); + } + SetWindowPos(wd.hWnd, wd.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | ((wd.no_focus || wd.is_popup) ? SWP_NOACTIVATE : 0)); if (p_repaint) { @@ -1895,9 +1899,11 @@ void DisplayServerWindows::set_icon(const Ref<Image> &p_icon) { _THREAD_SAFE_METHOD_ ERR_FAIL_COND(!p_icon.is_valid()); - Ref<Image> icon = p_icon->duplicate(); - if (icon->get_format() != Image::FORMAT_RGBA8) { - icon->convert(Image::FORMAT_RGBA8); + if (icon != p_icon) { + icon = p_icon->duplicate(); + if (icon->get_format() != Image::FORMAT_RGBA8) { + icon->convert(Image::FORMAT_RGBA8); + } } int w = icon->get_width(); int h = icon->get_height(); diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index c039b29c54..febc8a2043 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -399,6 +399,7 @@ class DisplayServerWindows : public DisplayServer { HHOOK mouse_monitor = nullptr; List<WindowID> popup_list; uint64_t time_since_popup = 0; + Ref<Image> icon; WindowID _create_window(WindowMode p_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Rect2i &p_rect); WindowID window_id_counter = MAIN_WINDOW_ID; |