* Windows 7 Application Identifier
@ 2009-05-24 16:01 Ben Straub
0 siblings, 0 replies; 2+ messages in thread
From: Ben Straub @ 2009-05-24 16:01 UTC (permalink / raw
To: emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 577 bytes --]
This patch sets an application identifier string under Windows 7,
The problem is that emacs.exe and emacsclient.exe are separate executables,
and so pinning emacsclient.exe to the taskbar clutters the taskbar (see
attached before.png; the left icon is a shortcut to emacsclientw, the
rightmost is the running emacs instance).
As documented at
http://msdn.microsoft.com/en-us/library/dd378459.aspx<http://msdn.microsoft.com/en-us/library/dd378459(VS.85).aspx>,
this situation can be avoided.by setting an application identifier when
starting both processes (after.png).
-- Ben
[-- Attachment #1.2: Type: text/html, Size: 724 bytes --]
[-- Attachment #2: win7appid.patch --]
[-- Type: application/octet-stream, Size: 2437 bytes --]
From 9cbc41e9d7c8b90b1c6c62a106463288467c4322 Mon Sep 17 00:00:00 2001
From: unknown <Ben@.(none)>
Date: Sun, 24 May 2009 08:21:12 -0700
Subject: [PATCH] Now setting AppID on Windows 7.
---
lib-src/emacsclient.c | 16 ++++++++++++++++
src/w32term.c | 18 ++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index a451c1b..fc13071 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# define CLOSE_SOCKET closesocket
# define INITIALIZE() (initialize_sockets ())
+/* Setting AppID for Windows 7 */
+HRESULT (*pfnSetAppID)(PCWSTR);
+
#else /* !WINDOWSNT */
# include "syswait.h"
@@ -1498,6 +1501,19 @@ main (argc, argv)
char string[BUFSIZ+1];
int null_socket_name, null_server_file, start_daemon_if_needed;
+ /* Set AppID so our icons stack on emacsclient's on Windows 7 */
+ {
+ /* HRESULT SetCurrentProcessExplicitAppUserModelID(PCWSTR AppID); */
+ HANDLE shell_lib = LoadLibrary ("shell32.dll");
+ pfnSetAppID = (void*)
+ GetProcAddress(shell_lib, "SetCurrentProcessExplicitAppUserModelID");
+ if (pfnSetAppID)
+ {
+ pfnSetAppID(L"GNU.Emacs");
+ MessageBox(NULL, "AppID", "AppID", MB_OK);
+ }
+ }
+
main_argv = argv;
progname = argv[0];
diff --git a/src/w32term.c b/src/w32term.c
index f38895b..fcb67cf 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -140,6 +140,10 @@ typedef struct tagGLYPHSET
/* Dynamic linking to SetLayeredWindowAttribute (only since 2000). */
BOOL (PASCAL *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
+/* Setting AppID for Windows 7 */
+HRESULT (*pfnSetAppID)(PCWSTR);
+
+
#ifndef LWA_ALPHA
#define LWA_ALPHA 0x02
#endif
@@ -6399,6 +6403,20 @@ w32_initialize ()
vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border
= GetSystemMetrics (SM_CYVSCROLL);
}
+
+ /* Set AppID so our icons stack on emacsclient's on Windows 7 */
+ {
+ /* HRESULT SetCurrentProcessExplicitAppUserModelID(PCWSTR AppID); */
+ HANDLE shell_lib = LoadLibrary ("shell32.dll");
+ pfnSetAppID = (void*)
+ GetProcAddress(shell_lib, "SetCurrentProcessExplicitAppUserModelID");
+ if (pfnSetAppID)
+ {
+ pfnSetAppID(L"GNU.Emacs");
+ MessageBox(NULL, "AppID", "AppID", MB_OK);
+ }
+ }
+
}
void
--
1.6.3.msysgit.0
[-- Attachment #3: before.png --]
[-- Type: image/png, Size: 18741 bytes --]
[-- Attachment #4: after.png --]
[-- Type: image/png, Size: 3921 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Windows 7 Application Identifier
@ 2009-05-24 20:42 Ben Straub
0 siblings, 0 replies; 2+ messages in thread
From: Ben Straub @ 2009-05-24 20:42 UTC (permalink / raw
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
Apologies for the poor formatting of my last message, and also for the
dirty patch. Please review this patch instead, it's cleaner.
Also, it should be noted that this patch isn't a complete solution;
the real problem is that the start-menu shortcut that's pinned to the
taskbar doesn't have the correct AppID embedded. But this patch will
ensure that emacs and emacsclient(w) will stack while they're running,
and gives us a string to match when modifying that shortcut.
-- Ben
[-- Attachment #2: win7appid.patch --]
[-- Type: application/octet-stream, Size: 2405 bytes --]
From f235d4d6d08795c69778390887a80f479d717495 Mon Sep 17 00:00:00 2001
From: unknown <Ben@.(none)>
Date: Sun, 24 May 2009 13:38:48 -0700
Subject: [PATCH] Now setting AppID on Windows 7.
---
lib-src/emacsclient.c | 16 ++++++++++++++++
src/w32term.c | 18 ++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index a451c1b..33b5602 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -39,6 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# define CLOSE_SOCKET closesocket
# define INITIALIZE() (initialize_sockets ())
+/* Setting AppID for Windows 7 */
+HRESULT (*pfnSetAppID)(PCWSTR);
+
#else /* !WINDOWSNT */
# include "syswait.h"
@@ -1498,6 +1501,19 @@ main (argc, argv)
char string[BUFSIZ+1];
int null_socket_name, null_server_file, start_daemon_if_needed;
+ /* Set AppID so our icons stack on emacsclient's on Windows 7 */
+ {
+ /* HRESULT SetCurrentProcessExplicitAppUserModelID(PCWSTR AppID); */
+ HANDLE shell_lib = LoadLibrary ("shell32.dll");
+ pfnSetAppID = (void*)
+ GetProcAddress(shell_lib, "SetCurrentProcessExplicitAppUserModelID");
+ if (pfnSetAppID)
+ {
+ pfnSetAppID(L"GNU.Emacs");
+ }
+ FreeLibrary(shell_lib);
+ }
+
main_argv = argv;
progname = argv[0];
diff --git a/src/w32term.c b/src/w32term.c
index f38895b..b2bf698 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -140,6 +140,10 @@ typedef struct tagGLYPHSET
/* Dynamic linking to SetLayeredWindowAttribute (only since 2000). */
BOOL (PASCAL *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
+/* Setting AppID for Windows 7 */
+HRESULT (*pfnSetAppID)(PCWSTR);
+
+
#ifndef LWA_ALPHA
#define LWA_ALPHA 0x02
#endif
@@ -6399,6 +6403,20 @@ w32_initialize ()
vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border
= GetSystemMetrics (SM_CYVSCROLL);
}
+
+ /* Set AppID so our icons stack on emacsclient's on Windows 7 */
+ {
+ /* HRESULT SetCurrentProcessExplicitAppUserModelID(PCWSTR AppID); */
+ HANDLE shell_lib = LoadLibrary ("shell32.dll");
+ pfnSetAppID = (void*)
+ GetProcAddress(shell_lib, "SetCurrentProcessExplicitAppUserModelID");
+ if (pfnSetAppID)
+ {
+ pfnSetAppID(L"GNU.Emacs");
+ }
+ FreeLibrary(shell_lib);
+ }
+
}
void
--
1.6.3.msysgit.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-24 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-24 16:01 Windows 7 Application Identifier Ben Straub
-- strict thread matches above, loose matches on Subject: below --
2009-05-24 20:42 Ben Straub
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.