← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2739: fix the splash screen on XP

 

------------------------------------------------------------
revno: 2739
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-12-23 15:08:07 +0100
message:
  fix the splash screen on XP
modified:
  win32/SplashWindow.cpp
  win32/SplashWindow.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/SplashWindow.cpp'
--- win32/SplashWindow.cpp	2011-12-22 19:24:21 +0000
+++ win32/SplashWindow.cpp	2011-12-23 14:08:07 +0000
@@ -23,15 +23,23 @@
 #include <dcpp/Text.h>
 #include <dcpp/version.h>
 
+#include <dwt/DWTException.h>
+
 #include "resource.h"
 #include "WinUtil.h"
 
-const long iconSize = 256;
-
 SplashWindow::SplashWindow() :
-dwt::Window(0),
-icon(WinUtil::createIcon(IDI_DCPP, iconSize))
+dwt::Window(0)
 {
+	// 256x icons only work on >= Vista. on failure, let Windows choose the image size it prefers.
+	try {
+		iconSize = 256;
+		icon = WinUtil::createIcon(IDI_DCPP, iconSize);
+	} catch(const dwt::DWTException&) {
+		icon = new dwt::Icon(IDI_DCPP);
+		iconSize = icon->getSize().x;
+	}
+
 	{
 		// create a layered window (WS_EX_LAYERED); it will be shown later with UpdateLayeredWindow.
 		Seed seed(_T(APPNAME) _T(" ") _T(VERSIONSTRING));

=== modified file 'win32/SplashWindow.h'
--- win32/SplashWindow.h	2011-12-22 19:24:21 +0000
+++ win32/SplashWindow.h	2011-12-23 14:08:07 +0000
@@ -29,6 +29,7 @@
 	void operator()(const string& status);
 
 private:
+	long iconSize;
 	dwt::IconPtr icon;
 };