diff options
| author | Andrew Innes | 1999-05-02 10:23:06 +0000 |
|---|---|---|
| committer | Andrew Innes | 1999-05-02 10:23:06 +0000 |
| commit | 55dcfc158861268dcc1bb2c524d6612f5aa86192 (patch) | |
| tree | 6d97b1d7ec32ae45a13ec88ad301c2f95ccf0b30 /src | |
| parent | e3ddd18c28c58472ef8e707a30f06703ef95e177 (diff) | |
| download | emacs-55dcfc158861268dcc1bb2c524d6612f5aa86192.tar.gz emacs-55dcfc158861268dcc1bb2c524d6612f5aa86192.zip | |
[andrewi]
(w32_list_bdf_fonts): Initialize n_fonts.
(Fw32_shell_execute): New function; used to support browse-url.
(syms_of_w32fns): Register it.
(w32_load_system_font): Force max width to be average
char width for fixed-pitch fonts, to avoid unnecessary redisplay
slowdown.
(x_to_w32_charset): Define VIETNAMESE_CHARSET if not
already defined.
(syms_of_w32fns): Set Vw32_phantom_key_code to 255.
[jasonr]
(w32_wnd_proc) [WM_PAINT]: Use rectangle from
GetUpdateRect rather than BeginPaint.
(w32_wnd_proc): Attach to current foreground thread
when grabbing focus; necessary on NT 5.0.
(w32_wnd_proc) [W32_DEBUG_DISPLAY]: Add output for
debugging display messages.
(w32_to_x_charset): Put wildcard last in unknown charsets to avoid
false matching.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 111 |
1 files changed, 95 insertions, 16 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index e11cf2c9e9b..6c58227f63b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -3719,18 +3719,38 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3719 | } | 3719 | } |
| 3720 | return 0; | 3720 | return 0; |
| 3721 | case WM_PAINT: | 3721 | case WM_PAINT: |
| 3722 | { | 3722 | { |
| 3723 | PAINTSTRUCT paintStruct; | 3723 | PAINTSTRUCT paintStruct; |
| 3724 | 3724 | RECT update_rect; | |
| 3725 | enter_crit (); | 3725 | |
| 3726 | BeginPaint (hwnd, &paintStruct); | 3726 | /* MSDN Docs say not to call BeginPaint if GetUpdateRect |
| 3727 | wmsg.rect = paintStruct.rcPaint; | 3727 | fails. Apparently this can happen under some |
| 3728 | EndPaint (hwnd, &paintStruct); | 3728 | circumstances. */ |
| 3729 | leave_crit (); | 3729 | if (GetUpdateRect (hwnd, &update_rect, FALSE)) |
| 3730 | 3730 | { | |
| 3731 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 3731 | enter_crit (); |
| 3732 | 3732 | BeginPaint (hwnd, &paintStruct); | |
| 3733 | return (0); | 3733 | |
| 3734 | /* The rectangles returned by GetUpdateRect and BeginPaint | ||
| 3735 | do not always match. GetUpdateRect seems to be the | ||
| 3736 | more reliable of the two. */ | ||
| 3737 | wmsg.rect = update_rect; | ||
| 3738 | |||
| 3739 | #if defined (W32_DEBUG_DISPLAY) | ||
| 3740 | DebPrint (("WM_PAINT: painting %d,%d-%d,%d\n", wmsg.rect.left, | ||
| 3741 | wmsg.rect.top, wmsg.rect.right, wmsg.rect.bottom)); | ||
| 3742 | DebPrint (("WM_PAINT: update region is %d,%d-%d,%d\n", | ||
| 3743 | update_rect.left, update_rect.top, | ||
| 3744 | update_rect.right, update_rect.bottom)); | ||
| 3745 | #endif | ||
| 3746 | EndPaint (hwnd, &paintStruct); | ||
| 3747 | leave_crit (); | ||
| 3748 | |||
| 3749 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | ||
| 3750 | |||
| 3751 | return 0; | ||
| 3752 | } | ||
| 3753 | return 1; | ||
| 3734 | } | 3754 | } |
| 3735 | 3755 | ||
| 3736 | case WM_INPUTLANGCHANGE: | 3756 | case WM_INPUTLANGCHANGE: |
| @@ -4960,9 +4980,9 @@ struct font_info *w32_load_bdf_font (struct frame *f, char *fontname, | |||
| 4960 | 4980 | ||
| 4961 | struct font_info * | 4981 | struct font_info * |
| 4962 | w32_load_system_font (f,fontname,size) | 4982 | w32_load_system_font (f,fontname,size) |
| 4963 | struct frame *f; | 4983 | struct frame *f; |
| 4964 | char * fontname; | 4984 | char * fontname; |
| 4965 | int size; | 4985 | int size; |
| 4966 | { | 4986 | { |
| 4967 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 4987 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
| 4968 | Lisp_Object font_names; | 4988 | Lisp_Object font_names; |
| @@ -5046,6 +5066,21 @@ int size; | |||
| 5046 | ok = GetTextMetrics (hdc, &font->tm); | 5066 | ok = GetTextMetrics (hdc, &font->tm); |
| 5047 | SelectObject (hdc, oldobj); | 5067 | SelectObject (hdc, oldobj); |
| 5048 | ReleaseDC (dpyinfo->root_window, hdc); | 5068 | ReleaseDC (dpyinfo->root_window, hdc); |
| 5069 | |||
| 5070 | /* [andrewi, 25-Apr-99] A number of fixed pitch fonts, | ||
| 5071 | eg. Courier New and perhaps others, report a max width which | ||
| 5072 | is larger than the average character width, at least on some | ||
| 5073 | NT systems (I don't understand why - my best guess is that it | ||
| 5074 | results from installing the CJK language packs for NT4). | ||
| 5075 | Unfortunately, this forces the redisplay code in dumpglyphs | ||
| 5076 | to draw text character by character. | ||
| 5077 | |||
| 5078 | I don't like this hack, but it seems better to force the max | ||
| 5079 | width to match the average width if the font is marked as | ||
| 5080 | fixed pitch, for the sake of redisplay performance. */ | ||
| 5081 | |||
| 5082 | if ((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) == 0) | ||
| 5083 | font->tm.tmMaxCharWidth = font->tm.tmAveCharWidth; | ||
| 5049 | } | 5084 | } |
| 5050 | 5085 | ||
| 5051 | UNBLOCK_INPUT; | 5086 | UNBLOCK_INPUT; |
| @@ -5799,7 +5834,7 @@ Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) | |||
| 5799 | { | 5834 | { |
| 5800 | char *fontname, *ptnstr; | 5835 | char *fontname, *ptnstr; |
| 5801 | Lisp_Object list, tem, newlist = Qnil; | 5836 | Lisp_Object list, tem, newlist = Qnil; |
| 5802 | int n_fonts; | 5837 | int n_fonts = 0; |
| 5803 | 5838 | ||
| 5804 | list = Vw32_bdf_filename_alist; | 5839 | list = Vw32_bdf_filename_alist; |
| 5805 | ptnstr = XSTRING (pattern)->data; | 5840 | ptnstr = XSTRING (pattern)->data; |
| @@ -6957,6 +6992,49 @@ If optional parameter FRAME is not specified, use selected frame.") | |||
| 6957 | return Qnil; | 6992 | return Qnil; |
| 6958 | } | 6993 | } |
| 6959 | 6994 | ||
| 6995 | DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0, | ||
| 6996 | "Get Windows to perform OPERATION on DOCUMENT.\n\ | ||
| 6997 | This is a wrapper around the ShellExecute system function, which\n\ | ||
| 6998 | invokes the application registered to handle OPERATION for DOCUMENT.\n\ | ||
| 6999 | OPERATION is typically \"open\", \"print\" or \"explore\", and DOCUMENT\n\ | ||
| 7000 | is typically the name of a document file or URL, but can also be a\n\ | ||
| 7001 | program executable to run or a directory to open in the Windows Explorer.\n\ | ||
| 7002 | \n\ | ||
| 7003 | If DOCUMENT is a program executable, PARAMETERS can be a list of command\n\ | ||
| 7004 | line parameters, but otherwise should be nil.\n\ | ||
| 7005 | \n\ | ||
| 7006 | SHOW-FLAG can be used to control whether the invoked application is hidden\n\ | ||
| 7007 | or minimized. If SHOw-FLAG is nil, the application is displayed normally,\n\ | ||
| 7008 | otherwise it is an integer representing a ShowWindow flag:\n\ | ||
| 7009 | \n\ | ||
| 7010 | 0 - start hidden\n\ | ||
| 7011 | 1 - start normally\n\ | ||
| 7012 | 3 - start maximized\n\ | ||
| 7013 | 6 - start minimized") | ||
| 7014 | (operation, document, parameters, show_flag) | ||
| 7015 | Lisp_Object operation, document, parameters, show_flag; | ||
| 7016 | { | ||
| 7017 | Lisp_Object current_dir; | ||
| 7018 | |||
| 7019 | CHECK_STRING (operation, 0); | ||
| 7020 | CHECK_STRING (document, 0); | ||
| 7021 | |||
| 7022 | /* Encode filename and current directory. */ | ||
| 7023 | current_dir = ENCODE_FILE (current_buffer->directory); | ||
| 7024 | document = ENCODE_FILE (document); | ||
| 7025 | if ((int) ShellExecute (NULL, | ||
| 7026 | XSTRING (operation)->data, | ||
| 7027 | XSTRING (document)->data, | ||
| 7028 | (STRINGP (parameters) ? | ||
| 7029 | XSTRING (parameters)->data : NULL), | ||
| 7030 | XSTRING (current_dir)->data, | ||
| 7031 | (INTEGERP (show_flag) ? | ||
| 7032 | XINT (show_flag) : SW_SHOWDEFAULT)) | ||
| 7033 | > 32) | ||
| 7034 | return Qt; | ||
| 7035 | error ("ShellExecute failed"); | ||
| 7036 | } | ||
| 7037 | |||
| 6960 | /* Lookup virtual keycode from string representing the name of a | 7038 | /* Lookup virtual keycode from string representing the name of a |
| 6961 | non-ascii keystroke into the corresponding virtual key, using | 7039 | non-ascii keystroke into the corresponding virtual key, using |
| 6962 | lispy_function_keys. */ | 7040 | lispy_function_keys. */ |
| @@ -7501,6 +7579,7 @@ fontsets are automatically created."); | |||
| 7501 | defsubr (&Sw32_default_color_map); | 7579 | defsubr (&Sw32_default_color_map); |
| 7502 | defsubr (&Sw32_load_color_file); | 7580 | defsubr (&Sw32_load_color_file); |
| 7503 | defsubr (&Sw32_send_sys_command); | 7581 | defsubr (&Sw32_send_sys_command); |
| 7582 | defsubr (&Sw32_shell_execute); | ||
| 7504 | defsubr (&Sw32_register_hot_key); | 7583 | defsubr (&Sw32_register_hot_key); |
| 7505 | defsubr (&Sw32_unregister_hot_key); | 7584 | defsubr (&Sw32_unregister_hot_key); |
| 7506 | defsubr (&Sw32_registered_hot_keys); | 7585 | defsubr (&Sw32_registered_hot_keys); |