diff options
| author | Jason Rumney | 2009-06-30 15:48:23 +0000 |
|---|---|---|
| committer | Jason Rumney | 2009-06-30 15:48:23 +0000 |
| commit | ff90fbdecc6ffb1e34fe5ee9c1f080106c0739df (patch) | |
| tree | 220a6ca0665b2ed33868247c02949704fa510335 /src | |
| parent | 974647ac913e1280e7142321a19e3b7eaabefc25 (diff) | |
| download | emacs-ff90fbdecc6ffb1e34fe5ee9c1f080106c0739df.tar.gz emacs-ff90fbdecc6ffb1e34fe5ee9c1f080106c0739df.zip | |
bug#1849 - Windows 7 Taskbar Support
* w32term.c (w32_initialize): Use GetModuleHandle for library that
is already loaded.
Set user model ID if supported (bug#1849).
* runemacs.c (set_user_model_id): New function.
(WinMain): Use it.
* emacsclient.c (w32_give_focus): Use GetModuleHandle for library
that is already loaded.
(w32_set_user_model_id): New function.
(main): Use it to associate emacsclient with emacs (bug#1849).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32term.c | 28 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dcf58c7f631..b06bf4fac8c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-06-30 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32term.c (w32_initialize): Use GetModuleHandle for library that | ||
| 4 | is already loaded. | ||
| 5 | Set user model ID if supported (bug#1849). | ||
| 6 | |||
| 1 | 2009-06-29 Jim Meyering <meyering@redhat.com> | 7 | 2009-06-29 Jim Meyering <meyering@redhat.com> |
| 2 | 8 | ||
| 3 | Remove useless if-before-xfree test. | 9 | Remove useless if-before-xfree test. |
diff --git a/src/w32term.c b/src/w32term.c index 209e86edc8b..c3cfc341169 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -138,7 +138,7 @@ typedef struct tagGLYPHSET | |||
| 138 | #endif | 138 | #endif |
| 139 | 139 | ||
| 140 | /* Dynamic linking to SetLayeredWindowAttribute (only since 2000). */ | 140 | /* Dynamic linking to SetLayeredWindowAttribute (only since 2000). */ |
| 141 | BOOL (PASCAL *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); | 141 | BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); |
| 142 | 142 | ||
| 143 | #ifndef LWA_ALPHA | 143 | #ifndef LWA_ALPHA |
| 144 | #define LWA_ALPHA 0x02 | 144 | #define LWA_ALPHA 0x02 |
| @@ -6340,6 +6340,9 @@ DWORD WINAPI w32_msg_worker (void * arg); | |||
| 6340 | static void | 6340 | static void |
| 6341 | w32_initialize () | 6341 | w32_initialize () |
| 6342 | { | 6342 | { |
| 6343 | HANDLE shell; | ||
| 6344 | HRESULT (WINAPI * set_user_model) (PCWSTR); | ||
| 6345 | |||
| 6343 | baud_rate = 19200; | 6346 | baud_rate = 19200; |
| 6344 | 6347 | ||
| 6345 | w32_system_caret_hwnd = NULL; | 6348 | w32_system_caret_hwnd = NULL; |
| @@ -6347,6 +6350,25 @@ w32_initialize () | |||
| 6347 | w32_system_caret_x = 0; | 6350 | w32_system_caret_x = 0; |
| 6348 | w32_system_caret_y = 0; | 6351 | w32_system_caret_y = 0; |
| 6349 | 6352 | ||
| 6353 | /* On Windows 7 and later, we need to set the user model ID | ||
| 6354 | to associate emacsclient launched files with Emacs frames | ||
| 6355 | in the UI. */ | ||
| 6356 | shell = GetModuleHandle ("shell32.dll"); | ||
| 6357 | if (shell) | ||
| 6358 | { | ||
| 6359 | set_user_model | ||
| 6360 | = (void *) GetProcAddress (shell, | ||
| 6361 | "SetCurrentProcessExplicitAppUserModelID"); | ||
| 6362 | |||
| 6363 | /* If the function is defined, then we are running on Windows 7 | ||
| 6364 | or newer, and the UI uses this to group related windows | ||
| 6365 | together. Since emacs, runemacs, emacsclient are related, we | ||
| 6366 | want them grouped even though the executables are different, | ||
| 6367 | so we need to set a consistent ID between them. */ | ||
| 6368 | if (set_user_model) | ||
| 6369 | set_user_model (L"GNU.Emacs"); | ||
| 6370 | } | ||
| 6371 | |||
| 6350 | /* Initialize w32_use_visible_system_caret based on whether a screen | 6372 | /* Initialize w32_use_visible_system_caret based on whether a screen |
| 6351 | reader is in use. */ | 6373 | reader is in use. */ |
| 6352 | if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, | 6374 | if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, |
| @@ -6400,7 +6422,7 @@ w32_initialize () | |||
| 6400 | 6422 | ||
| 6401 | /* Dynamically link to optional system components. */ | 6423 | /* Dynamically link to optional system components. */ |
| 6402 | { | 6424 | { |
| 6403 | HANDLE user_lib = LoadLibrary ("user32.dll"); | 6425 | HMODULE user_lib = GetModuleHandle ("user32.dll"); |
| 6404 | 6426 | ||
| 6405 | #define LOAD_PROC(lib, fn) pfn##fn = (void *) GetProcAddress (lib, #fn) | 6427 | #define LOAD_PROC(lib, fn) pfn##fn = (void *) GetProcAddress (lib, #fn) |
| 6406 | 6428 | ||
| @@ -6408,8 +6430,6 @@ w32_initialize () | |||
| 6408 | 6430 | ||
| 6409 | #undef LOAD_PROC | 6431 | #undef LOAD_PROC |
| 6410 | 6432 | ||
| 6411 | FreeLibrary (user_lib); | ||
| 6412 | |||
| 6413 | /* Ensure scrollbar handle is at least 5 pixels. */ | 6433 | /* Ensure scrollbar handle is at least 5 pixels. */ |
| 6414 | vertical_scroll_bar_min_handle = 5; | 6434 | vertical_scroll_bar_min_handle = 5; |
| 6415 | 6435 | ||