Merge pull request #5782 from electron/store-icons
Keep copies of window icons
This commit is contained in:
commit
f5839c3a5b
2 changed files with 12 additions and 3 deletions
|
@ -786,12 +786,16 @@ gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
void NativeWindowViews::SetIcon(HICON small_icon, HICON app_icon) {
|
void NativeWindowViews::SetIcon(HICON window_icon, HICON app_icon) {
|
||||||
|
// We are responsible for storing the images.
|
||||||
|
window_icon_ = base::win::ScopedHICON(CopyIcon(window_icon));
|
||||||
|
app_icon_ = base::win::ScopedHICON(CopyIcon(app_icon));
|
||||||
|
|
||||||
HWND hwnd = GetAcceleratedWidget();
|
HWND hwnd = GetAcceleratedWidget();
|
||||||
SendMessage(hwnd, WM_SETICON, ICON_SMALL,
|
SendMessage(hwnd, WM_SETICON, ICON_SMALL,
|
||||||
reinterpret_cast<LPARAM>(small_icon));
|
reinterpret_cast<LPARAM>(window_icon_.get()));
|
||||||
SendMessage(hwnd, WM_SETICON, ICON_BIG,
|
SendMessage(hwnd, WM_SETICON, ICON_BIG,
|
||||||
reinterpret_cast<LPARAM>(app_icon));
|
reinterpret_cast<LPARAM>(app_icon_.get()));
|
||||||
}
|
}
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
|
void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "atom/browser/ui/win/message_handler_delegate.h"
|
#include "atom/browser/ui/win/message_handler_delegate.h"
|
||||||
#include "atom/browser/ui/win/taskbar_host.h"
|
#include "atom/browser/ui/win/taskbar_host.h"
|
||||||
|
#include "base/win/scoped_gdi_object.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace views {
|
namespace views {
|
||||||
|
@ -205,6 +206,10 @@ class NativeWindowViews : public NativeWindow,
|
||||||
|
|
||||||
// If true we have enabled a11y
|
// If true we have enabled a11y
|
||||||
bool enabled_a11y_support_;
|
bool enabled_a11y_support_;
|
||||||
|
|
||||||
|
// The icons of window and taskbar.
|
||||||
|
base::win::ScopedHICON window_icon_;
|
||||||
|
base::win::ScopedHICON app_icon_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handles unhandled keyboard messages coming back from the renderer process.
|
// Handles unhandled keyboard messages coming back from the renderer process.
|
||||||
|
|
Loading…
Reference in a new issue