Page MenuHome

WinMultiMonitorPatch.patch

WinMultiMonitorPatch.patch

Index: intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- intern/ghost/intern/GHOST_WindowWin32.cpp (revision 34288)
+++ 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,26 @@
}
}
}
+
+ #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ if(version>=0x0601)
+ CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_Bar));
+ else
+ m_Bar=NULL;
+ #endif
}
GHOST_WindowWin32::~GHOST_WindowWin32()
{
+ #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ if(m_Bar)
+ {
+ m_Bar->SetProgressState(m_hWnd,TBPF_NOPROGRESS);
+ m_Bar->Release();
+ };
+ #endif
+
if (m_wintab) {
GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" );
if (fpWTClose) {
@@ -1089,6 +1121,27 @@
}
+GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
+{
+ #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ /*SetProgressValue sets state to TBPF_NORMAL automaticly*/
+ if(m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd,10000*progress,10000))
+ return GHOST_kSuccess;
+ #endif
+
+ return GHOST_kFailure;
+}
+
+GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
+{
+ #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ if(m_Bar && S_OK == m_Bar->SetProgressState(m_hWnd,TBPF_NOPROGRESS))
+ return GHOST_kSuccess;
+ #endif
+
+ 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 34288)
+++ intern/ghost/intern/GHOST_WindowWin32.h (working copy)
@@ -39,7 +39,20 @@
#include "GHOST_Window.h"
+/* MinGW might have some problems
+ Enable this if necessary */
+/*
+#ifndef FREE_WINDOWS
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+#endif
+*/
+
+
#include <windows.h>
+#include <shlobj.h>
#include <wintab.h>
@@ -218,6 +231,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 +348,11 @@
/** HCURSOR structure of the custom cursor */
HCURSOR m_customCursor;
+ #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ /** ITaskbarList3 structure for progress bar*/
+ ITaskbarList3 * m_Bar;
+ #endif
+
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
f6/ab/b9cafdefae170619bbda3dbde978

Event Timeline