diff options
author | Littleboy | 2011-04-04 16:10:58 -0400 |
---|---|---|
committer | Julien | 2011-06-16 14:23:14 -0400 |
commit | 5649ddaf101db5d8ce70e9ba1bfda850c5d00aa5 (patch) | |
tree | f564f2f6e8a06b119d6fb474885d19c3e0abd82b | |
parent | e1dc9cdc0b89609753d3558f9603bef1cc12f1d8 (diff) | |
download | scummvm-rg350-5649ddaf101db5d8ce70e9ba1bfda850c5d00aa5.tar.gz scummvm-rg350-5649ddaf101db5d8ce70e9ba1bfda850c5d00aa5.tar.bz2 scummvm-rg350-5649ddaf101db5d8ce70e9ba1bfda850c5d00aa5.zip |
BACKENDS: Move Win32TaskbarManager init code to constructor
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 1 | ||||
-rw-r--r-- | backends/taskbar/win32/win32-taskbar.cpp | 30 | ||||
-rw-r--r-- | backends/taskbar/win32/win32-taskbar.h | 2 |
3 files changed, 13 insertions, 20 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 0a6702b6d9..08139f0dc2 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -88,7 +88,6 @@ void OSystem_Win32::init() { #if defined(USE_TASKBAR) // Initialize taskbar manager _taskbarManager = new Win32TaskbarManager(); - ((Win32TaskbarManager *)_taskbarManager)->init(); #endif // Invoke parent implementation of this method diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp index c630129ea9..fd8cd263e8 100644 --- a/backends/taskbar/win32/win32-taskbar.cpp +++ b/backends/taskbar/win32/win32-taskbar.cpp @@ -51,19 +51,7 @@ const PROPERTYKEY PKEY_Title = { /* fmtid = */ { 0xF29F85E0, 0x4FF9, 0x1068, { 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9 } }, /* propID = */ 2 }; Win32TaskbarManager::Win32TaskbarManager() { - _taskbar = NULL; -} - -Win32TaskbarManager::~Win32TaskbarManager() { - if (_taskbar) - _taskbar->Release(); - _taskbar = NULL; - - CoUninitialize(); -} - -void Win32TaskbarManager::init() { - // Do nothing if not running on Windows 7 of later + // Do nothing if not running on Windows 7 or later if (!isWin7OrLater()) return; @@ -71,10 +59,10 @@ void Win32TaskbarManager::init() { // Try creating instance (on fail, _taskbar will contain NULL) HRESULT hr = CoCreateInstance(CLSID_TaskbarList, - 0, - CLSCTX_INPROC_SERVER, - IID_ITaskbarList3, - reinterpret_cast<void**> (&(_taskbar))); + 0, + CLSCTX_INPROC_SERVER, + IID_ITaskbarList3, + reinterpret_cast<void**> (&(_taskbar))); if (SUCCEEDED(hr)) { // Initialize taskbar object @@ -87,6 +75,14 @@ void Win32TaskbarManager::init() { } } +Win32TaskbarManager::~Win32TaskbarManager() { + if (_taskbar) + _taskbar->Release(); + _taskbar = NULL; + + CoUninitialize(); +} + void Win32TaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) { //warning("[Win32TaskbarManager::setOverlayIcon] Setting overlay icon to: %s (%s)", name.c_str(), description.c_str()); diff --git a/backends/taskbar/win32/win32-taskbar.h b/backends/taskbar/win32/win32-taskbar.h index 7d963c19ca..0fc219e816 100644 --- a/backends/taskbar/win32/win32-taskbar.h +++ b/backends/taskbar/win32/win32-taskbar.h @@ -38,8 +38,6 @@ public: Win32TaskbarManager(); virtual ~Win32TaskbarManager(); - void init(); - virtual void setOverlayIcon(const Common::String &name, const Common::String &description); virtual void setProgressValue(int completed, int total); virtual void setProgressState(TaskbarProgressState state); |