diff options
author | Jesús Corrius <jesus@softcatala.org> | 2012-06-04 11:26:20 +0200 |
---|---|---|
committer | Jesús Corrius <jesus@softcatala.org> | 2012-06-04 11:26:20 +0200 |
commit | 67673e9ba6788f4c85bfdaac6091148086f12941 (patch) | |
tree | 6e1b9de8b424f6a163bb76f93e8ef9e867f00810 /desktop | |
parent | Bypass scripting in one more place when DISABLE_SCRIPTING (diff) | |
download | core-67673e9ba6788f4c85bfdaac6091148086f12941.tar.gz core-67673e9ba6788f4c85bfdaac6091148086f12941.zip |
Move the AppUserModelID code to the launcher
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/Executable_sbase.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_scalc.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_sdraw.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_simpress.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_smath.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_sweb.mk | 4 | ||||
-rw-r--r-- | desktop/Executable_swriter.mk | 4 | ||||
-rw-r--r-- | desktop/Module_desktop.mk | 1 | ||||
-rw-r--r-- | desktop/StaticLibrary_appusermodelid.mk | 38 | ||||
-rw-r--r-- | desktop/win32/source/applauncher/appusermodelid.cxx | 72 | ||||
-rw-r--r-- | desktop/win32/source/applauncher/appusermodelid.hxx | 34 | ||||
-rw-r--r-- | desktop/win32/source/applauncher/launcher.cxx | 44 |
12 files changed, 37 insertions, 180 deletions
diff --git a/desktop/Executable_sbase.mk b/desktop/Executable_sbase.mk index d09faf47ea78..375cba33385f 100644 --- a/desktop/Executable_sbase.mk +++ b/desktop/Executable_sbase.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,sbase,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,sbase,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,sbase,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_scalc.mk b/desktop/Executable_scalc.mk index 6b626e54e635..ce90099a532b 100644 --- a/desktop/Executable_scalc.mk +++ b/desktop/Executable_scalc.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,scalc,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,scalc,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,scalc,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_sdraw.mk b/desktop/Executable_sdraw.mk index 0b1b9f44cb9f..4642445173b4 100644 --- a/desktop/Executable_sdraw.mk +++ b/desktop/Executable_sdraw.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,sdraw,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,sdraw,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,sdraw,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_simpress.mk b/desktop/Executable_simpress.mk index 0ad598688fa5..c3026435e3f4 100644 --- a/desktop/Executable_simpress.mk +++ b/desktop/Executable_simpress.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,simpress,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,simpress,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,simpress,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_smath.mk b/desktop/Executable_smath.mk index cbbb5bd3b655..4c7c4afb8232 100644 --- a/desktop/Executable_smath.mk +++ b/desktop/Executable_smath.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,smath,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,smath,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,smath,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_sweb.mk b/desktop/Executable_sweb.mk index dd88c31d9228..870cf7d6c86a 100644 --- a/desktop/Executable_sweb.mk +++ b/desktop/Executable_sweb.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,sweb,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,sweb,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,sweb,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Executable_swriter.mk b/desktop/Executable_swriter.mk index f0b435f09fd5..acd299b641ca 100644 --- a/desktop/Executable_swriter.mk +++ b/desktop/Executable_swriter.mk @@ -37,10 +37,6 @@ $(eval $(call gb_Executable_use_libraries,swriter,\ $(gb_STDLIBS) \ )) -$(eval $(call gb_Executable_use_static_libraries,swriter,\ - appusermodelid \ -)) - $(eval $(call gb_Executable_add_libs,swriter,\ $(call gb_CxxObject_get_target,desktop/win32/source/applauncher/launcher) \ )) diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk index cdc3d9920896..cb067b3205c6 100644 --- a/desktop/Module_desktop.mk +++ b/desktop/Module_desktop.mk @@ -77,7 +77,6 @@ ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,desktop,\ StaticLibrary_winextendloaderenv \ StaticLibrary_winlauncher \ - StaticLibrary_appusermodelid \ Executable_crashrep.com \ Executable_quickstart \ Executable_sbase \ diff --git a/desktop/StaticLibrary_appusermodelid.mk b/desktop/StaticLibrary_appusermodelid.mk deleted file mode 100644 index 2970fa5cd7e9..000000000000 --- a/desktop/StaticLibrary_appusermodelid.mk +++ /dev/null @@ -1,38 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# Major Contributor(s): -# Copyright (C) 2012 Jesús Corrius <jesus@softcatala.org> (initial developer) -# -# All Rights Reserved. -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_StaticLibrary_StaticLibrary,appusermodelid)) - -$(eval $(call gb_StaticLibrary_add_defs,appusermodelid,\ - -DUNICODE \ -)) - -$(eval $(call gb_StaticLibrary_add_noexception_objects,appusermodelid,\ - desktop/win32/source/applauncher/appusermodelid \ -)) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/desktop/win32/source/applauncher/appusermodelid.cxx b/desktop/win32/source/applauncher/appusermodelid.cxx deleted file mode 100644 index 209581768f93..000000000000 --- a/desktop/win32/source/applauncher/appusermodelid.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2012 Jesús Corrius <jesus@softcatala.org> (initial developer) - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "appusermodelid.hxx" - -#include <winbase.h> -#include <shlwapi.h> - -#define PACKVERSION(major,minor) MAKELONG(minor,major) - -void SetExplicitAppUserModelID(PCWSTR AppID) -{ - WCHAR szShell32[MAX_PATH]; - GetSystemDirectoryW(szShell32, MAX_PATH); - wcscat(szShell32, L"\\Shell32.dll"); - - HINSTANCE hinstDll = LoadLibraryW(szShell32); - - if(hinstDll) - { - DLLVERSIONINFO dvi; - ZeroMemory(&dvi, sizeof(dvi)); - dvi.cbSize = sizeof(dvi); - - DLLGETVERSIONPROC pDllGetVersion; - pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion"); - HRESULT hr = (*pDllGetVersion)(&dvi); - - if(SUCCEEDED(hr)) - { - DWORD dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion); - if(dwVersion >= PACKVERSION(6,1)) // Shell32 version in Windows 7 - { - typedef HRESULT (WINAPI *SETCURRENTPROCESSEXPLICITAPPUSERMODELID)(PCWSTR); - SETCURRENTPROCESSEXPLICITAPPUSERMODELID pSetCurrentProcessExplicitAppUserModelID; - pSetCurrentProcessExplicitAppUserModelID = - (SETCURRENTPROCESSEXPLICITAPPUSERMODELID)GetProcAddress(hinstDll, "SetCurrentProcessExplicitAppUserModelID"); - - if(pSetCurrentProcessExplicitAppUserModelID) - (*pSetCurrentProcessExplicitAppUserModelID) (AppID); - } - } - } - FreeLibrary(hinstDll); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/win32/source/applauncher/appusermodelid.hxx b/desktop/win32/source/applauncher/appusermodelid.hxx deleted file mode 100644 index 42941d0653b6..000000000000 --- a/desktop/win32/source/applauncher/appusermodelid.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2012 Jesús Corrius <jesus@softcatala.org> (initial developer) - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#pragma once -#include <windows.h> - -void SetExplicitAppUserModelID(LPCWSTR AppID); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx index 074e2b533270..24843a41ef02 100644 --- a/desktop/win32/source/applauncher/launcher.cxx +++ b/desktop/win32/source/applauncher/launcher.cxx @@ -26,10 +26,7 @@ * ************************************************************************/ - #include "launcher.hxx" -#include "appusermodelid.hxx" - #ifndef _WINDOWS_ # define WIN32_LEAN_AND_MEAN @@ -38,15 +35,18 @@ #endif # include <windows.h> # include <shellapi.h> +# include <winbase.h> +# include <shlwapi.h> #if defined _MSC_VER #pragma warning(pop) #endif #endif - #include <stdlib.h> #include <malloc.h> +#define PACKVERSION(major,minor) MAKELONG(minor,major) + #ifdef __MINGW32__ extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) @@ -54,10 +54,40 @@ extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) #endif { - // Set an explicit Application User Model ID for the process + // Set an explicit Application User Model ID for the process + + WCHAR szShell32[MAX_PATH]; + GetSystemDirectoryW(szShell32, MAX_PATH); + wcscat(szShell32, L"\\Shell32.dll"); - // FIXME: Comment this out until I find a fix for minGW. - // SetExplicitAppUserModelID(APPUSERMODELID); + HINSTANCE hinstDll = LoadLibraryW(szShell32); + + if(hinstDll) + { + DLLVERSIONINFO dvi; + ZeroMemory(&dvi, sizeof(dvi)); + dvi.cbSize = sizeof(dvi); + + DLLGETVERSIONPROC pDllGetVersion; + pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion"); + HRESULT hr = (*pDllGetVersion)(&dvi); + + if(SUCCEEDED(hr)) + { + DWORD dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion); + if(dwVersion >= PACKVERSION(6,1)) // Shell32 version in Windows 7 + { + typedef HRESULT (WINAPI *SETCURRENTPROCESSEXPLICITAPPUSERMODELID)(PCWSTR); + SETCURRENTPROCESSEXPLICITAPPUSERMODELID pSetCurrentProcessExplicitAppUserModelID; + pSetCurrentProcessExplicitAppUserModelID = + (SETCURRENTPROCESSEXPLICITAPPUSERMODELID)GetProcAddress(hinstDll, "SetCurrentProcessExplicitAppUserModelID"); + + if(pSetCurrentProcessExplicitAppUserModelID) + (*pSetCurrentProcessExplicitAppUserModelID) (APPUSERMODELID); + } + } + } + FreeLibrary(hinstDll); // Retreive startup info |