mirror of https://github.com/fltk/fltk
Fl_Window::default_icons(): more checks, don't CopyIcon()
This commit is contained in:
parent
8d3685f5eb
commit
2ae692cc1f
|
@ -2431,19 +2431,32 @@ void Fl_Window::default_icons(HICON big_icon, HICON small_icon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Window::default_icons() {
|
void Fl_Window::default_icons() {
|
||||||
HICON *big_icon, *small_icon, big_icon_array[1], small_icon_array[1];
|
HICON *pbig, *psmall, big_icons[1], small_icons[1];
|
||||||
wchar_t path[FL_PATH_MAX];
|
wchar_t path[FL_PATH_MAX];
|
||||||
|
|
||||||
big_icon_array[0] = NULL;
|
big_icons[0] = NULL;
|
||||||
small_icon_array[0] = NULL;
|
small_icons[0] = NULL;
|
||||||
big_icon = big_icon_array;
|
pbig = big_icons;
|
||||||
small_icon = small_icon_array;
|
psmall = small_icons;
|
||||||
|
|
||||||
|
if (default_big_icon != NULL)
|
||||||
|
DestroyIcon(default_big_icon);
|
||||||
|
if (default_small_icon != NULL)
|
||||||
|
DestroyIcon(default_small_icon);
|
||||||
|
|
||||||
// use exe's/module's icon resource to set window default icons
|
// use exe's/module's icon resource to set window default icons
|
||||||
GetModuleFileNameW(NULL, path, FL_PATH_MAX);
|
if (GetModuleFileNameW(NULL, path, FL_PATH_MAX) == 0)
|
||||||
ExtractIconExW(path, 0, big_icon, small_icon, 1);
|
return;
|
||||||
|
if (ExtractIconExW(path, 0, pbig, psmall, 1) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Fl_Window::default_icons(big_icon_array[0], small_icon_array[0]);
|
default_big_icon = NULL;
|
||||||
|
default_small_icon = NULL;
|
||||||
|
|
||||||
|
if (big_icons[0] != NULL)
|
||||||
|
default_big_icon = big_icons[0];
|
||||||
|
if (small_icons[0] != NULL)
|
||||||
|
default_small_icon = small_icons[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_WinAPI_Window_Driver::set_icons() {
|
void Fl_WinAPI_Window_Driver::set_icons() {
|
||||||
|
|
|
@ -49,6 +49,7 @@ include_directories(
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Add the ANDROID_OK option if the example can be compiled for Android
|
# Add the ANDROID_OK option if the example can be compiled for Android
|
||||||
# as well as for other platforms.
|
# as well as for other platforms.
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
|
|
||||||
CREATE_EXAMPLE (adjuster adjuster.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (adjuster adjuster.cxx fltk ANDROID_OK)
|
||||||
|
|
Loading…
Reference in New Issue