aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2000-05-30 21:45:33 +0000
committerJason Rumney2000-05-30 21:45:33 +0000
commitdfff8a69e8a6b5e9e26bf86923b98ed4e87e6a78 (patch)
treedfa00b8ee0fc4e0963e1b797e64fcc9c57129dc6 /src
parent5101dbdff2c551b749951f758c56eeb681f537f4 (diff)
downloademacs-dfff8a69e8a6b5e9e26bf86923b98ed4e87e6a78.tar.gz
emacs-dfff8a69e8a6b5e9e26bf86923b98ed4e87e6a78.zip
Format and doc changes to bring closer to xfns.c.
(VIETNAMESE_CHARSET): Define if not defined in system headers. (Qline_spacing, Qcenter): New variables. (Qw32_charset_*, w32_codepage_for_font): Moved from w32term.c. (x_set_line_spacing): New function. (x_set_frame_parameters): Use FRAME_NEW_WIDTH, FRAME_NEW_HEIGHT macros. (x_specified_cursor_type): New function. (x_set_cursor_type): Use it. (x_set_name, x_set_title): Use ENCODE_SYSTEM to encode titlebar and icon strings. (validate_x_resource_name, x_get_resource_string): Measure lengths of external strings in bytes. (w32_wnd_proc) [WM_MEASURE_ITEM]: Avoid calling GetTextExtentPoint32 with NULL title. (Fx_create_frame): Initialize Qline_spacing. (w32_load_system_font): Initialize font->double_byte_p. (x_to_w32_charset): Use Vw32_charset_info_alist. (Image, busy cursor, tooltip functions): Merged changes from xfns.c. Not yet functional on Windows.
Diffstat (limited to 'src')
-rw-r--r--src/w32fns.c552
1 files changed, 410 insertions, 142 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 3765124694e..f02a1c43ebe 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -54,7 +54,6 @@ Boston, MA 02111-1307, USA. */
54 54
55extern void free_frame_menubar (); 55extern void free_frame_menubar ();
56extern double atof (); 56extern double atof ();
57extern struct scroll_bar *x_window_to_scroll_bar ();
58extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state); 57extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);
59extern int quit_char; 58extern int quit_char;
60 59
@@ -146,26 +145,33 @@ Lisp_Object Vx_resource_name;
146Lisp_Object Vx_no_window_manager; 145Lisp_Object Vx_no_window_manager;
147 146
148/* Non-zero means we're allowed to display a busy cursor. */ 147/* Non-zero means we're allowed to display a busy cursor. */
148
149int display_busy_cursor_p; 149int display_busy_cursor_p;
150 150
151/* The background and shape of the mouse pointer, and shape when not 151/* The background and shape of the mouse pointer, and shape when not
152 over text or in the modeline. */ 152 over text or in the modeline. */
153
153Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; 154Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
154Lisp_Object Vx_busy_pointer_shape; 155Lisp_Object Vx_busy_pointer_shape;
155 156
156/* The shape when over mouse-sensitive text. */ 157/* The shape when over mouse-sensitive text. */
158
157Lisp_Object Vx_sensitive_text_pointer_shape; 159Lisp_Object Vx_sensitive_text_pointer_shape;
158 160
159/* Color of chars displayed in cursor box. */ 161/* Color of chars displayed in cursor box. */
162
160Lisp_Object Vx_cursor_fore_pixel; 163Lisp_Object Vx_cursor_fore_pixel;
161 164
162/* Nonzero if using Windows. */ 165/* Nonzero if using Windows. */
166
163static int w32_in_use; 167static int w32_in_use;
164 168
165/* Search path for bitmap files. */ 169/* Search path for bitmap files. */
170
166Lisp_Object Vx_bitmap_file_path; 171Lisp_Object Vx_bitmap_file_path;
167 172
168/* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ 173/* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
174
169Lisp_Object Vx_pixel_size_width_font_regexp; 175Lisp_Object Vx_pixel_size_width_font_regexp;
170 176
171/* Alist of bdf fonts and the files that define them. */ 177/* Alist of bdf fonts and the files that define them. */
@@ -180,6 +186,15 @@ int w32_strict_fontnames;
180 indicates there is an update region. */ 186 indicates there is an update region. */
181int w32_strict_painting; 187int w32_strict_painting;
182 188
189/* Associative list linking character set strings to Windows codepages. */
190Lisp_Object Vw32_charset_info_alist;
191
192/* VIETNAMESE_CHARSET is not defined in some versions of MSVC. */
193#ifndef VIETNAMESE_CHARSET
194#define VIETNAMESE_CHARSET 163
195#endif
196
197
183/* Evaluate this expression to rebuild the section of syms_of_w32fns 198/* Evaluate this expression to rebuild the section of syms_of_w32fns
184 that initializes and staticpros the symbols declared below. Note 199 that initializes and staticpros the symbols declared below. Note
185 that Emacs 18 has a bug that keeps C-x C-e from being able to 200 that Emacs 18 has a bug that keeps C-x C-e from being able to
@@ -245,6 +260,8 @@ Lisp_Object Qx_resource_name;
245Lisp_Object Quser_position; 260Lisp_Object Quser_position;
246Lisp_Object Quser_size; 261Lisp_Object Quser_size;
247Lisp_Object Qscreen_gamma; 262Lisp_Object Qscreen_gamma;
263Lisp_Object Qline_spacing;
264Lisp_Object Qcenter;
248Lisp_Object Qhyper; 265Lisp_Object Qhyper;
249Lisp_Object Qsuper; 266Lisp_Object Qsuper;
250Lisp_Object Qmeta; 267Lisp_Object Qmeta;
@@ -253,6 +270,32 @@ Lisp_Object Qctrl;
253Lisp_Object Qcontrol; 270Lisp_Object Qcontrol;
254Lisp_Object Qshift; 271Lisp_Object Qshift;
255 272
273Lisp_Object Qw32_charset_ansi;
274Lisp_Object Qw32_charset_default;
275Lisp_Object Qw32_charset_symbol;
276Lisp_Object Qw32_charset_shiftjis;
277Lisp_Object Qw32_charset_hangul;
278Lisp_Object Qw32_charset_gb2312;
279Lisp_Object Qw32_charset_chinesebig5;
280Lisp_Object Qw32_charset_oem;
281
282#ifdef JOHAB_CHARSET
283Lisp_Object Qw32_charset_easteurope;
284Lisp_Object Qw32_charset_turkish;
285Lisp_Object Qw32_charset_baltic;
286Lisp_Object Qw32_charset_russian;
287Lisp_Object Qw32_charset_arabic;
288Lisp_Object Qw32_charset_greek;
289Lisp_Object Qw32_charset_hebrew;
290Lisp_Object Qw32_charset_thai;
291Lisp_Object Qw32_charset_johab;
292Lisp_Object Qw32_charset_mac;
293#endif
294
295#ifdef UNICODE_CHARSET
296Lisp_Object Qw32_charset_unicode;
297#endif
298
256extern Lisp_Object Qtop; 299extern Lisp_Object Qtop;
257extern Lisp_Object Qdisplay; 300extern Lisp_Object Qdisplay;
258extern Lisp_Object Qtool_bar_lines; 301extern Lisp_Object Qtool_bar_lines;
@@ -275,6 +318,7 @@ unsigned int msh_mousewheel = 0;
275#define MOUSE_MOVE_ID 2 318#define MOUSE_MOVE_ID 2
276 319
277/* The below are defined in frame.c. */ 320/* The below are defined in frame.c. */
321
278extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; 322extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
279extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; 323extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
280extern Lisp_Object Qtool_bar_lines; 324extern Lisp_Object Qtool_bar_lines;
@@ -283,9 +327,6 @@ extern Lisp_Object Vwindow_system_version;
283 327
284Lisp_Object Qface_set_after_frame_default; 328Lisp_Object Qface_set_after_frame_default;
285 329
286extern Lisp_Object last_mouse_scroll_bar;
287extern int last_mouse_scroll_bar_pos;
288
289/* From w32term.c. */ 330/* From w32term.c. */
290extern Lisp_Object Vw32_num_mouse_buttons; 331extern Lisp_Object Vw32_num_mouse_buttons;
291extern Lisp_Object Vw32_recognize_altgr; 332extern Lisp_Object Vw32_recognize_altgr;
@@ -646,6 +687,7 @@ struct x_frame_parm_table
646 687
647/* NTEMACS_TODO: Native Input Method support; see x_create_im. */ 688/* NTEMACS_TODO: Native Input Method support; see x_create_im. */
648void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 689void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
690static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
649void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 691void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
650void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 692void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
651void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 693void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -693,12 +735,14 @@ static struct x_frame_parm_table x_frame_parms[] =
693 "vertical-scroll-bars", x_set_vertical_scroll_bars, 735 "vertical-scroll-bars", x_set_vertical_scroll_bars,
694 "visibility", x_set_visibility, 736 "visibility", x_set_visibility,
695 "tool-bar-lines", x_set_tool_bar_lines, 737 "tool-bar-lines", x_set_tool_bar_lines,
696 "screen-gamma", x_set_screen_gamma 738 "screen-gamma", x_set_screen_gamma,
739 "line-spacing", x_set_line_spacing
697}; 740};
698 741
699/* Attach the `x-frame-parameter' properties to 742/* Attach the `x-frame-parameter' properties to
700 the Lisp symbol names of parameters relevant to W32. */ 743 the Lisp symbol names of parameters relevant to W32. */
701 744
745void
702init_x_parm_symbols () 746init_x_parm_symbols ()
703{ 747{
704 int i; 748 int i;
@@ -708,7 +752,7 @@ init_x_parm_symbols ()
708 make_number (i)); 752 make_number (i));
709} 753}
710 754
711/* Change the parameters of FRAME as specified by ALIST. 755/* Change the parameters of frame F as specified by ALIST.
712 If a parameter is not specially recognized, do nothing; 756 If a parameter is not specially recognized, do nothing;
713 otherwise call the `x_set_...' function for that parameter. */ 757 otherwise call the `x_set_...' function for that parameter. */
714 758
@@ -758,7 +802,6 @@ x_set_frame_parameters (f, alist)
758 values[i] = Fcdr (elt); 802 values[i] = Fcdr (elt);
759 i++; 803 i++;
760 } 804 }
761
762 /* TAIL and ALIST are not used again below here. */ 805 /* TAIL and ALIST are not used again below here. */
763 alist = tail = Qnil; 806 alist = tail = Qnil;
764 807
@@ -772,8 +815,15 @@ x_set_frame_parameters (f, alist)
772 icon_left = icon_top = Qunbound; 815 icon_left = icon_top = Qunbound;
773 816
774 /* Provide default values for HEIGHT and WIDTH. */ 817 /* Provide default values for HEIGHT and WIDTH. */
775 width = FRAME_WIDTH (f); 818 if (FRAME_NEW_WIDTH (f))
776 height = FRAME_HEIGHT (f); 819 width = FRAME_NEW_WIDTH (f);
820 else
821 width = FRAME_WIDTH (f);
822
823 if (FRAME_NEW_HEIGHT (f))
824 height = FRAME_NEW_HEIGHT (f);
825 else
826 height = FRAME_HEIGHT (f);
777 827
778 /* Process foreground_color and background_color before anything else. 828 /* Process foreground_color and background_color before anything else.
779 They are independent of other properties, but other properties (e.g., 829 They are independent of other properties, but other properties (e.g.,
@@ -884,8 +934,9 @@ x_set_frame_parameters (f, alist)
884 934
885 XSETFRAME (frame, f); 935 XSETFRAME (frame, f);
886 936
887 if (XINT (width) != FRAME_WIDTH (f) 937 if (width != FRAME_WIDTH (f)
888 || XINT (height) != FRAME_HEIGHT (f)) 938 || height != FRAME_HEIGHT (f)
939 || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f))
889 Fset_frame_size (frame, make_number (width), make_number (height)); 940 Fset_frame_size (frame, make_number (width), make_number (height));
890 941
891 if ((!NILP (left) || !NILP (top)) 942 if ((!NILP (left) || !NILP (top))
@@ -994,6 +1045,7 @@ x_real_positions (f, xptr, yptr)
994 and whose values are not correctly recorded in the frame's 1045 and whose values are not correctly recorded in the frame's
995 param_alist need to be considered here. */ 1046 param_alist need to be considered here. */
996 1047
1048void
997x_report_frame_params (f, alistptr) 1049x_report_frame_params (f, alistptr)
998 struct frame *f; 1050 struct frame *f;
999 Lisp_Object *alistptr; 1051 Lisp_Object *alistptr;
@@ -1874,6 +1926,26 @@ x_decode_color (f, arg, def)
1874 return def; 1926 return def;
1875} 1927}
1876 1928
1929/* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
1930 the previous value of that parameter, NEW_VALUE is the new value. */
1931
1932static void
1933x_set_line_spacing (f, new_value, old_value)
1934 struct frame *f;
1935 Lisp_Object new_value, old_value;
1936{
1937 if (NILP (new_value))
1938 f->extra_line_spacing = 0;
1939 else if (NATNUMP (new_value))
1940 f->extra_line_spacing = XFASTINT (new_value);
1941 else
1942 Fsignal (Qerror, Fcons (build_string ("Illegal line-spacing"),
1943 Fcons (new_value, Qnil)));
1944 if (FRAME_VISIBLE_P (f))
1945 redraw_frame (f);
1946}
1947
1948
1877/* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is 1949/* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
1878 the previous value of that parameter, NEW_VALUE is the new value. */ 1950 the previous value of that parameter, NEW_VALUE is the new value. */
1879 1951
@@ -2085,7 +2157,7 @@ x_set_cursor_color (f, arg, oldval)
2085{ 2157{
2086 unsigned long fore_pixel; 2158 unsigned long fore_pixel;
2087 2159
2088 if (!EQ (Vx_cursor_fore_pixel, Qnil)) 2160 if (!NILP (Vx_cursor_fore_pixel))
2089 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, 2161 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
2090 WHITE_PIX_DEFAULT (f)); 2162 WHITE_PIX_DEFAULT (f));
2091 else 2163 else
@@ -2149,33 +2221,56 @@ x_set_border_color (f, arg, oldval)
2149 update_face_from_frame_parameter (f, Qborder_color, arg); 2221 update_face_from_frame_parameter (f, Qborder_color, arg);
2150} 2222}
2151 2223
2152void 2224/* Value is the internal representation of the specified cursor type
2153x_set_cursor_type (f, arg, oldval) 2225 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
2154 FRAME_PTR f; 2226 of the bar cursor. */
2155 Lisp_Object arg, oldval; 2227
2228enum text_cursor_kinds
2229x_specified_cursor_type (arg, width)
2230 Lisp_Object arg;
2231 int *width;
2156{ 2232{
2233 enum text_cursor_kinds type;
2234
2157 if (EQ (arg, Qbar)) 2235 if (EQ (arg, Qbar))
2158 { 2236 {
2159 FRAME_DESIRED_CURSOR (f) = BAR_CURSOR; 2237 type = BAR_CURSOR;
2160 f->output_data.w32->cursor_width = 2; 2238 *width = 2;
2161 } 2239 }
2162 else if (CONSP (arg) && EQ (XCAR (arg), Qbar) 2240 else if (CONSP (arg)
2163 && INTEGERP (XCDR (arg))) 2241 && EQ (XCAR (arg), Qbar)
2242 && INTEGERP (XCDR (arg))
2243 && XINT (XCDR (arg)) >= 0)
2164 { 2244 {
2165 FRAME_DESIRED_CURSOR (f) = BAR_CURSOR; 2245 type = BAR_CURSOR;
2166 f->output_data.w32->cursor_width = XINT (XCDR (arg)); 2246 *width = XINT (XCDR (arg));
2167 } 2247 }
2248 else if (NILP (arg))
2249 type = NO_CURSOR;
2168 else 2250 else
2169 /* Treat anything unknown as "box cursor". 2251 /* Treat anything unknown as "box cursor".
2170 It was bad to signal an error; people have trouble fixing 2252 It was bad to signal an error; people have trouble fixing
2171 .Xdefaults with Emacs, when it has something bad in it. */ 2253 .Xdefaults with Emacs, when it has something bad in it. */
2172 FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR; 2254 type = FILLED_BOX_CURSOR;
2255
2256 return type;
2257}
2258
2259void
2260x_set_cursor_type (f, arg, oldval)
2261 FRAME_PTR f;
2262 Lisp_Object arg, oldval;
2263{
2264 int width;
2265
2266 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width);
2267 f->output_data.w32->cursor_width = width;
2173 2268
2174 /* Make sure the cursor gets redrawn. This is overkill, but how 2269 /* Make sure the cursor gets redrawn. This is overkill, but how
2175 often do people change cursor types? */ 2270 often do people change cursor types? */
2176 update_mode_lines++; 2271 update_mode_lines++;
2177} 2272}
2178 2273
2179void 2274void
2180x_set_icon_type (f, arg, oldval) 2275x_set_icon_type (f, arg, oldval)
2181 struct frame *f; 2276 struct frame *f;
@@ -2294,9 +2389,9 @@ x_set_font (f, arg, oldval)
2294 UNBLOCK_INPUT; 2389 UNBLOCK_INPUT;
2295 2390
2296 if (EQ (result, Qnil)) 2391 if (EQ (result, Qnil))
2297 error ("Font \"%s\" is not defined", XSTRING (arg)->data); 2392 error ("Font `%s' is not defined", XSTRING (arg)->data);
2298 else if (EQ (result, Qt)) 2393 else if (EQ (result, Qt))
2299 error ("the characters of the given font have varying widths"); 2394 error ("The characters of the given font have varying widths");
2300 else if (STRINGP (result)) 2395 else if (STRINGP (result))
2301 { 2396 {
2302 store_frame_param (f, Qfont, result); 2397 store_frame_param (f, Qfont, result);
@@ -2501,7 +2596,7 @@ x_set_name (f, name, explicit)
2501 if (FRAME_W32_WINDOW (f)) 2596 if (FRAME_W32_WINDOW (f))
2502 { 2597 {
2503 if (STRING_MULTIBYTE (name)) 2598 if (STRING_MULTIBYTE (name))
2504 name = string_make_unibyte (name); 2599 name = ENCODE_SYSTEM (name);
2505 2600
2506 BLOCK_INPUT; 2601 BLOCK_INPUT;
2507 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); 2602 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
@@ -2561,7 +2656,7 @@ x_set_title (f, name, old_name)
2561 if (FRAME_W32_WINDOW (f)) 2656 if (FRAME_W32_WINDOW (f))
2562 { 2657 {
2563 if (STRING_MULTIBYTE (name)) 2658 if (STRING_MULTIBYTE (name))
2564 name = string_make_unibyte (name); 2659 name = ENCODE_SYSTEM (name);
2565 2660
2566 BLOCK_INPUT; 2661 BLOCK_INPUT;
2567 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); 2662 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
@@ -2673,7 +2768,7 @@ validate_x_resource_name ()
2673 unsigned char *p = XSTRING (Vx_resource_name)->data; 2768 unsigned char *p = XSTRING (Vx_resource_name)->data;
2674 int i; 2769 int i;
2675 2770
2676 len = XSTRING (Vx_resource_name)->size; 2771 len = STRING_BYTES (XSTRING (Vx_resource_name));
2677 2772
2678 /* Only letters, digits, - and _ are valid in resource names. 2773 /* Only letters, digits, - and _ are valid in resource names.
2679 Count the valid characters and count the invalid ones. */ 2774 Count the valid characters and count the invalid ones. */
@@ -2755,16 +2850,16 @@ and the class is `Emacs.CLASS.SUBCLASS'.")
2755 2850
2756 /* Allocate space for the components, the dots which separate them, 2851 /* Allocate space for the components, the dots which separate them,
2757 and the final '\0'. Make them big enough for the worst case. */ 2852 and the final '\0'. Make them big enough for the worst case. */
2758 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size 2853 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
2759 + (STRINGP (component) 2854 + (STRINGP (component)
2760 ? XSTRING (component)->size : 0) 2855 ? STRING_BYTES (XSTRING (component)) : 0)
2761 + XSTRING (attribute)->size 2856 + STRING_BYTES (XSTRING (attribute))
2762 + 3); 2857 + 3);
2763 2858
2764 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) 2859 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
2765 + XSTRING (class)->size 2860 + STRING_BYTES (XSTRING (class))
2766 + (STRINGP (subclass) 2861 + (STRINGP (subclass)
2767 ? XSTRING (subclass)->size : 0) 2862 ? STRING_BYTES (XSTRING (subclass)) : 0)
2768 + 3); 2863 + 3);
2769 2864
2770 /* Start with emacs.FRAMENAME for the name (the specific one) 2865 /* Start with emacs.FRAMENAME for the name (the specific one)
@@ -2808,7 +2903,7 @@ x_get_resource_string (attribute, class)
2808 2903
2809 /* Allocate space for the components, the dots which separate them, 2904 /* Allocate space for the components, the dots which separate them,
2810 and the final '\0'. */ 2905 and the final '\0'. */
2811 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size 2906 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
2812 + strlen (attribute) + 2); 2907 + strlen (attribute) + 2);
2813 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) 2908 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
2814 + strlen (class) + 2); 2909 + strlen (class) + 2);
@@ -2912,8 +3007,8 @@ w32_get_arg (alist, param, attribute, class, type)
2912} 3007}
2913 3008
2914/* Record in frame F the specified or default value according to ALIST 3009/* Record in frame F the specified or default value according to ALIST
2915 of the parameter named PARAM (a Lisp symbol). 3010 of the parameter named PROP (a Lisp symbol).
2916 If no value is specified for PARAM, look for an X default for XPROP 3011 If no value is specified for PROP, look for an X default for XPROP
2917 on the frame named NAME. 3012 on the frame named NAME.
2918 If that is not found either, use the value DEFLT. */ 3013 If that is not found either, use the value DEFLT. */
2919 3014
@@ -4497,11 +4592,16 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
4497 menu_font = CreateFontIndirect (&menu_logfont); 4592 menu_font = CreateFontIndirect (&menu_logfont);
4498 old_font = SelectObject (hdc, menu_font); 4593 old_font = SelectObject (hdc, menu_font);
4499 4594
4500 GetTextExtentPoint32 (hdc, title, strlen (title), &size); 4595 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE);
4501 pMis->itemWidth = size.cx; 4596 if (title)
4502 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE); 4597 {
4503 if (pMis->itemHeight < size.cy) 4598 GetTextExtentPoint32 (hdc, title, strlen (title), &size);
4504 pMis->itemHeight = size.cy; 4599 pMis->itemWidth = size.cx;
4600 if (pMis->itemHeight < size.cy)
4601 pMis->itemHeight = size.cy;
4602 }
4603 else
4604 pMis->itemWidth = 0;
4505 4605
4506 SelectObject (hdc, old_font); 4606 SelectObject (hdc, old_font);
4507 DeleteObject (menu_font); 4607 DeleteObject (menu_font);
@@ -5110,6 +5210,8 @@ This function is an internal primitive--use `make-frame' instead.")
5110 "borderColor", "BorderColor", RES_TYPE_STRING); 5210 "borderColor", "BorderColor", RES_TYPE_STRING);
5111 x_default_parameter (f, parms, Qscreen_gamma, Qnil, 5211 x_default_parameter (f, parms, Qscreen_gamma, Qnil,
5112 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); 5212 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
5213 x_default_parameter (f, parms, Qline_spacing, Qnil,
5214 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
5113 5215
5114 5216
5115 /* Init faces before x_default_parameter is called for scroll-bar 5217 /* Init faces before x_default_parameter is called for scroll-bar
@@ -5341,6 +5443,7 @@ w32_load_system_font (f,fontname,size)
5341 hdc = GetDC (dpyinfo->root_window); 5443 hdc = GetDC (dpyinfo->root_window);
5342 oldobj = SelectObject (hdc, font->hfont); 5444 oldobj = SelectObject (hdc, font->hfont);
5343 ok = GetTextMetrics (hdc, &font->tm); 5445 ok = GetTextMetrics (hdc, &font->tm);
5446 font->double_byte_p = GetFontLanguageInfo(hdc) & GCP_DBCS;
5344 SelectObject (hdc, oldobj); 5447 SelectObject (hdc, oldobj);
5345 ReleaseDC (dpyinfo->root_window, hdc); 5448 ReleaseDC (dpyinfo->root_window, hdc);
5346 /* Fill out details in lf according to the font that was 5449 /* Fill out details in lf according to the font that was
@@ -5605,61 +5708,78 @@ LONG
5605x_to_w32_charset (lpcs) 5708x_to_w32_charset (lpcs)
5606 char * lpcs; 5709 char * lpcs;
5607{ 5710{
5608 if (!lpcs) return (0); 5711 Lisp_Object rest;
5609
5610 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET;
5611 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET;
5612 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET;
5613 /* Map all Japanese charsets to the Windows Shift-JIS charset. */
5614 else if (strnicmp (lpcs, "jis", 3) == 0) return SHIFTJIS_CHARSET;
5615 /* Map all GB charsets to the Windows GB2312 charset. */
5616 else if (strnicmp (lpcs, "gb2312", 6) == 0) return GB2312_CHARSET;
5617 /* Map all Big5 charsets to the Windows Big5 charset. */
5618 else if (strnicmp (lpcs, "big5", 4) == 0) return CHINESEBIG5_CHARSET;
5619 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET;
5620 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET;
5621 5712
5622#ifdef EASTEUROPE_CHARSET 5713 /* Look through w32-charset-info-alist for the character set.
5623 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; 5714 Format of each entry is
5624 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; 5715 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)).
5625 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; 5716 */
5626 else if (stricmp (lpcs, "iso8859-5") == 0) return RUSSIAN_CHARSET; 5717 for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest))
5627 else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET; 5718 {
5628 else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET; 5719 Lisp_Object this_entry = XCAR (rest);
5629 else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET; 5720 char * x_charset = XSTRING (XCAR (this_entry))->data;
5630 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET;
5631 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET;
5632#ifndef VIETNAMESE_CHARSET
5633#define VIETNAMESE_CHARSET 163
5634#endif
5635 /* Map all Viscii charsets to the Windows Vietnamese charset. */
5636 else if (strnicmp (lpcs, "viscii", 6) == 0) return VIETNAMESE_CHARSET;
5637 else if (strnicmp (lpcs, "vscii", 5) == 0) return VIETNAMESE_CHARSET;
5638 /* Map all TIS charsets to the Windows Thai charset. */
5639 else if (strnicmp (lpcs, "tis620", 6) == 0) return THAI_CHARSET;
5640 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET;
5641 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET;
5642 /* For backwards compatibility with previous 20.4 pretests, map
5643 non-specific KSC charsets to the Windows Hangeul charset. */
5644 else if (strnicmp (lpcs, "ksc5601", 7) == 0) return HANGEUL_CHARSET;
5645 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET;
5646#endif
5647 5721
5722 if (strnicmp (lpcs, x_charset, strlen(x_charset)) == 0)
5723 {
5724 Lisp_Object w32_charset = XCAR (XCDR (this_entry));
5725 // Translate Lisp symbol to number.
5726 if (w32_charset == Qw32_charset_ansi)
5727 return ANSI_CHARSET;
5728 if (w32_charset == Qw32_charset_symbol)
5729 return SYMBOL_CHARSET;
5730 if (w32_charset == Qw32_charset_shiftjis)
5731 return SHIFTJIS_CHARSET;
5732 if (w32_charset == Qw32_charset_hangul)
5733 return HANGEUL_CHARSET;
5734 if (w32_charset == Qw32_charset_chinesebig5)
5735 return CHINESEBIG5_CHARSET;
5736 if (w32_charset == Qw32_charset_gb2312)
5737 return GB2312_CHARSET;
5738 if (w32_charset == Qw32_charset_oem)
5739 return OEM_CHARSET;
5740#ifdef JOHAB_CHARSET
5741 if (w32_charset == Qw32_charset_johab)
5742 return JOHAB_CHARSET;
5743 if (w32_charset == Qw32_charset_easteurope)
5744 return EASTEUROPE_CHARSET;
5745 if (w32_charset == Qw32_charset_turkish)
5746 return TURKISH_CHARSET;
5747 if (w32_charset == Qw32_charset_baltic)
5748 return BALTIC_CHARSET;
5749 if (w32_charset == Qw32_charset_russian)
5750 return RUSSIAN_CHARSET;
5751 if (w32_charset == Qw32_charset_arabic)
5752 return ARABIC_CHARSET;
5753 if (w32_charset == Qw32_charset_greek)
5754 return GREEK_CHARSET;
5755 if (w32_charset == Qw32_charset_hebrew)
5756 return HEBREW_CHARSET;
5757 if (w32_charset == Qw32_charset_thai)
5758 return THAI_CHARSET;
5759 if (w32_charset == Qw32_charset_mac)
5760 return MAC_CHARSET;
5761#endif /* JOHAB_CHARSET */
5648#ifdef UNICODE_CHARSET 5762#ifdef UNICODE_CHARSET
5649 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; 5763 if (w32_charset == Qw32_charset_unicode)
5650 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; 5764 return UNICODE_CHARSET;
5651#endif 5765#endif
5652 else if (lpcs[0] == '#') return atoi (lpcs + 1); 5766 }
5653 else 5767 }
5654 return DEFAULT_CHARSET; 5768
5769 return DEFAULT_CHARSET;
5655} 5770}
5656 5771
5772
5657char * 5773char *
5658w32_to_x_charset (fncharset) 5774w32_to_x_charset (fncharset)
5659 int fncharset; 5775 int fncharset;
5660{ 5776{
5661 static char buf[16]; 5777 static char buf[16];
5662 5778
5779 /* NTEMACS_TODO: use w32-charset-info-alist. Multiple matches
5780 are possible, so this will require more than just a rewrite of
5781 this function. w32_to_x_font is the only user of this function,
5782 and that will require rewriting too, and its users. */
5663 switch (fncharset) 5783 switch (fncharset)
5664 { 5784 {
5665 /* ansi is considered iso8859-1, as most modern ansi fonts are. */ 5785 /* ansi is considered iso8859-1, as most modern ansi fonts are. */
@@ -5705,6 +5825,45 @@ w32_to_x_charset (fncharset)
5705 return buf; 5825 return buf;
5706} 5826}
5707 5827
5828
5829/* Get the Windows codepage corresponding to the specified font. The
5830 charset info in the font name is used to look up
5831 w32-charset-to-codepage-alist. */
5832int
5833w32_codepage_for_font (char *fontname)
5834{
5835 Lisp_Object codepage;
5836 char charset_str[20], *charset, *end;
5837
5838 /* Extract charset part of font string. */
5839 if (sscanf (fontname,
5840 "-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%19s",
5841 charset_str) == EOF)
5842 return CP_DEFAULT;
5843
5844 /* Remove leading "*-". */
5845 if (strncmp ("*-", charset_str, 2) == 0)
5846 charset = charset_str + 2;
5847 else
5848 charset = charset_str;
5849
5850 /* Stop match at wildcard (including preceding '-'). */
5851 if (end = strchr (charset, '*'))
5852 {
5853 if (end > charset && *(end-1) == '-')
5854 end--;
5855 *end = '\0';
5856 }
5857
5858 codepage = Fcdr (Fcdr (Fassoc (build_string(charset),
5859 Vw32_charset_info_alist)));
5860 if (INTEGERP (codepage))
5861 return XINT (codepage);
5862 else
5863 return CP_DEFAULT;
5864}
5865
5866
5708BOOL 5867BOOL
5709w32_to_x_font (lplogfont, lpxstr, len) 5868w32_to_x_font (lplogfont, lpxstr, len)
5710 LOGFONT * lplogfont; 5869 LOGFONT * lplogfont;
@@ -6655,8 +6814,7 @@ Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory )
6655 6814
6656 6815
6657DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 6816DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
6658 "Return non-nil if color COLOR is supported on frame FRAME.\n\ 6817 "Internal function called by `color-defined-p', which see.")
6659If FRAME is omitted or nil, use the selected frame.")
6660 (color, frame) 6818 (color, frame)
6661 Lisp_Object color, frame; 6819 Lisp_Object color, frame;
6662{ 6820{
@@ -6672,11 +6830,7 @@ If FRAME is omitted or nil, use the selected frame.")
6672} 6830}
6673 6831
6674DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, 6832DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
6675 "Return a description of the color named COLOR on frame FRAME.\n\ 6833 "Internal function called by `color-values', which see.")
6676The value is a list of integer RGB values--(RED GREEN BLUE).\n\
6677These values appear to range from 0 to 65280 or 65535, depending\n\
6678on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
6679If FRAME is omitted or nil, use the selected frame.")
6680 (color, frame) 6834 (color, frame)
6681 Lisp_Object color, frame; 6835 Lisp_Object color, frame;
6682{ 6836{
@@ -6702,10 +6856,7 @@ If FRAME is omitted or nil, use the selected frame.")
6702} 6856}
6703 6857
6704DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, 6858DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
6705 "Return t if the X display supports color.\n\ 6859 "Internal function called by `display-color-p', which see.")
6706The optional argument DISPLAY specifies which display to ask about.\n\
6707DISPLAY should be either a frame or a display name (a string).\n\
6708If omitted or nil, that stands for the selected frame's display.")
6709 (display) 6860 (display)
6710 Lisp_Object display; 6861 Lisp_Object display;
6711{ 6862{
@@ -6824,11 +6975,7 @@ If omitted or nil, that stands for the selected frame's display.")
6824 (display) 6975 (display)
6825 Lisp_Object display; 6976 Lisp_Object display;
6826{ 6977{
6827 struct w32_display_info *dpyinfo = check_x_display_info (display); 6978 return build_string ("Microsoft Corp.");
6828 char *vendor = "Microsoft Corp.";
6829
6830 if (! vendor) vendor = "";
6831 return build_string (vendor);
6832} 6979}
6833 6980
6834DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, 6981DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
@@ -6842,8 +6989,6 @@ If omitted or nil, that stands for the selected frame's display.")
6842 (display) 6989 (display)
6843 Lisp_Object display; 6990 Lisp_Object display;
6844{ 6991{
6845 struct w32_display_info *dpyinfo = check_x_display_info (display);
6846
6847 return Fcons (make_number (w32_major_version), 6992 return Fcons (make_number (w32_major_version),
6848 Fcons (make_number (w32_minor_version), Qnil)); 6993 Fcons (make_number (w32_minor_version), Qnil));
6849} 6994}
@@ -6856,8 +7001,6 @@ If omitted or nil, that stands for the selected frame's display.")
6856 (display) 7001 (display)
6857 Lisp_Object display; 7002 Lisp_Object display;
6858{ 7003{
6859 struct w32_display_info *dpyinfo = check_x_display_info (display);
6860
6861 return make_number (1); 7004 return make_number (1);
6862} 7005}
6863 7006
@@ -6956,8 +7099,6 @@ If omitted or nil, that stands for the selected frame's display.")
6956 (display) 7099 (display)
6957 Lisp_Object display; 7100 Lisp_Object display;
6958{ 7101{
6959 struct w32_display_info *dpyinfo = check_x_display_info (display);
6960
6961 return Qnil; 7102 return Qnil;
6962} 7103}
6963 7104
@@ -7170,8 +7311,6 @@ If DISPLAY is omitted or nil, that stands for the selected frame's display.")
7170 (on, display) 7311 (on, display)
7171 Lisp_Object display, on; 7312 Lisp_Object display, on;
7172{ 7313{
7173 struct w32_display_info *dpyinfo = check_x_display_info (display);
7174
7175 return Qnil; 7314 return Qnil;
7176} 7315}
7177 7316
@@ -7201,10 +7340,11 @@ Lisp_Object Qxbm;
7201 7340
7202/* Keywords. */ 7341/* Keywords. */
7203 7342
7204Lisp_Object QCtype, QCascent, QCmargin, QCrelief;
7205extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; 7343extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
7344extern Lisp_Object QCdata;
7345Lisp_Object QCtype, QCascent, QCmargin, QCrelief;
7206Lisp_Object QCalgorithm, QCcolor_symbols, QCheuristic_mask; 7346Lisp_Object QCalgorithm, QCcolor_symbols, QCheuristic_mask;
7207extern Lisp_Object QCindex; 7347Lisp_Object QCindex;
7208 7348
7209/* Other symbols. */ 7349/* Other symbols. */
7210 7350
@@ -7224,6 +7364,7 @@ static void x_laplace P_ ((struct frame *, struct image *));
7224static int x_build_heuristic_mask P_ ((struct frame *, struct image *, 7364static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
7225 Lisp_Object)); 7365 Lisp_Object));
7226 7366
7367
7227/* Define a new image type from TYPE. This adds a copy of TYPE to 7368/* Define a new image type from TYPE. This adds a copy of TYPE to
7228 image_types and adds the symbol *TYPE->type to Vimage_types. */ 7369 image_types and adds the symbol *TYPE->type to Vimage_types. */
7229 7370
@@ -7311,6 +7452,7 @@ enum image_value_type
7311 IMAGE_SYMBOL_VALUE, 7452 IMAGE_SYMBOL_VALUE,
7312 IMAGE_POSITIVE_INTEGER_VALUE, 7453 IMAGE_POSITIVE_INTEGER_VALUE,
7313 IMAGE_NON_NEGATIVE_INTEGER_VALUE, 7454 IMAGE_NON_NEGATIVE_INTEGER_VALUE,
7455 IMAGE_ASCENT_VALUE,
7314 IMAGE_INTEGER_VALUE, 7456 IMAGE_INTEGER_VALUE,
7315 IMAGE_FUNCTION_VALUE, 7457 IMAGE_FUNCTION_VALUE,
7316 IMAGE_NUMBER_VALUE, 7458 IMAGE_NUMBER_VALUE,
@@ -7413,6 +7555,15 @@ parse_image_spec (spec, keywords, nkeywords, type)
7413 return 0; 7555 return 0;
7414 break; 7556 break;
7415 7557
7558 case IMAGE_ASCENT_VALUE:
7559 if (SYMBOLP (value) && EQ (value, Qcenter))
7560 break;
7561 else if (INTEGERP (value)
7562 && XINT (value) >= 0
7563 && XINT (value) <= 100)
7564 break;
7565 return 0;
7566
7416 case IMAGE_NON_NEGATIVE_INTEGER_VALUE: 7567 case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
7417 if (!INTEGERP (value) || XINT (value) < 0) 7568 if (!INTEGERP (value) || XINT (value) < 0)
7418 return 0; 7569 return 0;
@@ -7575,6 +7726,32 @@ prepare_image_for_display (f, img)
7575} 7726}
7576 7727
7577 7728
7729/* Value is the number of pixels for the ascent of image IMG when
7730 drawn in face FACE. */
7731
7732int
7733image_ascent (img, face)
7734 struct image *img;
7735 struct face *face;
7736{
7737 int height = img->height + img->margin;
7738 int ascent;
7739
7740 if (img->ascent == CENTERED_IMAGE_ASCENT)
7741 {
7742 if (face->font)
7743 ascent = height / 2 - (FONT_DESCENT(face->font)
7744 - FONT_BASE(face->font)) / 2;
7745 else
7746 ascent = height / 2;
7747 }
7748 else
7749 ascent = height * img->ascent / 100.0;
7750
7751 return ascent;
7752}
7753
7754
7578 7755
7579/*********************************************************************** 7756/***********************************************************************
7580 Helper functions for X image types 7757 Helper functions for X image types
@@ -7721,8 +7898,8 @@ free_image_cache (f)
7721/* Clear image cache of frame F. FORCE_P non-zero means free all 7898/* Clear image cache of frame F. FORCE_P non-zero means free all
7722 images. FORCE_P zero means clear only images that haven't been 7899 images. FORCE_P zero means clear only images that haven't been
7723 displayed for some time. Should be called from time to time to 7900 displayed for some time. Should be called from time to time to
7724 reduce the number of loaded images. If image-cache-eveiction-delay 7901 reduce the number of loaded images. If image-eviction-seconds is
7725 is non-nil, this frees images in the cache which weren't displayed for 7902 non-nil, this frees images in the cache which weren't displayed for
7726 at least that many seconds. */ 7903 at least that many seconds. */
7727 7904
7728void 7905void
@@ -7851,7 +8028,9 @@ lookup_image (f, spec)
7851 ascent = image_spec_value (spec, QCascent, NULL); 8028 ascent = image_spec_value (spec, QCascent, NULL);
7852 if (INTEGERP (ascent)) 8029 if (INTEGERP (ascent))
7853 img->ascent = XFASTINT (ascent); 8030 img->ascent = XFASTINT (ascent);
7854 8031 else if (EQ (ascent, Qcenter))
8032 img->ascent = CENTERED_IMAGE_ASCENT;
8033
7855 margin = image_spec_value (spec, QCmargin, NULL); 8034 margin = image_spec_value (spec, QCmargin, NULL);
7856 if (INTEGERP (margin) && XINT (margin) >= 0) 8035 if (INTEGERP (margin) && XINT (margin) >= 0)
7857 img->margin = XFASTINT (margin); 8036 img->margin = XFASTINT (margin);
@@ -8790,11 +8969,18 @@ xpm_load (f, img)
8790 /* Configure the XPM lib. Use the visual of frame F. Allocate 8969 /* Configure the XPM lib. Use the visual of frame F. Allocate
8791 close colors. Return colors allocated. */ 8970 close colors. Return colors allocated. */
8792 bzero (&attrs, sizeof attrs); 8971 bzero (&attrs, sizeof attrs);
8793 attrs.visual = FRAME_W32_DISPLAY_INFO (f)->visual; 8972 attrs.visual = FRAME_X_VISUAL (f);
8973 attrs.colormap = FRAME_X_COLORMAP (f);
8794 attrs.valuemask |= XpmVisual; 8974 attrs.valuemask |= XpmVisual;
8975 attrs.valuemask |= XpmColormap;
8795 attrs.valuemask |= XpmReturnAllocPixels; 8976 attrs.valuemask |= XpmReturnAllocPixels;
8977#ifdef XpmAllocCloseColors
8796 attrs.alloc_close_colors = 1; 8978 attrs.alloc_close_colors = 1;
8797 attrs.valuemask |= XpmAllocCloseColors; 8979 attrs.valuemask |= XpmAllocCloseColors;
8980#else
8981 attrs.closeness = 600;
8982 attrs.valuemask |= XpmCloseness;
8983#endif
8798 8984
8799 /* If image specification contains symbolic color definitions, add 8985 /* If image specification contains symbolic color definitions, add
8800 these to `attrs'. */ 8986 these to `attrs'. */
@@ -9569,14 +9755,6 @@ pbm_load (f, img)
9569 return 0; 9755 return 0;
9570 } 9756 }
9571 9757
9572 if (*magic != 'P')
9573 {
9574 fclose (fp);
9575 image_error ("Not a PBM image file: %s", file, Qnil);
9576 UNGCPRO;
9577 return 0;
9578 }
9579
9580 switch (*p++) 9758 switch (*p++)
9581 { 9759 {
9582 case '1': 9760 case '1':
@@ -9682,7 +9860,7 @@ pbm_load (f, img)
9682 9860
9683 if (r < 0 || g < 0 || b < 0) 9861 if (r < 0 || g < 0 || b < 0)
9684 { 9862 {
9685b xfree (ximg->data); 9863 xfree (ximg->data);
9686 ximg->data = NULL; 9864 ximg->data = NULL;
9687 XDestroyImage (ximg); 9865 XDestroyImage (ximg);
9688 UNBLOCK_INPUT; 9866 UNBLOCK_INPUT;
@@ -9821,7 +9999,6 @@ my_png_warning (png_ptr, msg)
9821 image_error ("PNG warning: %s", build_string (msg), Qnil); 9999 image_error ("PNG warning: %s", build_string (msg), Qnil);
9822} 10000}
9823 10001
9824
9825/* Memory source for PNG decoding. */ 10002/* Memory source for PNG decoding. */
9826 10003
9827struct png_memory_storage 10004struct png_memory_storage
@@ -9852,7 +10029,6 @@ png_read_from_memory (png_ptr, data, length)
9852 tbr->index = tbr->index + length; 10029 tbr->index = tbr->index + length;
9853} 10030}
9854 10031
9855
9856/* Load PNG image IMG for use on frame F. Value is non-zero if 10032/* Load PNG image IMG for use on frame F. Value is non-zero if
9857 successful. */ 10033 successful. */
9858 10034
@@ -9938,7 +10114,6 @@ png_load (f, img)
9938 tbr.bytes += sizeof (sig); 10114 tbr.bytes += sizeof (sig);
9939 } 10115 }
9940 10116
9941
9942 /* Initialize read and info structs for PNG lib. */ 10117 /* Initialize read and info structs for PNG lib. */
9943 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, 10118 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL,
9944 my_png_error, my_png_warning); 10119 my_png_error, my_png_warning);
@@ -10302,7 +10477,6 @@ my_error_exit (cinfo)
10302 longjmp (mgr->setjmp_buffer, 1); 10477 longjmp (mgr->setjmp_buffer, 1);
10303} 10478}
10304 10479
10305
10306/* Init source method for JPEG data source manager. Called by 10480/* Init source method for JPEG data source manager. Called by
10307 jpeg_read_header() before any data is actually read. See 10481 jpeg_read_header() before any data is actually read. See
10308 libjpeg.doc from the JPEG lib distribution. */ 10482 libjpeg.doc from the JPEG lib distribution. */
@@ -10426,7 +10600,6 @@ jpeg_load (f, img)
10426 file = Qnil; 10600 file = Qnil;
10427 GCPRO1 (file); 10601 GCPRO1 (file);
10428 10602
10429
10430 if (NILP (specified_data)) 10603 if (NILP (specified_data))
10431 { 10604 {
10432 file = x_find_image_file (specified_file); 10605 file = x_find_image_file (specified_file);
@@ -10761,7 +10934,6 @@ tiff_size_of_memory (data)
10761 return ((tiff_memory_source *) data)->len; 10934 return ((tiff_memory_source *) data)->len;
10762} 10935}
10763 10936
10764
10765/* Load TIFF image IMG for use on frame F. Value is non-zero if 10937/* Load TIFF image IMG for use on frame F. Value is non-zero if
10766 successful. */ 10938 successful. */
10767 10939
@@ -11028,11 +11200,11 @@ gif_load (f, img)
11028 specified_file = image_spec_value (img->spec, QCfile, NULL); 11200 specified_file = image_spec_value (img->spec, QCfile, NULL);
11029 specified_data = image_spec_value (img->spec, QCdata, NULL); 11201 specified_data = image_spec_value (img->spec, QCdata, NULL);
11030 file = Qnil; 11202 file = Qnil;
11203 GCPRO1 (file);
11031 11204
11032 if (NILP (specified_data)) 11205 if (NILP (specified_data))
11033 { 11206 {
11034 file = x_find_image_file (specified_file); 11207 file = x_find_image_file (specified_file);
11035 GCPRO1 (file);
11036 if (!STRINGP (file)) 11208 if (!STRINGP (file))
11037 { 11209 {
11038 image_error ("Cannot find image file `%s'", specified_file, Qnil); 11210 image_error ("Cannot find image file `%s'", specified_file, Qnil);
@@ -11633,17 +11805,25 @@ start_busy_cursor ()
11633{ 11805{
11634#if 0 /* NTEMACS_TODO: cursor shape changes. */ 11806#if 0 /* NTEMACS_TODO: cursor shape changes. */
11635 EMACS_TIME delay; 11807 EMACS_TIME delay;
11636 int secs; 11808 int secs, usecs = 0;
11637 11809
11638 cancel_busy_cursor (); 11810 cancel_busy_cursor ();
11639 11811
11640 if (INTEGERP (Vbusy_cursor_delay) 11812 if (INTEGERP (Vbusy_cursor_delay)
11641 && XINT (Vbusy_cursor_delay) > 0) 11813 && XINT (Vbusy_cursor_delay) > 0)
11642 secs = XFASTINT (Vbusy_cursor_delay); 11814 secs = XFASTINT (Vbusy_cursor_delay);
11815 else if (FLOATP (Vbusy_cursor_delay)
11816 && XFLOAT_DATA (Vbusy_cursor_delay) > 0)
11817 {
11818 Lisp_Object tem;
11819 tem = Ftruncate (Vbusy_cursor_delay, Qnil);
11820 secs = XFASTINT (tem);
11821 usecs = (XFLOAT_DATA (Vbusy_cursor_delay) - secs) * 1000000;
11822 }
11643 else 11823 else
11644 secs = DEFAULT_BUSY_CURSOR_DELAY; 11824 secs = DEFAULT_BUSY_CURSOR_DELAY;
11645 11825
11646 EMACS_SET_SECS_USECS (delay, secs, 0); 11826 EMACS_SET_SECS_USECS (delay, secs, usecs);
11647 busy_cursor_atimer = start_atimer (ATIMER_RELATIVE, delay, 11827 busy_cursor_atimer = start_atimer (ATIMER_RELATIVE, delay,
11648 show_busy_cursor, NULL); 11828 show_busy_cursor, NULL);
11649#endif 11829#endif
@@ -11657,7 +11837,11 @@ void
11657cancel_busy_cursor () 11837cancel_busy_cursor ()
11658{ 11838{
11659 if (busy_cursor_atimer) 11839 if (busy_cursor_atimer)
11660 cancel_atimer (busy_cursor_atimer); 11840 {
11841 cancel_atimer (busy_cursor_atimer);
11842 busy_cursor_atimer = NULL;
11843 }
11844
11661 if (busy_cursor_shown_p) 11845 if (busy_cursor_shown_p)
11662 hide_busy_cursor (); 11846 hide_busy_cursor ();
11663} 11847}
@@ -12039,7 +12223,7 @@ TIMEOUT nil means use the default timeout of 5 seconds.")
12039 12223
12040 specbind (Qinhibit_redisplay, Qt); 12224 specbind (Qinhibit_redisplay, Qt);
12041 12225
12042 GCPRO3 (string, parms, frame, timeout); 12226 GCPRO4 (string, parms, frame, timeout);
12043 12227
12044 CHECK_STRING (string, 0); 12228 CHECK_STRING (string, 0);
12045 f = check_x_frame (frame); 12229 f = check_x_frame (frame);
@@ -12148,8 +12332,8 @@ TIMEOUT nil means use the default timeout of 5 seconds.")
12148 /* Let the tip disappear after timeout seconds. */ 12332 /* Let the tip disappear after timeout seconds. */
12149 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, 12333 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
12150 intern ("x-hide-tip")); 12334 intern ("x-hide-tip"));
12151 UNGCPRO;
12152 12335
12336 UNGCPRO;
12153 return unbind_to (count, Qnil); 12337 return unbind_to (count, Qnil);
12154} 12338}
12155 12339
@@ -12291,7 +12475,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil.")
12291 if (NILP (file)) 12475 if (NILP (file))
12292 Fsignal (Qquit, Qnil); 12476 Fsignal (Qquit, Qnil);
12293 12477
12294 return file; 12478 return unbind_to (count, file);
12295} 12479}
12296 12480
12297 12481
@@ -12723,12 +12907,12 @@ syms_of_w32fns ()
12723 staticpro (&Quser_position); 12907 staticpro (&Quser_position);
12724 Quser_size = intern ("user-size"); 12908 Quser_size = intern ("user-size");
12725 staticpro (&Quser_size); 12909 staticpro (&Quser_size);
12726#if 0 /* Duplicate initialization in xdisp.c */
12727 Qdisplay = intern ("display");
12728 staticpro (&Qdisplay);
12729#endif
12730 Qscreen_gamma = intern ("screen-gamma"); 12910 Qscreen_gamma = intern ("screen-gamma");
12731 staticpro (&Qscreen_gamma); 12911 staticpro (&Qscreen_gamma);
12912 Qline_spacing = intern ("line-spacing");
12913 staticpro (&Qline_spacing);
12914 Qcenter = intern ("center");
12915 staticpro (&Qcenter);
12732 /* This is the end of symbol initialization. */ 12916 /* This is the end of symbol initialization. */
12733 12917
12734 Qhyper = intern ("hyper"); 12918 Qhyper = intern ("hyper");
@@ -12914,7 +13098,7 @@ or when you set the mouse color.");
12914 13098
12915 DEFVAR_LISP ("busy-cursor-delay", &Vbusy_cursor_delay, 13099 DEFVAR_LISP ("busy-cursor-delay", &Vbusy_cursor_delay,
12916 "*Seconds to wait before displaying a busy-cursor.\n\ 13100 "*Seconds to wait before displaying a busy-cursor.\n\
12917Value must be an integer."); 13101Value must be an integer or float.");
12918 Vbusy_cursor_delay = make_number (DEFAULT_BUSY_CURSOR_DELAY); 13102 Vbusy_cursor_delay = make_number (DEFAULT_BUSY_CURSOR_DELAY);
12919 13103
12920 DEFVAR_LISP ("x-sensitive-text-pointer-shape", 13104 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
@@ -12980,6 +13164,87 @@ only be necessary if the default setting causes problems.");
12980 "Coding system used by Windows system functions, such as for font names."); 13164 "Coding system used by Windows system functions, such as for font names.");
12981 Vw32_system_coding_system = Qnil; 13165 Vw32_system_coding_system = Qnil;
12982 13166
13167 DEFVAR_LISP ("w32-charset-info-alist",
13168 &Vw32_charset_info_alist,
13169 "Alist linking Emacs character sets to Windows fonts\n\
13170and codepages. Each entry should be of the form:\n\
13171\n\
13172 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE))\n\
13173\n\
13174where CHARSET_NAME is a string used in font names to identify the charset,\n\
13175WINDOWS_CHARSET is a symbol that can be one of:\n\
13176w32-charset-ansi, w32-charset-default, w32-charset-symbol,\n\
13177w32-charset-shiftjis, w32-charset-hangul, w32-charset-gb2312,\n\
13178w32-charset-chinesebig5, "
13179#ifdef JOHAB_CHARSET
13180"w32-charset-johab, w32-charset-hebrew,\n\
13181w32-charset-arabic, w32-charset-greek, w32-charset-turkish,\n\
13182w32-charset-vietnamese, w32-charset-thai, w32-charset-easteurope,\n\
13183w32-charset-russian, w32-charset-mac, w32-charset-baltic,\n"
13184#endif
13185#ifdef UNICODE_CHARSET
13186"w32-charset-unicode, "
13187#endif
13188"or w32-charset-oem.\n\
13189CODEPAGE should be an integer specifying the codepage that should be used\n\
13190to display the character set, t to do no translation and output as Unicode,\n\
13191or nil to do no translation and output as 8 bit (or multibyte on far-east\n\
13192versions of Windows) characters.");
13193 Vw32_charset_info_alist = Qnil;
13194
13195 staticpro (&Qw32_charset_ansi);
13196 Qw32_charset_ansi = intern ("w32-charset-ansi");
13197 staticpro (&Qw32_charset_symbol);
13198 Qw32_charset_symbol = intern ("w32-charset-symbol");
13199 staticpro (&Qw32_charset_shiftjis);
13200 Qw32_charset_shiftjis = intern ("w32-charset-shiftjis");
13201 staticpro (&Qw32_charset_hangul);
13202 Qw32_charset_hangul = intern ("w32-charset-hangul");
13203 staticpro (&Qw32_charset_chinesebig5);
13204 Qw32_charset_chinesebig5 = intern ("w32-charset-chinesebig5");
13205 staticpro (&Qw32_charset_gb2312);
13206 Qw32_charset_gb2312 = intern ("w32-charset-gb2312");
13207 staticpro (&Qw32_charset_oem);
13208 Qw32_charset_oem = intern ("w32-charset-oem");
13209
13210#ifdef JOHAB_CHARSET
13211 {
13212 static int w32_extra_charsets_defined = 1;
13213 DEFVAR_BOOL ("w32-extra-charsets-defined", w32_extra_charsets_defined, "");
13214
13215 staticpro (&Qw32_charset_johab);
13216 Qw32_charset_johab = intern ("w32-charset-johab");
13217 staticpro (&Qw32_charset_easteurope);
13218 Qw32_charset_easteurope = intern ("w32-charset-easteurope");
13219 staticpro (&Qw32_charset_turkish);
13220 Qw32_charset_turkish = intern ("w32-charset-turkish");
13221 staticpro (&Qw32_charset_baltic);
13222 Qw32_charset_baltic = intern ("w32-charset-baltic");
13223 staticpro (&Qw32_charset_russian);
13224 Qw32_charset_russian = intern ("w32-charset-russian");
13225 staticpro (&Qw32_charset_arabic);
13226 Qw32_charset_arabic = intern ("w32-charset-arabic");
13227 staticpro (&Qw32_charset_greek);
13228 Qw32_charset_greek = intern ("w32-charset-greek");
13229 staticpro (&Qw32_charset_hebrew);
13230 Qw32_charset_hebrew = intern ("w32-charset-hebrew");
13231 staticpro (&Qw32_charset_thai);
13232 Qw32_charset_thai = intern ("w32-charset-thai");
13233 staticpro (&Qw32_charset_mac);
13234 Qw32_charset_mac = intern ("w32-charset-mac");
13235 }
13236#endif
13237
13238#ifdef UNICODE_CHARSET
13239 {
13240 static int w32_unicode_charset_defined = 1;
13241 DEFVAR_BOOL ("w32-unicode-charset-defined",
13242 w32_unicode_charset_defined, "");
13243
13244 staticpro (&Qw32_charset_unicode);
13245 Qw32_charset_unicode = intern ("w32-charset-unicode");
13246#endif
13247
12983 defsubr (&Sx_get_resource); 13248 defsubr (&Sx_get_resource);
12984#if 0 /* NTEMACS_TODO: Port to W32 */ 13249#if 0 /* NTEMACS_TODO: Port to W32 */
12985 defsubr (&Sx_change_window_property); 13250 defsubr (&Sx_change_window_property);
@@ -13106,6 +13371,9 @@ only be necessary if the default setting causes problems.");
13106#endif 13371#endif
13107#endif /* NTEMACS_TODO */ 13372#endif /* NTEMACS_TODO */
13108 13373
13374 busy_cursor_atimer = NULL;
13375 busy_cursor_shown_p = 0;
13376
13109 defsubr (&Sx_show_tip); 13377 defsubr (&Sx_show_tip);
13110 defsubr (&Sx_hide_tip); 13378 defsubr (&Sx_hide_tip);
13111 staticpro (&tip_timer); 13379 staticpro (&tip_timer);