From d2d73da59e64acdc4718e4e6790a69d967bee875 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 29 Nov 2012 07:56:51 +0100 Subject: fontconfig xserver mesa git update 29 nov 2012 xserver: 1712a45422a63f11b2146541279616fcfda09ec6 fontconfig: faea1cac85ac3b0fd6a983e1c0adeb68e115e06c mesa: c1023608002c985b9d72edc64732cd666de2a206 --- xorg-server/hw/xwin/winSetAppUserModelID.c | 109 +++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 xorg-server/hw/xwin/winSetAppUserModelID.c (limited to 'xorg-server/hw/xwin/winSetAppUserModelID.c') diff --git a/xorg-server/hw/xwin/winSetAppUserModelID.c b/xorg-server/hw/xwin/winSetAppUserModelID.c new file mode 100644 index 000000000..ce9da5e7d --- /dev/null +++ b/xorg-server/hw/xwin/winSetAppUserModelID.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011 Tobias Häußler + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif + +#include +#include +#include +#include "winwindow.h" +#include "os.h" +#include "winmsg.h" + +#include + +#define INITGUID +#include "initguid.h" +#include "propertystore.h" +#undef INITGUID + +static HMODULE g_hmodShell32Dll = NULL; +static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL; + +void +winPropertyStoreInit(void) +{ + /* + Load library and get function pointer to SHGetPropertyStoreForWindow() + + SHGetPropertyStoreForWindow is only supported since Windows 7. On previous + versions the pointer will be NULL and taskbar grouping is not supported. + winSetAppUserModelID() will do nothing in this case. + */ + g_hmodShell32Dll = LoadLibrary("shell32.dll"); + if (g_hmodShell32Dll == NULL) { + ErrorF("winPropertyStoreInit - Could not load shell32.dll\n"); + return; + } + + g_pSHGetPropertyStoreForWindow = + (SHGETPROPERTYSTOREFORWINDOWPROC) GetProcAddress(g_hmodShell32Dll, + "SHGetPropertyStoreForWindow"); + if (g_pSHGetPropertyStoreForWindow == NULL) { + ErrorF + ("winPropertyStoreInit - Could not get SHGetPropertyStoreForWindow address\n"); + return; + } +} + +void +winPropertyStoreDestroy(void) +{ + if (g_hmodShell32Dll != NULL) { + FreeLibrary(g_hmodShell32Dll); + g_hmodShell32Dll = NULL; + g_pSHGetPropertyStoreForWindow = NULL; + } +} + +void +winSetAppUserModelID(HWND hWnd, const char *AppID) +{ + PROPVARIANT pv; + IPropertyStore *pps = NULL; + HRESULT hr; + + if (g_pSHGetPropertyStoreForWindow == NULL) { + return; + } + + winDebug("winSetAppUserMOdelID - hwnd 0x%08x appid '%s'\n", hWnd, AppID); + + hr = g_pSHGetPropertyStoreForWindow(hWnd, &IID_IPropertyStore, + (void **) &pps); + if (SUCCEEDED(hr) && pps) { + memset(&pv, 0, sizeof(PROPVARIANT)); + if (AppID) { + pv.vt = VT_LPWSTR; + hr = SHStrDupA(AppID, &pv.pwszVal); + } + + if (SUCCEEDED(hr)) { + pps->lpVtbl->SetValue(pps, &PKEY_AppUserModel_ID, &pv); + PropVariantClear(&pv); + } + pps->lpVtbl->Release(pps); + } +} -- cgit v1.2.3