HiDPI support: keep window's icons after rescaling

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12276 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2017-06-28 15:15:34 +00:00
parent 322b62a9f1
commit 582701ba07
6 changed files with 15 additions and 1 deletions

View File

@ -162,6 +162,7 @@ public:
// --- window icon stuff
virtual void icons(const Fl_RGB_Image *icons[], int count) {}
virtual void reuse_icons() {}
virtual const void *icon() const {return NULL;}
virtual void icon(const void * ic) {}
virtual void free_icons() {}

View File

@ -375,6 +375,7 @@ void Fl_Screen_Driver::rescale_all_windows_from_screen(int screen, float f)
}
win->show();
win->driver()->reuse_cursor(current);
win->driver()->reuse_icons();
win->wait_for_expose();
}
delete[] win_array;

View File

@ -109,6 +109,7 @@ public:
virtual const void *icon() const;
virtual void icon(const void * ic);
virtual void free_icons();
virtual void reuse_icons();
void set_icons(); // driver-internal support function
// this one is implemented in Fl_win32.cxx
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);

View File

@ -347,6 +347,11 @@ void Fl_WinAPI_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) {
icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy();
}
reuse_icons();
}
void Fl_WinAPI_Window_Driver::reuse_icons()
{
if (Fl_X::i(pWindow))
set_icons();
}
@ -443,7 +448,7 @@ void Fl_WinAPI_Window_Driver::hide() {
if (hide_common()) return;
// make sure any custom icons get freed
icons(NULL, 0);
// icons(NULL, 0); // free_icons() is called by the Fl_Window destructor
// this little trick keeps the current clipboard alive, even if we are about
// to destroy the window that owns the selection.
if (GetClipboardOwner()==ip->xid)

View File

@ -135,6 +135,7 @@ public:
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);
virtual void reuse_icons();
virtual const void *icon() const;
virtual void icon(const void * ic);
virtual void free_icons();

View File

@ -356,6 +356,11 @@ void Fl_X11_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) {
icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy();
}
reuse_icons();
}
void Fl_X11_Window_Driver::reuse_icons()
{
if (Fl_X::i(pWindow))
set_icons();
}