diff options
| author | Richard M. Stallman | 1996-05-10 20:40:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-05-10 20:40:49 +0000 |
| commit | 3cb20f4a4934e0eae4cfae7ea1ee0009b743584e (patch) | |
| tree | 8141257dca5a072bcefb86decaa03f94320b25f7 | |
| parent | 0b287713ac4a062da2c5ce19d51879a2e631698d (diff) | |
| download | emacs-3cb20f4a4934e0eae4cfae7ea1ee0009b743584e.tar.gz emacs-3cb20f4a4934e0eae4cfae7ea1ee0009b743584e.zip | |
(win_msg_worker): Use post_msg.
(win32_wnd_proc): Don't abort if button_state & this, just return.
Use post_msg instead of my_post_msg in some places.
(win32_to_x_font): Major rewrite.
(struct enumfont_t): New element logfont.
(enum_font_cb2): Add special code for TRUETYPE_FONTTYPE.
(Fx_list_fonts): Call x_to_win32_font.
| -rw-r--r-- | src/w32fns.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index c89a7707a3b..f34c215227f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -2844,9 +2844,7 @@ win_msg_worker (dw) | |||
| 2844 | case WM_TIMER: | 2844 | case WM_TIMER: |
| 2845 | if (saved_mouse_msg.msg.hwnd) | 2845 | if (saved_mouse_msg.msg.hwnd) |
| 2846 | { | 2846 | { |
| 2847 | Win32Msg wmsg = saved_mouse_msg; | 2847 | post_msg (&saved_mouse_msg); |
| 2848 | my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, | ||
| 2849 | wmsg.msg.wParam, wmsg.msg.lParam); | ||
| 2850 | saved_mouse_msg.msg.hwnd = 0; | 2848 | saved_mouse_msg.msg.hwnd = 0; |
| 2851 | } | 2849 | } |
| 2852 | timer_id = 0; | 2850 | timer_id = 0; |
| @@ -2992,7 +2990,8 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 2992 | int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE; | 2990 | int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE; |
| 2993 | int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE; | 2991 | int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE; |
| 2994 | 2992 | ||
| 2995 | if (button_state & this) abort (); | 2993 | if (button_state & this) |
| 2994 | return 0; | ||
| 2996 | 2995 | ||
| 2997 | if (button_state == 0) | 2996 | if (button_state == 0) |
| 2998 | SetCapture (hwnd); | 2997 | SetCapture (hwnd); |
| @@ -3021,9 +3020,7 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3021 | else | 3020 | else |
| 3022 | { | 3021 | { |
| 3023 | /* Flush out saved message. */ | 3022 | /* Flush out saved message. */ |
| 3024 | wmsg = saved_mouse_msg; | 3023 | post_msg (&saved_mouse_msg); |
| 3025 | my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, | ||
| 3026 | wmsg.msg.wParam, wmsg.msg.lParam); | ||
| 3027 | } | 3024 | } |
| 3028 | wmsg.dwModifiers = win32_get_modifiers (); | 3025 | wmsg.dwModifiers = win32_get_modifiers (); |
| 3029 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | 3026 | my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
| @@ -3055,7 +3052,8 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3055 | int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE; | 3052 | int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE; |
| 3056 | int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE; | 3053 | int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE; |
| 3057 | 3054 | ||
| 3058 | if ((button_state & this) == 0) abort (); | 3055 | if ((button_state & this) == 0) |
| 3056 | return 0; | ||
| 3059 | 3057 | ||
| 3060 | button_state &= ~this; | 3058 | button_state &= ~this; |
| 3061 | 3059 | ||
| @@ -3077,9 +3075,7 @@ win32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3077 | /* Flush out saved message if necessary. */ | 3075 | /* Flush out saved message if necessary. */ |
| 3078 | if (saved_mouse_msg.msg.hwnd) | 3076 | if (saved_mouse_msg.msg.hwnd) |
| 3079 | { | 3077 | { |
| 3080 | wmsg = saved_mouse_msg; | 3078 | post_msg (&saved_mouse_msg); |
| 3081 | my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, | ||
| 3082 | wmsg.msg.wParam, wmsg.msg.lParam); | ||
| 3083 | } | 3079 | } |
| 3084 | } | 3080 | } |
| 3085 | wmsg.dwModifiers = win32_get_modifiers (); | 3081 | wmsg.dwModifiers = win32_get_modifiers (); |
| @@ -3846,27 +3842,43 @@ win32_to_x_font (lplogfont, lpxstr, len) | |||
| 3846 | char * lpxstr; | 3842 | char * lpxstr; |
| 3847 | int len; | 3843 | int len; |
| 3848 | { | 3844 | { |
| 3849 | if (!lpxstr) return (FALSE); | 3845 | char height_pixels[8]; |
| 3846 | char height_dpi[8]; | ||
| 3847 | char width_pixels[8]; | ||
| 3848 | |||
| 3849 | if (!lpxstr) abort (); | ||
| 3850 | 3850 | ||
| 3851 | if (lplogfont) | 3851 | if (!lplogfont) |
| 3852 | return FALSE; | ||
| 3853 | |||
| 3854 | if (lplogfont->lfHeight) | ||
| 3852 | { | 3855 | { |
| 3853 | _snprintf (lpxstr, len - 1, | 3856 | sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
| 3854 | "-*-%s-%s-%c-*-*-%d-%d-*-*-%c-%d-*-%s-", | 3857 | sprintf (height_dpi, "%u", |
| 3855 | lplogfont->lfFaceName, | 3858 | (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in); |
| 3856 | win32_to_x_weight (lplogfont->lfWeight), | ||
| 3857 | lplogfont->lfItalic?'i':'r', | ||
| 3858 | abs (lplogfont->lfHeight), | ||
| 3859 | (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in, | ||
| 3860 | ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c', | ||
| 3861 | lplogfont->lfWidth * 10, | ||
| 3862 | win32_to_x_charset (lplogfont->lfCharSet) | ||
| 3863 | ); | ||
| 3864 | } | 3859 | } |
| 3865 | else | 3860 | else |
| 3866 | { | 3861 | { |
| 3867 | strncpy (lpxstr,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*-", len - 1); | 3862 | strcpy (height_pixels, "*"); |
| 3863 | strcpy (height_dpi, "*"); | ||
| 3868 | } | 3864 | } |
| 3869 | 3865 | if (lplogfont->lfWidth) | |
| 3866 | sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); | ||
| 3867 | else | ||
| 3868 | strcpy (width_pixels, "*"); | ||
| 3869 | |||
| 3870 | _snprintf (lpxstr, len - 1, | ||
| 3871 | "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-", | ||
| 3872 | lplogfont->lfFaceName, | ||
| 3873 | win32_to_x_weight (lplogfont->lfWeight), | ||
| 3874 | lplogfont->lfItalic?'i':'r', | ||
| 3875 | height_pixels, | ||
| 3876 | height_dpi, | ||
| 3877 | ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c', | ||
| 3878 | width_pixels, | ||
| 3879 | win32_to_x_charset (lplogfont->lfCharSet) | ||
| 3880 | ); | ||
| 3881 | |||
| 3870 | lpxstr[len - 1] = 0; /* just to be sure */ | 3882 | lpxstr[len - 1] = 0; /* just to be sure */ |
| 3871 | return (TRUE); | 3883 | return (TRUE); |
| 3872 | } | 3884 | } |
| @@ -4047,6 +4059,7 @@ typedef struct enumfont_t | |||
| 4047 | { | 4059 | { |
| 4048 | HDC hdc; | 4060 | HDC hdc; |
| 4049 | int numFonts; | 4061 | int numFonts; |
| 4062 | LOGFONT logfont; | ||
| 4050 | XFontStruct *size_ref; | 4063 | XFontStruct *size_ref; |
| 4051 | Lisp_Object *pattern; | 4064 | Lisp_Object *pattern; |
| 4052 | Lisp_Object *head; | 4065 | Lisp_Object *head; |
| @@ -4068,6 +4081,12 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) | |||
| 4068 | { | 4081 | { |
| 4069 | char buf[100]; | 4082 | char buf[100]; |
| 4070 | 4083 | ||
| 4084 | if (!NILP (*(lpef->pattern)) && FontType == TRUETYPE_FONTTYPE) | ||
| 4085 | { | ||
| 4086 | lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; | ||
| 4087 | lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; | ||
| 4088 | } | ||
| 4089 | |||
| 4071 | if (!win32_to_x_font (lplf, buf, 100)) return (0); | 4090 | if (!win32_to_x_font (lplf, buf, 100)) return (0); |
| 4072 | 4091 | ||
| 4073 | if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | 4092 | if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data)) |
| @@ -4196,6 +4215,7 @@ even if they match PATTERN and FACE.") | |||
| 4196 | ef.pattern = &pattern; | 4215 | ef.pattern = &pattern; |
| 4197 | ef.tail = ef.head = &namelist; | 4216 | ef.tail = ef.head = &namelist; |
| 4198 | ef.numFonts = 0; | 4217 | ef.numFonts = 0; |
| 4218 | x_to_win32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont); | ||
| 4199 | 4219 | ||
| 4200 | { | 4220 | { |
| 4201 | ef.hdc = GetDC (FRAME_WIN32_WINDOW (f)); | 4221 | ef.hdc = GetDC (FRAME_WIN32_WINDOW (f)); |