summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJesús Corrius <jesus@softcatala.org>2012-05-23 22:06:44 +0200
committerJesús Corrius <jesus@softcatala.org>2012-05-24 08:38:12 +0200
commit776db316d271d14e653426e21e66b983ec52100a (patch)
tree711b39f03067749e2c9b63c81b2451d7c902a915 /desktop
parenteadcfa4e276aad610c674dd3eabc0956cb669d9b (diff)
set explicit Application User Models IDs in the native Windows launchers
Change-Id: Ib60a2a4f0d28a53d997731eb34b118cc9b9f822d
Diffstat (limited to 'desktop')
-rw-r--r--desktop/Executable_sbase.mk4
-rw-r--r--desktop/Executable_scalc.mk4
-rw-r--r--desktop/Executable_sdraw.mk4
-rw-r--r--desktop/Executable_simpress.mk4
-rw-r--r--desktop/Executable_smath.mk4
-rw-r--r--desktop/Executable_sweb.mk4
-rw-r--r--desktop/Executable_swriter.mk4
-rw-r--r--desktop/Module_desktop.mk1
-rw-r--r--desktop/StaticLibrary_appusermodelid.mk38
-rw-r--r--desktop/win32/source/applauncher/appusermodelid.cxx72
-rw-r--r--desktop/win32/source/applauncher/appusermodelid.hxx34
-rw-r--r--desktop/win32/source/applauncher/launcher.cxx6
-rw-r--r--desktop/win32/source/applauncher/launcher.hxx3
-rw-r--r--desktop/win32/source/applauncher/sbase.cxx2
-rw-r--r--desktop/win32/source/applauncher/scalc.cxx2
-rw-r--r--desktop/win32/source/applauncher/sdraw.cxx2
-rw-r--r--desktop/win32/source/applauncher/simpress.cxx2
-rw-r--r--desktop/win32/source/applauncher/smath.cxx2
-rw-r--r--desktop/win32/source/applauncher/sweb.cxx2
-rw-r--r--desktop/win32/source/applauncher/swriter.cxx2
20 files changed, 196 insertions, 0 deletions
diff --git a/desktop/Executable_sbase.mk b/desktop/Executable_sbase.mk
index 375cba33385f..d09faf47ea78 100644
--- a/desktop/Executable_sbase.mk
+++ b/desktop/Executable_sbase.mk
@@ -37,6 +37,10 @@ $(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 ce90099a532b..6b626e54e635 100644
--- a/desktop/Executable_scalc.mk
+++ b/desktop/Executable_scalc.mk
@@ -37,6 +37,10 @@ $(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 4642445173b4..0b1b9f44cb9f 100644
--- a/desktop/Executable_sdraw.mk
+++ b/desktop/Executable_sdraw.mk
@@ -37,6 +37,10 @@ $(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 c3026435e3f4..0ad598688fa5 100644
--- a/desktop/Executable_simpress.mk
+++ b/desktop/Executable_simpress.mk
@@ -37,6 +37,10 @@ $(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 4c7c4afb8232..cbbb5bd3b655 100644
--- a/desktop/Executable_smath.mk
+++ b/desktop/Executable_smath.mk
@@ -37,6 +37,10 @@ $(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 870cf7d6c86a..dd88c31d9228 100644
--- a/desktop/Executable_sweb.mk
+++ b/desktop/Executable_sweb.mk
@@ -37,6 +37,10 @@ $(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 acd299b641ca..f0b435f09fd5 100644
--- a/desktop/Executable_swriter.mk
+++ b/desktop/Executable_swriter.mk
@@ -37,6 +37,10 @@ $(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 cb067b3205c6..cdc3d9920896 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -77,6 +77,7 @@ 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
new file mode 100644
index 000000000000..2970fa5cd7e9
--- /dev/null
+++ b/desktop/StaticLibrary_appusermodelid.mk
@@ -0,0 +1,38 @@
+# -*- 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
new file mode 100644
index 000000000000..721fefa6edc4
--- /dev/null
+++ b/desktop/win32/source/applauncher/appusermodelid.cxx
@@ -0,0 +1,72 @@
+/* -*- 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_s(szShell32, MAX_PATH, 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
new file mode 100644
index 000000000000..42941d0653b6
--- /dev/null
+++ b/desktop/win32/source/applauncher/appusermodelid.hxx
@@ -0,0 +1,34 @@
+/* -*- 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 96b94bbbfd7d..8ba9cb6ee046 100644
--- a/desktop/win32/source/applauncher/launcher.cxx
+++ b/desktop/win32/source/applauncher/launcher.cxx
@@ -28,6 +28,7 @@
#include "launcher.hxx"
+#include "appusermodelid.hxx"
#ifndef _WINDOWS_
@@ -53,6 +54,10 @@ 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
+
+ SetExplicitAppUserModelID(APPUSERMODELID);
+
// Retreive startup info
STARTUPINFO aStartupInfo;
@@ -86,6 +91,7 @@ extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
_tsplitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
_tmakepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, _T(".exe") );
+
PROCESS_INFORMATION aProcessInfo;
BOOL fSuccess = CreateProcess(
diff --git a/desktop/win32/source/applauncher/launcher.hxx b/desktop/win32/source/applauncher/launcher.hxx
index 46829d67037c..0dcf720f2aac 100644
--- a/desktop/win32/source/applauncher/launcher.hxx
+++ b/desktop/win32/source/applauncher/launcher.hxx
@@ -4,6 +4,8 @@
#error Need C++ to compile
#endif
+#include <Windows.h>
+
#ifndef _INC_TCHAR
# ifdef UNICODE
# define _UNICODE
@@ -20,5 +22,6 @@
#define OFFICE_IMAGE_NAME _T("soffice")
extern _TCHAR APPLICATION_SWITCH[];
+extern LPCWSTR APPUSERMODELID;
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sbase.cxx b/desktop/win32/source/applauncher/sbase.cxx
index 9823ef28282e..c0d6215902ed 100644
--- a/desktop/win32/source/applauncher/sbase.cxx
+++ b/desktop/win32/source/applauncher/sbase.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--base" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Base";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/scalc.cxx b/desktop/win32/source/applauncher/scalc.cxx
index d91cd3430d83..19017dc4479d 100644
--- a/desktop/win32/source/applauncher/scalc.cxx
+++ b/desktop/win32/source/applauncher/scalc.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--calc" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Calc";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sdraw.cxx b/desktop/win32/source/applauncher/sdraw.cxx
index 360259defd23..3155109f103a 100644
--- a/desktop/win32/source/applauncher/sdraw.cxx
+++ b/desktop/win32/source/applauncher/sdraw.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--draw" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Draw";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/simpress.cxx b/desktop/win32/source/applauncher/simpress.cxx
index bb4a2bf1a2fc..5d0df8204843 100644
--- a/desktop/win32/source/applauncher/simpress.cxx
+++ b/desktop/win32/source/applauncher/simpress.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--impress" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Impress";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/smath.cxx b/desktop/win32/source/applauncher/smath.cxx
index 559dfa65e71a..d90fed065463 100644
--- a/desktop/win32/source/applauncher/smath.cxx
+++ b/desktop/win32/source/applauncher/smath.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--math" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Math";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/sweb.cxx b/desktop/win32/source/applauncher/sweb.cxx
index ec01bcc45461..7af39cdedeeb 100644
--- a/desktop/win32/source/applauncher/sweb.cxx
+++ b/desktop/win32/source/applauncher/sweb.cxx
@@ -32,4 +32,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--web" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Writer";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/win32/source/applauncher/swriter.cxx b/desktop/win32/source/applauncher/swriter.cxx
index ff83e00a78a6..1b9f2e74c9e4 100644
--- a/desktop/win32/source/applauncher/swriter.cxx
+++ b/desktop/win32/source/applauncher/swriter.cxx
@@ -30,4 +30,6 @@
_TCHAR APPLICATION_SWITCH[] = _T( "--writer" );
+LPCWSTR APPUSERMODELID = L"TheDocumentFoundation.LibreOffice.Writer";
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */