Page MenuHome

TaskbarDefTest3.patch

TaskbarDefTest3.patch

Index: intern/ghost/intern/GHOST_TaskbarWin32.h
===================================================================
--- intern/ghost/intern/GHOST_TaskbarWin32.h (revision 0)
+++ intern/ghost/intern/GHOST_TaskbarWin32.h (revision 0)
@@ -0,0 +1,68 @@
+#ifndef WIN32
+#error WIN32 only!
+#endif // WIN32
+
+/* MinGW needs it */
+#ifdef FREE_WINDOWS
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+#endif
+
+
+
+#include <windows.h>
+#include <shlobj.h>
+
+#ifndef __ITaskbarList_INTERFACE_DEFINED__
+#define __ITaskbarList_INTERFACE_DEFINED__
+ extern "C" {const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} };
+ const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} }; }
+ class ITaskbarList : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE HrInit (void) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE DeleteTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ActivateTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetActiveAlt (HWND hwnd) = 0;
+ };
+#endif /* ITaskbarList */
+
+#ifndef __ITaskbarList2_INTERFACE_DEFINED__
+#define __ITaskbarList2_INTERFACE_DEFINED__
+ extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
+ class ITaskbarList2 : public ITaskbarList
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
+ };
+#endif /* ITaskbarList2 */
+
+#ifndef __ITaskbarList3_INTERFACE_DEFINED__
+#define __ITaskbarList3_INTERFACE_DEFINED__
+typedef enum THUMBBUTTONFLAGS {THBF_ENABLED = 0, THBF_DISABLED = 0x1, THBF_DISMISSONCLICK = 0x2, THBF_NOBACKGROUND = 0x4, THBF_HIDDEN = 0x8, THBF_NONINTERACTIVE = 0x10} THUMBBUTTONFLAGS;
+typedef enum THUMBBUTTONMASK {THB_BITMAP = 0x1, THB_ICON = 0x2, THB_TOOLTIP = 0x4, THB_FLAGS = 0x8} THUMBBUTTONMASK;
+typedef struct THUMBBUTTON {THUMBBUTTONMASK dwMask; UINT iId; UINT iBitmap; HICON hIcon; WCHAR szTip[260]; THUMBBUTTONFLAGS dwFlags; } THUMBBUTTON;
+typedef enum TBPFLAG {TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 0x1, TBPF_NORMAL = 0x2, TBPF_ERROR = 0x4, TBPF_PAUSED = 0x8 } TBPFLAG;
+#define THBN_CLICKED 0x1800
+ extern "C" {const GUID IID_ITaskList3 = { 0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF} };}
+
+ class ITaskbarList3 : public ITaskbarList2
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE SetProgressValue (HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetProgressState (HWND hwnd, TBPFLAG tbpFlags) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RegisterTab (HWND hwndTab, HWND hwndMDI) = 0;
+ virtual HRESULT STDMETHODCALLTYPE UnregisterTab (HWND hwndTab) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetTabOrder (HWND hwndTab, HWND hwndInsertBefore) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetTabActive (HWND hwndTab, HWND hwndMDI, DWORD dwReserved) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarAddButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarUpdateButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList (HWND hwnd, HIMAGELIST himl) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon (HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip (HWND hwnd, LPCWSTR pszTip) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip (HWND hwnd, RECT *prcClip) = 0;
+ };
+#endif /* ITaskbarList3 */
Index: intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- intern/ghost/intern/GHOST_WindowWin32.cpp (revision 34479)
+++ intern/ghost/intern/GHOST_WindowWin32.cpp (working copy)
@@ -139,33 +139,50 @@
m_stereo(stereoVisual),
m_nextWindow(NULL)
{
+ short version= (short)GetVersion();
+ version=((version & 0xff)<<8) | ((version >> 8) & 0xff);
+
if (state != GHOST_kWindowStateFullScreen) {
RECT rect;
+ MONITORINFO monitor;
GHOST_TUns32 tw, th;
width += GetSystemMetrics(SM_CXSIZEFRAME)*2;
height += GetSystemMetrics(SM_CYSIZEFRAME)*2 + GetSystemMetrics(SM_CYCAPTION);
+ rect.left = left;
+ rect.right = left + width;
+ rect.top = top;
+ rect.bottom = top + height;
+
+ monitor.cbSize=sizeof(monitor);
+ monitor.dwFlags=0;
+
// take taskbar into account
- SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0);
- th = rect.bottom - rect.top;
- tw = rect.right - rect.left;
+ GetMonitorInfo(MonitorFromRect(&rect,MONITOR_DEFAULTTONEAREST),&monitor);
+ th = monitor.rcWork.bottom - monitor.rcWork.top;
+ tw = monitor.rcWork.right - monitor.rcWork.left;
+
if(tw < width)
{
width = tw;
- left = rect.left;
+ left = monitor.rcWork.left;
}
- else if(left < rect.left)
- left = rect.left;
+ else if(monitor.rcWork.right < left + (int)width)
+ left = monitor.rcWork.right - width;
+ else if(left < monitor.rcWork.left)
+ left = monitor.rcWork.left;
if(th < height)
{
height = th;
- top = rect.top;
+ top = monitor.rcWork.top;
}
- else if(top < rect.top)
- top = rect.top;
+ else if(monitor.rcWork.bottom < top + (int)height)
+ top = monitor.rcWork.bottom - height;
+ else if(top < monitor.rcWork.top)
+ top = monitor.rcWork.top;
m_hWnd = ::CreateWindow(
s_windowClassName, // pointer to registered class name
@@ -294,11 +311,22 @@
}
}
}
+
+ if(version>=0x0601)
+ CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList ,(LPVOID*)&m_Bar);
+ else
+ m_Bar=NULL;
}
GHOST_WindowWin32::~GHOST_WindowWin32()
{
+ if(m_Bar)
+ {
+ m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
+ m_Bar->Release();
+ };
+
if (m_wintab) {
GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" );
if (fpWTClose) {
@@ -1089,6 +1117,23 @@
}
+GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
+{
+ /*SetProgressValue sets state to TBPF_NORMAL automaticly*/
+ if(m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd,10000*progress,10000))
+ return GHOST_kSuccess;
+
+ return GHOST_kFailure;
+}
+
+GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
+{
+ if(m_Bar && S_OK == m_Bar->SetProgressState(m_hWnd,TBPF_NOPROGRESS))
+ return GHOST_kSuccess;
+
+ return GHOST_kFailure;
+}
+
/* Ron Fosner's code for weighting pixel formats and forcing software.
See http://www.opengl.org/resources/faq/technical/weight.cpp */
Index: intern/ghost/intern/GHOST_WindowWin32.h
===================================================================
--- intern/ghost/intern/GHOST_WindowWin32.h (revision 34479)
+++ intern/ghost/intern/GHOST_WindowWin32.h (working copy)
@@ -39,7 +39,18 @@
#include "GHOST_Window.h"
+/* MinGW needs it */
+#ifdef FREE_WINDOWS
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+#endif
+
+
+
#include <windows.h>
+#include "GHOST_TaskbarWin32.h"
#include <wintab.h>
@@ -218,6 +229,17 @@
virtual GHOST_TSuccess invalidate();
/**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param progress The progress %
+ */
+ virtual GHOST_TSuccess setProgressBar(float progress);
+
+ /**
+ * Hides the progress bar in the icon
+ */
+ virtual GHOST_TSuccess endProgressBar();
+
+ /**
* Returns the name of the window class.
* @return The name of the window class.
*/
@@ -324,6 +346,9 @@
/** HCURSOR structure of the custom cursor */
HCURSOR m_customCursor;
+ /** ITaskbarList3 structure for progress bar*/
+ ITaskbarList3 * m_Bar;
+
static LPCSTR s_windowClassName;
static const int s_maxTitleLength;

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9d/0d/e193d2011b62a900f8cca7b9e9eb

Event Timeline