pidgin/win32/gtkdocklet-win32.c

changeset 16058
dc1c7b09a058
parent 15891
8703019e56de
child 16238
33bf2fd32108
child 16808
c0736ad72fd6
child 20478
46933dc62880
--- a/pidgin/win32/gtkdocklet-win32.c	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/win32/gtkdocklet-win32.c	Thu Apr 05 04:25:11 2007 +0000
@@ -107,7 +107,7 @@
 	wcex.lpfnWndProc	= systray_mainmsg_handler;
 	wcex.cbClsExtra		= 0;
 	wcex.cbWndExtra		= 0;
-	wcex.hInstance		= winpidgin_hinstance();
+	wcex.hInstance		= winpidgin_exe_hinstance();
 	wcex.hIcon		= NULL;
 	wcex.hCursor		= NULL,
 	wcex.hbrBackground	= NULL;
@@ -118,7 +118,7 @@
 	RegisterClassEx(&wcex);
 
 	/* Create the window */
-	return (CreateWindow(wname, "", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, winpidgin_hinstance(), 0));
+	return (CreateWindow(wname, "", 0, 0, 0, 0, 0, GetDesktopWindow(), NULL, winpidgin_exe_hinstance(), 0));
 }
 
 static void systray_init_icon(HWND hWnd) {
@@ -533,6 +533,7 @@
 
 
 static void winpidgin_tray_create() {
+	OSVERSIONINFO osinfo;
 	/* dummy window to process systray messages */
 	systray_hwnd = systray_create_hiddenwin();
 
@@ -544,6 +545,32 @@
 	gtk_object_sink(GTK_OBJECT(image));
 #endif
 
+	osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+	GetVersionEx(&osinfo);
+
+	/* Load icons, and init systray notify icon
+	 * NOTE: Windows < XP only supports displaying 4-bit images in the Systray,
+	 *  2K and ME will use the highest color depth that the desktop will support,
+	 *  but will scale it back to 4-bits for display.
+	 * That is why we use custom 4-bit icons for pre XP Windowses */
+	if (osinfo.dwMajorVersion < 5 || (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 0))
+	{
+		cached_icons[DOCKLET_STATUS_OFFLINE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_OFFLINE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_AVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_AVAILABLE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_AWAY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_XA] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_XA_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_BUSY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_BUSY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_CONNECTING] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_CONNECTING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+		cached_icons[DOCKLET_STATUS_PENDING] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+			MAKEINTRESOURCE(PIDGIN_TRAY_PENDING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
+	}
+
 	/* Create icon in systray */
 	systray_init_icon(systray_hwnd);
 

mercurial