comparison src/w32fns.c @ 24718:547f54dfbb94

(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET definition. (w32_wnd_proc): Reinstall debugging output. (w32_wnd_proc): Reinstall SetForegroundWindow change. (syms_of_w32fns): Reinstall new initializer for Vw32_phantom_key_code. (x_to_w32_charset): Do partial matching of charset names for most non-European charsets, to cope with wildcards or missing spec dates. (Fw32_send_sys_command): Post WM_SYSCOMMAND rather than sending it to avoid deadlock when activating the menu bar.
author Andrew Innes <andrewi@gnu.org>
date Tue, 11 May 1999 13:38:10 +0000
parents 2fe2c743ce68
children e0eaca5025bc
comparison
equal deleted inserted replaced
24717:ea66a10b8c12 24718:547f54dfbb94
3704 f = x_window_to_frame (dpyinfo, hwnd); 3704 f = x_window_to_frame (dpyinfo, hwnd);
3705 if (f) 3705 if (f)
3706 { 3706 {
3707 GetUpdateRect (hwnd, &wmsg.rect, FALSE); 3707 GetUpdateRect (hwnd, &wmsg.rect, FALSE);
3708 w32_clear_rect (f, NULL, &wmsg.rect); 3708 w32_clear_rect (f, NULL, &wmsg.rect);
3709
3710 #if defined (W32_DEBUG_DISPLAY)
3711 DebPrint (("WM_ERASEBKGND: erasing %d,%d-%d,%d\n",
3712 wmsg.rect.left, wmsg.rect.top, wmsg.rect.right,
3713 wmsg.rect.bottom));
3714 #endif /* W32_DEBUG_DISPLAY */
3709 } 3715 }
3710 return 1; 3716 return 1;
3711 case WM_PALETTECHANGED: 3717 case WM_PALETTECHANGED:
3712 /* ignore our own changes */ 3718 /* ignore our own changes */
3713 if ((HWND)wParam != hwnd) 3719 if ((HWND)wParam != hwnd)
3718 frames to be redrawn if needed. */ 3724 frames to be redrawn if needed. */
3719 release_frame_dc (f, get_frame_dc (f)); 3725 release_frame_dc (f, get_frame_dc (f));
3720 } 3726 }
3721 return 0; 3727 return 0;
3722 case WM_PAINT: 3728 case WM_PAINT:
3723 { 3729 {
3724 PAINTSTRUCT paintStruct; 3730 PAINTSTRUCT paintStruct;
3725 RECT update_rect; 3731 RECT update_rect;
3726 3732
3727 /* MSDN Docs say not to call BeginPaint if GetUpdateRect 3733 /* MSDN Docs say not to call BeginPaint if GetUpdateRect
3728 fails. Apparently this can happen under some 3734 fails. Apparently this can happen under some
4475 4481
4476 case WM_EMACS_SHOWWINDOW: 4482 case WM_EMACS_SHOWWINDOW:
4477 return ShowWindow ((HWND) wParam, (WPARAM) lParam); 4483 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
4478 4484
4479 case WM_EMACS_SETFOREGROUND: 4485 case WM_EMACS_SETFOREGROUND:
4480 return SetForegroundWindow ((HWND) wParam); 4486 {
4487 HWND foreground_window;
4488 DWORD foreground_thread, retval;
4489
4490 /* On NT 5.0, and apparently Windows 98, it is necessary to
4491 attach to the thread that currently has focus in order to
4492 pull the focus away from it. */
4493 foreground_window = GetForegroundWindow ();
4494 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL);
4495 if (!foreground_window
4496 || foreground_thread == GetCurrentThreadId ()
4497 || !AttachThreadInput (GetCurrentThreadId (),
4498 foreground_thread, TRUE))
4499 foreground_thread = 0;
4500
4501 retval = SetForegroundWindow ((HWND) wParam);
4502
4503 /* Detach from the previous foreground thread. */
4504 if (foreground_thread)
4505 AttachThreadInput (GetCurrentThreadId (),
4506 foreground_thread, FALSE);
4507
4508 return retval;
4509 }
4481 4510
4482 case WM_EMACS_SETWINDOWPOS: 4511 case WM_EMACS_SETWINDOWPOS:
4483 { 4512 {
4484 WINDOWPOS * pos = (WINDOWPOS *) wParam; 4513 WINDOWPOS * pos = (WINDOWPOS *) wParam;
4485 return SetWindowPos (hwnd, pos->hwndInsertAfter, 4514 return SetWindowPos (hwnd, pos->hwndInsertAfter,
5343 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; 5372 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET;
5344 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; 5373 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET;
5345 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET; 5374 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET;
5346 /* Map all Japanese charsets to the Windows Shift-JIS charset. */ 5375 /* Map all Japanese charsets to the Windows Shift-JIS charset. */
5347 else if (strnicmp (lpcs, "jis", 3) == 0) return SHIFTJIS_CHARSET; 5376 else if (strnicmp (lpcs, "jis", 3) == 0) return SHIFTJIS_CHARSET;
5377 /* Map all GB charsets to the Windows GB2312 charset. */
5378 else if (strnicmp (lpcs, "gb2312", 6) == 0) return GB2312_CHARSET;
5379 /* Map all Big5 charsets to the Windows Big5 charset. */
5380 else if (strnicmp (lpcs, "big5", 4) == 0) return CHINESEBIG5_CHARSET;
5348 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET; 5381 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET;
5349 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET;
5350 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET;
5351 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET; 5382 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET;
5352 5383
5353 #ifdef EASTEUROPE_CHARSET 5384 #ifdef EASTEUROPE_CHARSET
5354 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; 5385 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET;
5355 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; 5386 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET;
5358 else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET; 5389 else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET;
5359 else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET; 5390 else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET;
5360 else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET; 5391 else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET;
5361 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET; 5392 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET;
5362 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET; 5393 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET;
5363 else if (stricmp (lpcs, "viscii") == 0) return VIETNAMESE_CHARSET; 5394 #ifndef VIETNAMESE_CHARSET
5364 else if (stricmp (lpcs, "vscii") == 0) return VIETNAMESE_CHARSET; 5395 #define VIETNAMESE_CHARSET 163
5365 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; 5396 #endif
5397 /* Map all Viscii charsets to the Windows Vietnamese charset. */
5398 else if (strnicmp (lpcs, "viscii", 6) == 0) return VIETNAMESE_CHARSET;
5399 else if (strnicmp (lpcs, "vscii", 5) == 0) return VIETNAMESE_CHARSET;
5400 /* Map all TIS charsets to the Windows Thai charset. */
5401 else if (strnicmp (lpcs, "tis620", 6) == 0) return THAI_CHARSET;
5366 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; 5402 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET;
5367 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET; 5403 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET;
5368 /* For backwards compatibility with previous 20.4 pretests. */ 5404 /* For backwards compatibility with previous 20.4 pretests, map
5369 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; 5405 non-specific KSC charsets to the Windows Hangeul charset. */
5406 else if (strnicmp (lpcs, "ksc5601", 7) == 0) return HANGEUL_CHARSET;
5370 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET; 5407 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET;
5371 #endif 5408 #endif
5372 5409
5373 #ifdef UNICODE_CHARSET 5410 #ifdef UNICODE_CHARSET
5374 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; 5411 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET;
6995 WPARAM code; 7032 WPARAM code;
6996 FRAME_PTR f = check_x_frame (frame); 7033 FRAME_PTR f = check_x_frame (frame);
6997 7034
6998 CHECK_NUMBER (command, 0); 7035 CHECK_NUMBER (command, 0);
6999 7036
7000 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0); 7037 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0);
7001 7038
7002 return Qnil; 7039 return Qnil;
7003 } 7040 }
7004 7041
7005 DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0, 7042 DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0,
7399 Value is a number between 0 and 255.\n\ 7436 Value is a number between 0 and 255.\n\
7400 \n\ 7437 \n\
7401 Phantom key presses are generated in order to stop the system from\n\ 7438 Phantom key presses are generated in order to stop the system from\n\
7402 acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or\n\ 7439 acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or\n\
7403 `w32-pass-rwindow-to-system' is nil."); 7440 `w32-pass-rwindow-to-system' is nil.");
7404 Vw32_phantom_key_code = VK_SPACE; 7441 /* Although 255 is technically not a valid key code, it works and
7442 means that this hack won't interfere with any real key code. */
7443 Vw32_phantom_key_code = 255;
7405 7444
7406 DEFVAR_LISP ("w32-enable-num-lock", 7445 DEFVAR_LISP ("w32-enable-num-lock",
7407 &Vw32_enable_num_lock, 7446 &Vw32_enable_num_lock,
7408 "Non-nil if Num Lock should act normally.\n\ 7447 "Non-nil if Num Lock should act normally.\n\
7409 Set to nil to see Num Lock as the key `kp-numlock'."); 7448 Set to nil to see Num Lock as the key `kp-numlock'.");