Improve handling of the small icon of the window class. (#152620, Kazuki

2006-10-29  Tor Lillqvist  <tml@novell.com>

	* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Improve handling
	of the small icon of the window class. (#152620, Kazuki Iwamoto)
This commit is contained in:
Tor Lillqvist 2006-10-28 23:58:30 +00:00 committed by Tor Lillqvist
parent 957d8c2fda
commit 52b1bac8ec
2 changed files with 30 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2006-10-29 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Improve handling
of the small icon of the window class. (#152620, Kazuki Iwamoto)
2006-10-27 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (validate_visible_area): rework the area_above == 0

View File

@ -318,6 +318,7 @@ RegisterGdkClass (GdkWindowType wtype)
static ATOM klassCHILD = 0;
static ATOM klassTEMP = 0;
static HICON hAppIcon = NULL;
static HICON hAppIconSm = NULL;
static WNDCLASSEXW wcl;
ATOM klass = 0;
@ -330,26 +331,37 @@ RegisterGdkClass (GdkWindowType wtype)
wcl.cbWndExtra = 0;
wcl.hInstance = _gdk_app_hmodule;
wcl.hIcon = 0;
wcl.hIconSm = 0;
/* initialize once! */
if (0 == hAppIcon)
if (0 == hAppIcon && 0 == hAppIconSm)
{
gchar sLoc [MAX_PATH+1];
if (0 != GetModuleFileName (_gdk_app_hmodule, sLoc, MAX_PATH))
{
hAppIcon = ExtractIcon (_gdk_app_hmodule, sLoc, 0);
if (0 == hAppIcon)
{
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
hAppIcon = ExtractIcon (_gdk_dll_hinstance, sLoc, 0);
}
}
if (0 == hAppIcon)
hAppIcon = LoadIcon (NULL, IDI_APPLICATION);
{
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
if (0 == hAppIcon && 0 == hAppIconSm)
{
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
}
}
if (0 == hAppIcon && 0 == hAppIconSm)
{
hAppIcon = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
GetSystemMetrics (SM_CXICON),
GetSystemMetrics (SM_CYICON), 0);
hAppIconSm = LoadImage (NULL, IDI_APPLICATION, IMAGE_ICON,
GetSystemMetrics (SM_CXSMICON),
GetSystemMetrics (SM_CYSMICON), 0);
}
}
if (0 == hAppIcon)
hAppIcon = hAppIconSm;
else if (0 == hAppIconSm)
hAppIconSm = hAppIcon;
wcl.lpszMenuName = NULL;
wcl.hIconSm = 0;
/* initialize once per class */
/*
@ -359,7 +371,7 @@ RegisterGdkClass (GdkWindowType wtype)
*/
#define ONCE_PER_CLASS() \
wcl.hIcon = CopyIcon (hAppIcon); \
wcl.hIconSm = CopyIcon (hAppIcon); \
wcl.hIconSm = CopyIcon (hAppIconSm); \
wcl.hbrBackground = NULL; \
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);