changeset 15997:495800004c0a

4bit icons for windows < XP. These are certainly not as pretty as the originals, but look a lot better than scaled down versions.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 05 Apr 2007 04:25:11 +0000
parents 1f06a0433528
children 7aa21490bf80
files pidgin/pixmaps/tray/16/Makefile.am pidgin/pixmaps/tray/16/available_4bit.ico pidgin/pixmaps/tray/16/away_4bit.ico pidgin/pixmaps/tray/16/busy_4bit.ico pidgin/pixmaps/tray/16/connecting_4bit.ico pidgin/pixmaps/tray/16/extended-away_4bit.ico pidgin/pixmaps/tray/16/message_4bit.ico pidgin/pixmaps/tray/16/offline_4bit.ico pidgin/pixmaps/tray/22/Makefile.am pidgin/pixmaps/tray/22/tray-away.ico pidgin/pixmaps/tray/22/tray-busy.ico pidgin/pixmaps/tray/22/tray-extended-away.ico pidgin/pixmaps/tray/22/tray-message.ico pidgin/pixmaps/tray/22/tray-offline.ico pidgin/pixmaps/tray/22/tray-online.ico pidgin/win32/gtkdocklet-win32.c pidgin/win32/gtkwin32dep.c pidgin/win32/gtkwin32dep.h pidgin/win32/pidgin_dll_rc.rc.in pidgin/win32/resource.h
diffstat 20 files changed, 65 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/pixmaps/tray/16/Makefile.am	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/pixmaps/tray/16/Makefile.am	Thu Apr 05 04:25:11 2007 +0000
@@ -6,7 +6,14 @@
 		tray-offline.png \
 		tray-online.png
 
-EXTRA_DIST = $(TRAY_ICONS)
+EXTRA_DIST = $(TRAY_ICONS) \
+	available_4bit.ico \
+	away_4bit.ico \
+	busy_4bit.ico \
+	connecting_4bit.ico \
+	extended-away_4bit.ico \
+	message_4bit.ico \
+	offline_4bit.ico
 
 pidgintraypixdir = $(datadir)/pixmaps/pidgin/tray/16
 pidgintraypix_DATA = $(TRAY_ICONS)
Binary file pidgin/pixmaps/tray/16/available_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/away_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/busy_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/connecting_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/extended-away_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/message_4bit.ico has changed
Binary file pidgin/pixmaps/tray/16/offline_4bit.ico has changed
--- a/pidgin/pixmaps/tray/22/Makefile.am	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/pixmaps/tray/22/Makefile.am	Thu Apr 05 04:25:11 2007 +0000
@@ -6,14 +6,7 @@
 		tray-offline.png \
 		tray-online.png
 
-EXTRA_DIST =	$(TRAY_ICONS) \
-		tray-away.ico \
-		tray-busy.ico \
-		tray-extended-away.ico \
-		tray-message.ico \
-		tray-offline.ico \
-		tray-online.ico
-#		tray-connecting.ico
+EXTRA_DIST =	$(TRAY_ICONS)
 
 pidgintraypixdir = $(datadir)/pixmaps/pidgin/tray/22
 pidgintraypix_DATA = $(TRAY_ICONS)
Binary file pidgin/pixmaps/tray/22/tray-away.ico has changed
Binary file pidgin/pixmaps/tray/22/tray-busy.ico has changed
Binary file pidgin/pixmaps/tray/22/tray-extended-away.ico has changed
Binary file pidgin/pixmaps/tray/22/tray-message.ico has changed
Binary file pidgin/pixmaps/tray/22/tray-offline.ico has changed
Binary file pidgin/pixmaps/tray/22/tray-online.ico has changed
--- 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);
 
--- a/pidgin/win32/gtkwin32dep.c	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/win32/gtkwin32dep.c	Thu Apr 05 04:25:11 2007 +0000
@@ -68,10 +68,14 @@
  *  PUBLIC CODE
  */
 
