Taskbar grouping in Windows 7

Tobias Häußler tobias.haeussler@gmx.de
Mon Jul 25 11:20:00 GMT 2011


On 19.07.2011 17:17, Jon TURNEY wrote:
> On 01/07/2011 21:38, Tobias Häußler wrote:
>> On 29/06/2011 15:25, Jon TURNEY wrote:
>>> On 25/06/2011 13:48, Tobias Häußler wrote:
>>>> I created a small patch for XWin that adds correct grouping of taskbar
>>>> icons when 'Always combine, hide labels' is set in the taskbar
>>>> properties. It uses the new taskbar APIs introduced in Windows 7 to set
>>>> an application id for each window. The id is based on the X11 class hints.
>>>> Maybe it is useful for someone...
>>>
>>> Firstly, thanks very much for this patch.
>>>
>>> Getting Windows to correctly group XWin windows on the taskbar is something
>>> that has needed fixing for a while, so it's great to have it done :-)
>>
>> Thanks for your suggestions! I changed the code you mentioned.
>
> Thanks.  I've included this patch into the 1.10.3-1 package.
>
> I noticed that there are a couple of warnings issued when building
>
>>    CC     winmultiwindowwm.o
>> In file included from winmultiwindowwm.c:69:0:
>> taskbar.h:59:19: warning: ‘IID_IPropertyStore’ initialized and declared ‘extern’
>> taskbar.h:67:53: warning: ‘PKEY_AppUserModel_ID’ initialized and declared ‘extern’
>
> This seems to be related to the nonsense that is INITGUID.  I'm not sure how
> to fix this warning.  Would moving all the GUIDs we use (including the DirectX
> ones we use) to a separate file and compiling that with INITGUID defined be
> the correct solution?

I don't know the right way to deal with that, but it seems to work if 
taskbar.h is included in a separate .c-file with INITGUID defined, and 
in winmultiwindowwm.c without:

--- taskbar.c:
#define INITGUID
#include <basetyps.h>
#include <shlguid.h>

#include "taskbar.h"

--- winmultiwindowwm.c:
#include "taskbar.h"

The current solution produces this warning because of the declaration of 
DEFINE_GUID in basetyps.h and initguid.h:

DEFINE_GUID with INITGUID in basetyps.h resolves to:
   const GUID IID_IPropertyStore = {a,b,c,...}

DEFINE_GUID without INITGUID in basetyps.h resolves to:
   extern const GUID IID_IPropertyStore;

DEFINE_GUID with INITGUID in initguid.h resolves to:
   (extern) const GUID IID_IPropertyStore = {a,b,c,...}
Whether extern is appended or not depends on basetyps.h, which is 
included before initguid.h.

Including initguid.h (with INITGUID defined) after basetyps.h appends "= 
{a,b,c}", but does not remove "extern". In winmultiwindowwm.c this is 
the case, as basetyps.h is included by objbase.h before initguid.h.

The DirectX-GUIDs are initialized in the lib*.a-files of w32api, 
therefore INITGUID is not necessary and the warnings are not present. As 
soon as w32api contains the GUID for IID_IPropertyStore, taskbar.c with 
INITGUID can be removed.


>
> The other thing I noticed is that PropVariantClear() has been provided by
> ole32.dll since at least NT4, so there's no need to dynamically link with it.
>   So I'm confused as to why you are using GetProcAddress for that?
>

PropVariantClear() is not declared in the header files of w32api, so I 
had to link it dynamically.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list