ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2016
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
462 discussions
Start a n
N
ew thread
[akhaldi] 72448: [ACPPAGE] Improve header inclusions.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:37:31 2016 New Revision: 72448 URL:
http://svn.reactos.org/svn/reactos?rev=72448&view=rev
Log: [ACPPAGE] Improve header inclusions. Modified: trunk/reactos/dll/shellext/acppage/ACPPage.cpp trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp trunk/reactos/dll/shellext/acppage/precomp.h Modified: trunk/reactos/dll/shellext/acppage/ACPPage.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/ACPPa…
============================================================================== --- trunk/reactos/dll/shellext/acppage/ACPPage.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/shellext/acppage/ACPPage.cpp [iso-8859-1] Tue Aug 23 19:37:31 2016 @@ -17,6 +17,8 @@ */ #include "precomp.h" + +#include <shellutils.h> HMODULE g_hModule = NULL; LONG g_ModuleRefCnt = 0; Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLaye…
============================================================================== --- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] Tue Aug 23 19:37:31 2016 @@ -17,6 +17,11 @@ */ #include "precomp.h" + +#include <shlwapi.h> +#include <shellapi.h> +#include <strsafe.h> +#include <apphelp.h> #include <windowsx.h> #include <sfc.h> Modified: trunk/reactos/dll/shellext/acppage/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/preco…
============================================================================== --- trunk/reactos/dll/shellext/acppage/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/shellext/acppage/precomp.h [iso-8859-1] Tue Aug 23 19:37:31 2016 @@ -1,8 +1,5 @@ #ifndef ACPPAGE_PRECOMP_H #define ACPPAGE_PRECOMP_H - -#include <stdarg.h> -#include <assert.h> #define COBJMACROS #define WIN32_NO_STATUS @@ -10,25 +7,13 @@ #define COM_NO_WINDOWS_H #define NTOS_MODE_USER -#include <windows.h> - #include <windef.h> #include <winbase.h> -#include <winreg.h> -#include <winuser.h> - #include <shlobj.h> -#include <shlwapi.h> -#include <shellapi.h> -#include <tchar.h> -#include <strsafe.h> #include <atlbase.h> #include <atlcom.h> -#include <atlwin.h> + ULONG DbgPrint(PCH Format,...); -#include <shellutils.h> -#include <prsht.h> -#include <apphelp.h> extern const GUID CLSID_CLayerUIPropPage; extern HMODULE g_hModule;
8 years, 4 months
1
0
0
0
[akhaldi] 72447: [STRMBASE] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:35:53 2016 New Revision: 72447 URL:
http://svn.reactos.org/svn/reactos?rev=72447&view=rev
Log: [STRMBASE] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/media/doc/README.WINE trunk/reactos/sdk/lib/3rdparty/strmbase/mediatype.c trunk/reactos/sdk/lib/3rdparty/strmbase/qualitycontrol.c trunk/reactos/sdk/lib/3rdparty/strmbase/video.c Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:35:53 2016 @@ -252,7 +252,7 @@ from Winehq CVS. If you are looking to update something in these files check Wine current sources first as it may already be fixed. -reactos/sdk/lib/3rdparty/strmbase # Synced to WineStaging-1.9.11 +reactos/sdk/lib/3rdparty/strmbase # Synced to WineStaging-1.9.16 reactos/sdk/lib/rtl/actctx.c # Partly synced with WineStaging-1.7.55 reactos/sdk/lib/rtl/timerqueue.c # Partly synced with WineStaging-1.7.55 Modified: trunk/reactos/sdk/lib/3rdparty/strmbase/mediatype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/strmbase/…
============================================================================== --- trunk/reactos/sdk/lib/3rdparty/strmbase/mediatype.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/strmbase/mediatype.c [iso-8859-1] Tue Aug 23 19:35:53 2016 @@ -104,11 +104,11 @@ IEnumMediaTypesImpl * pEnumMediaTypes = CoTaskMemAlloc(sizeof(IEnumMediaTypesImpl)); AM_MEDIA_TYPE amt; + *ppEnum = NULL; + if (!pEnumMediaTypes) - { - *ppEnum = NULL; return E_OUTOFMEMORY; - } + pEnumMediaTypes->IEnumMediaTypes_iface.lpVtbl = &IEnumMediaTypesImpl_Vtbl; pEnumMediaTypes->refCount = 1; pEnumMediaTypes->uIndex = 0; @@ -122,14 +122,13 @@ pEnumMediaTypes->enumMediaDetails.cMediaTypes = i; pEnumMediaTypes->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i); + memset(pEnumMediaTypes->enumMediaDetails.pMediaTypes, 0, sizeof(AM_MEDIA_TYPE) * i); for (i = 0; i < pEnumMediaTypes->enumMediaDetails.cMediaTypes; i++) { enumFunc(basePin,i,&amt); if (FAILED(CopyMediaType(&pEnumMediaTypes->enumMediaDetails.pMediaTypes[i], &amt))) { - while (i--) - FreeMediaType(&pEnumMediaTypes->enumMediaDetails.pMediaTypes[i]); - CoTaskMemFree(pEnumMediaTypes->enumMediaDetails.pMediaTypes); + IEnumMediaTypes_Release(&pEnumMediaTypes->IEnumMediaTypes_iface); return E_OUTOFMEMORY; } } Modified: trunk/reactos/sdk/lib/3rdparty/strmbase/qualitycontrol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/strmbase/…
============================================================================== --- trunk/reactos/sdk/lib/3rdparty/strmbase/qualitycontrol.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/strmbase/qualitycontrol.c [iso-8859-1] Tue Aug 23 19:35:53 2016 @@ -25,9 +25,14 @@ #include "strmbase_private.h" -HRESULT QualityControlImpl_Create(IPin *input, IBaseFilter *self, QualityControlImpl **ppv) { +#define XTIME_FMT "%u.%03u" +#define XTIME(u) (int)(u/10000000), (int)((u / 10000)%1000) + +HRESULT QualityControlImpl_Create(IPin *input, IBaseFilter *self, QualityControlImpl **ppv) +{ QualityControlImpl *This; - *ppv = HeapAlloc(GetProcessHeap(),0,sizeof(QualityControlImpl)); + TRACE("%p, %p, %p\n", input, self, ppv); + *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(QualityControlImpl)); if (!*ppv) return E_OUTOFMEMORY; This = *ppv; @@ -35,6 +40,8 @@ This->self = self; This->tonotify = NULL; This->clock = NULL; + This->current_rstart = This->current_rstop = -1; + TRACE("-> %p\n", This); return S_OK; } @@ -43,26 +50,41 @@ HeapFree(GetProcessHeap(),0,This); } -HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) { - QualityControlImpl *This = (QualityControlImpl*)iface; +static inline QualityControlImpl *impl_from_IQualityControl(IQualityControl *iface) +{ + return CONTAINING_RECORD(iface, QualityControlImpl, IQualityControl_iface); +} + +HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) +{ + QualityControlImpl *This = impl_from_IQualityControl(iface); return IBaseFilter_QueryInterface(This->self, riid, ppv); } -ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) { - QualityControlImpl *This = (QualityControlImpl*)iface; +ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) +{ + QualityControlImpl *This = impl_from_IQualityControl(iface); return IBaseFilter_AddRef(This->self); } -ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) { - QualityControlImpl *This = (QualityControlImpl*)iface; +ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) +{ + QualityControlImpl *This = impl_from_IQualityControl(iface); return IBaseFilter_Release(This->self); } -HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) { +HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) +{ + QualityControlImpl *This = impl_from_IQualityControl(iface); HRESULT hr = S_FALSE; - QualityControlImpl *This = (QualityControlImpl*)iface; + + TRACE("%p %p { 0x%x %u " XTIME_FMT " " XTIME_FMT " }\n", + This, sender, qm.Type, qm.Proportion, + XTIME(qm.Late), XTIME(qm.TimeStamp)); + if (This->tonotify) return IQualityControl_Notify(This->tonotify, This->self, qm); + if (This->input) { IPin *to = NULL; IPin_ConnectedTo(This->input, &to); @@ -76,11 +98,14 @@ IPin_Release(to); } } + return hr; } -HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) { - QualityControlImpl *This = (QualityControlImpl*)iface; +HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) +{ + QualityControlImpl *This = impl_from_IQualityControl(iface); + TRACE("%p %p\n", This, tonotify); This->tonotify = tonotify; return S_OK; } @@ -97,7 +122,9 @@ #define UPDATE_RUNNING_AVG_P(avg,val) DO_RUNNING_AVG(avg,val,16) #define UPDATE_RUNNING_AVG_N(avg,val) DO_RUNNING_AVG(avg,val,4) -void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) { +void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart) +{ + TRACE("%p " XTIME_FMT "\n", This, XTIME(tStart)); This->avg_render = This->last_in_time = This->last_left = This->avg_duration = This->avg_pt = -1; This->clockstart = tStart; This->avg_rate = -1.0; @@ -107,7 +134,9 @@ } -void QualityControlRender_SetClock(QualityControlImpl *This, IReferenceClock *clock) { +void QualityControlRender_SetClock(QualityControlImpl *This, IReferenceClock *clock) +{ + TRACE("%p %p\n", This, clock); This->clock = clock; } @@ -115,6 +144,9 @@ REFERENCE_TIME start, REFERENCE_TIME stop) { REFERENCE_TIME max_lateness = 200000; + + TRACE("%p " XTIME_FMT " " XTIME_FMT " " XTIME_FMT "\n", + This, XTIME(jitter), XTIME(start), XTIME(stop)); /* we can add a valid stop time */ if (stop >= start) @@ -137,8 +169,12 @@ return FALSE; } -HRESULT QualityControlRender_WaitFor(QualityControlImpl *This, IMediaSample *sample, HANDLE ev) { +HRESULT QualityControlRender_WaitFor(QualityControlImpl *This, IMediaSample *sample, HANDLE ev) +{ REFERENCE_TIME start = -1, stop = -1, jitter = 0; + + TRACE("%p %p %p\n", This, sample, ev); + This->current_rstart = This->current_rstop = -1; This->current_jitter = 0; if (!This->clock || FAILED(IMediaSample_GetTime(sample, &start, &stop))) @@ -178,6 +214,8 @@ REFERENCE_TIME start, stop, jitter, pt, entered, left, duration; double rate; + TRACE("%p\n", priv); + if (!priv->clock || priv->current_rstart < 0) return; @@ -217,14 +255,12 @@ pt = priv->avg_pt; } -#define XTIME(u) (int)(u/10000000), (int)((u / 10000)%1000) - TRACE("start: %u.%03u, entered %u.%03u, left %u.%03u, pt: %u.%03u, " - "duration %u.%03u, jitter %u.%03u\n", XTIME(start), XTIME(entered), + TRACE("start: " XTIME_FMT ", entered " XTIME_FMT ", left " XTIME_FMT ", pt: " XTIME_FMT ", " + "duration " XTIME_FMT ", jitter " XTIME_FMT "\n", XTIME(start), XTIME(entered), XTIME(left), XTIME(pt), XTIME(duration), XTIME(jitter)); - TRACE("avg_duration: %u.%03u, avg_pt: %u.%03u, avg_rate: %g\n", + TRACE("avg_duration: " XTIME_FMT ", avg_pt: " XTIME_FMT ", avg_rate: %g\n", XTIME(priv->avg_duration), XTIME(priv->avg_pt), priv->avg_rate); -#undef XTIME /* collect running averages. for first observations, we copy the * values */ @@ -277,7 +313,7 @@ q.Late = priv->current_jitter; q.TimeStamp = priv->current_rstart; TRACE("Late: %i from %i, rate: %g\n", (int)(q.Late/10000), (int)(q.TimeStamp/10000), 1./priv->avg_rate); - hr = IQualityControl_Notify((IQualityControl *)priv, priv->self, q); + hr = IQualityControl_Notify(&priv->IQualityControl_iface, priv->self, q); priv->qos_handled = hr == S_OK; } @@ -286,15 +322,25 @@ } -void QualityControlRender_BeginRender(QualityControlImpl *This) { +void QualityControlRender_BeginRender(QualityControlImpl *This) +{ + TRACE("%p\n", This); + This->start = -1; + if (!This->clock) return; + IReferenceClock_GetTime(This->clock, &This->start); -} - -void QualityControlRender_EndRender(QualityControlImpl *This) { + TRACE("at: " XTIME_FMT "\n", XTIME(This->start)); +} + +void QualityControlRender_EndRender(QualityControlImpl *This) +{ REFERENCE_TIME elapsed; + + TRACE("%p\n", This); + if (!This->clock || This->start < 0 || FAILED(IReferenceClock_GetTime(This->clock, &This->stop))) return; Modified: trunk/reactos/sdk/lib/3rdparty/strmbase/video.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/3rdparty/strmbase/…
============================================================================== --- trunk/reactos/sdk/lib/3rdparty/strmbase/video.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/3rdparty/strmbase/video.c [iso-8859-1] Tue Aug 23 19:35:53 2016 @@ -358,10 +358,8 @@ BaseControlVideo *This = impl_from_IBasicVideo(iface); TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); - SourceRect.left = Left; - SourceRect.top = Top; - SourceRect.right = Left + Width; - SourceRect.bottom = Top + Height; + + SetRect(&SourceRect, Left, Top, Left + Width, Top + Height); This->pFuncsTable->pfnSetSourceRect(This, &SourceRect); return S_OK; @@ -398,10 +396,7 @@ TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); - DestRect.left = Left; - DestRect.top = Top; - DestRect.right = Left + Width; - DestRect.bottom = Top + Height; + SetRect(&DestRect, Left, Top, Left + Width, Top + Height); This->pFuncsTable->pfnSetTargetRect(This, &DestRect); return S_OK;
8 years, 4 months
1
0
0
0
[akhaldi] 72446: [RPCSS] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:34:57 2016 New Revision: 72446 URL:
http://svn.reactos.org/svn/reactos?rev=72446&view=rev
Log: [RPCSS] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/base/services/rpcss/epmp.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/services/rpcss/epmp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/rpcss/epmp.c…
============================================================================== --- trunk/reactos/base/services/rpcss/epmp.c [iso-8859-1] (original) +++ trunk/reactos/base/services/rpcss/epmp.c [iso-8859-1] Tue Aug 23 19:34:57 2016 @@ -112,7 +112,6 @@ *status = EPT_S_CANT_PERFORM_OP; break; } - list_init(&entry->entry); memcpy(entry->annotation, entries[i].annotation, sizeof(entries[i].annotation)); rpc_status = TowerExplode(entries[i].tower, &entry->iface, &entry->syntax, &entry->protseq, &entry->endpoint, @@ -121,6 +120,7 @@ { WINE_WARN("TowerExplode failed %u\n", rpc_status); *status = rpc_status; + HeapFree(GetProcessHeap(), 0, entry); break; /* FIXME: more cleanup? */ } @@ -164,6 +164,11 @@ if (rpc_status != RPC_S_OK) break; entry = find_ept_entry(&iface, &syntax, protseq, endpoint, address, &entries[i].object); + + I_RpcFree(protseq); + I_RpcFree(endpoint); + I_RpcFree(address); + if (entry) delete_registered_ept_entry(entry); else @@ -171,9 +176,6 @@ *status = EPT_S_NOT_REGISTERED; break; } - I_RpcFree(protseq); - I_RpcFree(endpoint); - I_RpcFree(address); } LeaveCriticalSection(&csEpm); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:34:57 2016 @@ -243,7 +243,7 @@ reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.16 reactos/base/applications/wordpad # Synced to WineStaging-1.9.16 reactos/base/applications/write # Synced to WineStaging-1.9.16 -reactos/base/services/rpcss # Synced to WineStaging-1.9.11 +reactos/base/services/rpcss # Synced to WineStaging-1.9.16 reactos/base/system/expand # Synced to WineStaging-1.9.11 reactos/base/system/msiexec # Synced to WineStaging-1.9.11 reactos/modules/rosapps/winfile # Autosync
8 years, 4 months
1
0
0
0
[akhaldi] 72445: [WRITE] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:34:21 2016 New Revision: 72445 URL:
http://svn.reactos.org/svn/reactos?rev=72445&view=rev
Log: [WRITE] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/base/applications/write/write.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/applications/write/write.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/write/wr…
============================================================================== --- trunk/reactos/base/applications/write/write.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/write/write.c [iso-8859-1] Tue Aug 23 19:34:21 2016 @@ -25,8 +25,7 @@ #include "resources.h" -static const WCHAR SZ_BACKSLASH[] = {'\\',0}; -static const WCHAR SZ_WORDPAD[] = {'w','o','r','d','p','a','d','.','e','x','e',0}; +static const WCHAR SZ_WORDPAD[] = {'\\','w','o','r','d','p','a','d','.','e','x','e',0}; int CALLBACK wWinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPWSTR szCmdParagraph, int res) { @@ -35,20 +34,14 @@ PROCESS_INFORMATION info; if (!GetSystemDirectoryW(path, MAX_PATH - 1 - lstrlenW(SZ_WORDPAD))) - goto failed; - - if (path[lstrlenW(path) - 1] != '\\') - lstrcatW(path, SZ_BACKSLASH); - + goto failed; lstrcatW(path, SZ_WORDPAD); - ZeroMemory(&stinf, sizeof(stinf)); - stinf.cb = sizeof(stinf); + stinf.cb = sizeof(STARTUPINFOW); GetStartupInfoW(&stinf); if (!CreateProcessW(path, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &stinf, &info)) - goto failed; - + goto failed; CloseHandle(info.hProcess); CloseHandle(info.hThread); return 0; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:34:21 2016 @@ -242,6 +242,7 @@ reactos/base/applications/regedit # Out of sync reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.16 reactos/base/applications/wordpad # Synced to WineStaging-1.9.16 +reactos/base/applications/write # Synced to WineStaging-1.9.16 reactos/base/services/rpcss # Synced to WineStaging-1.9.11 reactos/base/system/expand # Synced to WineStaging-1.9.11 reactos/base/system/msiexec # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72444: [WORDPAD] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:32:58 2016 New Revision: 72444 URL:
http://svn.reactos.org/svn/reactos?rev=72444&view=rev
Log: [WORDPAD] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/base/applications/wordpad/print.c trunk/reactos/base/applications/wordpad/registry.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/applications/wordpad/print.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
============================================================================== --- trunk/reactos/base/applications/wordpad/print.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/wordpad/print.c [iso-8859-1] Tue Aug 23 19:32:58 2016 @@ -93,12 +93,7 @@ if(!hKey || RegQueryValueExW(hKey, var_pagemargin, 0, NULL, (LPBYTE)&margins, &size) != ERROR_SUCCESS || size != sizeof(RECT)) - { - margins.top = 1417; - margins.bottom = 1417; - margins.left = 1757; - margins.right = 1757; - } + SetRect(&margins, 1757, 1417, 1757, 1417); } void registry_set_previewpages(HKEY hKey) @@ -206,10 +201,7 @@ height = centmm_to_twips(27000); } - rc.left = margins.left; - rc.right = width - margins.right; - rc.top = margins.top; - rc.bottom = height - margins.bottom; + SetRect(&rc, margins.left, margins.top, width - margins.right, height - margins.bottom); return rc; } @@ -394,8 +386,7 @@ GetClientRect(hWnd, &drawRect); FillRect(hdc, &drawRect, hBrush); - drawRect.top += 3; - drawRect.bottom -= 3; + InflateRect(&drawRect, 0, -3); drawRect.left = EditLeftmost; drawRect.right = twips_to_pixels(printRect.right - margins.left, GetDeviceCaps(hdc, LOGPIXELSX)); FillRect(hdc, &drawRect, GetStockObject(WHITE_BRUSH)); @@ -457,10 +448,7 @@ fr.hdcTarget = pd->hDC; fr.rc = get_print_rect(fr.hdc); - fr.rcPage.left = 0; - fr.rcPage.right = fr.rc.right + margins.right; - fr.rcPage.top = 0; - fr.rcPage.bottom = fr.rc.bottom + margins.bottom; + SetRect(&fr.rcPage, 0, 0, fr.rc.right + margins.right, fr.rc.bottom + margins.bottom); ZeroMemory(&di, sizeof(di)); di.cbSize = sizeof(di); @@ -517,19 +505,15 @@ ps.lStructSize = sizeof(ps); ps.hwndOwner = hMainWnd; ps.Flags = PSD_INHUNDREDTHSOFMILLIMETERS | PSD_MARGINS; - ps.rtMargin.left = twips_to_centmm(margins.left); - ps.rtMargin.right = twips_to_centmm(margins.right); - ps.rtMargin.top = twips_to_centmm(margins.top); - ps.rtMargin.bottom = twips_to_centmm(margins.bottom); + SetRect(&ps.rtMargin, twips_to_centmm(margins.left), twips_to_centmm(margins.top), + twips_to_centmm(margins.right), twips_to_centmm(margins.bottom)); ps.hDevMode = devMode; ps.hDevNames = devNames; if(PageSetupDlgW(&ps)) { - margins.left = centmm_to_twips(ps.rtMargin.left); - margins.right = centmm_to_twips(ps.rtMargin.right); - margins.top = centmm_to_twips(ps.rtMargin.top); - margins.bottom = centmm_to_twips(ps.rtMargin.bottom); + SetRect(&margins, centmm_to_twips(ps.rtMargin.left), centmm_to_twips(ps.rtMargin.top), + centmm_to_twips(ps.rtMargin.right), centmm_to_twips(ps.rtMargin.bottom)); devMode = ps.hDevMode; devNames = ps.hDevNames; update_ruler(get_ruler_wnd(hMainWnd)); @@ -718,20 +702,15 @@ dpi.cx = GetDeviceCaps(hdc, LOGPIXELSX); dpi.cy = GetDeviceCaps(hdc, LOGPIXELSY); - page_margin.left = preview.rcPage.left + margins.left; - page_margin.top = preview.rcPage.top + margins.top; - page_margin.bottom = preview.rcPage.bottom - margins.bottom; - page_margin.right = preview.rcPage.right - margins.right; + SetRect(&page_margin, preview.rcPage.left + margins.left, preview.rcPage.top + margins.top, + preview.rcPage.right - margins.right, preview.rcPage.bottom - margins.bottom); page_margin.left = (int)((float)twips_to_pixels(page_margin.left, dpi.cx) * ratio); page_margin.top = (int)((float)twips_to_pixels(page_margin.top, dpi.cy) * ratio); page_margin.bottom = (int)((float)twips_to_pixels(page_margin.bottom, dpi.cy) * ratio); page_margin.right = (int)((float)twips_to_pixels(page_margin.right, dpi.cx) * ratio); - page_margin.left += x; - page_margin.top += y; - page_margin.bottom += y; - page_margin.right += x; + OffsetRect(&page_margin, x, y); hPen = CreatePen(PS_DOT, 1, RGB(0,0,0)); oldPen = SelectObject(hdc, hPen); @@ -868,10 +847,8 @@ /* draw page outlines */ hPen = CreatePen(PS_SOLID|PS_INSIDEFRAME, 2, RGB(0,0,0)); oldPen = SelectObject(hdc, hPen); - background.left = x - 2; - background.right = x + preview.bmScaledSize.cx + 2; - background.top = y - 2; - background.bottom = y + preview.bmScaledSize.cy + 2; + SetRect(&background, x - 2, y - 2, x + preview.bmScaledSize.cx + 2, + y + preview.bmScaledSize.cy + 2); Rectangle(hdc, background.left, background.top, background.right, background.bottom); excl_rgn = CreateRectRgnIndirect(&background); @@ -908,10 +885,7 @@ draw_margin_lines(hdc, x, y, preview.zoomratio); } else { - background.left += 2; - background.right -= 2; - background.top += 2; - background.bottom -= 2; + InflateRect(&background, -2, -2); FillRect(hdc, &background, GetStockObject(WHITE_BRUSH)); } } @@ -964,10 +938,7 @@ fr.chrg.cpMin = 0; fr.chrg.cpMax = preview.textlength; - paper.left = 0; - paper.right = preview.bmSize.cx; - paper.top = 0; - paper.bottom = preview.bmSize.cy; + SetRect(&paper, 0, 0, preview.bmSize.cx, preview.bmSize.cy); if (!preview.hdc) { preview.hdc = CreateCompatibleDC(hdc); Modified: trunk/reactos/base/applications/wordpad/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/…
============================================================================== --- trunk/reactos/base/applications/wordpad/registry.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/wordpad/registry.c [iso-8859-1] Tue Aug 23 19:32:58 2016 @@ -116,12 +116,7 @@ if(registry_get_handle(&hKey, 0, key_options) != ERROR_SUCCESS || RegQueryValueExW(hKey, var_framerect, 0, NULL, (LPBYTE)rc, &size) != ERROR_SUCCESS || size != sizeof(RECT)) - { - rc->top = 0; - rc->left = 0; - rc->bottom = 300; - rc->right = 600; - } + SetRect(rc, 0, 0, 600, 300); RegCloseKey(hKey); } @@ -300,7 +295,7 @@ if(!lstrcmpiW(pFiles[i], newFile)) { int j; - for(j = 0; pFiles[j] && j < i; j++) + for(j = 0; j < i; j++) { pFiles[i-j] = pFiles[i-j-1]; } Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:32:58 2016 @@ -241,7 +241,7 @@ reactos/base/applications/notepad # Forked at Wine-20041201 reactos/base/applications/regedit # Out of sync reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.16 -reactos/base/applications/wordpad # Synced to WineStaging-1.9.11 +reactos/base/applications/wordpad # Synced to WineStaging-1.9.16 reactos/base/services/rpcss # Synced to WineStaging-1.9.11 reactos/base/system/expand # Synced to WineStaging-1.9.11 reactos/base/system/msiexec # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72443: [WINHLP32] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:31:44 2016 New Revision: 72443 URL:
http://svn.reactos.org/svn/reactos?rev=72443&view=rev
Log: [WINHLP32] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/base/applications/winhlp32/macro.c trunk/reactos/base/applications/winhlp32/winhelp.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/applications/winhlp32/macro.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32…
============================================================================== --- trunk/reactos/base/applications/winhlp32/macro.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/winhlp32/macro.c [iso-8859-1] Tue Aug 23 19:31:44 2016 @@ -598,7 +598,7 @@ LPSTR ptr; WINE_TRACE("(%s, %s)\n", debugstr_a(lpszPathWindow), debugstr_a(topic_id)); - if ((ptr = strchr(lpszPathWindow, '>')) != NULL) + if (lpszPathWindow && (ptr = strchr(lpszPathWindow, '>')) != NULL) { LPSTR tmp; size_t sz; Modified: trunk/reactos/base/applications/winhlp32/winhelp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32…
============================================================================== --- trunk/reactos/base/applications/winhlp32/winhelp.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/winhlp32/winhelp.c [iso-8859-1] Tue Aug 23 19:31:44 2016 @@ -501,7 +501,7 @@ /*********************************************************************** * - * WINHELP_RelaseWindow + * WINHELP_ReleaseWindow */ BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW* win) { @@ -968,6 +968,7 @@ popup = Globals.active_popup; Globals.active_popup = NULL; WINHELP_ReleaseWindow(popup); + if (lret) *lret = 1; return TRUE; } return FALSE; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:31:44 2016 @@ -240,7 +240,7 @@ reactos/base/applications/iexplore # Synced to WineStaging-1.9.11 reactos/base/applications/notepad # Forked at Wine-20041201 reactos/base/applications/regedit # Out of sync -reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.11 +reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.16 reactos/base/applications/wordpad # Synced to WineStaging-1.9.11 reactos/base/services/rpcss # Synced to WineStaging-1.9.11 reactos/base/system/expand # Synced to WineStaging-1.9.11
8 years, 4 months
1
0
0
0
[akhaldi] 72442: [FREELDR] Fix a regression introduced in r70687. Dedicated to Sylvain Deverre.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:20:44 2016 New Revision: 72442 URL:
http://svn.reactos.org/svn/reactos?rev=72442&view=rev
Log: [FREELDR] Fix a regression introduced in r70687. Dedicated to Sylvain Deverre. Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMake…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Tue Aug 23 19:20:44 2016 @@ -1,7 +1,7 @@ if(SEPARATE_DBG) # FIXME:
http://sourceware.org/bugzilla/show_bug.cgi?id=11822
- set(CMAKE_LDR_PE_HELPER_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_LDR_PE_HELPER_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_LDR_PE_HELPER_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries") endif()
8 years, 4 months
1
0
0
0
[akhaldi] 72441: [WINMINE] Sync with Wine Staging 1.9.16. CORE-11866
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Aug 23 19:08:37 2016 New Revision: 72441 URL:
http://svn.reactos.org/svn/reactos?rev=72441&view=rev
Log: [WINMINE] Sync with Wine Staging 1.9.16. CORE-11866 Modified: trunk/reactos/base/applications/games/winmine/main.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/applications/games/winmine/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/wi…
============================================================================== --- trunk/reactos/base/applications/games/winmine/main.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/games/winmine/main.c [iso-8859-1] Tue Aug 23 19:08:37 2016 @@ -312,10 +312,8 @@ p_board->face_bmp = SMILE_BMP; p_board->time = 0; - wnd_rect.left = p_board->pos.x; - wnd_rect.right = p_board->pos.x + p_board->width; - wnd_rect.top = p_board->pos.y; - wnd_rect.bottom = p_board->pos.y + p_board->height; + SetRect(&wnd_rect, p_board->pos.x, p_board->pos.y, p_board->pos.x + p_board->width, + p_board->pos.y + p_board->height); AdjustWindowRect(&wnd_rect, wnd_style, TRUE); /* Make sure the window is completely on the screen */ Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Aug 23 19:08:37 2016 @@ -235,7 +235,7 @@ reactos/base/applications/cmdutils/wmic # Synced to WineStaging-1.9.11 reactos/base/applications/cmdutils/wscript # Synced to WineStaging-1.9.16 reactos/base/applications/cmdutils/xcopy # Synced to WineStaging-1.9.11 -reactos/base/applications/games/winmine # Synced to WineStaging-1.9.11 with our own resources. +reactos/base/applications/games/winmine # Synced to WineStaging-1.9.16 with our own resources. reactos/base/applications/extrac32 # Synced to WineStaging-1.9.11 reactos/base/applications/iexplore # Synced to WineStaging-1.9.11 reactos/base/applications/notepad # Forked at Wine-20041201
8 years, 4 months
1
0
0
0
[gadamopoulos] 72440: [EXPLORER] - CTrayWindow: Reorganise the code in logical groups to make it more readable. Move command handlers at the top of the file followed by the code that manages moving...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Tue Aug 23 16:52:05 2016 New Revision: 72440 URL:
http://svn.reactos.org/svn/reactos?rev=72440&view=rev
Log: [EXPLORER] - CTrayWindow: Reorganise the code in logical groups to make it more readable. Move command handlers at the top of the file followed by the code that manages moving and resizing the taskbar. After that is code that paints the taskbar and the implementation of the ITrayWindow interface which I really doubt if it is needed. Finally at the bottom are the message handlers. Modified: trunk/reactos/base/shell/explorer/traywnd.cpp Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywn…
============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Tue Aug 23 16:52:05 2016 @@ -502,1135 +502,95 @@ PostQuitMessage(0); } - /* - * ITrayWindow + + + + + /********************************************************** + * ##### command handling ##### */ - BOOL UpdateNonClientMetrics() - { - NONCLIENTMETRICS ncm; - ncm.cbSize = sizeof(ncm); - if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)) - { - if (m_Font != NULL) - DeleteObject(m_Font); - - m_Font = CreateFontIndirect(&ncm.lfMessageFont); - return TRUE; - } - - return FALSE; - } - - VOID SetWindowsFont() - { - if (m_TrayNotify != NULL) - { - SendMessage(m_TrayNotify, WM_SETFONT, (WPARAM) m_Font, TRUE); - } - } - - HMONITOR GetScreenRectFromRect( - IN OUT RECT *pRect, - IN DWORD dwFlags) - { - MONITORINFO mi; - HMONITOR hMon; - - mi.cbSize = sizeof(mi); - hMon = MonitorFromRect(pRect, dwFlags); - if (hMon != NULL && - GetMonitorInfo(hMon, &mi)) - { - *pRect = mi.rcMonitor; - } - else - { - pRect->left = 0; - pRect->top = 0; - pRect->right = GetSystemMetrics(SM_CXSCREEN); - pRect->bottom = GetSystemMetrics(SM_CYSCREEN); - - hMon = NULL; - } - - return hMon; - } - - HMONITOR GetMonitorFromRect( - IN const RECT *pRect) - { - HMONITOR hMon; - - /* In case the monitor sizes or saved sizes differ a bit (probably - not a lot, only so the tray window overlaps into another monitor - now), minimize the risk that we determine a wrong monitor by - using the center point of the tray window if we can't determine - it using the rectangle. */ - hMon = MonitorFromRect(pRect, MONITOR_DEFAULTTONULL); - if (hMon == NULL) - { - POINT pt; - - pt.x = pRect->left + ((pRect->right - pRect->left) / 2); - pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2); - - /* be less error-prone, find the nearest monitor */ - hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); - } - - return hMon; - } - - HMONITOR GetScreenRect( - IN HMONITOR hMonitor, - IN OUT RECT *pRect) - { - HMONITOR hMon = NULL; - - if (hMonitor != NULL) - { - MONITORINFO mi; - - mi.cbSize = sizeof(mi); - if (!GetMonitorInfo(hMonitor, &mi)) - { - /* Hm, the monitor is gone? Try to find a monitor where it - could be located now */ - hMon = GetMonitorFromRect(pRect); - if (hMon == NULL || - !GetMonitorInfo(hMon, &mi)) - { - hMon = NULL; - goto GetPrimaryRect; - } - } - - *pRect = mi.rcMonitor; - } - else - { -GetPrimaryRect: - pRect->left = 0; - pRect->top = 0; - pRect->right = GetSystemMetrics(SM_CXSCREEN); - pRect->bottom = GetSystemMetrics(SM_CYSCREEN); - } - - return hMon; - } - - VOID MakeTrayRectWithSize(IN DWORD Position, - IN const SIZE *pTraySize, - IN OUT RECT *pRect) - { - switch (Position) - { - case ABE_LEFT: - pRect->right = pRect->left + pTraySize->cx; - break; - - case ABE_TOP: - pRect->bottom = pRect->top + pTraySize->cy; - break; - - case ABE_RIGHT: - pRect->left = pRect->right - pTraySize->cx; - break; - - case ABE_BOTTOM: - default: - pRect->top = pRect->bottom - pTraySize->cy; - break; - } - } - - VOID GetTrayRectFromScreenRect(IN DWORD Position, - IN const RECT *pScreen, - IN const SIZE *pTraySize OPTIONAL, - OUT RECT *pRect) - { - if (pTraySize == NULL) - pTraySize = &m_TraySize; - - *pRect = *pScreen; - - /* Move the border outside of the screen */ - InflateRect(pRect, - GetSystemMetrics(SM_CXEDGE), - GetSystemMetrics(SM_CYEDGE)); - - MakeTrayRectWithSize(Position, pTraySize, pRect); - } - - BOOL IsPosHorizontal() - { - return m_Position == ABE_TOP || m_Position == ABE_BOTTOM; - } - - HMONITOR CalculateValidSize( - IN DWORD Position, - IN OUT RECT *pRect) - { - RECT rcScreen; - //BOOL Horizontal; - HMONITOR hMon; - SIZE szMax, szWnd; - - //Horizontal = IsPosHorizontal(); - - szWnd.cx = pRect->right - pRect->left; - szWnd.cy = pRect->bottom - pRect->top; - - rcScreen = *pRect; - hMon = GetScreenRectFromRect( - &rcScreen, - MONITOR_DEFAULTTONEAREST); - - /* Calculate the maximum size of the tray window and limit the window - size to half of the screen's size. */ - szMax.cx = (rcScreen.right - rcScreen.left) / 2; - szMax.cy = (rcScreen.bottom - rcScreen.top) / 2; - if (szWnd.cx > szMax.cx) - szWnd.cx = szMax.cx; - if (szWnd.cy > szMax.cy) - szWnd.cy = szMax.cy; - - /* FIXME - calculate */ - - GetTrayRectFromScreenRect(Position, - &rcScreen, - &szWnd, - pRect); - - return hMon; - } - -#if 0 - VOID - GetMinimumWindowSize( - OUT RECT *pRect) - { - RECT rcMin = {0}; - - AdjustWindowRectEx(&rcMin, - GetWindowLong(m_hWnd, - GWL_STYLE), - FALSE, - GetWindowLong(m_hWnd, - GWL_EXSTYLE)); - - *pRect = rcMin; - } -#endif - - - DWORD GetDraggingRectFromPt( - IN POINT pt, - OUT RECT *pRect, - OUT HMONITOR *phMonitor) - { - HMONITOR hMon, hMonNew; - DWORD PosH, PosV, Pos; - SIZE DeltaPt, ScreenOffset; - RECT rcScreen; - - rcScreen.left = 0; - rcScreen.top = 0; - - /* Determine the screen rectangle */ - hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); - if (hMon != NULL) - { - MONITORINFO mi; - - mi.cbSize = sizeof(mi); - if (!GetMonitorInfo(hMon, &mi)) - { - hMon = NULL; - goto GetPrimaryScreenRect; - } - - /* make left top corner of the screen zero based to - make calculations easier */ - pt.x -= mi.rcMonitor.left; - pt.y -= mi.rcMonitor.top; - - ScreenOffset.cx = mi.rcMonitor.left; - ScreenOffset.cy = mi.rcMonitor.top; - rcScreen.right = mi.rcMonitor.right - mi.rcMonitor.left; - rcScreen.bottom = mi.rcMonitor.bottom - mi.rcMonitor.top; - } - else - { -GetPrimaryScreenRect: - ScreenOffset.cx = 0; - ScreenOffset.cy = 0; - rcScreen.right = GetSystemMetrics(SM_CXSCREEN); - rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN); - } - - /* Calculate the nearest screen border */ - if (pt.x < rcScreen.right / 2) - { - DeltaPt.cx = pt.x; - PosH = ABE_LEFT; - } - else - { - DeltaPt.cx = rcScreen.right - pt.x; - PosH = ABE_RIGHT; - } - - if (pt.y < rcScreen.bottom / 2) - { - DeltaPt.cy = pt.y; - PosV = ABE_TOP; - } - else - { - DeltaPt.cy = rcScreen.bottom - pt.y; - PosV = ABE_BOTTOM; - } - - Pos = (DeltaPt.cx * rcScreen.bottom < DeltaPt.cy * rcScreen.right) ? PosH : PosV; - - /* Fix the screen origin to be relative to the primary monitor again */ - OffsetRect(&rcScreen, - ScreenOffset.cx, - ScreenOffset.cy); - - RECT rcPos = m_TrayRects[Pos]; - - hMonNew = GetMonitorFromRect(&rcPos); - if (hMon != hMonNew) - { - SIZE szTray; - - /* Recalculate the rectangle, we're dragging to another monitor. - We don't need to recalculate the rect on single monitor systems. */ - szTray.cx = rcPos.right - rcPos.left; - szTray.cy = rcPos.bottom - rcPos.top; - - GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect); - if (AutoHide) - { - pRect->left += m_AutoHideOffset.cx; - pRect->right += m_AutoHideOffset.cx; - pRect->top += m_AutoHideOffset.cy; - pRect->bottom += m_AutoHideOffset.cy; - } - hMon = hMonNew; - } - else - { - /* The user is dragging the tray window on the same monitor. We don't need - to recalculate the rectangle */ - *pRect = rcPos; - if (AutoHide) - { - pRect->left += m_AutoHideOffset.cx; - pRect->right += m_AutoHideOffset.cx; - pRect->top += m_AutoHideOffset.cy; - pRect->bottom += m_AutoHideOffset.cy; - } - } - - *phMonitor = hMon; - - return Pos; - } - - DWORD GetDraggingRectFromRect( - IN OUT RECT *pRect, - OUT HMONITOR *phMonitor) - { - POINT pt; - - /* Calculate the center of the rectangle. We call - GetDraggingRectFromPt to calculate a valid - dragging rectangle */ - pt.x = pRect->left + ((pRect->right - pRect->left) / 2); - pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2); - - return GetDraggingRectFromPt( - pt, - pRect, - phMonitor); - } - - VOID ChangingWinPos(IN OUT LPWINDOWPOS pwp) - { - RECT rcTray; - - if (IsDragging) - { - rcTray.left = pwp->x; - rcTray.top = pwp->y; - rcTray.right = rcTray.left + pwp->cx; - rcTray.bottom = rcTray.top + pwp->cy; - if (AutoHide) - { - rcTray.left -= m_AutoHideOffset.cx; - rcTray.right -= m_AutoHideOffset.cx; - rcTray.top -= m_AutoHideOffset.cy; - rcTray.bottom -= m_AutoHideOffset.cy; - } - - if (!EqualRect(&rcTray, - &m_TrayRects[m_DraggingPosition])) - { - /* Recalculate the rectangle, the user dragged the tray - window to another monitor or the window was somehow else - moved or resized */ - m_DraggingPosition = GetDraggingRectFromRect( - &rcTray, - &m_DraggingMonitor); - //m_TrayRects[DraggingPosition] = rcTray; - } - - //Monitor = CalculateValidSize(DraggingPosition, - // &rcTray); - - m_Monitor = m_DraggingMonitor; - m_Position = m_DraggingPosition; - IsDragging = FALSE; - - m_TrayRects[m_Position] = rcTray; - goto ChangePos; - } - else if (GetWindowRect(&rcTray)) - { - if (InSizeMove) - { - if (!(pwp->flags & SWP_NOMOVE)) - { - rcTray.left = pwp->x; - rcTray.top = pwp->y; - } - - if (!(pwp->flags & SWP_NOSIZE)) - { - rcTray.right = rcTray.left + pwp->cx; - rcTray.bottom = rcTray.top + pwp->cy; - } - - m_Position = GetDraggingRectFromRect(&rcTray, &m_Monitor); - - if (!(pwp->flags & (SWP_NOMOVE | SWP_NOSIZE))) - { - SIZE szWnd; - - szWnd.cx = pwp->cx; - szWnd.cy = pwp->cy; - - MakeTrayRectWithSize(m_Position, &szWnd, &rcTray); - } - - if (AutoHide) - { - rcTray.left -= m_AutoHideOffset.cx; - rcTray.right -= m_AutoHideOffset.cx; - rcTray.top -= m_AutoHideOffset.cy; - rcTray.bottom -= m_AutoHideOffset.cy; - } - m_TrayRects[m_Position] = rcTray; - } - else - { - /* If the user isn't resizing the tray window we need to make sure the - new size or position is valid. this is to prevent changes to the window - without user interaction. */ - rcTray = m_TrayRects[m_Position]; - } - -ChangePos: - m_TraySize.cx = rcTray.right - rcTray.left; - m_TraySize.cy = rcTray.bottom - rcTray.top; - - if (AutoHide) - { - rcTray.left += m_AutoHideOffset.cx; - rcTray.right += m_AutoHideOffset.cx; - rcTray.top += m_AutoHideOffset.cy; - rcTray.bottom += m_AutoHideOffset.cy; - } - - pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE); - pwp->x = rcTray.left; - pwp->y = rcTray.top; - pwp->cx = m_TraySize.cx; - pwp->cy = m_TraySize.cy; - } - } - - VOID ApplyClipping(IN BOOL Clip) - { - RECT rcClip, rcWindow; - HRGN hClipRgn; - - if (GetWindowRect(&rcWindow)) - { - /* Disable clipping on systems with only one monitor */ - if (GetSystemMetrics(SM_CMONITORS) <= 1) - Clip = FALSE; - - if (Clip) - { - rcClip = rcWindow; - - GetScreenRect(m_Monitor, &rcClip); - - if (!IntersectRect(&rcClip, &rcClip, &rcWindow)) - { - rcClip = rcWindow; - } - - OffsetRect(&rcClip, - -rcWindow.left, - -rcWindow.top); - - hClipRgn = CreateRectRgnIndirect(&rcClip); - } - else - hClipRgn = NULL; - - /* Set the clipping region or make sure the window isn't clipped - by disabling it explicitly. */ - SetWindowRgn(hClipRgn, TRUE); - } - } - - VOID ResizeWorkArea() - { -#if !WIN7_DEBUG_MODE - RECT rcTray, rcWorkArea; - - /* If monitor has changed then fix the previous monitors work area */ - if (m_PreviousMonitor != m_Monitor) - { - GetScreenRect(m_PreviousMonitor, &rcWorkArea); - SystemParametersInfoW(SPI_SETWORKAREA, - 1, - &rcWorkArea, - SPIF_SENDCHANGE); - } - - rcTray = m_TrayRects[m_Position]; - - GetScreenRect(m_Monitor, &rcWorkArea); - m_PreviousMonitor = m_Monitor; - - /* If AutoHide is false then change the workarea to exclude - the area that the taskbar covers. */ - if (!AutoHide) - { - switch (m_Position) - { - case ABE_TOP: - rcWorkArea.top = rcTray.bottom; - break; - case ABE_LEFT: - rcWorkArea.left = rcTray.right; - break; - case ABE_RIGHT: - rcWorkArea.right = rcTray.left; - break; - case ABE_BOTTOM: - rcWorkArea.bottom = rcTray.top; - break; - } - } - - /* - * Resize the current monitor work area. Win32k will also send - * a WM_SIZE message to automatically resize the desktop. - */ - SystemParametersInfoW(SPI_SETWORKAREA, - 1, - &rcWorkArea, - SPIF_SENDCHANGE); -#endif - } - - VOID CheckTrayWndPosition() - { - RECT rcTray; - - rcTray = m_TrayRects[m_Position]; - - if (AutoHide) - { - rcTray.left += m_AutoHideOffset.cx; - rcTray.right += m_AutoHideOffset.cx; - rcTray.top += m_AutoHideOffset.cy; - rcTray.bottom += m_AutoHideOffset.cy; - } - - /* Move the tray window */ - SetWindowPos(NULL, - rcTray.left, - rcTray.top, - rcTray.right - rcTray.left, - rcTray.bottom - rcTray.top, - SWP_NOZORDER | SWP_NOACTIVATE); - - ResizeWorkArea(); - - ApplyClipping(TRUE); - } - - typedef struct _TW_STUCKRECTS2 - { - DWORD cbSize; - LONG Unknown; - DWORD dwFlags; - DWORD Position; - SIZE Size; - RECT Rect; - } TW_STRUCKRECTS2, *PTW_STUCKRECTS2; - - VOID RegLoadSettings() - { - DWORD Pos; - TW_STRUCKRECTS2 sr; - RECT rcScreen; - SIZE WndSize, EdgeSize, DlgFrameSize; - DWORD cbSize = sizeof(sr); - SIZE StartBtnSize = m_StartButton.GetSize(); - - EdgeSize.cx = GetSystemMetrics(SM_CXEDGE); - EdgeSize.cy = GetSystemMetrics(SM_CYEDGE); - DlgFrameSize.cx = GetSystemMetrics(SM_CXDLGFRAME); - DlgFrameSize.cy = GetSystemMetrics(SM_CYDLGFRAME); - - if (SHGetValue(hkExplorer, - TEXT("StuckRects2"), - TEXT("Settings"), - NULL, - &sr, - &cbSize) == ERROR_SUCCESS && - sr.cbSize == sizeof(sr)) - { - AutoHide = (sr.dwFlags & ABS_AUTOHIDE) != 0; - AlwaysOnTop = (sr.dwFlags & ABS_ALWAYSONTOP) != 0; - SmSmallIcons = (sr.dwFlags & 0x4) != 0; - HideClock = (sr.dwFlags & 0x8) != 0; - - /* FIXME: Are there more flags? */ - -#if WIN7_DEBUG_MODE - m_Position = ABE_LEFT; -#else - if (sr.Position > ABE_BOTTOM) - m_Position = ABE_BOTTOM; - else - m_Position = sr.Position; -#endif - - /* Try to find out which monitor the tray window was located on last. - Here we're only interested in the monitor screen that we think - is the last one used. We're going to determine on which monitor - we really are after calculating the docked position. */ - rcScreen = sr.Rect; - GetScreenRectFromRect( - &rcScreen, - MONITOR_DEFAULTTONEAREST); - } - else - { - m_Position = ABE_BOTTOM; - AlwaysOnTop = TRUE; - - /* Use the minimum size of the taskbar, we'll use the start - button as a minimum for now. Make sure we calculate the - entire window size, not just the client size. However, we - use a thinner border than a standard thick border, so that - the start button and bands are not stuck to the screen border. */ - sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx)); - sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); - - /* Use the primary screen by default */ - rcScreen.left = 0; - rcScreen.top = 0; - rcScreen.right = GetSystemMetrics(SM_CXSCREEN); - rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN); - GetScreenRectFromRect( - &rcScreen, - MONITOR_DEFAULTTOPRIMARY); - } - - if (m_hWnd != NULL) - SetWindowPos( - AlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, - 0, - 0, - 0, - 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - - /* Determine a minimum tray window rectangle. The "client" height is - zero here since we cannot determine an optimal minimum width when - loaded as a vertical tray window. We just need to make sure the values - loaded from the registry are at least. The windows explorer behaves - the same way, it allows the user to save a zero width vertical tray - window, but not a zero height horizontal tray window. */ - WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx); - WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); - - if (WndSize.cx < sr.Size.cx) - WndSize.cx = sr.Size.cx; - if (WndSize.cy < sr.Size.cy) - WndSize.cy = sr.Size.cy; - - /* Save the calculated size */ - m_TraySize = WndSize; - - /* Calculate all docking rectangles. We need to do this here so they're - initialized and dragging the tray window to another position gives - usable results */ - for (Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++) - { - GetTrayRectFromScreenRect(Pos, - &rcScreen, - &m_TraySize, - &m_TrayRects[Pos]); - // TRACE("m_TrayRects[%d(%d)]: %d,%d,%d,%d\n", Pos, Position, m_TrayRects[Pos].left, m_TrayRects[Pos].top, m_TrayRects[Pos].right, m_TrayRects[Pos].bottom); - } - - /* Determine which monitor we are on. It shouldn't matter which docked - position rectangle we use */ - m_Monitor = GetMonitorFromRect(&m_TrayRects[ABE_LEFT]); - } - - UINT TrackMenu( - IN HMENU hMenu, - IN POINT *ppt OPTIONAL, - IN HWND hwndExclude OPTIONAL, - IN BOOL TrackUp, - IN BOOL IsContextMenu) - { - TPMPARAMS tmp, *ptmp = NULL; - POINT pt; - UINT cmdId; - UINT fuFlags; - - if (hwndExclude != NULL) - { - /* Get the client rectangle and map it to screen coordinates */ - if (::GetClientRect(hwndExclude, - &tmp.rcExclude) && - ::MapWindowPoints(hwndExclude, - NULL, - (LPPOINT) &tmp.rcExclude, - 2) != 0) - { - ptmp = &tmp; - } - } - - if (ppt == NULL) - { - if (ptmp == NULL && - GetClientRect(&tmp.rcExclude) && - MapWindowPoints( - NULL, - (LPPOINT) &tmp.rcExclude, - 2) != 0) - { - ptmp = &tmp; - } - - if (ptmp != NULL) - { - /* NOTE: TrackPopupMenuEx will eventually align the track position - for us, no need to take care of it here as long as the - coordinates are somewhere within the exclusion rectangle */ - pt.x = ptmp->rcExclude.left; - pt.y = ptmp->rcExclude.top; - } - else - pt.x = pt.y = 0; - } - else - pt = *ppt; - - tmp.cbSize = sizeof(tmp); - - fuFlags = TPM_RETURNCMD | TPM_VERTICAL; - fuFlags |= (TrackUp ? TPM_BOTTOMALIGN : TPM_TOPALIGN); - if (IsContextMenu) - fuFlags |= TPM_RIGHTBUTTON; - else - fuFlags |= (TrackUp ? TPM_VERNEGANIMATION : TPM_VERPOSANIMATION); - - cmdId = TrackPopupMenuEx(hMenu, - fuFlags, - pt.x, - pt.y, - m_hWnd, - ptmp); - - return cmdId; - } - - HRESULT TrackCtxMenu( - IN IContextMenu * contextMenu, - IN POINT *ppt OPTIONAL, - IN HWND hwndExclude OPTIONAL, - IN BOOL TrackUp, - IN PVOID Context OPTIONAL) - { - INT x = ppt->x; - INT y = ppt->y; - HRESULT hr; - UINT uCommand; - HMENU popup = CreatePopupMenu(); - - if (popup == NULL) + HRESULT ExecResourceCmd(int id) + { + WCHAR szCommand[256]; + WCHAR *pszParameters; + + if (!LoadStringW(hExplorerInstance, + id, + szCommand, + _countof(szCommand))) + { return E_FAIL; - - TRACE("Before Query\n"); - hr = contextMenu->QueryContextMenu(popup, 0, 0, UINT_MAX, CMF_NORMAL); - if (FAILED_UNEXPECTEDLY(hr)) - { - TRACE("Query failed\n"); - DestroyMenu(popup); - return hr; - } - - TRACE("Before Tracking\n"); - uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, x, y, m_hWnd, NULL); - - if (uCommand != 0) - { - TRACE("Before InvokeCommand\n"); - CMINVOKECOMMANDINFO cmi = { 0 }; - cmi.cbSize = sizeof(cmi); - cmi.lpVerb = MAKEINTRESOURCEA(uCommand); - cmi.hwnd = m_hWnd; - hr = contextMenu->InvokeCommand(&cmi); - } - else - { - TRACE("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand, GetLastError()); - hr = S_FALSE; - } - - DestroyMenu(popup); - return hr; - } - - VOID AlignControls(IN PRECT prcClient OPTIONAL) - { - RECT rcClient; - SIZE TraySize, StartSize; - POINT ptTrayNotify = { 0, 0 }; - BOOL Horizontal; - HDWP dwp; - - m_StartButton.UpdateSize(); - if (prcClient != NULL) - { - rcClient = *prcClient; - } - else - { - if (!GetClientRect(&rcClient)) - { - ERR("Could not get client rect lastErr=%d\n", GetLastError()); + } + + pszParameters = wcschr(szCommand, L'>'); + if (pszParameters) + { + *pszParameters = 0; + pszParameters++; + } + + ShellExecuteW(m_hWnd, NULL, szCommand, pszParameters, NULL, SW_SHOWNORMAL); + return S_OK; + } + + LRESULT DoExitWindows() + { + ExitWindowsDialog(m_hWnd); + return 0; + } + + DWORD WINAPI RunFileDlgThread() + { + HWND hwnd; + RECT posRect; + + m_StartButton.GetWindowRect(&posRect); + + hwnd = CreateWindowEx(0, + WC_STATIC, + NULL, + WS_OVERLAPPED | WS_DISABLED | WS_CLIPSIBLINGS | WS_BORDER | SS_LEFT, + posRect.left, + posRect.top, + posRect.right - posRect.left, + posRect.bottom - posRect.top, + NULL, + NULL, + NULL, + NULL); + + m_RunFileDlgOwner = hwnd; + + RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); + + m_RunFileDlgOwner = NULL; + ::DestroyWindow(hwnd); + + return 0; + } + + static DWORD WINAPI s_RunFileDlgThread(IN OUT PVOID pParam) + { + CTrayWindow * This = (CTrayWindow*) pParam; + return This->RunFileDlgThread(); + } + + void DisplayRunFileDlg() + { + HWND hRunDlg; + if (m_RunFileDlgOwner) + { + hRunDlg = ::GetLastActivePopup(m_RunFileDlgOwner); + if (hRunDlg != NULL && + hRunDlg != m_RunFileDlgOwner) + { + SetForegroundWindow(hRunDlg); return; } } - Horizontal = IsPosHorizontal(); - - /* We're about to resize/move the start button, the rebar control and - the tray notification control */ - dwp = BeginDeferWindowPos(3); - if (dwp == NULL) - { - ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError()); - return; - } - - /* Limit the Start button width to the client width, if neccessary */ - StartSize = m_StartButton.GetSize(); - if (StartSize.cx > rcClient.right) - StartSize.cx = rcClient.right; - - if (m_StartButton.m_hWnd != NULL) - { - /* Resize and reposition the button */ - dwp = m_StartButton.DeferWindowPos(dwp, - NULL, - 0, - 0, - StartSize.cx, - StartSize.cy, - SWP_NOZORDER | SWP_NOACTIVATE); - if (dwp == NULL) - { - ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError()); - return; - } - } - - /* Determine the size that the tray notification window needs */ - if (Horizontal) - { - TraySize.cx = 0; - TraySize.cy = rcClient.bottom; - } - else - { - TraySize.cx = rcClient.right; - TraySize.cy = 0; - } - - if (m_TrayNotify != NULL && - SendMessage(m_TrayNotify, - TNWM_GETMINIMUMSIZE, - (WPARAM)Horizontal, - (LPARAM)&TraySize)) - { - /* Move the tray notification window to the desired location */ - if (Horizontal) - ptTrayNotify.x = rcClient.right - TraySize.cx; - else - ptTrayNotify.y = rcClient.bottom - TraySize.cy; - - dwp = ::DeferWindowPos(dwp, - m_TrayNotify, - NULL, - ptTrayNotify.x, - ptTrayNotify.y, - TraySize.cx, - TraySize.cy, - SWP_NOZORDER | SWP_NOACTIVATE); - if (dwp == NULL) - { - ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError()); - return; - } - } - - /* Resize/Move the rebar control */ - if (m_Rebar != NULL) - { - POINT ptRebar = { 0, 0 }; - SIZE szRebar; - - SetWindowStyle(m_Rebar, CCS_VERT, Horizontal ? 0 : CCS_VERT); - - if (Horizontal) - { - ptRebar.x = StartSize.cx + GetSystemMetrics(SM_CXSIZEFRAME); - szRebar.cx = ptTrayNotify.x - ptRebar.x; - szRebar.cy = rcClient.bottom; - } - else - { - ptRebar.y = StartSize.cy + GetSystemMetrics(SM_CYSIZEFRAME); - szRebar.cx = rcClient.right; - szRebar.cy = ptTrayNotify.y - ptRebar.y; - } - - dwp = ::DeferWindowPos(dwp, - m_Rebar, - NULL, - ptRebar.x, - ptRebar.y, - szRebar.cx, - szRebar.cy, - SWP_NOZORDER | SWP_NOACTIVATE); - } - - if (dwp != NULL) - EndDeferWindowPos(dwp); - - if (m_TaskSwitch != NULL) - { - /* Update the task switch window configuration */ - SendMessage(m_TaskSwitch, TSWM_UPDATETASKBARPOS, 0, 0); - } - } - - LRESULT OnThemeChanged() - { - if (m_Theme) - CloseThemeData(m_Theme); - - if (IsThemeActive()) - m_Theme = OpenThemeData(m_hWnd, L"TaskBar"); - else - m_Theme = NULL; - - if (Locked && m_Theme) - { - SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0); - } - else - { - SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER); - } - SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); - - return TRUE; - } - - LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnThemeChanged(); - } - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - ((ITrayWindow*)this)->AddRef(); - - SetWindowTheme(m_hWnd, L"TaskBar", NULL); - - InterlockedIncrement(&TrayWndCount); - - if (m_CaptionFont == NULL) - { - NONCLIENTMETRICS ncm; - - /* Get the system fonts, we use the caption font, - always bold, though. */ - ncm.cbSize = sizeof(ncm); - if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE)) - { - if (m_CaptionFont == NULL) - { - ncm.lfCaptionFont.lfWeight = FW_NORMAL; - m_CaptionFont = CreateFontIndirect(&ncm.lfCaptionFont); - } - } - } - - /* Create the Start button */ - m_StartButton.Create(m_hWnd); - - /* Load the saved tray window settings */ - RegLoadSettings(); - - /* Create and initialize the start menu */ - HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU)); - m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0); - - /* Load the tray band site */ - m_TrayBandSite = CreateTrayBandSite(this, &m_Rebar, &m_TaskSwitch); - SetWindowTheme(m_Rebar, L"TaskBar", NULL); - - /* Create the tray notification window */ - m_TrayNotify = CreateTrayNotifyWnd(this, HideClock, &m_TrayNotifyInstance); - - if (UpdateNonClientMetrics()) - { - SetWindowsFont(); - } - - /* Move the tray window to the right position and resize it if neccessary */ - CheckTrayWndPosition(); - - /* Align all controls on the tray window */ - AlignControls(NULL); - - InitShellServices(&m_ShellServices); - - if (AutoHide) - { - m_AutoHideState = AUTOHIDE_HIDING; - SetTimer(TIMER_ID_AUTOHIDE, AUTOHIDE_DELAY_HIDE, NULL); - } - - RegisterHotKey(m_hWnd, IDHK_RUN, MOD_WIN, 'R'); - RegisterHotKey(m_hWnd, IDHK_MINIMIZE_ALL, MOD_WIN, 'M'); - RegisterHotKey(m_hWnd, IDHK_RESTORE_ALL, MOD_WIN|MOD_SHIFT, 'M'); - RegisterHotKey(m_hWnd, IDHK_HELP, MOD_WIN, VK_F1); - RegisterHotKey(m_hWnd, IDHK_EXPLORE, MOD_WIN, 'E'); - RegisterHotKey(m_hWnd, IDHK_FIND, MOD_WIN, 'F'); - RegisterHotKey(m_hWnd, IDHK_FIND_COMPUTER, MOD_WIN|MOD_CONTROL, 'F'); - RegisterHotKey(m_hWnd, IDHK_NEXT_TASK, MOD_WIN, VK_TAB); - RegisterHotKey(m_hWnd, IDHK_PREV_TASK, MOD_WIN|MOD_SHIFT, VK_TAB); - RegisterHotKey(m_hWnd, IDHK_SYS_PROPERTIES, MOD_WIN, VK_PAUSE); - RegisterHotKey(m_hWnd, IDHK_DESKTOP, MOD_WIN, 'D'); - RegisterHotKey(m_hWnd, IDHK_PAGER, MOD_WIN, 'B'); - - return TRUE; - } - - HRESULT STDMETHODCALLTYPE Open() - { - RECT rcWnd; - - /* Check if there's already a window created and try to show it. - If it was somehow destroyed just create a new tray window. */ - if (m_hWnd != NULL && IsWindow()) - { - if (!IsWindowVisible()) - { - CheckTrayWndPosition(); - - ShowWindow(SW_SHOW); - } - - return S_OK; - } - - DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE; - if (AlwaysOnTop) - dwExStyle |= WS_EX_TOPMOST; - - DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | - WS_BORDER | WS_THICKFRAME; - - ZeroMemory(&rcWnd, sizeof(rcWnd)); - if (m_Position != (DWORD) -1) - rcWnd = m_TrayRects[m_Position]; - - if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle)) - return E_FAIL; - - return S_OK; - } - - HRESULT STDMETHODCALLTYPE Close() - { - if (m_hWnd != NULL) - { - SendMessage(m_hWnd, - WM_APP_TRAYDESTROY, - 0, - 0); - } - - return S_OK; - } - - HWND STDMETHODCALLTYPE GetHWND() - { - return m_hWnd; - } - - BOOL STDMETHODCALLTYPE IsSpecialHWND(IN HWND hWnd) - { - return (m_hWnd == hWnd || - (m_DesktopWnd != NULL && m_hWnd == m_DesktopWnd)); - } - - BOOL STDMETHODCALLTYPE IsHorizontal() - { - return IsPosHorizontal(); - } - - HFONT STDMETHODCALLTYPE GetCaptionFonts(OUT HFONT *phBoldCaption OPTIONAL) - { - if (phBoldCaption != NULL) - *phBoldCaption = m_StartButton.GetFont(); - - return m_CaptionFont; + CloseHandle(CreateThread(NULL, 0, s_RunFileDlgThread, this, 0, NULL)); } DWORD WINAPI TrayPropertiesThread() @@ -1718,8 +678,6 @@ BOOL STDMETHODCALLTYPE ExecContextMenuCmd(IN UINT uiCmd) { - BOOL bHandled = TRUE; - switch (uiCmd) { case ID_SHELL_CMD_PROPERTIES: @@ -1775,185 +733,1049 @@ default: TRACE("ITrayWindow::ExecContextMenuCmd(%u): Unhandled Command ID!\n", uiCmd); - bHandled = FALSE; - break; - } - - return bHandled; - } - - BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock) - { - BOOL bPrevLock = Locked; - - if (Locked != bLock) - { - Locked = bLock; - - if (m_TrayBandSite != NULL) - { - if (!SUCCEEDED(m_TrayBandSite->Lock(bLock))) + return FALSE; + } + + return TRUE; + } + + LRESULT HandleHotKey(DWORD id) + { + switch (id) + { + case IDHK_RUN: + DisplayRunFileDlg(); + break; + case IDHK_HELP: + ExecResourceCmd(IDS_HELP_COMMAND); + break; + case IDHK_EXPLORE: + //FIXME: We don't support this yet: + //ShellExecuteW(0, L"explore", NULL, NULL, NULL, 1); + ShellExecuteW(0, NULL, L"explorer.exe", NULL, NULL, 1); + break; + case IDHK_FIND: + SHFindFiles(NULL, NULL); + break; + case IDHK_FIND_COMPUTER: + SHFindComputer(NULL, NULL); + break; + case IDHK_SYS_PROPERTIES: + //FIXME: Use SHRunControlPanel + ShellExecuteW(m_hWnd, NULL, L"sysdm.cpl", NULL, NULL, SW_NORMAL); + break; + case IDHK_NEXT_TASK: + break; + case IDHK_PREV_TASK: + break; + case IDHK_MINIMIZE_ALL: + break; + case IDHK_RESTORE_ALL: + break; + case IDHK_DESKTOP: + break; + case IDHK_PAGER: + break; + } + + return 0; + } + + LRESULT HandleCommand(UINT uCommand) + { + switch (uCommand) + { + case IDM_TASKBARANDSTARTMENU: + DisplayProperties(); + break; + + case IDM_SEARCH: + SHFindFiles(NULL, NULL); + break; + + case IDM_HELPANDSUPPORT: + ExecResourceCmd(IDS_HELP_COMMAND); + break; + + case IDM_RUN: + DisplayRunFileDlg(); + break; + + /* FIXME: Handle these commands as well */ + case IDM_SYNCHRONIZE: + case IDM_DISCONNECT: + case IDM_UNDOCKCOMPUTER: + break; + + case IDM_LOGOFF: + LogoffWindowsDialog(m_hWnd); // FIXME: Maybe handle it in a similar way as DoExitWindows? + break; + + case IDM_SHUTDOWN: + DoExitWindows(); + break; + } + + return FALSE; + } + + + UINT TrackMenu( + IN HMENU hMenu, + IN POINT *ppt OPTIONAL, + IN HWND hwndExclude OPTIONAL, + IN BOOL TrackUp, + IN BOOL IsContextMenu) + { + TPMPARAMS tmp, *ptmp = NULL; + POINT pt; + UINT cmdId; + UINT fuFlags; + + if (hwndExclude != NULL) + { + /* Get the client rectangle and map it to screen coordinates */ + if (::GetClientRect(hwndExclude, + &tmp.rcExclude) && + ::MapWindowPoints(hwndExclude, + NULL, + (LPPOINT) &tmp.rcExclude, + 2) != 0) + { + ptmp = &tmp; + } + } + + if (ppt == NULL) + { + if (ptmp == NULL && + GetClientRect(&tmp.rcExclude) && + MapWindowPoints( + NULL, + (LPPOINT) &tmp.rcExclude, + 2) != 0) + { + ptmp = &tmp; + } + + if (ptmp != NULL) + { + /* NOTE: TrackPopupMenuEx will eventually align the track position + for us, no need to take care of it here as long as the + coordinates are somewhere within the exclusion rectangle */ + pt.x = ptmp->rcExclude.left; + pt.y = ptmp->rcExclude.top; + } + else + pt.x = pt.y = 0; + } + else + pt = *ppt; + + tmp.cbSize = sizeof(tmp); + + fuFlags = TPM_RETURNCMD | TPM_VERTICAL; + fuFlags |= (TrackUp ? TPM_BOTTOMALIGN : TPM_TOPALIGN); + if (IsContextMenu) + fuFlags |= TPM_RIGHTBUTTON; + else + fuFlags |= (TrackUp ? TPM_VERNEGANIMATION : TPM_VERPOSANIMATION); + + cmdId = TrackPopupMenuEx(hMenu, + fuFlags, + pt.x, + pt.y, + m_hWnd, + ptmp); + + return cmdId; + } + + HRESULT TrackCtxMenu( + IN IContextMenu * contextMenu, + IN POINT *ppt OPTIONAL, + IN HWND hwndExclude OPTIONAL, + IN BOOL TrackUp, + IN PVOID Context OPTIONAL) + { + INT x = ppt->x; + INT y = ppt->y; + HRESULT hr; + UINT uCommand; + HMENU popup = CreatePopupMenu(); + + if (popup == NULL) + return E_FAIL; + + TRACE("Before Query\n"); + hr = contextMenu->QueryContextMenu(popup, 0, 0, UINT_MAX, CMF_NORMAL); + if (FAILED_UNEXPECTEDLY(hr)) + { + TRACE("Query failed\n"); + DestroyMenu(popup); + return hr; + } + + TRACE("Before Tracking\n"); + uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, x, y, m_hWnd, NULL); + + if (uCommand != 0) + { + TRACE("Before InvokeCommand\n"); + CMINVOKECOMMANDINFO cmi = { 0 }; + cmi.cbSize = sizeof(cmi); + cmi.lpVerb = MAKEINTRESOURCEA(uCommand); + cmi.hwnd = m_hWnd; + hr = contextMenu->InvokeCommand(&cmi); + } + else + { + TRACE("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand, GetLastError()); + hr = S_FALSE; + } + + DestroyMenu(popup); + return hr; + } + + + + + + /********************************************************** + * ##### moving and sizing handling ##### + */ + + BOOL UpdateNonClientMetrics() + { + NONCLIENTMETRICS ncm; + ncm.cbSize = sizeof(ncm); + if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)) + { + if (m_Font != NULL) + DeleteObject(m_Font); + + m_Font = CreateFontIndirect(&ncm.lfMessageFont); + return TRUE; + } + + return FALSE; + } + + VOID SetWindowsFont() + { + if (m_TrayNotify != NULL) + { + SendMessage(m_TrayNotify, WM_SETFONT, (WPARAM) m_Font, TRUE); + } + } + + HMONITOR GetScreenRectFromRect( + IN OUT RECT *pRect, + IN DWORD dwFlags) + { + MONITORINFO mi; + HMONITOR hMon; + + mi.cbSize = sizeof(mi); + hMon = MonitorFromRect(pRect, dwFlags); + if (hMon != NULL && + GetMonitorInfo(hMon, &mi)) + { + *pRect = mi.rcMonitor; + } + else + { + pRect->left = 0; + pRect->top = 0; + pRect->right = GetSystemMetrics(SM_CXSCREEN); + pRect->bottom = GetSystemMetrics(SM_CYSCREEN); + + hMon = NULL; + } + + return hMon; + } + + HMONITOR GetMonitorFromRect( + IN const RECT *pRect) + { + HMONITOR hMon; + + /* In case the monitor sizes or saved sizes differ a bit (probably + not a lot, only so the tray window overlaps into another monitor + now), minimize the risk that we determine a wrong monitor by + using the center point of the tray window if we can't determine + it using the rectangle. */ + hMon = MonitorFromRect(pRect, MONITOR_DEFAULTTONULL); + if (hMon == NULL) + { + POINT pt; + + pt.x = pRect->left + ((pRect->right - pRect->left) / 2); + pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2); + + /* be less error-prone, find the nearest monitor */ + hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + } + + return hMon; + } + + HMONITOR GetScreenRect( + IN HMONITOR hMonitor, + IN OUT RECT *pRect) + { + HMONITOR hMon = NULL; + + if (hMonitor != NULL) + { + MONITORINFO mi; + + mi.cbSize = sizeof(mi); + if (!GetMonitorInfo(hMonitor, &mi)) + { + /* Hm, the monitor is gone? Try to find a monitor where it + could be located now */ + hMon = GetMonitorFromRect(pRect); + if (hMon == NULL || + !GetMonitorInfo(hMon, &mi)) { - /* Reset?? */ - Locked = bPrevLock; - return bPrevLock; + hMon = NULL; + goto GetPrimaryRect; } } - if (Locked && m_Theme) - { - SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0); + *pRect = mi.rcMonitor; + } + else + { +GetPrimaryRect: + pRect->left = 0; + pRect->top = 0; + pRect->right = GetSystemMetrics(SM_CXSCREEN); + pRect->bottom = GetSystemMetrics(SM_CYSCREEN); + } + + return hMon; + } + + VOID MakeTrayRectWithSize(IN DWORD Position, + IN const SIZE *pTraySize, + IN OUT RECT *pRect) + { + switch (Position) + { + case ABE_LEFT: + pRect->right = pRect->left + pTraySize->cx; + break; + + case ABE_TOP: + pRect->bottom = pRect->top + pTraySize->cy; + break; + + case ABE_RIGHT: + pRect->left = pRect->right - pTraySize->cx; + break; + + case ABE_BOTTOM: + default: + pRect->top = pRect->bottom - pTraySize->cy; + break; + } + } + + VOID GetTrayRectFromScreenRect(IN DWORD Position, + IN const RECT *pScreen, + IN const SIZE *pTraySize OPTIONAL, + OUT RECT *pRect) + { + if (pTraySize == NULL) + pTraySize = &m_TraySize; + + *pRect = *pScreen; + + /* Move the border outside of the screen */ + InflateRect(pRect, + GetSystemMetrics(SM_CXEDGE), + GetSystemMetrics(SM_CYEDGE)); + + MakeTrayRectWithSize(Position, pTraySize, pRect); + } + + BOOL IsPosHorizontal() + { + return m_Position == ABE_TOP || m_Position == ABE_BOTTOM; + } + + HMONITOR CalculateValidSize( + IN DWORD Position, + IN OUT RECT *pRect) + { + RECT rcScreen; + //BOOL Horizontal; + HMONITOR hMon; + SIZE szMax, szWnd; + + //Horizontal = IsPosHorizontal(); + + szWnd.cx = pRect->right - pRect->left; + szWnd.cy = pRect->bottom - pRect->top; + + rcScreen = *pRect; + hMon = GetScreenRectFromRect( + &rcScreen, + MONITOR_DEFAULTTONEAREST); + + /* Calculate the maximum size of the tray window and limit the window + size to half of the screen's size. */ + szMax.cx = (rcScreen.right - rcScreen.left) / 2; + szMax.cy = (rcScreen.bottom - rcScreen.top) / 2; + if (szWnd.cx > szMax.cx) + szWnd.cx = szMax.cx; + if (szWnd.cy > szMax.cy) + szWnd.cy = szMax.cy; + + /* FIXME - calculate */ + + GetTrayRectFromScreenRect(Position, + &rcScreen, + &szWnd, + pRect); + + return hMon; + } + +#if 0 + VOID + GetMinimumWindowSize( + OUT RECT *pRect) + { + RECT rcMin = {0}; + + AdjustWindowRectEx(&rcMin, + GetWindowLong(m_hWnd, + GWL_STYLE), + FALSE, + GetWindowLong(m_hWnd, + GWL_EXSTYLE)); + + *pRect = rcMin; + } +#endif + + + DWORD GetDraggingRectFromPt( + IN POINT pt, + OUT RECT *pRect, + OUT HMONITOR *phMonitor) + { + HMONITOR hMon, hMonNew; + DWORD PosH, PosV, Pos; + SIZE DeltaPt, ScreenOffset; + RECT rcScreen; + + rcScreen.left = 0; + rcScreen.top = 0; + + /* Determine the screen rectangle */ + hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + if (hMon != NULL) + { + MONITORINFO mi; + + mi.cbSize = sizeof(mi); + if (!GetMonitorInfo(hMon, &mi)) + { + hMon = NULL; + goto GetPrimaryScreenRect; + } + + /* make left top corner of the screen zero based to + make calculations easier */ + pt.x -= mi.rcMonitor.left; + pt.y -= mi.rcMonitor.top; + + ScreenOffset.cx = mi.rcMonitor.left; + ScreenOffset.cy = mi.rcMonitor.top; + rcScreen.right = mi.rcMonitor.right - mi.rcMonitor.left; + rcScreen.bottom = mi.rcMonitor.bottom - mi.rcMonitor.top; + } + else + { +GetPrimaryScreenRect: + ScreenOffset.cx = 0; + ScreenOffset.cy = 0; + rcScreen.right = GetSystemMetrics(SM_CXSCREEN); + rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN); + } + + /* Calculate the nearest screen border */ + if (pt.x < rcScreen.right / 2) + { + DeltaPt.cx = pt.x; + PosH = ABE_LEFT; + } + else + { + DeltaPt.cx = rcScreen.right - pt.x; + PosH = ABE_RIGHT; + } + + if (pt.y < rcScreen.bottom / 2) + { + DeltaPt.cy = pt.y; + PosV = ABE_TOP; + } + else + { + DeltaPt.cy = rcScreen.bottom - pt.y; + PosV = ABE_BOTTOM; + } + + Pos = (DeltaPt.cx * rcScreen.bottom < DeltaPt.cy * rcScreen.right) ? PosH : PosV; + + /* Fix the screen origin to be relative to the primary monitor again */ + OffsetRect(&rcScreen, + ScreenOffset.cx, + ScreenOffset.cy); + + RECT rcPos = m_TrayRects[Pos]; + + hMonNew = GetMonitorFromRect(&rcPos); + if (hMon != hMonNew) + { + SIZE szTray; + + /* Recalculate the rectangle, we're dragging to another monitor. + We don't need to recalculate the rect on single monitor systems. */ + szTray.cx = rcPos.right - rcPos.left; + szTray.cy = rcPos.bottom - rcPos.top; + + GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect); + if (AutoHide) + { + pRect->left += m_AutoHideOffset.cx; + pRect->right += m_AutoHideOffset.cx; + pRect->top += m_AutoHideOffset.cy; + pRect->bottom += m_AutoHideOffset.cy; + } + hMon = hMonNew; + } + else + { + /* The user is dragging the tray window on the same monitor. We don't need + to recalculate the rectangle */ + *pRect = rcPos; + if (AutoHide) + { + pRect->left += m_AutoHideOffset.cx; + pRect->right += m_AutoHideOffset.cx; + pRect->top += m_AutoHideOffset.cy; + pRect->bottom += m_AutoHideOffset.cy; + } + } + + *phMonitor = hMon; + + return Pos; + } + + DWORD GetDraggingRectFromRect( + IN OUT RECT *pRect, + OUT HMONITOR *phMonitor) + { + POINT pt; + + /* Calculate the center of the rectangle. We call + GetDraggingRectFromPt to calculate a valid + dragging rectangle */ + pt.x = pRect->left + ((pRect->right - pRect->left) / 2); + pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2); + + return GetDraggingRectFromPt( + pt, + pRect, + phMonitor); + } + + VOID ChangingWinPos(IN OUT LPWINDOWPOS pwp) + { + RECT rcTray; + + if (IsDragging) + { + rcTray.left = pwp->x; + rcTray.top = pwp->y; + rcTray.right = rcTray.left + pwp->cx; + rcTray.bottom = rcTray.top + pwp->cy; + if (AutoHide) + { + rcTray.left -= m_AutoHideOffset.cx; + rcTray.right -= m_AutoHideOffset.cx; + rcTray.top -= m_AutoHideOffset.cy; + rcTray.bottom -= m_AutoHideOffset.cy; + } + + if (!EqualRect(&rcTray, + &m_TrayRects[m_DraggingPosition])) + { + /* Recalculate the rectangle, the user dragged the tray + window to another monitor or the window was somehow else + moved or resized */ + m_DraggingPosition = GetDraggingRectFromRect( + &rcTray, + &m_DraggingMonitor); + //m_TrayRects[DraggingPosition] = rcTray; + } + + //Monitor = CalculateValidSize(DraggingPosition, + // &rcTray); + + m_Monitor = m_DraggingMonitor; + m_Position = m_DraggingPosition; + IsDragging = FALSE; + + m_TrayRects[m_Position] = rcTray; + goto ChangePos; + } + else if (GetWindowRect(&rcTray)) + { + if (InSizeMove) + { + if (!(pwp->flags & SWP_NOMOVE)) + { + rcTray.left = pwp->x; + rcTray.top = pwp->y; + } + + if (!(pwp->flags & SWP_NOSIZE)) + { + rcTray.right = rcTray.left + pwp->cx; + rcTray.bottom = rcTray.top + pwp->cy; + } + + m_Position = GetDraggingRectFromRect(&rcTray, &m_Monitor); + + if (!(pwp->flags & (SWP_NOMOVE | SWP_NOSIZE))) + { + SIZE szWnd; + + szWnd.cx = pwp->cx; + szWnd.cy = pwp->cy; + + MakeTrayRectWithSize(m_Position, &szWnd, &rcTray); + } + + if (AutoHide) + { + rcTray.left -= m_AutoHideOffset.cx; + rcTray.right -= m_AutoHideOffset.cx; + rcTray.top -= m_AutoHideOffset.cy; + rcTray.bottom -= m_AutoHideOffset.cy; + } + m_TrayRects[m_Position] = rcTray; } else { - SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER); - } - SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); - - } - - return bPrevLock; - } - - - LRESULT DrawBackground(HDC hdc) - { - RECT rect; - int partId; - HRESULT res; - - GetClientRect(&rect); - - if (m_Theme) - { - GetClientRect(&rect); + /* If the user isn't resizing the tray window we need to make sure the + new size or position is valid. this is to prevent changes to the window + without user interaction. */ + rcTray = m_TrayRects[m_Position]; + } + +ChangePos: + m_TraySize.cx = rcTray.right - rcTray.left; + m_TraySize.cy = rcTray.bottom - rcTray.top; + + if (AutoHide) + { + rcTray.left += m_AutoHideOffset.cx; + rcTray.right += m_AutoHideOffset.cx; + rcTray.top += m_AutoHideOffset.cy; + rcTray.bottom += m_AutoHideOffset.cy; + } + + pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE); + pwp->x = rcTray.left; + pwp->y = rcTray.top; + pwp->cx = m_TraySize.cx; + pwp->cy = m_TraySize.cy; + } + } + + VOID ApplyClipping(IN BOOL Clip) + { + RECT rcClip, rcWindow; + HRGN hClipRgn; + + if (GetWindowRect(&rcWindow)) + { + /* Disable clipping on systems with only one monitor */ + if (GetSystemMetrics(SM_CMONITORS) <= 1) + Clip = FALSE; + + if (Clip) + { + rcClip = rcWindow; + + GetScreenRect(m_Monitor, &rcClip); + + if (!IntersectRect(&rcClip, &rcClip, &rcWindow)) + { + rcClip = rcWindow; + } + + OffsetRect(&rcClip, + -rcWindow.left, + -rcWindow.top); + + hClipRgn = CreateRectRgnIndirect(&rcClip); + } + else + hClipRgn = NULL; + + /* Set the clipping region or make sure the window isn't clipped + by disabling it explicitly. */ + SetWindowRgn(hClipRgn, TRUE); + } + } + + VOID ResizeWorkArea() + { +#if !WIN7_DEBUG_MODE + RECT rcTray, rcWorkArea; + + /* If monitor has changed then fix the previous monitors work area */ + if (m_PreviousMonitor != m_Monitor) + { + GetScreenRect(m_PreviousMonitor, &rcWorkArea); + SystemParametersInfoW(SPI_SETWORKAREA, + 1, + &rcWorkArea, + SPIF_SENDCHANGE); + } + + rcTray = m_TrayRects[m_Position]; + + GetScreenRect(m_Monitor, &rcWorkArea); + m_PreviousMonitor = m_Monitor; + + /* If AutoHide is false then change the workarea to exclude + the area that the taskbar covers. */ + if (!AutoHide) + { switch (m_Position) { + case ABE_TOP: + rcWorkArea.top = rcTray.bottom; + break; case ABE_LEFT: - partId = TBP_BACKGROUNDLEFT; - break; - case ABE_TOP: - partId = TBP_BACKGROUNDTOP; + rcWorkArea.left = rcTray.right; break; case ABE_RIGHT: - partId = TBP_BACKGROUNDRIGHT; + rcWorkArea.right = rcTray.left; break; case ABE_BOTTOM: - default: - partId = TBP_BACKGROUNDBOTTOM; + rcWorkArea.bottom = rcTray.top; break; } - res = DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0); - } - - return res; - } - - LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - HDC hdc = (HDC) wParam; - - if (!m_Theme) - { - bHandled = FALSE; - return 0; - } - - return DrawBackground(hdc); - } - - int DrawSizer(IN HRGN hRgn) - { - HDC hdc; - RECT rect; - int backoundPart; - - GetWindowRect(&rect); - OffsetRect(&rect, -rect.left, -rect.top); - - hdc = GetDCEx(hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP); - - switch (m_Position) - { - case ABE_LEFT: - backoundPart = TBP_SIZINGBARLEFT; - rect.left = rect.right - GetSystemMetrics(SM_CXSIZEFRAME); - break; - case ABE_TOP: - backoundPart = TBP_SIZINGBARTOP; - rect.top = rect.bottom - GetSystemMetrics(SM_CYSIZEFRAME); - break; - case ABE_RIGHT: - backoundPart = TBP_SIZINGBARRIGHT; - rect.right = rect.left + GetSystemMetrics(SM_CXSIZEFRAME); - break; - case ABE_BOTTOM: - default: - backoundPart = TBP_SIZINGBARBOTTOM; - rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME); - break; - } - if (IsThemeBackgroundPartiallyTransparent(m_Theme, backoundPart, 0)) - { - DrawThemeParentBackground(m_hWnd, hdc, &rect); - } - DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0); - - ReleaseDC(hdc); - return 0; - } - - DWORD WINAPI RunFileDlgThread() - { - HWND hwnd; - RECT posRect; - - m_StartButton.GetWindowRect(&posRect); - - hwnd = CreateWindowEx(0, - WC_STATIC, - NULL, - WS_OVERLAPPED | WS_DISABLED | WS_CLIPSIBLINGS | WS_BORDER | SS_LEFT, - posRect.left, - posRect.top, - posRect.right - posRect.left, - posRect.bottom - posRect.top, - NULL, - NULL, - NULL, - NULL); - - m_RunFileDlgOwner = hwnd; - - RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); - - m_RunFileDlgOwner = NULL; - ::DestroyWindow(hwnd); - - return 0; - } - - static DWORD WINAPI s_RunFileDlgThread(IN OUT PVOID pParam) - { - CTrayWindow * This = (CTrayWindow*) pParam; - return This->RunFileDlgThread(); - } - - void DisplayRunFileDlg() - { - HWND hRunDlg; - if (m_RunFileDlgOwner) - { - hRunDlg = ::GetLastActivePopup(m_RunFileDlgOwner); - if (hRunDlg != NULL && - hRunDlg != m_RunFileDlgOwner) - { - SetForegroundWindow(hRunDlg); + } + + /* + * Resize the current monitor work area. Win32k will also send + * a WM_SIZE message to automatically resize the desktop. + */ + SystemParametersInfoW(SPI_SETWORKAREA, + 1, + &rcWorkArea, + SPIF_SENDCHANGE); +#endif + } + + VOID CheckTrayWndPosition() + { + RECT rcTray; + + rcTray = m_TrayRects[m_Position]; + + if (AutoHide) + { + rcTray.left += m_AutoHideOffset.cx; + rcTray.right += m_AutoHideOffset.cx; + rcTray.top += m_AutoHideOffset.cy; + rcTray.bottom += m_AutoHideOffset.cy; + } + + /* Move the tray window */ + SetWindowPos(NULL, + rcTray.left, + rcTray.top, + rcTray.right - rcTray.left, + rcTray.bottom - rcTray.top, + SWP_NOZORDER | SWP_NOACTIVATE); + + ResizeWorkArea(); + + ApplyClipping(TRUE); + } + + typedef struct _TW_STUCKRECTS2 + { + DWORD cbSize; + LONG Unknown; + DWORD dwFlags; + DWORD Position; + SIZE Size; + RECT Rect; + } TW_STRUCKRECTS2, *PTW_STUCKRECTS2; + + VOID RegLoadSettings() + { + DWORD Pos; + TW_STRUCKRECTS2 sr; + RECT rcScreen; + SIZE WndSize, EdgeSize, DlgFrameSize; + DWORD cbSize = sizeof(sr); + SIZE StartBtnSize = m_StartButton.GetSize(); + + EdgeSize.cx = GetSystemMetrics(SM_CXEDGE); + EdgeSize.cy = GetSystemMetrics(SM_CYEDGE); + DlgFrameSize.cx = GetSystemMetrics(SM_CXDLGFRAME); + DlgFrameSize.cy = GetSystemMetrics(SM_CYDLGFRAME); + + if (SHGetValue(hkExplorer, + TEXT("StuckRects2"), + TEXT("Settings"), + NULL, + &sr, + &cbSize) == ERROR_SUCCESS && + sr.cbSize == sizeof(sr)) + { + AutoHide = (sr.dwFlags & ABS_AUTOHIDE) != 0; + AlwaysOnTop = (sr.dwFlags & ABS_ALWAYSONTOP) != 0; + SmSmallIcons = (sr.dwFlags & 0x4) != 0; + HideClock = (sr.dwFlags & 0x8) != 0; + + /* FIXME: Are there more flags? */ + +#if WIN7_DEBUG_MODE + m_Position = ABE_LEFT; +#else + if (sr.Position > ABE_BOTTOM) + m_Position = ABE_BOTTOM; + else + m_Position = sr.Position; +#endif + + /* Try to find out which monitor the tray window was located on last. + Here we're only interested in the monitor screen that we think + is the last one used. We're going to determine on which monitor + we really are after calculating the docked position. */ + rcScreen = sr.Rect; + GetScreenRectFromRect( + &rcScreen, + MONITOR_DEFAULTTONEAREST); + } + else + { + m_Position = ABE_BOTTOM; + AlwaysOnTop = TRUE; + + /* Use the minimum size of the taskbar, we'll use the start + button as a minimum for now. Make sure we calculate the + entire window size, not just the client size. However, we + use a thinner border than a standard thick border, so that + the start button and bands are not stuck to the screen border. */ + sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx)); + sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); + + /* Use the primary screen by default */ + rcScreen.left = 0; + rcScreen.top = 0; + rcScreen.right = GetSystemMetrics(SM_CXSCREEN); + rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN); + GetScreenRectFromRect( + &rcScreen, + MONITOR_DEFAULTTOPRIMARY); + } + + if (m_hWnd != NULL) + SetWindowPos( + AlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, + 0, + 0, + 0, + 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + + /* Determine a minimum tray window rectangle. The "client" height is + zero here since we cannot determine an optimal minimum width when + loaded as a vertical tray window. We just need to make sure the values + loaded from the registry are at least. The windows explorer behaves + the same way, it allows the user to save a zero width vertical tray + window, but not a zero height horizontal tray window. */ + WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx); + WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy)); + + if (WndSize.cx < sr.Size.cx) + WndSize.cx = sr.Size.cx; + if (WndSize.cy < sr.Size.cy) + WndSize.cy = sr.Size.cy; + + /* Save the calculated size */ + m_TraySize = WndSize; + + /* Calculate all docking rectangles. We need to do this here so they're + initialized and dragging the tray window to another position gives + usable results */ + for (Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++) + { + GetTrayRectFromScreenRect(Pos, + &rcScreen, + &m_TraySize, + &m_TrayRects[Pos]); + // TRACE("m_TrayRects[%d(%d)]: %d,%d,%d,%d\n", Pos, Position, m_TrayRects[Pos].left, m_TrayRects[Pos].top, m_TrayRects[Pos].right, m_TrayRects[Pos].bottom); + } + + /* Determine which monitor we are on. It shouldn't matter which docked + position rectangle we use */ + m_Monitor = GetMonitorFromRect(&m_TrayRects[ABE_LEFT]); + } + + VOID AlignControls(IN PRECT prcClient OPTIONAL) + { + RECT rcClient; + SIZE TraySize, StartSize; + POINT ptTrayNotify = { 0, 0 }; + BOOL Horizontal; + HDWP dwp; + + m_StartButton.UpdateSize(); + if (prcClient != NULL) + { + rcClient = *prcClient; + } + else + { + if (!GetClientRect(&rcClient)) + { + ERR("Could not get client rect lastErr=%d\n", GetLastError()); return; } } - CloseHandle(CreateThread(NULL, 0, s_RunFileDlgThread, this, 0, NULL)); + Horizontal = IsPosHorizontal(); + + /* We're about to resize/move the start button, the rebar control and + the tray notification control */ + dwp = BeginDeferWindowPos(3); + if (dwp == NULL) + { + ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError()); + return; + } + + /* Limit the Start button width to the client width, if neccessary */ + StartSize = m_StartButton.GetSize(); + if (StartSize.cx > rcClient.right) + StartSize.cx = rcClient.right; + + if (m_StartButton.m_hWnd != NULL) + { + /* Resize and reposition the button */ + dwp = m_StartButton.DeferWindowPos(dwp, + NULL, + 0, + 0, + StartSize.cx, + StartSize.cy, + SWP_NOZORDER | SWP_NOACTIVATE); + if (dwp == NULL) + { + ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError()); + return; + } + } + + /* Determine the size that the tray notification window needs */ + if (Horizontal) + { + TraySize.cx = 0; + TraySize.cy = rcClient.bottom; + } + else + { + TraySize.cx = rcClient.right; + TraySize.cy = 0; + } + + if (m_TrayNotify != NULL && + SendMessage(m_TrayNotify, + TNWM_GETMINIMUMSIZE, + (WPARAM)Horizontal, + (LPARAM)&TraySize)) + { + /* Move the tray notification window to the desired location */ + if (Horizontal) + ptTrayNotify.x = rcClient.right - TraySize.cx; + else + ptTrayNotify.y = rcClient.bottom - TraySize.cy; + + dwp = ::DeferWindowPos(dwp, + m_TrayNotify, + NULL, + ptTrayNotify.x, + ptTrayNotify.y, + TraySize.cx, + TraySize.cy, + SWP_NOZORDER | SWP_NOACTIVATE); + if (dwp == NULL) + { + ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError()); + return; + } + } + + /* Resize/Move the rebar control */ + if (m_Rebar != NULL) + { + POINT ptRebar = { 0, 0 }; + SIZE szRebar; + + SetWindowStyle(m_Rebar, CCS_VERT, Horizontal ? 0 : CCS_VERT); + + if (Horizontal) + { + ptRebar.x = StartSize.cx + GetSystemMetrics(SM_CXSIZEFRAME); + szRebar.cx = ptTrayNotify.x - ptRebar.x; + szRebar.cy = rcClient.bottom; + } + else + { + ptRebar.y = StartSize.cy + GetSystemMetrics(SM_CYSIZEFRAME); + szRebar.cx = rcClient.right; + szRebar.cy = ptTrayNotify.y - ptRebar.y; + } + + dwp = ::DeferWindowPos(dwp, + m_Rebar, + NULL, + ptRebar.x, + ptRebar.y, + szRebar.cx, + szRebar.cy, + SWP_NOZORDER | SWP_NOACTIVATE); + } + + if (dwp != NULL) + EndDeferWindowPos(dwp); + + if (m_TaskSwitch != NULL) + { + /* Update the task switch window configuration */ + SendMessage(m_TaskSwitch, TSWM_UPDATETASKBARPOS, 0, 0); + } } void PopupStartMenu() @@ -2169,17 +1991,333 @@ SetWindowPos(NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER); } - LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { + + + + + /********************************************************** + * ##### taskbar drawing ##### + */ + + LRESULT EraseBackgroundWithTheme(HDC hdc) + { + RECT rect; + int partId; + HRESULT res; + + GetClientRect(&rect); + + if (m_Theme) + { + GetClientRect(&rect); + switch (m_Position) + { + case ABE_LEFT: + partId = TBP_BACKGROUNDLEFT; + break; + case ABE_TOP: + partId = TBP_BACKGROUNDTOP; + break; + case ABE_RIGHT: + partId = TBP_BACKGROUNDRIGHT; + break; + case ABE_BOTTOM: + default: + partId = TBP_BACKGROUNDBOTTOM; + break; + } + res = DrawThemeBackground(m_Theme, hdc, partId, 0, &rect, 0); + } + + return res; + } + + int DrawSizerWithTheme(IN HRGN hRgn) + { + HDC hdc; + RECT rect; + int backoundPart; + + GetWindowRect(&rect); + OffsetRect(&rect, -rect.left, -rect.top); + + hdc = GetDCEx(hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP); + + switch (m_Position) + { + case ABE_LEFT: + backoundPart = TBP_SIZINGBARLEFT; + rect.left = rect.right - GetSystemMetrics(SM_CXSIZEFRAME); + break; + case ABE_TOP: + backoundPart = TBP_SIZINGBARTOP; + rect.top = rect.bottom - GetSystemMetrics(SM_CYSIZEFRAME); + break; + case ABE_RIGHT: + backoundPart = TBP_SIZINGBARRIGHT; + rect.right = rect.left + GetSystemMetrics(SM_CXSIZEFRAME); + break; + case ABE_BOTTOM: + default: + backoundPart = TBP_SIZINGBARBOTTOM; + rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME); + break; + } + if (IsThemeBackgroundPartiallyTransparent(m_Theme, backoundPart, 0)) + { + DrawThemeParentBackground(m_hWnd, hdc, &rect); + } + DrawThemeBackground(m_Theme, hdc, backoundPart, 0, &rect, 0); + + ReleaseDC(hdc); + return 0; + } + + + + + + /* + * ITrayWindow + */ + HRESULT STDMETHODCALLTYPE Open() + { + RECT rcWnd; + + /* Check if there's already a window created and try to show it. + If it was somehow destroyed just create a new tray window. */ + if (m_hWnd != NULL && IsWindow()) + { + if (!IsWindowVisible()) + { + CheckTrayWndPosition(); + + ShowWindow(SW_SHOW); + } + + return S_OK; + } + + DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE; + if (AlwaysOnTop) + dwExStyle |= WS_EX_TOPMOST; + + DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | + WS_BORDER | WS_THICKFRAME; + + ZeroMemory(&rcWnd, sizeof(rcWnd)); + if (m_Position != (DWORD) -1) + rcWnd = m_TrayRects[m_Position]; + + if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle)) + return E_FAIL; + + return S_OK; + } + + HRESULT STDMETHODCALLTYPE Close() + { + if (m_hWnd != NULL) + { + SendMessage(m_hWnd, + WM_APP_TRAYDESTROY, + 0, + 0); + } + + return S_OK; + } + + HWND STDMETHODCALLTYPE GetHWND() + { + return m_hWnd; + } + + BOOL STDMETHODCALLTYPE IsSpecialHWND(IN HWND hWnd) + { + return (m_hWnd == hWnd || + (m_DesktopWnd != NULL && m_hWnd == m_DesktopWnd)); + } + + BOOL STDMETHODCALLTYPE IsHorizontal() + { + return IsPosHorizontal(); + } + + HFONT STDMETHODCALLTYPE GetCaptionFonts(OUT HFONT *phBoldCaption OPTIONAL) + { + if (phBoldCaption != NULL) + *phBoldCaption = m_StartButton.GetFont(); + + return m_CaptionFont; + } + + BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock) + { + BOOL bPrevLock = Locked; + + if (Locked != bLock) + { + Locked = bLock; + + if (m_TrayBandSite != NULL) + { + if (!SUCCEEDED(m_TrayBandSite->Lock(bLock))) + { + /* Reset?? */ + Locked = bPrevLock; + return bPrevLock; + } + } + + if (Locked && m_Theme) + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0); + } + else + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER); + } + SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); + + } + + return bPrevLock; + } + + + + + + + /********************************************************** + * ##### message handling ##### + */ + + LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + ((ITrayWindow*)this)->AddRef(); + + SetWindowTheme(m_hWnd, L"TaskBar", NULL); + + InterlockedIncrement(&TrayWndCount); + + if (m_CaptionFont == NULL) + { + NONCLIENTMETRICS ncm; + + /* Get the system fonts, we use the caption font, + always bold, though. */ + ncm.cbSize = sizeof(ncm); + if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE)) + { + if (m_CaptionFont == NULL) + { + ncm.lfCaptionFont.lfWeight = FW_NORMAL; + m_CaptionFont = CreateFontIndirect(&ncm.lfCaptionFont); + } + } + } + + /* Create the Start button */ + m_StartButton.Create(m_hWnd); + /* Load the saved tray window settings */ RegLoadSettings(); + /* Create and initialize the start menu */ + HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU)); + m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0); + + /* Load the tray band site */ + m_TrayBandSite = CreateTrayBandSite(this, &m_Rebar, &m_TaskSwitch); + SetWindowTheme(m_Rebar, L"TaskBar", NULL); + + /* Create the tray notification window */ + m_TrayNotify = CreateTrayNotifyWnd(this, HideClock, &m_TrayNotifyInstance); + + if (UpdateNonClientMetrics()) + { + SetWindowsFont(); + } + /* Move the tray window to the right position and resize it if neccessary */ CheckTrayWndPosition(); /* Align all controls on the tray window */ AlignControls(NULL); + InitShellServices(&m_ShellServices); + + if (AutoHide) + { + m_AutoHideState = AUTOHIDE_HIDING; + SetTimer(TIMER_ID_AUTOHIDE, AUTOHIDE_DELAY_HIDE, NULL); + } + + RegisterHotKey(m_hWnd, IDHK_RUN, MOD_WIN, 'R'); + RegisterHotKey(m_hWnd, IDHK_MINIMIZE_ALL, MOD_WIN, 'M'); + RegisterHotKey(m_hWnd, IDHK_RESTORE_ALL, MOD_WIN|MOD_SHIFT, 'M'); + RegisterHotKey(m_hWnd, IDHK_HELP, MOD_WIN, VK_F1); + RegisterHotKey(m_hWnd, IDHK_EXPLORE, MOD_WIN, 'E'); + RegisterHotKey(m_hWnd, IDHK_FIND, MOD_WIN, 'F'); + RegisterHotKey(m_hWnd, IDHK_FIND_COMPUTER, MOD_WIN|MOD_CONTROL, 'F'); + RegisterHotKey(m_hWnd, IDHK_NEXT_TASK, MOD_WIN, VK_TAB); + RegisterHotKey(m_hWnd, IDHK_PREV_TASK, MOD_WIN|MOD_SHIFT, VK_TAB); + RegisterHotKey(m_hWnd, IDHK_SYS_PROPERTIES, MOD_WIN, VK_PAUSE); + RegisterHotKey(m_hWnd, IDHK_DESKTOP, MOD_WIN, 'D'); + RegisterHotKey(m_hWnd, IDHK_PAGER, MOD_WIN, 'B'); + + return TRUE; + } + + LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if (m_Theme) + CloseThemeData(m_Theme); + + if (IsThemeActive()) + m_Theme = OpenThemeData(m_hWnd, L"TaskBar"); + else + m_Theme = NULL; + + if (Locked && m_Theme) + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0); + } + else + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER); + } + SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER); + + return TRUE; + } + + LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + HDC hdc = (HDC) wParam; + + if (!m_Theme) + { + bHandled = FALSE; + return 0; + } + + return EraseBackgroundWithTheme(hdc); + } + + LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + /* Load the saved tray window settings */ + RegLoadSettings(); + + /* Move the tray window to the right position and resize it if neccessary */ + CheckTrayWndPosition(); + + /* Align all controls on the tray window */ + AlignControls(NULL); + return TRUE; } @@ -2201,7 +2339,7 @@ return 0; } - return DrawSizer((HRGN) wParam); + return DrawSizerWithTheme((HRGN) wParam); } LRESULT OnCtlColorBtn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -2627,12 +2765,6 @@ return TRUE; } - LRESULT DoExitWindows() - { - ExitWindowsDialog(m_hWnd); - return 0; - } - LRESULT OnDoExitWindows(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { /* @@ -2654,70 +2786,9 @@ return TRUE; } - HRESULT ExecResourceCmd(int id) - { - WCHAR szCommand[256]; - WCHAR *pszParameters; - - if (!LoadStringW(hExplorerInstance, - id, - szCommand, - _countof(szCommand))) - { - return E_FAIL; - } - - pszParameters = wcschr(szCommand, L'>'); - if (pszParameters) - { - *pszParameters = 0; - pszParameters++; - } - - ShellExecuteW(m_hWnd, NULL, szCommand, pszParameters, NULL, SW_SHOWNORMAL); - return S_OK; - } - LRESULT OnHotkey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - switch (wParam) - { - case IDHK_RUN: - DisplayRunFileDlg(); - break; - case IDHK_HELP: - ExecResourceCmd(IDS_HELP_COMMAND); - break; - case IDHK_EXPLORE: - //FIXME: We don't support this yet: - //ShellExecuteW(0, L"explore", NULL, NULL, NULL, 1); - ShellExecuteW(0, NULL, L"explorer.exe", NULL, NULL, 1); - break; - case IDHK_FIND: - SHFindFiles(NULL, NULL); - break; - case IDHK_FIND_COMPUTER: - SHFindComputer(NULL, NULL); - break; - case IDHK_SYS_PROPERTIES: - //FIXME: Use SHRunControlPanel - ShellExecuteW(m_hWnd, NULL, L"sysdm.cpl", NULL, NULL, SW_NORMAL); - break; - case IDHK_NEXT_TASK: - break; - case IDHK_PREV_TASK: - break; - case IDHK_MINIMIZE_ALL: - break; - case IDHK_RESTORE_ALL: - break; - case IDHK_DESKTOP: - break; - case IDHK_PAGER: - break; - } - - return 0; + return HandleHotKey(wParam); } LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -2732,38 +2803,7 @@ if (m_TrayBandSite == NULL || FAILED_UNEXPECTEDLY(m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret))) { - switch (LOWORD(wParam)) - { - case IDM_TASKBARANDSTARTMENU: - DisplayProperties(); - break; - - case IDM_SEARCH: - SHFindFiles(NULL, NULL); - break; - - case IDM_HELPANDSUPPORT: - ExecResourceCmd(IDS_HELP_COMMAND); - break; - - case IDM_RUN: - DisplayRunFileDlg(); - break; - - /* FIXME: Handle these commands as well */ - case IDM_SYNCHRONIZE: - case IDM_DISCONNECT: - case IDM_UNDOCKCOMPUTER: - break; - - case IDM_LOGOFF: - LogoffWindowsDialog(m_hWnd); // FIXME: Maybe handle it in a similar way as DoExitWindows? - break; - - case IDM_SHUTDOWN: - DoExitWindows(); - break; - } + return HandleCommand(LOWORD(wParam)); } return Ret; }
8 years, 4 months
1
0
0
0
[jimtabor] 72439: [NtUser] - Properly sync wine menu code. Attempt to fix CORE-11892.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Tue Aug 23 16:33:44 2016 New Revision: 72439 URL:
http://svn.reactos.org/svn/reactos?rev=72439&view=rev
Log: [NtUser] - Properly sync wine menu code. Attempt to fix CORE-11892. Modified: trunk/reactos/win32ss/user/ntuser/menu.c Modified: trunk/reactos/win32ss/user/ntuser/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Tue Aug 23 16:33:44 2016 @@ -2596,7 +2596,7 @@ UINT u; item = menu->rgItems; - for (u = 0; u < menu->cItems; u++, item++) + for( u = menu->cItems; u > 0; u--, item++) { MENU_DrawMenuItem(wnd, menu, menu->spwndNotify, hdc, item, menu->cyMenu, FALSE, ODA_DRAWENTIRE);
8 years, 4 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
47
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Results per page:
10
25
50
100
200