-HINSTANCE winpidgin_hinstance(void) {
+HINSTANCE winpidgin_exe_hinstance(void) {
 	return exe_hInstance;
 }
 
+HINSTANCE winpidgin_dll_hinstance(void) {
+	return dll_hInstance;
+}
+
 int winpidgin_gz_decompress(const char* in, const char* out) {
 	gzFile fin;
 	FILE *fout;
@@ -224,7 +228,7 @@
 	wcx.lpfnWndProc = message_window_handler;
 	wcx.cbClsExtra = 0;
 	wcx.cbWndExtra = 0;
-	wcx.hInstance = winpidgin_hinstance();
+	wcx.hInstance = winpidgin_exe_hinstance();
 	wcx.hIcon = NULL;
 	wcx.hCursor = NULL;
 	wcx.hbrBackground = NULL;
@@ -236,7 +240,7 @@
 
 	/* Create the window */
 	if(!(win_hwnd = CreateWindow(wname, TEXT("WinpidginMsgWin"), 0, 0, 0, 0, 0,
-			NULL, NULL, winpidgin_hinstance(), 0))) {
+			NULL, NULL, winpidgin_exe_hinstance(), 0))) {
 		purple_debug_error("winpidgin",
 			"Unable to create message window.\n");
 		return NULL;
--- a/pidgin/win32/gtkwin32dep.h	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/win32/gtkwin32dep.h	Thu Apr 05 04:25:11 2007 +0000
@@ -26,7 +26,8 @@
 #include <gtk/gtk.h>
 #include "conversation.h"
 
-HINSTANCE winpidgin_hinstance(void);
+HINSTANCE winpidgin_dll_hinstance(void);
+HINSTANCE winpidgin_exe_hinstance(void);
 
 /* Utility */
 int winpidgin_gz_decompress(const char* in, const char* out);
--- a/pidgin/win32/pidgin_dll_rc.rc.in	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/win32/pidgin_dll_rc.rc.in	Thu Apr 05 04:25:11 2007 +0000
@@ -1,5 +1,8 @@
 #include <winver.h>
 #include "version.h"
+#include "resource.h"
+
+#define PIXMAPDIR "pixmaps/tray/16/"
 
 VS_VERSION_INFO VERSIONINFO
   FILEVERSION PURPLE_MAJOR_VERSION,PURPLE_MINOR_VERSION,PURPLE_MICRO_VERSION,0
@@ -30,3 +33,10 @@
     END
   END
 
+PIDGIN_TRAY_AVAILABLE_4BIT	ICON PIXMAPDIR "available_4bit.ico"
+PIDGIN_TRAY_AWAY_4BIT		ICON PIXMAPDIR "away_4bit.ico"
+PIDGIN_TRAY_BUSY_4BIT		ICON PIXMAPDIR "busy_4bit.ico"
+PIDGIN_TRAY_XA_4BIT		ICON PIXMAPDIR "extended-away_4bit.ico"
+PIDGIN_TRAY_OFFLINE_4BIT	ICON PIXMAPDIR "offline_4bit.ico"
+PIDGIN_TRAY_CONNECTING_4BIT	ICON PIXMAPDIR "connecting_4bit.ico"
+PIDGIN_TRAY_PENDING_4BIT	ICON PIXMAPDIR "message_4bit.ico"
--- a/pidgin/win32/resource.h	Thu Apr 05 03:00:48 2007 +0000
+++ b/pidgin/win32/resource.h	Thu Apr 05 04:25:11 2007 +0000
@@ -1,1 +1,8 @@
-#define PURPLE_ICON                       104
+#define PIDGIN_ICON			104
+#define PIDGIN_TRAY_AVAILABLE_4BIT	105
+#define PIDGIN_TRAY_AWAY_4BIT		106
+#define PIDGIN_TRAY_BUSY_4BIT		107
+#define PIDGIN_TRAY_XA_4BIT		108
+#define PIDGIN_TRAY_OFFLINE_4BIT	109
+#define PIDGIN_TRAY_CONNECTING_4BIT	110
+#define PIDGIN_TRAY_PENDING_4BIT	111