aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c607
1 files changed, 304 insertions, 303 deletions
diff --git a/src/xfns.c b/src/xfns.c
index d8a41b5d537..34b34f81da9 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -284,11 +284,11 @@ check_x_display_info (frame)
284 Lisp_Object frame; 284 Lisp_Object frame;
285{ 285{
286 struct x_display_info *dpyinfo = NULL; 286 struct x_display_info *dpyinfo = NULL;
287 287
288 if (NILP (frame)) 288 if (NILP (frame))
289 { 289 {
290 struct frame *sf = XFRAME (selected_frame); 290 struct frame *sf = XFRAME (selected_frame);
291 291
292 if (FRAME_X_P (sf) && FRAME_LIVE_P (sf)) 292 if (FRAME_X_P (sf) && FRAME_LIVE_P (sf))
293 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 293 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
294 else if (x_display_list != 0) 294 else if (x_display_list != 0)
@@ -332,7 +332,7 @@ x_window_to_frame (dpyinfo, wdesc)
332 if (f->output_data.x->hourglass_window == wdesc) 332 if (f->output_data.x->hourglass_window == wdesc)
333 return f; 333 return f;
334#ifdef USE_X_TOOLKIT 334#ifdef USE_X_TOOLKIT
335 if ((f->output_data.x->edit_widget 335 if ((f->output_data.x->edit_widget
336 && XtWindow (f->output_data.x->edit_widget) == wdesc) 336 && XtWindow (f->output_data.x->edit_widget) == wdesc)
337 /* A tooltip frame? */ 337 /* A tooltip frame? */
338 || (!f->output_data.x->edit_widget 338 || (!f->output_data.x->edit_widget
@@ -367,7 +367,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
367 frame = XCAR (tail); 367 frame = XCAR (tail);
368 if (!GC_FRAMEP (frame)) 368 if (!GC_FRAMEP (frame))
369 continue; 369 continue;
370 370
371 f = XFRAME (frame); 371 f = XFRAME (frame);
372 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo) 372 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
373 { 373 {
@@ -377,8 +377,8 @@ x_any_window_to_frame (dpyinfo, wdesc)
377 found = f; 377 found = f;
378 else if (x->widget) 378 else if (x->widget)
379 { 379 {
380 if (wdesc == XtWindow (x->widget) 380 if (wdesc == XtWindow (x->widget)
381 || wdesc == XtWindow (x->column_widget) 381 || wdesc == XtWindow (x->column_widget)
382 || wdesc == XtWindow (x->edit_widget)) 382 || wdesc == XtWindow (x->edit_widget))
383 found = f; 383 found = f;
384 /* Match if the window is this frame's menubar. */ 384 /* Match if the window is this frame's menubar. */
@@ -390,7 +390,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
390 found = f; 390 found = f;
391 } 391 }
392 } 392 }
393 393
394 return found; 394 return found;
395} 395}
396 396
@@ -419,8 +419,8 @@ x_non_menubar_window_to_frame (dpyinfo, wdesc)
419 return f; 419 return f;
420 else if (x->widget) 420 else if (x->widget)
421 { 421 {
422 if (wdesc == XtWindow (x->widget) 422 if (wdesc == XtWindow (x->widget)
423 || wdesc == XtWindow (x->column_widget) 423 || wdesc == XtWindow (x->column_widget)
424 || wdesc == XtWindow (x->edit_widget)) 424 || wdesc == XtWindow (x->edit_widget))
425 return f; 425 return f;
426 } 426 }
@@ -490,7 +490,7 @@ x_top_window_to_frame (dpyinfo, wdesc)
490 but it seems logically wrong, 490 but it seems logically wrong,
491 and it causes trouble for MapNotify events. */ 491 and it causes trouble for MapNotify events. */
492 /* Match if the window is this frame's menubar. */ 492 /* Match if the window is this frame's menubar. */
493 if (x->menubar_widget 493 if (x->menubar_widget
494 && wdesc == XtWindow (x->menubar_widget)) 494 && wdesc == XtWindow (x->menubar_widget))
495 return f; 495 return f;
496#endif 496#endif
@@ -806,7 +806,7 @@ static struct x_frame_parm_table x_frame_parms[] =
806 {"right-fringe", x_set_fringe_width}, 806 {"right-fringe", x_set_fringe_width},
807 {"wait-for-wm", x_set_wait_for_wm}, 807 {"wait-for-wm", x_set_wait_for_wm},
808 {"fullscreen", x_set_fullscreen}, 808 {"fullscreen", x_set_fullscreen},
809 809
810}; 810};
811 811
812/* Attach the `x-frame-parameter' properties to 812/* Attach the `x-frame-parameter' properties to
@@ -925,7 +925,7 @@ x_set_frame_parameters (f, alist)
925 cursor_color) are dependent upon them. */ 925 cursor_color) are dependent upon them. */
926 /* Process default font as well, since fringe widths depends on it. */ 926 /* Process default font as well, since fringe widths depends on it. */
927 /* Also, process fullscreen, width and height depend upon that */ 927 /* Also, process fullscreen, width and height depend upon that */
928 for (p = 0; p < i; p++) 928 for (p = 0; p < i; p++)
929 { 929 {
930 Lisp_Object prop, val; 930 Lisp_Object prop, val;
931 931
@@ -940,7 +940,7 @@ x_set_frame_parameters (f, alist)
940 940
941 old_value = get_frame_param (f, prop); 941 old_value = get_frame_param (f, prop);
942 fullscreen_is_being_set |= EQ (prop, Qfullscreen); 942 fullscreen_is_being_set |= EQ (prop, Qfullscreen);
943 943
944 if (NILP (Fequal (val, old_value))) 944 if (NILP (Fequal (val, old_value)))
945 { 945 {
946 store_frame_param (f, prop, val); 946 store_frame_param (f, prop, val);
@@ -1040,11 +1040,11 @@ x_set_frame_parameters (f, alist)
1040 position. Resize of the frame is taken care of in the code after 1040 position. Resize of the frame is taken care of in the code after
1041 this if-statement. */ 1041 this if-statement. */
1042 int new_left, new_top; 1042 int new_left, new_top;
1043 1043
1044 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); 1044 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left);
1045 x_fullscreen_move (f, new_top, new_left); 1045 x_fullscreen_move (f, new_top, new_left);
1046 } 1046 }
1047 1047
1048 /* Don't set these parameters unless they've been explicitly 1048 /* Don't set these parameters unless they've been explicitly
1049 specified. The window might be mapped or resized while we're in 1049 specified. The window might be mapped or resized while we're in
1050 this function, and we don't want to override that unless the lisp 1050 this function, and we don't want to override that unless the lisp
@@ -1188,12 +1188,12 @@ x_real_positions (f, xptr, yptr)
1188 1188
1189 win = wm_window; 1189 win = wm_window;
1190 } 1190 }
1191 1191
1192 if (! had_errors) 1192 if (! had_errors)
1193 { 1193 {
1194 int ign; 1194 int ign;
1195 Window child, rootw; 1195 Window child, rootw;
1196 1196
1197 /* Get the real coordinates for the WM window upper left corner */ 1197 /* Get the real coordinates for the WM window upper left corner */
1198 XGetGeometry (FRAME_X_DISPLAY (f), win, 1198 XGetGeometry (FRAME_X_DISPLAY (f), win,
1199 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); 1199 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
@@ -1232,23 +1232,23 @@ x_real_positions (f, xptr, yptr)
1232 /* From-window, to-window. */ 1232 /* From-window, to-window. */
1233 FRAME_X_DISPLAY_INFO (f)->root_window, 1233 FRAME_X_DISPLAY_INFO (f)->root_window,
1234 FRAME_OUTER_WINDOW (f), 1234 FRAME_OUTER_WINDOW (f),
1235 1235
1236 /* From-position, to-position. */ 1236 /* From-position, to-position. */
1237 real_x, real_y, &outer_x, &outer_y, 1237 real_x, real_y, &outer_x, &outer_y,
1238 1238
1239 /* Child of win. */ 1239 /* Child of win. */
1240 &child); 1240 &child);
1241 } 1241 }
1242 1242
1243 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 1243 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
1244 } 1244 }
1245 1245
1246 x_uncatch_errors (FRAME_X_DISPLAY (f), count); 1246 x_uncatch_errors (FRAME_X_DISPLAY (f), count);
1247 1247
1248 UNBLOCK_INPUT; 1248 UNBLOCK_INPUT;
1249 1249
1250 if (had_errors) return; 1250 if (had_errors) return;
1251 1251
1252 f->output_data.x->x_pixels_diff = -win_x; 1252 f->output_data.x->x_pixels_diff = -win_x;
1253 f->output_data.x->y_pixels_diff = -win_y; 1253 f->output_data.x->y_pixels_diff = -win_y;
1254 f->output_data.x->x_pixels_outer_diff = -outer_x; 1254 f->output_data.x->x_pixels_outer_diff = -outer_x;
@@ -1508,7 +1508,7 @@ x_set_foreground_color (f, arg, oldval)
1508 if (FRAME_X_WINDOW (f) != 0) 1508 if (FRAME_X_WINDOW (f) != 0)
1509 { 1509 {
1510 Display *dpy = FRAME_X_DISPLAY (f); 1510 Display *dpy = FRAME_X_DISPLAY (f);
1511 1511
1512 BLOCK_INPUT; 1512 BLOCK_INPUT;
1513 XSetForeground (dpy, x->normal_gc, fg); 1513 XSetForeground (dpy, x->normal_gc, fg);
1514 XSetBackground (dpy, x->reverse_gc, fg); 1514 XSetBackground (dpy, x->reverse_gc, fg);
@@ -1519,15 +1519,15 @@ x_set_foreground_color (f, arg, oldval)
1519 x->cursor_pixel = x_copy_color (f, fg); 1519 x->cursor_pixel = x_copy_color (f, fg);
1520 XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); 1520 XSetBackground (dpy, x->cursor_gc, x->cursor_pixel);
1521 } 1521 }
1522 1522
1523 UNBLOCK_INPUT; 1523 UNBLOCK_INPUT;
1524 1524
1525 update_face_from_frame_parameter (f, Qforeground_color, arg); 1525 update_face_from_frame_parameter (f, Qforeground_color, arg);
1526 1526
1527 if (FRAME_VISIBLE_P (f)) 1527 if (FRAME_VISIBLE_P (f))
1528 redraw_frame (f); 1528 redraw_frame (f);
1529 } 1529 }
1530 1530
1531 unload_color (f, old_fg); 1531 unload_color (f, old_fg);
1532} 1532}
1533 1533
@@ -1546,7 +1546,7 @@ x_set_background_color (f, arg, oldval)
1546 if (FRAME_X_WINDOW (f) != 0) 1546 if (FRAME_X_WINDOW (f) != 0)
1547 { 1547 {
1548 Display *dpy = FRAME_X_DISPLAY (f); 1548 Display *dpy = FRAME_X_DISPLAY (f);
1549 1549
1550 BLOCK_INPUT; 1550 BLOCK_INPUT;
1551 XSetBackground (dpy, x->normal_gc, bg); 1551 XSetBackground (dpy, x->normal_gc, bg);
1552 XSetForeground (dpy, x->reverse_gc, bg); 1552 XSetForeground (dpy, x->reverse_gc, bg);
@@ -1631,7 +1631,7 @@ x_set_mouse_color (f, arg, oldval)
1631 else 1631 else
1632 hourglass_cursor = XCreateFontCursor (dpy, XC_watch); 1632 hourglass_cursor = XCreateFontCursor (dpy, XC_watch);
1633 x_check_errors (dpy, "bad hourglass pointer cursor: %s"); 1633 x_check_errors (dpy, "bad hourglass pointer cursor: %s");
1634 1634
1635 x_check_errors (dpy, "bad nontext pointer cursor: %s"); 1635 x_check_errors (dpy, "bad nontext pointer cursor: %s");
1636 if (!NILP (Vx_mode_pointer_shape)) 1636 if (!NILP (Vx_mode_pointer_shape))
1637 { 1637 {
@@ -1672,7 +1672,7 @@ x_set_mouse_color (f, arg, oldval)
1672 x_query_color (f, &fore_color); 1672 x_query_color (f, &fore_color);
1673 back_color.pixel = mask_color; 1673 back_color.pixel = mask_color;
1674 x_query_color (f, &back_color); 1674 x_query_color (f, &back_color);
1675 1675
1676 XRecolorCursor (dpy, cursor, &fore_color, &back_color); 1676 XRecolorCursor (dpy, cursor, &fore_color, &back_color);
1677 XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color); 1677 XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color);
1678 XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color); 1678 XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color);
@@ -1703,7 +1703,7 @@ x_set_mouse_color (f, arg, oldval)
1703 && x->modeline_cursor != 0) 1703 && x->modeline_cursor != 0)
1704 XFreeCursor (dpy, f->output_data.x->modeline_cursor); 1704 XFreeCursor (dpy, f->output_data.x->modeline_cursor);
1705 x->modeline_cursor = mode_cursor; 1705 x->modeline_cursor = mode_cursor;
1706 1706
1707 if (cross_cursor != x->cross_cursor 1707 if (cross_cursor != x->cross_cursor
1708 && x->cross_cursor != 0) 1708 && x->cross_cursor != 0)
1709 XFreeCursor (dpy, x->cross_cursor); 1709 XFreeCursor (dpy, x->cross_cursor);
@@ -1737,7 +1737,7 @@ x_set_cursor_color (f, arg, oldval)
1737 } 1737 }
1738 else 1738 else
1739 fore_pixel = x->background_pixel; 1739 fore_pixel = x->background_pixel;
1740 1740
1741 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); 1741 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
1742 pixel_allocated_p = 1; 1742 pixel_allocated_p = 1;
1743 1743
@@ -1749,7 +1749,7 @@ x_set_cursor_color (f, arg, oldval)
1749 x_free_colors (f, &pixel, 1); 1749 x_free_colors (f, &pixel, 1);
1750 pixel_allocated_p = 0; 1750 pixel_allocated_p = 0;
1751 } 1751 }
1752 1752
1753 pixel = x->mouse_pixel; 1753 pixel = x->mouse_pixel;
1754 if (pixel == fore_pixel) 1754 if (pixel == fore_pixel)
1755 { 1755 {
@@ -1957,7 +1957,7 @@ x_set_font (f, arg, oldval)
1957 ? x_new_fontset (f, SDATA (fontset_name)) 1957 ? x_new_fontset (f, SDATA (fontset_name))
1958 : x_new_font (f, SDATA (arg))); 1958 : x_new_font (f, SDATA (arg)));
1959 UNBLOCK_INPUT; 1959 UNBLOCK_INPUT;
1960 1960
1961 if (EQ (result, Qnil)) 1961 if (EQ (result, Qnil))
1962 error ("Font `%s' is not defined", SDATA (arg)); 1962 error ("Font `%s' is not defined", SDATA (arg));
1963 else if (EQ (result, Qt)) 1963 else if (EQ (result, Qt))
@@ -1973,7 +1973,7 @@ x_set_font (f, arg, oldval)
1973 } 1973 }
1974 else if (!NILP (Fequal (result, oldval))) 1974 else if (!NILP (Fequal (result, oldval)))
1975 return; 1975 return;
1976 1976
1977 store_frame_param (f, Qfont, result); 1977 store_frame_param (f, Qfont, result);
1978 recompute_basic_faces (f); 1978 recompute_basic_faces (f);
1979 } 1979 }
@@ -2185,7 +2185,7 @@ x_set_tool_bar_lines (f, value, oldval)
2185 FRAME_TOOL_BAR_LINES (f) = nlines; 2185 FRAME_TOOL_BAR_LINES (f) = nlines;
2186 x_change_window_heights (root_window, delta); 2186 x_change_window_heights (root_window, delta);
2187 adjust_glyphs (f); 2187 adjust_glyphs (f);
2188 2188
2189 /* We also have to make sure that the internal border at the top of 2189 /* We also have to make sure that the internal border at the top of
2190 the frame, below the menu bar or tool bar, is redrawn when the 2190 the frame, below the menu bar or tool bar, is redrawn when the
2191 tool bar disappears. This is so because the internal border is 2191 tool bar disappears. This is so because the internal border is
@@ -2231,7 +2231,7 @@ x_set_scroll_bar_foreground (f, value, oldval)
2231 Lisp_Object value, oldval; 2231 Lisp_Object value, oldval;
2232{ 2232{
2233 unsigned long pixel; 2233 unsigned long pixel;
2234 2234
2235 if (STRINGP (value)) 2235 if (STRINGP (value))
2236 pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f)); 2236 pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f));
2237 else 2237 else
@@ -2239,7 +2239,7 @@ x_set_scroll_bar_foreground (f, value, oldval)
2239 2239
2240 if (f->output_data.x->scroll_bar_foreground_pixel != -1) 2240 if (f->output_data.x->scroll_bar_foreground_pixel != -1)
2241 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); 2241 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel);
2242 2242
2243 f->output_data.x->scroll_bar_foreground_pixel = pixel; 2243 f->output_data.x->scroll_bar_foreground_pixel = pixel;
2244 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) 2244 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f))
2245 { 2245 {
@@ -2271,10 +2271,10 @@ x_set_scroll_bar_background (f, value, oldval)
2271 pixel = x_decode_color (f, value, WHITE_PIX_DEFAULT (f)); 2271 pixel = x_decode_color (f, value, WHITE_PIX_DEFAULT (f));
2272 else 2272 else
2273 pixel = -1; 2273 pixel = -1;
2274 2274
2275 if (f->output_data.x->scroll_bar_background_pixel != -1) 2275 if (f->output_data.x->scroll_bar_background_pixel != -1)
2276 unload_color (f, f->output_data.x->scroll_bar_background_pixel); 2276 unload_color (f, f->output_data.x->scroll_bar_background_pixel);
2277 2277
2278#ifdef USE_TOOLKIT_SCROLL_BARS 2278#ifdef USE_TOOLKIT_SCROLL_BARS
2279 /* Scrollbar shadow colors. */ 2279 /* Scrollbar shadow colors. */
2280 if (f->output_data.x->scroll_bar_top_shadow_pixel != -1) 2280 if (f->output_data.x->scroll_bar_top_shadow_pixel != -1)
@@ -2297,7 +2297,7 @@ x_set_scroll_bar_background (f, value, oldval)
2297 (*condemn_scroll_bars_hook) (f); 2297 (*condemn_scroll_bars_hook) (f);
2298 if (judge_scroll_bars_hook) 2298 if (judge_scroll_bars_hook)
2299 (*judge_scroll_bars_hook) (f); 2299 (*judge_scroll_bars_hook) (f);
2300 2300
2301 update_face_from_frame_parameter (f, Qscroll_bar_background, value); 2301 update_face_from_frame_parameter (f, Qscroll_bar_background, value);
2302 redraw_frame (f); 2302 redraw_frame (f);
2303 } 2303 }
@@ -2392,7 +2392,7 @@ x_set_name (f, name, explicit)
2392 Lisp_Object name; 2392 Lisp_Object name;
2393 int explicit; 2393 int explicit;
2394{ 2394{
2395 /* Make sure that requests from lisp code override requests from 2395 /* Make sure that requests from lisp code override requests from
2396 Emacs redisplay code. */ 2396 Emacs redisplay code. */
2397 if (explicit) 2397 if (explicit)
2398 { 2398 {
@@ -2627,7 +2627,7 @@ x_set_vertical_scroll_bars (f, arg, oldval)
2627 = (NILP (arg) 2627 = (NILP (arg)
2628 ? vertical_scroll_bar_none 2628 ? vertical_scroll_bar_none
2629 : EQ (Qright, arg) 2629 : EQ (Qright, arg)
2630 ? vertical_scroll_bar_right 2630 ? vertical_scroll_bar_right
2631 : vertical_scroll_bar_left); 2631 : vertical_scroll_bar_left);
2632 2632
2633 /* We set this parameter before creating the X window for the 2633 /* We set this parameter before creating the X window for the
@@ -2658,7 +2658,7 @@ x_set_scroll_bar_width (f, arg, oldval)
2658 /* Make the actual width at least 14 pixels and a multiple of a 2658 /* Make the actual width at least 14 pixels and a multiple of a
2659 character width. */ 2659 character width. */
2660 FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; 2660 FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
2661 2661
2662 /* Use all of that space (aside from required margins) for the 2662 /* Use all of that space (aside from required margins) for the
2663 scroll bar. */ 2663 scroll bar. */
2664 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; 2664 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
@@ -2987,7 +2987,7 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type)
2987 if (!strcmp (SDATA (tem), "on") 2987 if (!strcmp (SDATA (tem), "on")
2988 || !strcmp (SDATA (tem), "true")) 2988 || !strcmp (SDATA (tem), "true"))
2989 return Qt; 2989 return Qt;
2990 else 2990 else
2991 return Qnil; 2991 return Qnil;
2992 2992
2993 case RES_TYPE_STRING: 2993 case RES_TYPE_STRING:
@@ -3106,11 +3106,11 @@ x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass,
3106 specified. */ 3106 specified. */
3107 tem = Qnil; 3107 tem = Qnil;
3108 } 3108 }
3109 3109
3110#else /* not USE_TOOLKIT_SCROLL_BARS */ 3110#else /* not USE_TOOLKIT_SCROLL_BARS */
3111 3111
3112 tem = Qnil; 3112 tem = Qnil;
3113 3113
3114#endif /* not USE_TOOLKIT_SCROLL_BARS */ 3114#endif /* not USE_TOOLKIT_SCROLL_BARS */
3115 } 3115 }
3116 3116
@@ -3308,7 +3308,7 @@ x_figure_window_size (f, parms)
3308 { 3308 {
3309 int left, top; 3309 int left, top;
3310 int width, height; 3310 int width, height;
3311 3311
3312 /* It takes both for some WM:s to place it where we want */ 3312 /* It takes both for some WM:s to place it where we want */
3313 window_prompting = USPosition | PPosition; 3313 window_prompting = USPosition | PPosition;
3314 x_fullscreen_adjust (f, &width, &height, &top, &left); 3314 x_fullscreen_adjust (f, &width, &height, &top, &left);
@@ -3319,7 +3319,7 @@ x_figure_window_size (f, parms)
3319 f->output_data.x->left_pos = left; 3319 f->output_data.x->left_pos = left;
3320 f->output_data.x->top_pos = top; 3320 f->output_data.x->top_pos = top;
3321 } 3321 }
3322 3322
3323 return window_prompting; 3323 return window_prompting;
3324} 3324}
3325 3325
@@ -3442,13 +3442,13 @@ xic_create_xfontset (f, base_fontname)
3442 char **missing_list; 3442 char **missing_list;
3443 int missing_count; 3443 int missing_count;
3444 char *def_string; 3444 char *def_string;
3445 3445
3446 xfs = XCreateFontSet (FRAME_X_DISPLAY (f), 3446 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
3447 base_fontname, &missing_list, 3447 base_fontname, &missing_list,
3448 &missing_count, &def_string); 3448 &missing_count, &def_string);
3449 if (missing_list) 3449 if (missing_list)
3450 XFreeStringList (missing_list); 3450 XFreeStringList (missing_list);
3451 3451
3452 /* No need to free def_string. */ 3452 /* No need to free def_string. */
3453 return xfs; 3453 return xfs;
3454} 3454}
@@ -3488,7 +3488,7 @@ create_frame_xic (f)
3488 3488
3489 if (FRAME_XIC (f)) 3489 if (FRAME_XIC (f))
3490 return; 3490 return;
3491 3491
3492 xim = FRAME_X_XIM (f); 3492 xim = FRAME_X_XIM (f);
3493 if (xim) 3493 if (xim)
3494 { 3494 {
@@ -3586,7 +3586,7 @@ create_frame_xic (f)
3586 XFree (preedit_attr); 3586 XFree (preedit_attr);
3587 XFree (status_attr); 3587 XFree (status_attr);
3588 } 3588 }
3589 3589
3590 FRAME_XIC (f) = xic; 3590 FRAME_XIC (f) = xic;
3591 FRAME_XIC_STYLE (f) = xic_style; 3591 FRAME_XIC_STYLE (f) = xic_style;
3592 FRAME_XIC_FONTSET (f) = xfs; 3592 FRAME_XIC_FONTSET (f) = xfs;
@@ -3601,7 +3601,7 @@ free_frame_xic (f)
3601{ 3601{
3602 if (FRAME_XIC (f) == NULL) 3602 if (FRAME_XIC (f) == NULL)
3603 return; 3603 return;
3604 3604
3605 XDestroyIC (FRAME_XIC (f)); 3605 XDestroyIC (FRAME_XIC (f));
3606 if (FRAME_XIC_FONTSET (f)) 3606 if (FRAME_XIC_FONTSET (f))
3607 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); 3607 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
@@ -3622,7 +3622,7 @@ xic_set_preeditarea (w, x, y)
3622 struct frame *f = XFRAME (w->frame); 3622 struct frame *f = XFRAME (w->frame);
3623 XVaNestedList attr; 3623 XVaNestedList attr;
3624 XPoint spot; 3624 XPoint spot;
3625 3625
3626 spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x); 3626 spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x);
3627 spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f)); 3627 spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f));
3628 attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL); 3628 attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL);
@@ -3648,7 +3648,7 @@ xic_set_statusarea (f)
3648 attr = XVaCreateNestedList (0, XNAreaNeeded, &area, NULL); 3648 attr = XVaCreateNestedList (0, XNAreaNeeded, &area, NULL);
3649 XSetICValues (xic, XNStatusAttributes, attr, NULL); 3649 XSetICValues (xic, XNStatusAttributes, attr, NULL);
3650 XFree (attr); 3650 XFree (attr);
3651 3651
3652 attr = XVaCreateNestedList (0, XNAreaNeeded, &needed, NULL); 3652 attr = XVaCreateNestedList (0, XNAreaNeeded, &needed, NULL);
3653 XGetICValues (xic, XNStatusAttributes, attr, NULL); 3653 XGetICValues (xic, XNStatusAttributes, attr, NULL);
3654 XFree (attr); 3654 XFree (attr);
@@ -3692,7 +3692,7 @@ xic_set_xfontset (f, base_fontname)
3692 if (FRAME_XIC_STYLE (f) & XIMStatusArea) 3692 if (FRAME_XIC_STYLE (f) & XIMStatusArea)
3693 XSetICValues (FRAME_XIC (f), XNStatusAttributes, attr, NULL); 3693 XSetICValues (FRAME_XIC (f), XNStatusAttributes, attr, NULL);
3694 XFree (attr); 3694 XFree (attr);
3695 3695
3696 if (FRAME_XIC_FONTSET (f)) 3696 if (FRAME_XIC_FONTSET (f))
3697 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); 3697 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
3698 FRAME_XIC_FONTSET (f) = xfs; 3698 FRAME_XIC_FONTSET (f) = xfs;
@@ -3728,7 +3728,7 @@ x_window (f, window_prompting, minibuffer_only)
3728 for the window manager, so GC relocation won't bother it. 3728 for the window manager, so GC relocation won't bother it.
3729 3729
3730 Elsewhere we specify the window name for the window manager. */ 3730 Elsewhere we specify the window name for the window manager. */
3731 3731
3732 { 3732 {
3733 char *str = (char *) SDATA (Vx_resource_name); 3733 char *str = (char *) SDATA (Vx_resource_name);
3734 f->namebuf = (char *) xmalloc (strlen (str) + 1); 3734 f->namebuf = (char *) xmalloc (strlen (str) + 1);
@@ -3765,7 +3765,7 @@ x_window (f, window_prompting, minibuffer_only)
3765 XtSetValues (pane_widget, al, ac); 3765 XtSetValues (pane_widget, al, ac);
3766 f->output_data.x->column_widget = pane_widget; 3766 f->output_data.x->column_widget = pane_widget;
3767 3767
3768 /* mappedWhenManaged to false tells to the paned window to not map/unmap 3768 /* mappedWhenManaged to false tells to the paned window to not map/unmap
3769 the emacs screen when changing menubar. This reduces flickering. */ 3769 the emacs screen when changing menubar. This reduces flickering. */
3770 3770
3771 ac = 0; 3771 ac = 0;
@@ -3779,10 +3779,10 @@ x_window (f, window_prompting, minibuffer_only)
3779 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; 3779 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
3780 frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, 3780 frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget,
3781 al, ac); 3781 al, ac);
3782 3782
3783 f->output_data.x->edit_widget = frame_widget; 3783 f->output_data.x->edit_widget = frame_widget;
3784 3784
3785 XtManageChild (frame_widget); 3785 XtManageChild (frame_widget);
3786 3786
3787 /* Do some needed geometry management. */ 3787 /* Do some needed geometry management. */
3788 { 3788 {
@@ -3791,7 +3791,7 @@ x_window (f, window_prompting, minibuffer_only)
3791 Arg al[2]; 3791 Arg al[2];
3792 int ac = 0; 3792 int ac = 0;
3793 int extra_borders = 0; 3793 int extra_borders = 0;
3794 int menubar_size 3794 int menubar_size
3795 = (f->output_data.x->menubar_widget 3795 = (f->output_data.x->menubar_widget
3796 ? (f->output_data.x->menubar_widget->core.height 3796 ? (f->output_data.x->menubar_widget->core.height
3797 + f->output_data.x->menubar_widget->core.border_width) 3797 + f->output_data.x->menubar_widget->core.border_width)
@@ -3835,13 +3835,13 @@ x_window (f, window_prompting, minibuffer_only)
3835 3835
3836 if (window_prompting & USPosition) 3836 if (window_prompting & USPosition)
3837 sprintf (shell_position, "=%dx%d%c%d%c%d", 3837 sprintf (shell_position, "=%dx%d%c%d%c%d",
3838 PIXEL_WIDTH (f) + extra_borders, 3838 PIXEL_WIDTH (f) + extra_borders,
3839 PIXEL_HEIGHT (f) + menubar_size + extra_borders, 3839 PIXEL_HEIGHT (f) + menubar_size + extra_borders,
3840 (xneg ? '-' : '+'), left, 3840 (xneg ? '-' : '+'), left,
3841 (yneg ? '-' : '+'), top); 3841 (yneg ? '-' : '+'), top);
3842 else 3842 else
3843 sprintf (shell_position, "=%dx%d", 3843 sprintf (shell_position, "=%dx%d",
3844 PIXEL_WIDTH (f) + extra_borders, 3844 PIXEL_WIDTH (f) + extra_borders,
3845 PIXEL_HEIGHT (f) + menubar_size + extra_borders); 3845 PIXEL_HEIGHT (f) + menubar_size + extra_borders);
3846 } 3846 }
3847 3847
@@ -3859,7 +3859,7 @@ x_window (f, window_prompting, minibuffer_only)
3859 XtManageChild (pane_widget); 3859 XtManageChild (pane_widget);
3860 XtRealizeWidget (shell_widget); 3860 XtRealizeWidget (shell_widget);
3861 3861
3862 FRAME_X_WINDOW (f) = XtWindow (frame_widget); 3862 FRAME_X_WINDOW (f) = XtWindow (frame_widget);
3863 3863
3864 validate_x_resource_name (); 3864 validate_x_resource_name ();
3865 3865
@@ -3906,7 +3906,7 @@ x_window (f, window_prompting, minibuffer_only)
3906 attributes.event_mask |= fevent; 3906 attributes.event_mask |= fevent;
3907 } 3907 }
3908#endif /* HAVE_X_I18N */ 3908#endif /* HAVE_X_I18N */
3909 3909
3910 attribute_mask = CWEventMask; 3910 attribute_mask = CWEventMask;
3911 XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget), 3911 XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget),
3912 attribute_mask, &attributes); 3912 attribute_mask, &attributes);
@@ -3988,7 +3988,7 @@ x_window (f)
3988 } 3988 }
3989#endif 3989#endif
3990#endif /* HAVE_X_I18N */ 3990#endif /* HAVE_X_I18N */
3991 3991
3992 validate_x_resource_name (); 3992 validate_x_resource_name ();
3993 3993
3994 class_hints.res_name = (char *) SDATA (Vx_resource_name); 3994 class_hints.res_name = (char *) SDATA (Vx_resource_name);
@@ -4152,7 +4152,7 @@ x_make_gc (f)
4152 this must be done on a per-frame basis. */ 4152 this must be done on a per-frame basis. */
4153 f->output_data.x->border_tile 4153 f->output_data.x->border_tile
4154 = (XCreatePixmapFromBitmapData 4154 = (XCreatePixmapFromBitmapData
4155 (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, 4155 (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
4156 gray_bits, gray_width, gray_height, 4156 gray_bits, gray_width, gray_height,
4157 f->output_data.x->foreground_pixel, 4157 f->output_data.x->foreground_pixel,
4158 f->output_data.x->background_pixel, 4158 f->output_data.x->background_pixel,
@@ -4171,7 +4171,7 @@ x_free_gcs (f)
4171 Display *dpy = FRAME_X_DISPLAY (f); 4171 Display *dpy = FRAME_X_DISPLAY (f);
4172 4172
4173 BLOCK_INPUT; 4173 BLOCK_INPUT;
4174 4174
4175 if (f->output_data.x->normal_gc) 4175 if (f->output_data.x->normal_gc)
4176 { 4176 {
4177 XFreeGC (dpy, f->output_data.x->normal_gc); 4177 XFreeGC (dpy, f->output_data.x->normal_gc);
@@ -4183,7 +4183,7 @@ x_free_gcs (f)
4183 XFreeGC (dpy, f->output_data.x->reverse_gc); 4183 XFreeGC (dpy, f->output_data.x->reverse_gc);
4184 f->output_data.x->reverse_gc = 0; 4184 f->output_data.x->reverse_gc = 0;
4185 } 4185 }
4186 4186
4187 if (f->output_data.x->cursor_gc) 4187 if (f->output_data.x->cursor_gc)
4188 { 4188 {
4189 XFreeGC (dpy, f->output_data.x->cursor_gc); 4189 XFreeGC (dpy, f->output_data.x->cursor_gc);
@@ -4216,7 +4216,7 @@ unwind_create_frame (frame)
4216#if GLYPH_DEBUG 4216#if GLYPH_DEBUG
4217 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 4217 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
4218#endif 4218#endif
4219 4219
4220 x_free_frame_resources (f); 4220 x_free_frame_resources (f);
4221 4221
4222 /* Check that reference counts are indeed correct. */ 4222 /* Check that reference counts are indeed correct. */
@@ -4224,7 +4224,7 @@ unwind_create_frame (frame)
4224 xassert (dpyinfo->image_cache->refcount == image_cache_refcount); 4224 xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
4225 return Qt; 4225 return Qt;
4226 } 4226 }
4227 4227
4228 return Qnil; 4228 return Qnil;
4229} 4229}
4230 4230
@@ -4355,7 +4355,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4355 f->output_data.x->cursor_foreground_pixel = -1; 4355 f->output_data.x->cursor_foreground_pixel = -1;
4356 f->output_data.x->border_pixel = -1; 4356 f->output_data.x->border_pixel = -1;
4357 f->output_data.x->mouse_pixel = -1; 4357 f->output_data.x->mouse_pixel = -1;
4358 4358
4359 black = build_string ("black"); 4359 black = build_string ("black");
4360 GCPRO1 (black); 4360 GCPRO1 (black);
4361 f->output_data.x->foreground_pixel 4361 f->output_data.x->foreground_pixel
@@ -4418,7 +4418,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4418 else 4418 else
4419 font = x_new_font (f, SDATA (font)); 4419 font = x_new_font (f, SDATA (font));
4420 } 4420 }
4421 4421
4422 /* Try out a font which we hope has bold and italic variations. */ 4422 /* Try out a font which we hope has bold and italic variations. */
4423 if (!STRINGP (font)) 4423 if (!STRINGP (font))
4424 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); 4424 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
@@ -4449,7 +4449,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4449 4449
4450 x_default_parameter (f, parms, Qborder_width, make_number (2), 4450 x_default_parameter (f, parms, Qborder_width, make_number (2),
4451 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 4451 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
4452 4452
4453 /* This defaults to 1 in order to match xterm. We recognize either 4453 /* This defaults to 1 in order to match xterm. We recognize either
4454 internalBorderWidth or internalBorder (which is what xterm calls 4454 internalBorderWidth or internalBorder (which is what xterm calls
4455 it). */ 4455 it). */
@@ -4504,7 +4504,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4504 end up in init_iterator with a null face cache, which should not 4504 end up in init_iterator with a null face cache, which should not
4505 happen. */ 4505 happen. */
4506 init_frame_faces (f); 4506 init_frame_faces (f);
4507 4507
4508 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), 4508 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
4509 "menuBar", "MenuBar", RES_TYPE_NUMBER); 4509 "menuBar", "MenuBar", RES_TYPE_NUMBER);
4510 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), 4510 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
@@ -4530,7 +4530,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4530 if (FRAME_TOOL_BAR_LINES (f)) 4530 if (FRAME_TOOL_BAR_LINES (f))
4531 { 4531 {
4532 int margin, relief, bar_height; 4532 int margin, relief, bar_height;
4533 4533
4534 relief = (tool_bar_button_relief >= 0 4534 relief = (tool_bar_button_relief >= 0
4535 ? tool_bar_button_relief 4535 ? tool_bar_button_relief
4536 : DEFAULT_TOOL_BAR_BUTTON_RELIEF); 4536 : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
@@ -4544,7 +4544,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4544 margin = XFASTINT (XCDR (Vtool_bar_button_margin)); 4544 margin = XFASTINT (XCDR (Vtool_bar_button_margin));
4545 else 4545 else
4546 margin = 0; 4546 margin = 0;
4547 4547
4548 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; 4548 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief;
4549 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); 4549 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
4550 } 4550 }
@@ -4578,7 +4578,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4578#else 4578#else
4579 x_window (f); 4579 x_window (f);
4580#endif 4580#endif
4581 4581
4582 x_icon (f, parms); 4582 x_icon (f, parms);
4583 x_make_gc (f); 4583 x_make_gc (f);
4584 4584
@@ -4606,7 +4606,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4606 f->height. */ 4606 f->height. */
4607 width = f->width; 4607 width = f->width;
4608 height = f->height; 4608 height = f->height;
4609 4609
4610 f->height = 0; 4610 f->height = 0;
4611 SET_FRAME_WIDTH (f, 0); 4611 SET_FRAME_WIDTH (f, 0);
4612 change_frame_size (f, height, width, 1, 0, 0); 4612 change_frame_size (f, height, width, 1, 0, 0);
@@ -4667,7 +4667,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4667 /* Make sure windows on this frame appear in calls to next-window 4667 /* Make sure windows on this frame appear in calls to next-window
4668 and similar functions. */ 4668 and similar functions. */
4669 Vwindow_list = Qnil; 4669 Vwindow_list = Qnil;
4670 4670
4671 return unbind_to (count, frame); 4671 return unbind_to (count, frame);
4672} 4672}
4673 4673
@@ -4715,7 +4715,7 @@ FRAME nil means use the selected frame. */)
4715 RevertToParent, CurrentTime); 4715 RevertToParent, CurrentTime);
4716 x_uncatch_errors (dpy, count); 4716 x_uncatch_errors (dpy, count);
4717 UNBLOCK_INPUT; 4717 UNBLOCK_INPUT;
4718 4718
4719 return Qnil; 4719 return Qnil;
4720} 4720}
4721 4721
@@ -5032,7 +5032,7 @@ If omitted or nil, that stands for the selected frame's display. */)
5032 error ("Display has an unknown visual class"); 5032 error ("Display has an unknown visual class");
5033 result = Qnil; 5033 result = Qnil;
5034 } 5034 }
5035 5035
5036 return result; 5036 return result;
5037} 5037}
5038 5038
@@ -5187,14 +5187,14 @@ select_visual (dpyinfo)
5187 || !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen), 5187 || !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen),
5188 dpyinfo->n_planes, class, &vinfo)) 5188 dpyinfo->n_planes, class, &vinfo))
5189 fatal ("Invalid visual specification `%s'", SDATA (value)); 5189 fatal ("Invalid visual specification `%s'", SDATA (value));
5190 5190
5191 dpyinfo->visual = vinfo.visual; 5191 dpyinfo->visual = vinfo.visual;
5192 } 5192 }
5193 else 5193 else
5194 { 5194 {
5195 int n_visuals; 5195 int n_visuals;
5196 XVisualInfo *vinfo, vinfo_template; 5196 XVisualInfo *vinfo, vinfo_template;
5197 5197
5198 dpyinfo->visual = DefaultVisualOfScreen (screen); 5198 dpyinfo->visual = DefaultVisualOfScreen (screen);
5199 5199
5200#ifdef HAVE_X11R4 5200#ifdef HAVE_X11R4
@@ -5488,7 +5488,7 @@ valid_image_p (object)
5488 Lisp_Object object; 5488 Lisp_Object object;
5489{ 5489{
5490 int valid_p = 0; 5490 int valid_p = 0;
5491 5491
5492 if (CONSP (object) && EQ (XCAR (object), Qimage)) 5492 if (CONSP (object) && EQ (XCAR (object), Qimage))
5493 { 5493 {
5494 Lisp_Object tem; 5494 Lisp_Object tem;
@@ -5504,7 +5504,7 @@ valid_image_p (object)
5504 if (type) 5504 if (type)
5505 valid_p = type->valid_p (object); 5505 valid_p = type->valid_p (object);
5506 } 5506 }
5507 5507
5508 break; 5508 break;
5509 } 5509 }
5510 } 5510 }
@@ -5623,7 +5623,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
5623 was found more than once, it's an error. */ 5623 was found more than once, it's an error. */
5624 keywords[i].value = value; 5624 keywords[i].value = value;
5625 ++keywords[i].count; 5625 ++keywords[i].count;
5626 5626
5627 if (keywords[i].count > 1) 5627 if (keywords[i].count > 1)
5628 return 0; 5628 return 0;
5629 5629
@@ -5667,7 +5667,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
5667 && XINT (value) <= 100) 5667 && XINT (value) <= 100)
5668 break; 5668 break;
5669 return 0; 5669 return 0;
5670 5670
5671 case IMAGE_NON_NEGATIVE_INTEGER_VALUE: 5671 case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
5672 if (!INTEGERP (value) || XINT (value) < 0) 5672 if (!INTEGERP (value) || XINT (value) < 0)
5673 return 0; 5673 return 0;
@@ -5678,7 +5678,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
5678 5678
5679 case IMAGE_FUNCTION_VALUE: 5679 case IMAGE_FUNCTION_VALUE:
5680 value = indirect_function (value); 5680 value = indirect_function (value);
5681 if (SUBRP (value) 5681 if (SUBRP (value)
5682 || COMPILEDP (value) 5682 || COMPILEDP (value)
5683 || (CONSP (value) && EQ (XCAR (value), Qlambda))) 5683 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
5684 break; 5684 break;
@@ -5727,7 +5727,7 @@ image_spec_value (spec, key, found)
5727 int *found; 5727 int *found;
5728{ 5728{
5729 Lisp_Object tail; 5729 Lisp_Object tail;
5730 5730
5731 xassert (valid_image_p (spec)); 5731 xassert (valid_image_p (spec));
5732 5732
5733 for (tail = XCDR (spec); 5733 for (tail = XCDR (spec);
@@ -5741,12 +5741,12 @@ image_spec_value (spec, key, found)
5741 return XCAR (XCDR (tail)); 5741 return XCAR (XCDR (tail));
5742 } 5742 }
5743 } 5743 }
5744 5744
5745 if (found) 5745 if (found)
5746 *found = 0; 5746 *found = 0;
5747 return Qnil; 5747 return Qnil;
5748} 5748}
5749 5749
5750 5750
5751DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, 5751DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0,
5752 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). 5752 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT).
@@ -5767,7 +5767,7 @@ or omitted means use the selected frame. */)
5767 struct image *img = IMAGE_FROM_ID (f, id); 5767 struct image *img = IMAGE_FROM_ID (f, id);
5768 int width = img->width + 2 * img->hmargin; 5768 int width = img->width + 2 * img->hmargin;
5769 int height = img->height + 2 * img->vmargin; 5769 int height = img->height + 2 * img->vmargin;
5770 5770
5771 if (NILP (pixels)) 5771 if (NILP (pixels))
5772 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), 5772 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)),
5773 make_float ((double) height / CANON_Y_UNIT (f))); 5773 make_float ((double) height / CANON_Y_UNIT (f)));
@@ -5824,7 +5824,7 @@ make_image (spec, hash)
5824 unsigned hash; 5824 unsigned hash;
5825{ 5825{
5826 struct image *img = (struct image *) xmalloc (sizeof *img); 5826 struct image *img = (struct image *) xmalloc (sizeof *img);
5827 5827
5828 xassert (valid_image_p (spec)); 5828 xassert (valid_image_p (spec));
5829 bzero (img, sizeof *img); 5829 bzero (img, sizeof *img);
5830 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); 5830 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
@@ -5885,7 +5885,7 @@ prepare_image_for_display (f, img)
5885 if (img->pixmap == None && !img->load_failed_p) 5885 if (img->pixmap == None && !img->load_failed_p)
5886 img->load_failed_p = img->type->load (f, img) == 0; 5886 img->load_failed_p = img->type->load (f, img) == 0;
5887} 5887}
5888 5888
5889 5889
5890/* Value is the number of pixels for the ascent of image IMG when 5890/* Value is the number of pixels for the ascent of image IMG when
5891 drawn in face FACE. */ 5891 drawn in face FACE. */
@@ -5937,7 +5937,7 @@ four_corners_best (ximg, width, height)
5937 for (i = best_count = 0; i < 4; ++i) 5937 for (i = best_count = 0; i < 4; ++i)
5938 { 5938 {
5939 int j, n; 5939 int j, n;
5940 5940
5941 for (j = n = 0; j < 4; ++j) 5941 for (j = n = 0; j < 4; ++j)
5942 if (corners[i] == corners[j]) 5942 if (corners[i] == corners[j])
5943 ++n; 5943 ++n;
@@ -6053,7 +6053,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
6053 img->mask = None; 6053 img->mask = None;
6054 img->background_transparent_valid = 0; 6054 img->background_transparent_valid = 0;
6055 } 6055 }
6056 6056
6057 if (colors_p && img->ncolors) 6057 if (colors_p && img->ncolors)
6058 { 6058 {
6059 x_free_colors (f, img->colors, img->ncolors); 6059 x_free_colors (f, img->colors, img->ncolors);
@@ -6128,7 +6128,7 @@ make_image_cache ()
6128{ 6128{
6129 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); 6129 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
6130 int size; 6130 int size;
6131 6131
6132 bzero (c, sizeof *c); 6132 bzero (c, sizeof *c);
6133 c->size = 50; 6133 c->size = 50;
6134 c->images = (struct image **) xmalloc (c->size * sizeof *c->images); 6134 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
@@ -6153,7 +6153,7 @@ free_image_cache (f)
6153 6153
6154 /* Cache should not be referenced by any frame when freed. */ 6154 /* Cache should not be referenced by any frame when freed. */
6155 xassert (c->refcount == 0); 6155 xassert (c->refcount == 0);
6156 6156
6157 for (i = 0; i < c->used; ++i) 6157 for (i = 0; i < c->used; ++i)
6158 free_image (f, c->images[i]); 6158 free_image (f, c->images[i]);
6159 xfree (c->images); 6159 xfree (c->images);
@@ -6190,7 +6190,7 @@ clear_image_cache (f, force_p)
6190 /* Block input so that we won't be interrupted by a SIGIO 6190 /* Block input so that we won't be interrupted by a SIGIO
6191 while being in an inconsistent state. */ 6191 while being in an inconsistent state. */
6192 BLOCK_INPUT; 6192 BLOCK_INPUT;
6193 6193
6194 for (i = nfreed = 0; i < c->used; ++i) 6194 for (i = nfreed = 0; i < c->used; ++i)
6195 { 6195 {
6196 struct image *img = c->images[i]; 6196 struct image *img = c->images[i];
@@ -6209,7 +6209,7 @@ clear_image_cache (f, force_p)
6209 if (nfreed) 6209 if (nfreed)
6210 { 6210 {
6211 Lisp_Object tail, frame; 6211 Lisp_Object tail, frame;
6212 6212
6213 FOR_EACH_FRAME (tail, frame) 6213 FOR_EACH_FRAME (tail, frame)
6214 { 6214 {
6215 struct frame *f = XFRAME (frame); 6215 struct frame *f = XFRAME (frame);
@@ -6237,7 +6237,7 @@ FRAME t means clear the image caches of all frames. */)
6237 if (EQ (frame, Qt)) 6237 if (EQ (frame, Qt))
6238 { 6238 {
6239 Lisp_Object tail; 6239 Lisp_Object tail;
6240 6240
6241 FOR_EACH_FRAME (tail, frame) 6241 FOR_EACH_FRAME (tail, frame)
6242 if (FRAME_X_P (XFRAME (frame))) 6242 if (FRAME_X_P (XFRAME (frame)))
6243 clear_image_cache (XFRAME (frame), 1); 6243 clear_image_cache (XFRAME (frame), 1);
@@ -6264,7 +6264,7 @@ postprocess_image (f, img)
6264 Lisp_Object mask; 6264 Lisp_Object mask;
6265 6265
6266 spec = img->spec; 6266 spec = img->spec;
6267 6267
6268 /* `:heuristic-mask t' 6268 /* `:heuristic-mask t'
6269 `:mask heuristic' 6269 `:mask heuristic'
6270 means build a mask heuristically. 6270 means build a mask heuristically.
@@ -6274,16 +6274,16 @@ postprocess_image (f, img)
6274 image. 6274 image.
6275 `:mask nil' 6275 `:mask nil'
6276 means remove a mask, if any. */ 6276 means remove a mask, if any. */
6277 6277
6278 mask = image_spec_value (spec, QCheuristic_mask, NULL); 6278 mask = image_spec_value (spec, QCheuristic_mask, NULL);
6279 if (!NILP (mask)) 6279 if (!NILP (mask))
6280 x_build_heuristic_mask (f, img, mask); 6280 x_build_heuristic_mask (f, img, mask);
6281 else 6281 else
6282 { 6282 {
6283 int found_p; 6283 int found_p;
6284 6284
6285 mask = image_spec_value (spec, QCmask, &found_p); 6285 mask = image_spec_value (spec, QCmask, &found_p);
6286 6286
6287 if (EQ (mask, Qheuristic)) 6287 if (EQ (mask, Qheuristic))
6288 x_build_heuristic_mask (f, img, Qt); 6288 x_build_heuristic_mask (f, img, Qt);
6289 else if (CONSP (mask) 6289 else if (CONSP (mask)
@@ -6300,8 +6300,8 @@ postprocess_image (f, img)
6300 img->mask = None; 6300 img->mask = None;
6301 } 6301 }
6302 } 6302 }
6303 6303
6304 6304
6305 /* Should we apply an image transformation algorithm? */ 6305 /* Should we apply an image transformation algorithm? */
6306 conversion = image_spec_value (spec, QCconversion, NULL); 6306 conversion = image_spec_value (spec, QCconversion, NULL);
6307 if (EQ (conversion, Qdisabled)) 6307 if (EQ (conversion, Qdisabled))
@@ -6343,7 +6343,7 @@ lookup_image (f, spec)
6343 specification. */ 6343 specification. */
6344 xassert (FRAME_WINDOW_P (f)); 6344 xassert (FRAME_WINDOW_P (f));
6345 xassert (valid_image_p (spec)); 6345 xassert (valid_image_p (spec));
6346 6346
6347 GCPRO1 (spec); 6347 GCPRO1 (spec);
6348 6348
6349 /* Look up SPEC in the hash table of the image cache. */ 6349 /* Look up SPEC in the hash table of the image cache. */
@@ -6358,7 +6358,7 @@ lookup_image (f, spec)
6358 if (img == NULL) 6358 if (img == NULL)
6359 { 6359 {
6360 extern Lisp_Object Qpostscript; 6360 extern Lisp_Object Qpostscript;
6361 6361
6362 BLOCK_INPUT; 6362 BLOCK_INPUT;
6363 img = make_image (spec, hash); 6363 img = make_image (spec, hash);
6364 cache_image (f, img); 6364 cache_image (f, img);
@@ -6390,7 +6390,7 @@ lookup_image (f, spec)
6390 img->ascent = XFASTINT (ascent); 6390 img->ascent = XFASTINT (ascent);
6391 else if (EQ (ascent, Qcenter)) 6391 else if (EQ (ascent, Qcenter))
6392 img->ascent = CENTERED_IMAGE_ASCENT; 6392 img->ascent = CENTERED_IMAGE_ASCENT;
6393 6393
6394 margin = image_spec_value (spec, QCmargin, NULL); 6394 margin = image_spec_value (spec, QCmargin, NULL);
6395 if (INTEGERP (margin) && XINT (margin) >= 0) 6395 if (INTEGERP (margin) && XINT (margin) >= 0)
6396 img->vmargin = img->hmargin = XFASTINT (margin); 6396 img->vmargin = img->hmargin = XFASTINT (margin);
@@ -6402,7 +6402,7 @@ lookup_image (f, spec)
6402 if (XINT (XCDR (margin)) > 0) 6402 if (XINT (XCDR (margin)) > 0)
6403 img->vmargin = XFASTINT (XCDR (margin)); 6403 img->vmargin = XFASTINT (XCDR (margin));
6404 } 6404 }
6405 6405
6406 relief = image_spec_value (spec, QCrelief, NULL); 6406 relief = image_spec_value (spec, QCrelief, NULL);
6407 if (INTEGERP (relief)) 6407 if (INTEGERP (relief))
6408 { 6408 {
@@ -6436,9 +6436,9 @@ lookup_image (f, spec)
6436 /* We're using IMG, so set its timestamp to `now'. */ 6436 /* We're using IMG, so set its timestamp to `now'. */
6437 EMACS_GET_TIME (now); 6437 EMACS_GET_TIME (now);
6438 img->timestamp = EMACS_SECS (now); 6438 img->timestamp = EMACS_SECS (now);
6439 6439
6440 UNGCPRO; 6440 UNGCPRO;
6441 6441
6442 /* Value is the image id. */ 6442 /* Value is the image id. */
6443 return img->id; 6443 return img->id;
6444} 6444}
@@ -6590,7 +6590,7 @@ x_put_x_image (f, ximg, pixmap, width, height)
6590 int width, height; 6590 int width, height;
6591{ 6591{
6592 GC gc; 6592 GC gc;
6593 6593
6594 xassert (interrupt_input_blocked); 6594 xassert (interrupt_input_blocked);
6595 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); 6595 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
6596 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); 6596 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
@@ -6625,7 +6625,7 @@ x_find_image_file (file)
6625 6625
6626 /* Try to find FILE in data-directory, then x-bitmap-file-path. */ 6626 /* Try to find FILE in data-directory, then x-bitmap-file-path. */
6627 fd = openp (search_path, file, Qnil, &file_found, Qnil); 6627 fd = openp (search_path, file, Qnil, &file_found, Qnil);
6628 6628
6629 if (fd == -1) 6629 if (fd == -1)
6630 file_found = Qnil; 6630 file_found = Qnil;
6631 else 6631 else
@@ -6667,7 +6667,7 @@ slurp_file (file, size)
6667 buf = NULL; 6667 buf = NULL;
6668 } 6668 }
6669 } 6669 }
6670 6670
6671 return buf; 6671 return buf;
6672} 6672}
6673 6673
@@ -6746,7 +6746,7 @@ enum xbm_token
6746 XBM_TK_NUMBER 6746 XBM_TK_NUMBER
6747}; 6747};
6748 6748
6749 6749
6750/* Return non-zero if OBJECT is a valid XBM-type image specification. 6750/* Return non-zero if OBJECT is a valid XBM-type image specification.
6751 A valid specification is a list starting with the symbol `image' 6751 A valid specification is a list starting with the symbol `image'
6752 The rest of the list is a property list which must contain an 6752 The rest of the list is a property list which must contain an
@@ -6781,7 +6781,7 @@ xbm_image_p (object)
6781 Lisp_Object object; 6781 Lisp_Object object;
6782{ 6782{
6783 struct image_keyword kw[XBM_LAST]; 6783 struct image_keyword kw[XBM_LAST];
6784 6784
6785 bcopy (xbm_format, kw, sizeof kw); 6785 bcopy (xbm_format, kw, sizeof kw);
6786 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) 6786 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
6787 return 0; 6787 return 0;
@@ -6813,13 +6813,13 @@ xbm_image_p (object)
6813 data = kw[XBM_DATA].value; 6813 data = kw[XBM_DATA].value;
6814 width = XFASTINT (kw[XBM_WIDTH].value); 6814 width = XFASTINT (kw[XBM_WIDTH].value);
6815 height = XFASTINT (kw[XBM_HEIGHT].value); 6815 height = XFASTINT (kw[XBM_HEIGHT].value);
6816 6816
6817 /* Check type of data, and width and height against contents of 6817 /* Check type of data, and width and height against contents of
6818 data. */ 6818 data. */
6819 if (VECTORP (data)) 6819 if (VECTORP (data))
6820 { 6820 {
6821 int i; 6821 int i;
6822 6822
6823 /* Number of elements of the vector must be >= height. */ 6823 /* Number of elements of the vector must be >= height. */
6824 if (XVECTOR (data)->size < height) 6824 if (XVECTOR (data)->size < height)
6825 return 0; 6825 return 0;
@@ -6879,7 +6879,7 @@ xbm_scan (s, end, sval, ival)
6879 int c; 6879 int c;
6880 6880
6881 loop: 6881 loop:
6882 6882
6883 /* Skip white space. */ 6883 /* Skip white space. */
6884 while (*s < end && (c = *(*s)++, isspace (c))) 6884 while (*s < end && (c = *(*s)++, isspace (c)))
6885 ; 6885 ;
@@ -6889,7 +6889,7 @@ xbm_scan (s, end, sval, ival)
6889 else if (isdigit (c)) 6889 else if (isdigit (c))
6890 { 6890 {
6891 int value = 0, digit; 6891 int value = 0, digit;
6892 6892
6893 if (c == '0' && *s < end) 6893 if (c == '0' && *s < end)
6894 { 6894 {
6895 c = *(*s)++; 6895 c = *(*s)++;
@@ -6987,7 +6987,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
6987 if (LA1 != (TOKEN)) \ 6987 if (LA1 != (TOKEN)) \
6988 goto failure; \ 6988 goto failure; \
6989 else \ 6989 else \
6990 match () 6990 match ()
6991 6991
6992#define expect_ident(IDENT) \ 6992#define expect_ident(IDENT) \
6993 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ 6993 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
@@ -7030,7 +7030,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
7030 { 7030 {
7031 if (strcmp (buffer, "unsigned") == 0) 7031 if (strcmp (buffer, "unsigned") == 0)
7032 { 7032 {
7033 match (); 7033 match ();
7034 expect_ident ("char"); 7034 expect_ident ("char");
7035 } 7035 }
7036 else if (strcmp (buffer, "short") == 0) 7036 else if (strcmp (buffer, "short") == 0)
@@ -7045,7 +7045,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
7045 else 7045 else
7046 goto failure; 7046 goto failure;
7047 } 7047 }
7048 else 7048 else
7049 goto failure; 7049 goto failure;
7050 7050
7051 expect (XBM_TK_IDENT); 7051 expect (XBM_TK_IDENT);
@@ -7068,7 +7068,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
7068 *p++ = val; 7068 *p++ = val;
7069 if (!padding_p || ((i + 2) % bytes_per_line)) 7069 if (!padding_p || ((i + 2) % bytes_per_line))
7070 *p++ = value >> 8; 7070 *p++ = value >> 8;
7071 7071
7072 if (LA1 == ',' || LA1 == '}') 7072 if (LA1 == ',' || LA1 == '}')
7073 match (); 7073 match ();
7074 else 7074 else
@@ -7081,9 +7081,9 @@ xbm_read_bitmap_data (contents, end, width, height, data)
7081 { 7081 {
7082 int val = value; 7082 int val = value;
7083 expect (XBM_TK_NUMBER); 7083 expect (XBM_TK_NUMBER);
7084 7084
7085 *p++ = val; 7085 *p++ = val;
7086 7086
7087 if (LA1 == ',' || LA1 == '}') 7087 if (LA1 == ',' || LA1 == '}')
7088 match (); 7088 match ();
7089 else 7089 else
@@ -7095,7 +7095,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
7095 return 1; 7095 return 1;
7096 7096
7097 failure: 7097 failure:
7098 7098
7099 if (data && *data) 7099 if (data && *data)
7100 { 7100 {
7101 xfree (*data); 7101 xfree (*data);
@@ -7122,7 +7122,7 @@ xbm_load_image (f, img, contents, end)
7122 int rc; 7122 int rc;
7123 unsigned char *data; 7123 unsigned char *data;
7124 int success_p = 0; 7124 int success_p = 0;
7125 7125
7126 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); 7126 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data);
7127 if (rc) 7127 if (rc)
7128 { 7128 {
@@ -7130,7 +7130,7 @@ xbm_load_image (f, img, contents, end)
7130 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 7130 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
7131 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 7131 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
7132 Lisp_Object value; 7132 Lisp_Object value;
7133 7133
7134 xassert (img->width > 0 && img->height > 0); 7134 xassert (img->width > 0 && img->height > 0);
7135 7135
7136 /* Get foreground and background colors, maybe allocate colors. */ 7136 /* Get foreground and background colors, maybe allocate colors. */
@@ -7183,7 +7183,7 @@ xbm_file_p (data)
7183 &w, &h, NULL)); 7183 &w, &h, NULL));
7184} 7184}
7185 7185
7186 7186
7187/* Fill image IMG which is used on frame F with pixmap data. Value is 7187/* Fill image IMG which is used on frame F with pixmap data. Value is
7188 non-zero if successful. */ 7188 non-zero if successful. */
7189 7189
@@ -7205,7 +7205,7 @@ xbm_load (f, img)
7205 char *contents; 7205 char *contents;
7206 int size; 7206 int size;
7207 struct gcpro gcpro1; 7207 struct gcpro gcpro1;
7208 7208
7209 file = x_find_image_file (file_name); 7209 file = x_find_image_file (file_name);
7210 GCPRO1 (file); 7210 GCPRO1 (file);
7211 if (!STRINGP (file)) 7211 if (!STRINGP (file))
@@ -7275,7 +7275,7 @@ xbm_load (f, img)
7275 int i; 7275 int i;
7276 char *p; 7276 char *p;
7277 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; 7277 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
7278 7278
7279 p = bits = (char *) alloca (nbytes * img->height); 7279 p = bits = (char *) alloca (nbytes * img->height);
7280 for (i = 0; i < img->height; ++i, p += nbytes) 7280 for (i = 0; i < img->height; ++i, p += nbytes)
7281 { 7281 {
@@ -7313,14 +7313,14 @@ xbm_load (f, img)
7313 7313
7314 return success_p; 7314 return success_p;
7315} 7315}
7316 7316
7317 7317
7318 7318
7319/*********************************************************************** 7319/***********************************************************************
7320 XPM images 7320 XPM images
7321 ***********************************************************************/ 7321 ***********************************************************************/
7322 7322
7323#if HAVE_XPM 7323#if HAVE_XPM
7324 7324
7325static int xpm_image_p P_ ((Lisp_Object object)); 7325static int xpm_image_p P_ ((Lisp_Object object));
7326static int xpm_load P_ ((struct frame *f, struct image *img)); 7326static int xpm_load P_ ((struct frame *f, struct image *img));
@@ -7437,7 +7437,7 @@ xpm_init_color_cache (f, attrs)
7437 { 7437 {
7438 int i; 7438 int i;
7439 XColor color; 7439 XColor color;
7440 7440
7441 for (i = 0; i < attrs->numsymbols; ++i) 7441 for (i = 0; i < attrs->numsymbols; ++i)
7442 if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), 7442 if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
7443 attrs->colorsymbols[i].value, &color)) 7443 attrs->colorsymbols[i].value, &color))
@@ -7480,7 +7480,7 @@ xpm_color_bucket (color_name)
7480{ 7480{
7481 unsigned h = 0; 7481 unsigned h = 0;
7482 char *s; 7482 char *s;
7483 7483
7484 for (s = color_name; *s; ++s) 7484 for (s = color_name; *s; ++s)
7485 h = (h << 2) ^ *s; 7485 h = (h << 2) ^ *s;
7486 return h %= XPM_COLOR_CACHE_BUCKETS; 7486 return h %= XPM_COLOR_CACHE_BUCKETS;
@@ -7500,10 +7500,10 @@ xpm_cache_color (f, color_name, color, bucket)
7500{ 7500{
7501 size_t nbytes; 7501 size_t nbytes;
7502 struct xpm_cached_color *p; 7502 struct xpm_cached_color *p;
7503 7503
7504 if (bucket < 0) 7504 if (bucket < 0)
7505 bucket = xpm_color_bucket (color_name); 7505 bucket = xpm_color_bucket (color_name);
7506 7506
7507 nbytes = sizeof *p + strlen (color_name); 7507 nbytes = sizeof *p + strlen (color_name);
7508 p = (struct xpm_cached_color *) xmalloc (nbytes); 7508 p = (struct xpm_cached_color *) xmalloc (nbytes);
7509 strcpy (p->name, color_name); 7509 strcpy (p->name, color_name);
@@ -7541,7 +7541,7 @@ xpm_lookup_color (f, color_name, color)
7541 color->blue); 7541 color->blue);
7542 p = xpm_cache_color (f, color_name, color, h); 7542 p = xpm_cache_color (f, color_name, color, h);
7543 } 7543 }
7544 7544
7545 return p != NULL; 7545 return p != NULL;
7546} 7546}
7547 7547
@@ -7668,7 +7668,7 @@ xpm_load (f, img)
7668 Lisp_Object tail; 7668 Lisp_Object tail;
7669 XpmColorSymbol *xpm_syms; 7669 XpmColorSymbol *xpm_syms;
7670 int i, size; 7670 int i, size;
7671 7671
7672 attrs.valuemask |= XpmColorSymbols; 7672 attrs.valuemask |= XpmColorSymbols;
7673 7673
7674 /* Count number of symbols. */ 7674 /* Count number of symbols. */
@@ -7701,7 +7701,7 @@ xpm_load (f, img)
7701#ifdef ALLOC_XPM_COLORS 7701#ifdef ALLOC_XPM_COLORS
7702 xpm_init_color_cache (f, &attrs); 7702 xpm_init_color_cache (f, &attrs);
7703#endif 7703#endif
7704 7704
7705 specified_file = image_spec_value (img->spec, QCfile, NULL); 7705 specified_file = image_spec_value (img->spec, QCfile, NULL);
7706 if (STRINGP (specified_file)) 7706 if (STRINGP (specified_file))
7707 { 7707 {
@@ -7711,7 +7711,7 @@ xpm_load (f, img)
7711 image_error ("Cannot find image file `%s'", specified_file, Qnil); 7711 image_error ("Cannot find image file `%s'", specified_file, Qnil);
7712 return 0; 7712 return 0;
7713 } 7713 }
7714 7714
7715 rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 7715 rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
7716 SDATA (file), &img->pixmap, &img->mask, 7716 SDATA (file), &img->pixmap, &img->mask,
7717 &attrs); 7717 &attrs);
@@ -7758,19 +7758,19 @@ xpm_load (f, img)
7758 case XpmOpenFailed: 7758 case XpmOpenFailed:
7759 image_error ("Error opening XPM file (%s)", img->spec, Qnil); 7759 image_error ("Error opening XPM file (%s)", img->spec, Qnil);
7760 break; 7760 break;
7761 7761
7762 case XpmFileInvalid: 7762 case XpmFileInvalid:
7763 image_error ("Invalid XPM file (%s)", img->spec, Qnil); 7763 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
7764 break; 7764 break;
7765 7765
7766 case XpmNoMemory: 7766 case XpmNoMemory:
7767 image_error ("Out of memory (%s)", img->spec, Qnil); 7767 image_error ("Out of memory (%s)", img->spec, Qnil);
7768 break; 7768 break;
7769 7769
7770 case XpmColorFailed: 7770 case XpmColorFailed:
7771 image_error ("Color allocation error (%s)", img->spec, Qnil); 7771 image_error ("Color allocation error (%s)", img->spec, Qnil);
7772 break; 7772 break;
7773 7773
7774 default: 7774 default:
7775 image_error ("Unknown error (%s)", img->spec, Qnil); 7775 image_error ("Unknown error (%s)", img->spec, Qnil);
7776 break; 7776 break;
@@ -7876,14 +7876,14 @@ lookup_rgb_color (f, r, g, b)
7876 color.red = r; 7876 color.red = r;
7877 color.green = g; 7877 color.green = g;
7878 color.blue = b; 7878 color.blue = b;
7879 7879
7880 cmap = FRAME_X_COLORMAP (f); 7880 cmap = FRAME_X_COLORMAP (f);
7881 rc = x_alloc_nearest_color (f, cmap, &color); 7881 rc = x_alloc_nearest_color (f, cmap, &color);
7882 7882
7883 if (rc) 7883 if (rc)
7884 { 7884 {
7885 ++ct_colors_allocated; 7885 ++ct_colors_allocated;
7886 7886
7887 p = (struct ct_color *) xmalloc (sizeof *p); 7887 p = (struct ct_color *) xmalloc (sizeof *p);
7888 p->r = r; 7888 p->r = r;
7889 p->g = g; 7889 p->g = g;
@@ -7929,7 +7929,7 @@ lookup_pixel_color (f, pixel)
7929 if (rc) 7929 if (rc)
7930 { 7930 {
7931 ++ct_colors_allocated; 7931 ++ct_colors_allocated;
7932 7932
7933 p = (struct ct_color *) xmalloc (sizeof *p); 7933 p = (struct ct_color *) xmalloc (sizeof *p);
7934 p->r = color.red; 7934 p->r = color.red;
7935 p->g = color.green; 7935 p->g = color.green;
@@ -7941,7 +7941,7 @@ lookup_pixel_color (f, pixel)
7941 else 7941 else
7942 return FRAME_FOREGROUND_PIXEL (f); 7942 return FRAME_FOREGROUND_PIXEL (f);
7943 } 7943 }
7944 7944
7945 return p->pixel; 7945 return p->pixel;
7946} 7946}
7947 7947
@@ -7967,7 +7967,7 @@ colors_in_color_table (n)
7967 colors = (unsigned long *) xmalloc (ct_colors_allocated 7967 colors = (unsigned long *) xmalloc (ct_colors_allocated
7968 * sizeof *colors); 7968 * sizeof *colors);
7969 *n = ct_colors_allocated; 7969 *n = ct_colors_allocated;
7970 7970
7971 for (i = j = 0; i < CT_SIZE; ++i) 7971 for (i = j = 0; i < CT_SIZE; ++i)
7972 for (p = ct_table[i]; p; p = p->next) 7972 for (p = ct_table[i]; p; p = p->next)
7973 colors[j++] = p->pixel; 7973 colors[j++] = p->pixel;
@@ -8042,7 +8042,7 @@ x_to_xcolors (f, img, rgb_p)
8042 for (y = 0; y < img->height; ++y) 8042 for (y = 0; y < img->height; ++y)
8043 { 8043 {
8044 XColor *row = p; 8044 XColor *row = p;
8045 8045
8046 for (x = 0; x < img->width; ++x, ++p) 8046 for (x = 0; x < img->width; ++x, ++p)
8047 p->pixel = XGetPixel (ximg, x, y); 8047 p->pixel = XGetPixel (ximg, x, y);
8048 8048
@@ -8069,9 +8069,9 @@ x_from_xcolors (f, img, colors)
8069 XImage *oimg; 8069 XImage *oimg;
8070 Pixmap pixmap; 8070 Pixmap pixmap;
8071 XColor *p; 8071 XColor *p;
8072 8072
8073 init_color_table (); 8073 init_color_table ();
8074 8074
8075 x_create_x_image_and_pixmap (f, img->width, img->height, 0, 8075 x_create_x_image_and_pixmap (f, img->width, img->height, 0,
8076 &oimg, &pixmap); 8076 &oimg, &pixmap);
8077 p = colors; 8077 p = colors;
@@ -8098,7 +8098,7 @@ x_from_xcolors (f, img, colors)
8098 8098
8099 MATRIX is a nine-element array specifying the transformation 8099 MATRIX is a nine-element array specifying the transformation
8100 matrix. See emboss_matrix for an example. 8100 matrix. See emboss_matrix for an example.
8101 8101
8102 COLOR_ADJUST is a color adjustment added to each pixel of the 8102 COLOR_ADJUST is a color adjustment added to each pixel of the
8103 outgoing image. */ 8103 outgoing image. */
8104 8104
@@ -8126,7 +8126,7 @@ x_detect_edges (f, img, matrix, color_adjust)
8126 p = COLOR (new, img->width - 1, y); 8126 p = COLOR (new, img->width - 1, y);
8127 p->red = p->green = p->blue = 0xffff/2; 8127 p->red = p->green = p->blue = 0xffff/2;
8128 } 8128 }
8129 8129
8130 for (x = 1; x < img->width - 1; ++x) 8130 for (x = 1; x < img->width - 1; ++x)
8131 { 8131 {
8132 p = COLOR (new, x, 0); 8132 p = COLOR (new, x, 0);
@@ -8138,7 +8138,7 @@ x_detect_edges (f, img, matrix, color_adjust)
8138 for (y = 1; y < img->height - 1; ++y) 8138 for (y = 1; y < img->height - 1; ++y)
8139 { 8139 {
8140 p = COLOR (new, 1, y); 8140 p = COLOR (new, 1, y);
8141 8141
8142 for (x = 1; x < img->width - 1; ++x, ++p) 8142 for (x = 1; x < img->width - 1; ++x, ++p)
8143 { 8143 {
8144 int r, g, b, y1, x1; 8144 int r, g, b, y1, x1;
@@ -8211,7 +8211,7 @@ x_edge_detection (f, img, matrix, color_adjust)
8211{ 8211{
8212 int i = 0; 8212 int i = 0;
8213 int trans[9]; 8213 int trans[9];
8214 8214
8215 if (CONSP (matrix)) 8215 if (CONSP (matrix))
8216 { 8216 {
8217 for (i = 0; 8217 for (i = 0;
@@ -8331,7 +8331,7 @@ x_build_heuristic_mask (f, img, how)
8331 /* Determine the background color of ximg. If HOW is `(R G B)' 8331 /* Determine the background color of ximg. If HOW is `(R G B)'
8332 take that as color. Otherwise, use the image's background color. */ 8332 take that as color. Otherwise, use the image's background color. */
8333 use_img_background = 1; 8333 use_img_background = 1;
8334 8334
8335 if (CONSP (how)) 8335 if (CONSP (how))
8336 { 8336 {
8337 int rgb[3], i; 8337 int rgb[3], i;
@@ -8350,7 +8350,7 @@ x_build_heuristic_mask (f, img, how)
8350 use_img_background = 0; 8350 use_img_background = 0;
8351 } 8351 }
8352 } 8352 }
8353 8353
8354 if (use_img_background) 8354 if (use_img_background)
8355 bg = four_corners_best (ximg, img->width, img->height); 8355 bg = four_corners_best (ximg, img->width, img->height);
8356 8356
@@ -8367,7 +8367,7 @@ x_build_heuristic_mask (f, img, how)
8367 x_put_x_image (f, mask_img, img->mask, img->width, img->height); 8367 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
8368 x_destroy_x_image (mask_img); 8368 x_destroy_x_image (mask_img);
8369 XDestroyImage (ximg); 8369 XDestroyImage (ximg);
8370 8370
8371 return 1; 8371 return 1;
8372} 8372}
8373 8373
@@ -8440,9 +8440,9 @@ pbm_image_p (object)
8440 Lisp_Object object; 8440 Lisp_Object object;
8441{ 8441{
8442 struct image_keyword fmt[PBM_LAST]; 8442 struct image_keyword fmt[PBM_LAST];
8443 8443
8444 bcopy (pbm_format, fmt, sizeof fmt); 8444 bcopy (pbm_format, fmt, sizeof fmt);
8445 8445
8446 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) 8446 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
8447 return 0; 8447 return 0;
8448 8448
@@ -8491,7 +8491,7 @@ pbm_scan_number (s, end)
8491 8491
8492/* Load PBM image IMG for use on frame F. */ 8492/* Load PBM image IMG for use on frame F. */
8493 8493
8494static int 8494static int
8495pbm_load (f, img) 8495pbm_load (f, img)
8496 struct frame *f; 8496 struct frame *f;
8497 struct image *img; 8497 struct image *img;
@@ -8554,7 +8554,7 @@ pbm_load (f, img)
8554 case '1': 8554 case '1':
8555 raw_p = 0, type = PBM_MONO; 8555 raw_p = 0, type = PBM_MONO;
8556 break; 8556 break;
8557 8557
8558 case '2': 8558 case '2':
8559 raw_p = 0, type = PBM_GRAY; 8559 raw_p = 0, type = PBM_GRAY;
8560 break; 8560 break;
@@ -8566,11 +8566,11 @@ pbm_load (f, img)
8566 case '4': 8566 case '4':
8567 raw_p = 1, type = PBM_MONO; 8567 raw_p = 1, type = PBM_MONO;
8568 break; 8568 break;
8569 8569
8570 case '5': 8570 case '5':
8571 raw_p = 1, type = PBM_GRAY; 8571 raw_p = 1, type = PBM_GRAY;
8572 break; 8572 break;
8573 8573
8574 case '6': 8574 case '6':
8575 raw_p = 1, type = PBM_COLOR; 8575 raw_p = 1, type = PBM_COLOR;
8576 break; 8576 break;
@@ -8591,7 +8591,7 @@ pbm_load (f, img)
8591 if (raw_p && max_color_idx > 255) 8591 if (raw_p && max_color_idx > 255)
8592 max_color_idx = 255; 8592 max_color_idx = 255;
8593 } 8593 }
8594 8594
8595 if (width < 0 8595 if (width < 0
8596 || height < 0 8596 || height < 0
8597 || (type != PBM_MONO && max_color_idx < 0)) 8597 || (type != PBM_MONO && max_color_idx < 0))
@@ -8600,7 +8600,7 @@ pbm_load (f, img)
8600 if (!x_create_x_image_and_pixmap (f, width, height, 0, 8600 if (!x_create_x_image_and_pixmap (f, width, height, 0,
8601 &ximg, &img->pixmap)) 8601 &ximg, &img->pixmap))
8602 goto error; 8602 goto error;
8603 8603
8604 /* Initialize the color hash table. */ 8604 /* Initialize the color hash table. */
8605 init_color_table (); 8605 init_color_table ();
8606 8606
@@ -8614,7 +8614,7 @@ pbm_load (f, img)
8614 /* Parse the image specification. */ 8614 /* Parse the image specification. */
8615 bcopy (pbm_format, fmt, sizeof fmt); 8615 bcopy (pbm_format, fmt, sizeof fmt);
8616 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); 8616 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
8617 8617
8618 /* Get foreground and background colors, maybe allocate colors. */ 8618 /* Get foreground and background colors, maybe allocate colors. */
8619 if (fmt[PBM_FOREGROUND].count 8619 if (fmt[PBM_FOREGROUND].count
8620 && STRINGP (fmt[PBM_FOREGROUND].value)) 8620 && STRINGP (fmt[PBM_FOREGROUND].value))
@@ -8626,7 +8626,7 @@ pbm_load (f, img)
8626 img->background = bg; 8626 img->background = bg;
8627 img->background_valid = 1; 8627 img->background_valid = 1;
8628 } 8628 }
8629 8629
8630 for (y = 0; y < height; ++y) 8630 for (y = 0; y < height; ++y)
8631 for (x = 0; x < width; ++x) 8631 for (x = 0; x < width; ++x)
8632 { 8632 {
@@ -8649,7 +8649,7 @@ pbm_load (f, img)
8649 for (x = 0; x < width; ++x) 8649 for (x = 0; x < width; ++x)
8650 { 8650 {
8651 int r, g, b; 8651 int r, g, b;
8652 8652
8653 if (type == PBM_GRAY) 8653 if (type == PBM_GRAY)
8654 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); 8654 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
8655 else if (raw_p) 8655 else if (raw_p)
@@ -8664,7 +8664,7 @@ pbm_load (f, img)
8664 g = pbm_scan_number (&p, end); 8664 g = pbm_scan_number (&p, end);
8665 b = pbm_scan_number (&p, end); 8665 b = pbm_scan_number (&p, end);
8666 } 8666 }
8667 8667
8668 if (r < 0 || g < 0 || b < 0) 8668 if (r < 0 || g < 0 || b < 0)
8669 { 8669 {
8670 xfree (ximg->data); 8670 xfree (ximg->data);
@@ -8674,7 +8674,7 @@ pbm_load (f, img)
8674 img->spec, Qnil); 8674 img->spec, Qnil);
8675 goto error; 8675 goto error;
8676 } 8676 }
8677 8677
8678 /* RGB values are now in the range 0..max_color_idx. 8678 /* RGB values are now in the range 0..max_color_idx.
8679 Scale this to the range 0..0xffff supported by X. */ 8679 Scale this to the range 0..0xffff supported by X. */
8680 r = (double) r * 65535 / max_color_idx; 8680 r = (double) r * 65535 / max_color_idx;
@@ -8683,7 +8683,7 @@ pbm_load (f, img)
8683 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); 8683 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
8684 } 8684 }
8685 } 8685 }
8686 8686
8687 /* Store in IMG->colors the colors allocated for the image, and 8687 /* Store in IMG->colors the colors allocated for the image, and
8688 free the color table. */ 8688 free the color table. */
8689 img->colors = colors_in_color_table (&img->ncolors); 8689 img->colors = colors_in_color_table (&img->ncolors);
@@ -8692,11 +8692,11 @@ pbm_load (f, img)
8692 /* Maybe fill in the background field while we have ximg handy. */ 8692 /* Maybe fill in the background field while we have ximg handy. */
8693 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 8693 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
8694 IMAGE_BACKGROUND (img, f, ximg); 8694 IMAGE_BACKGROUND (img, f, ximg);
8695 8695
8696 /* Put the image into a pixmap. */ 8696 /* Put the image into a pixmap. */
8697 x_put_x_image (f, ximg, img->pixmap, width, height); 8697 x_put_x_image (f, ximg, img->pixmap, width, height);
8698 x_destroy_x_image (ximg); 8698 x_destroy_x_image (ximg);
8699 8699
8700 img->width = width; 8700 img->width = width;
8701 img->height = height; 8701 img->height = height;
8702 8702
@@ -8778,7 +8778,7 @@ png_image_p (object)
8778{ 8778{
8779 struct image_keyword fmt[PNG_LAST]; 8779 struct image_keyword fmt[PNG_LAST];
8780 bcopy (png_format, fmt, sizeof fmt); 8780 bcopy (png_format, fmt, sizeof fmt);
8781 8781
8782 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) 8782 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
8783 return 0; 8783 return 0;
8784 8784
@@ -8835,7 +8835,7 @@ png_read_from_memory (png_ptr, data, length)
8835 8835
8836 if (length > tbr->len - tbr->index) 8836 if (length > tbr->len - tbr->index)
8837 png_error (png_ptr, "Read error"); 8837 png_error (png_ptr, "Read error");
8838 8838
8839 bcopy (tbr->bytes + tbr->index, data, length); 8839 bcopy (tbr->bytes + tbr->index, data, length);
8840 tbr->index = tbr->index + length; 8840 tbr->index = tbr->index + length;
8841} 8841}
@@ -8977,14 +8977,14 @@ png_load (f, img)
8977 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 8977 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
8978 &interlace_type, NULL, NULL); 8978 &interlace_type, NULL, NULL);
8979 8979
8980 /* If image contains simply transparency data, we prefer to 8980 /* If image contains simply transparency data, we prefer to
8981 construct a clipping mask. */ 8981 construct a clipping mask. */
8982 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) 8982 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
8983 transparent_p = 1; 8983 transparent_p = 1;
8984 else 8984 else
8985 transparent_p = 0; 8985 transparent_p = 0;
8986 8986
8987 /* This function is easier to write if we only have to handle 8987 /* This function is easier to write if we only have to handle
8988 one data format: RGB or RGBA with 8 bits per channel. Let's 8988 one data format: RGB or RGBA with 8 bits per channel. Let's
8989 transform other formats into that format. */ 8989 transform other formats into that format. */
8990 8990
@@ -8997,14 +8997,14 @@ png_load (f, img)
8997 png_set_expand (png_ptr); 8997 png_set_expand (png_ptr);
8998 8998
8999 /* Convert grayscale images to RGB. */ 8999 /* Convert grayscale images to RGB. */
9000 if (color_type == PNG_COLOR_TYPE_GRAY 9000 if (color_type == PNG_COLOR_TYPE_GRAY
9001 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) 9001 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
9002 png_set_gray_to_rgb (png_ptr); 9002 png_set_gray_to_rgb (png_ptr);
9003 9003
9004 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2); 9004 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
9005 9005
9006#if 0 /* avoid double gamma correction for PNG images */
9006 /* Tell the PNG lib to handle gamma correction for us. */ 9007 /* Tell the PNG lib to handle gamma correction for us. */
9007
9008#if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) 9008#if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
9009 if (png_get_sRGB (png_ptr, info_ptr, &intent)) 9009 if (png_get_sRGB (png_ptr, info_ptr, &intent))
9010 /* The libpng documentation says this is right in this case. */ 9010 /* The libpng documentation says this is right in this case. */
@@ -9017,6 +9017,7 @@ png_load (f, img)
9017 else 9017 else
9018 /* Use the standard default for the image gamma. */ 9018 /* Use the standard default for the image gamma. */
9019 png_set_gamma (png_ptr, screen_gamma, 0.45455); 9019 png_set_gamma (png_ptr, screen_gamma, 0.45455);
9020#endif /* if 0 */
9020 9021
9021 /* Handle alpha channel by combining the image with a background 9022 /* Handle alpha channel by combining the image with a background
9022 color. Do this only if a real alpha channel is supplied. For 9023 color. Do this only if a real alpha channel is supplied. For
@@ -9045,14 +9046,14 @@ png_load (f, img)
9045 } 9046 }
9046 } 9047 }
9047 else if (png_get_bKGD (png_ptr, info_ptr, &image_bg)) 9048 else if (png_get_bKGD (png_ptr, info_ptr, &image_bg))
9048 /* Image contains a background color with which to 9049 /* Image contains a background color with which to
9049 combine the image. */ 9050 combine the image. */
9050 png_set_background (png_ptr, image_bg, 9051 png_set_background (png_ptr, image_bg,
9051 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); 9052 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
9052 else 9053 else
9053 { 9054 {
9054 /* Image does not contain a background color with which 9055 /* Image does not contain a background color with which
9055 to combine the image data via an alpha channel. Use 9056 to combine the image data via an alpha channel. Use
9056 the frame's background instead. */ 9057 the frame's background instead. */
9057 XColor color; 9058 XColor color;
9058 Colormap cmap; 9059 Colormap cmap;
@@ -9100,12 +9101,12 @@ png_load (f, img)
9100 fclose (fp); 9101 fclose (fp);
9101 fp = NULL; 9102 fp = NULL;
9102 } 9103 }
9103 9104
9104 /* Create the X image and pixmap. */ 9105 /* Create the X image and pixmap. */
9105 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, 9106 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
9106 &img->pixmap)) 9107 &img->pixmap))
9107 goto error; 9108 goto error;
9108 9109
9109 /* Create an image and pixmap serving as mask if the PNG image 9110 /* Create an image and pixmap serving as mask if the PNG image
9110 contains an alpha channel. */ 9111 contains an alpha channel. */
9111 if (channels == 4 9112 if (channels == 4
@@ -9136,16 +9137,16 @@ png_load (f, img)
9136 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); 9137 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
9137 9138
9138 /* An alpha channel, aka mask channel, associates variable 9139 /* An alpha channel, aka mask channel, associates variable
9139 transparency with an image. Where other image formats 9140 transparency with an image. Where other image formats
9140 support binary transparency---fully transparent or fully 9141 support binary transparency---fully transparent or fully
9141 opaque---PNG allows up to 254 levels of partial transparency. 9142 opaque---PNG allows up to 254 levels of partial transparency.
9142 The PNG library implements partial transparency by combining 9143 The PNG library implements partial transparency by combining
9143 the image with a specified background color. 9144 the image with a specified background color.
9144 9145
9145 I'm not sure how to handle this here nicely: because the 9146 I'm not sure how to handle this here nicely: because the
9146 background on which the image is displayed may change, for 9147 background on which the image is displayed may change, for
9147 real alpha channel support, it would be necessary to create 9148 real alpha channel support, it would be necessary to create
9148 a new image for each possible background. 9149 a new image for each possible background.
9149 9150
9150 What I'm doing now is that a mask is created if we have 9151 What I'm doing now is that a mask is created if we have
9151 boolean transparency information. Otherwise I'm using 9152 boolean transparency information. Otherwise I'm using
@@ -9291,9 +9292,9 @@ jpeg_image_p (object)
9291 Lisp_Object object; 9292 Lisp_Object object;
9292{ 9293{
9293 struct image_keyword fmt[JPEG_LAST]; 9294 struct image_keyword fmt[JPEG_LAST];
9294 9295
9295 bcopy (jpeg_format, fmt, sizeof fmt); 9296 bcopy (jpeg_format, fmt, sizeof fmt);
9296 9297
9297 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) 9298 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
9298 return 0; 9299 return 0;
9299 9300
@@ -9364,7 +9365,7 @@ our_skip_input_data (cinfo, num_bytes)
9364 { 9365 {
9365 if (num_bytes > src->bytes_in_buffer) 9366 if (num_bytes > src->bytes_in_buffer)
9366 ERREXIT (cinfo, JERR_INPUT_EOF); 9367 ERREXIT (cinfo, JERR_INPUT_EOF);
9367 9368
9368 src->bytes_in_buffer -= num_bytes; 9369 src->bytes_in_buffer -= num_bytes;
9369 src->next_input_byte += num_bytes; 9370 src->next_input_byte += num_bytes;
9370 } 9371 }
@@ -9402,7 +9403,7 @@ jpeg_memory_src (cinfo, data, len)
9402 src = (struct jpeg_source_mgr *) cinfo->src; 9403 src = (struct jpeg_source_mgr *) cinfo->src;
9403 src->next_input_byte = data; 9404 src->next_input_byte = data;
9404 } 9405 }
9405 9406
9406 src = (struct jpeg_source_mgr *) cinfo->src; 9407 src = (struct jpeg_source_mgr *) cinfo->src;
9407 src->init_source = our_init_source; 9408 src->init_source = our_init_source;
9408 src->fill_input_buffer = our_fill_input_buffer; 9409 src->fill_input_buffer = our_fill_input_buffer;
@@ -9417,7 +9418,7 @@ jpeg_memory_src (cinfo, data, len)
9417/* Load image IMG for use on frame F. Patterned after example.c 9418/* Load image IMG for use on frame F. Patterned after example.c
9418 from the JPEG lib. */ 9419 from the JPEG lib. */
9419 9420
9420static int 9421static int
9421jpeg_load (f, img) 9422jpeg_load (f, img)
9422 struct frame *f; 9423 struct frame *f;
9423 struct image *img; 9424 struct image *img;
@@ -9450,7 +9451,7 @@ jpeg_load (f, img)
9450 UNGCPRO; 9451 UNGCPRO;
9451 return 0; 9452 return 0;
9452 } 9453 }
9453 9454
9454 fp = fopen (SDATA (file), "r"); 9455 fp = fopen (SDATA (file), "r");
9455 if (fp == NULL) 9456 if (fp == NULL)
9456 { 9457 {
@@ -9464,7 +9465,7 @@ jpeg_load (f, img)
9464 error is detected. This function will perform a longjmp. */ 9465 error is detected. This function will perform a longjmp. */
9465 cinfo.err = jpeg_std_error (&mgr.pub); 9466 cinfo.err = jpeg_std_error (&mgr.pub);
9466 mgr.pub.error_exit = my_error_exit; 9467 mgr.pub.error_exit = my_error_exit;
9467 9468
9468 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) 9469 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
9469 { 9470 {
9470 if (rc == 1) 9471 if (rc == 1)
@@ -9475,7 +9476,7 @@ jpeg_load (f, img)
9475 image_error ("Error reading JPEG image `%s': %s", img->spec, 9476 image_error ("Error reading JPEG image `%s': %s", img->spec,
9476 build_string (buffer)); 9477 build_string (buffer));
9477 } 9478 }
9478 9479
9479 /* Close the input file and destroy the JPEG object. */ 9480 /* Close the input file and destroy the JPEG object. */
9480 if (fp) 9481 if (fp)
9481 fclose ((FILE *) fp); 9482 fclose ((FILE *) fp);
@@ -9486,7 +9487,7 @@ jpeg_load (f, img)
9486 9487
9487 /* Free pixmap and colors. */ 9488 /* Free pixmap and colors. */
9488 x_clear_image (f, img); 9489 x_clear_image (f, img);
9489 9490
9490 UNGCPRO; 9491 UNGCPRO;
9491 return 0; 9492 return 0;
9492 } 9493 }
@@ -9536,7 +9537,7 @@ jpeg_load (f, img)
9536 init_color_table (); 9537 init_color_table ();
9537 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors 9538 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
9538 * sizeof *colors); 9539 * sizeof *colors);
9539 9540
9540 for (i = 0; i < cinfo.actual_number_of_colors; ++i) 9541 for (i = 0; i < cinfo.actual_number_of_colors; ++i)
9541 { 9542 {
9542 /* Multiply RGB values with 255 because X expects RGB values 9543 /* Multiply RGB values with 255 because X expects RGB values
@@ -9572,7 +9573,7 @@ jpeg_load (f, img)
9572 /* Maybe fill in the background field while we have ximg handy. */ 9573 /* Maybe fill in the background field while we have ximg handy. */
9573 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 9574 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
9574 IMAGE_BACKGROUND (img, f, ximg); 9575 IMAGE_BACKGROUND (img, f, ximg);
9575 9576
9576 /* Put the image into the pixmap. */ 9577 /* Put the image into the pixmap. */
9577 x_put_x_image (f, ximg, img->pixmap, width, height); 9578 x_put_x_image (f, ximg, img->pixmap, width, height);
9578 x_destroy_x_image (ximg); 9579 x_destroy_x_image (ximg);
@@ -9653,10 +9654,10 @@ tiff_image_p (object)
9653{ 9654{
9654 struct image_keyword fmt[TIFF_LAST]; 9655 struct image_keyword fmt[TIFF_LAST];
9655 bcopy (tiff_format, fmt, sizeof fmt); 9656 bcopy (tiff_format, fmt, sizeof fmt);
9656 9657
9657 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) 9658 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
9658 return 0; 9659 return 0;
9659 9660
9660 /* Must specify either the :data or :file keyword. */ 9661 /* Must specify either the :data or :file keyword. */
9661 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; 9662 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
9662} 9663}
@@ -9720,22 +9721,22 @@ tiff_seek_in_memory (data, off, whence)
9720 case SEEK_SET: /* Go from beginning of source. */ 9721 case SEEK_SET: /* Go from beginning of source. */
9721 idx = off; 9722 idx = off;
9722 break; 9723 break;
9723 9724
9724 case SEEK_END: /* Go from end of source. */ 9725 case SEEK_END: /* Go from end of source. */
9725 idx = src->len + off; 9726 idx = src->len + off;
9726 break; 9727 break;
9727 9728
9728 case SEEK_CUR: /* Go from current position. */ 9729 case SEEK_CUR: /* Go from current position. */
9729 idx = src->index + off; 9730 idx = src->index + off;
9730 break; 9731 break;
9731 9732
9732 default: /* Invalid `whence'. */ 9733 default: /* Invalid `whence'. */
9733 return -1; 9734 return -1;
9734 } 9735 }
9735 9736
9736 if (idx > src->len || idx < 0) 9737 if (idx > src->len || idx < 0)
9737 return -1; 9738 return -1;
9738 9739
9739 src->index = idx; 9740 src->index = idx;
9740 return src->index; 9741 return src->index;
9741} 9742}
@@ -9786,7 +9787,7 @@ tiff_error_handler (title, format, ap)
9786{ 9787{
9787 char buf[512]; 9788 char buf[512];
9788 int len; 9789 int len;
9789 9790
9790 len = sprintf (buf, "TIFF error: %s ", title); 9791 len = sprintf (buf, "TIFF error: %s ", title);
9791 vsprintf (buf + len, format, ap); 9792 vsprintf (buf + len, format, ap);
9792 add_to_log (buf, Qnil, Qnil); 9793 add_to_log (buf, Qnil, Qnil);
@@ -9800,7 +9801,7 @@ tiff_warning_handler (title, format, ap)
9800{ 9801{
9801 char buf[512]; 9802 char buf[512];
9802 int len; 9803 int len;
9803 9804
9804 len = sprintf (buf, "TIFF warning: %s ", title); 9805 len = sprintf (buf, "TIFF warning: %s ", title);
9805 vsprintf (buf + len, format, ap); 9806 vsprintf (buf + len, format, ap);
9806 add_to_log (buf, Qnil, Qnil); 9807 add_to_log (buf, Qnil, Qnil);
@@ -9843,7 +9844,7 @@ tiff_load (f, img)
9843 UNGCPRO; 9844 UNGCPRO;
9844 return 0; 9845 return 0;
9845 } 9846 }
9846 9847
9847 /* Try to open the image file. */ 9848 /* Try to open the image file. */
9848 tiff = TIFFOpen (SDATA (file), "r"); 9849 tiff = TIFFOpen (SDATA (file), "r");
9849 if (tiff == NULL) 9850 if (tiff == NULL)
@@ -9882,7 +9883,7 @@ tiff_load (f, img)
9882 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); 9883 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
9883 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); 9884 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
9884 buf = (uint32 *) xmalloc (width * height * sizeof *buf); 9885 buf = (uint32 *) xmalloc (width * height * sizeof *buf);
9885 9886
9886 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); 9887 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
9887 TIFFClose (tiff); 9888 TIFFClose (tiff);
9888 if (!rc) 9889 if (!rc)
@@ -9908,21 +9909,21 @@ tiff_load (f, img)
9908 for (y = 0; y < height; ++y) 9909 for (y = 0; y < height; ++y)
9909 { 9910 {
9910 uint32 *row = buf + y * width; 9911 uint32 *row = buf + y * width;
9911 9912
9912 for (x = 0; x < width; ++x) 9913 for (x = 0; x < width; ++x)
9913 { 9914 {
9914 uint32 abgr = row[x]; 9915 uint32 abgr = row[x];
9915 int r = TIFFGetR (abgr) << 8; 9916 int r = TIFFGetR (abgr) << 8;
9916 int g = TIFFGetG (abgr) << 8; 9917 int g = TIFFGetG (abgr) << 8;
9917 int b = TIFFGetB (abgr) << 8; 9918 int b = TIFFGetB (abgr) << 8;
9918 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); 9919 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
9919 } 9920 }
9920 } 9921 }
9921 9922
9922 /* Remember the colors allocated for the image. Free the color table. */ 9923 /* Remember the colors allocated for the image. Free the color table. */
9923 img->colors = colors_in_color_table (&img->ncolors); 9924 img->colors = colors_in_color_table (&img->ncolors);
9924 free_color_table (); 9925 free_color_table ();
9925 9926
9926 img->width = width; 9927 img->width = width;
9927 img->height = height; 9928 img->height = height;
9928 9929
@@ -10014,10 +10015,10 @@ gif_image_p (object)
10014{ 10015{
10015 struct image_keyword fmt[GIF_LAST]; 10016 struct image_keyword fmt[GIF_LAST];
10016 bcopy (gif_format, fmt, sizeof fmt); 10017 bcopy (gif_format, fmt, sizeof fmt);
10017 10018
10018 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) 10019 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
10019 return 0; 10020 return 0;
10020 10021
10021 /* Must specify either the :data or :file keyword. */ 10022 /* Must specify either the :data or :file keyword. */
10022 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; 10023 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
10023} 10024}
@@ -10092,7 +10093,7 @@ gif_load (f, img)
10092 UNGCPRO; 10093 UNGCPRO;
10093 return 0; 10094 return 0;
10094 } 10095 }
10095 10096
10096 /* Open the GIF file. */ 10097 /* Open the GIF file. */
10097 gif = DGifOpenFileName (SDATA (file)); 10098 gif = DGifOpenFileName (SDATA (file));
10098 if (gif == NULL) 10099 if (gif == NULL)
@@ -10150,14 +10151,14 @@ gif_load (f, img)
10150 UNGCPRO; 10151 UNGCPRO;
10151 return 0; 10152 return 0;
10152 } 10153 }
10153 10154
10154 /* Allocate colors. */ 10155 /* Allocate colors. */
10155 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; 10156 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
10156 if (!gif_color_map) 10157 if (!gif_color_map)
10157 gif_color_map = gif->SColorMap; 10158 gif_color_map = gif->SColorMap;
10158 init_color_table (); 10159 init_color_table ();
10159 bzero (pixel_colors, sizeof pixel_colors); 10160 bzero (pixel_colors, sizeof pixel_colors);
10160 10161
10161 for (i = 0; i < gif_color_map->ColorCount; ++i) 10162 for (i = 0; i < gif_color_map->ColorCount; ++i)
10162 { 10163 {
10163 int r = gif_color_map->Colors[i].Red << 8; 10164 int r = gif_color_map->Colors[i].Red << 8;
@@ -10170,7 +10171,7 @@ gif_load (f, img)
10170 free_color_table (); 10171 free_color_table ();
10171 10172
10172 /* Clear the part of the screen image that are not covered by 10173 /* Clear the part of the screen image that are not covered by
10173 the image from the GIF file. Full animated GIF support 10174 the image from the GIF file. Full animated GIF support
10174 requires more than can be done here (see the gif89 spec, 10175 requires more than can be done here (see the gif89 spec,
10175 disposal methods). Let's simply assume that the part 10176 disposal methods). Let's simply assume that the part
10176 not covered by a sub-image is in the frame's background color. */ 10177 not covered by a sub-image is in the frame's background color. */
@@ -10199,7 +10200,7 @@ gif_load (f, img)
10199 `raster' here because RasterBits below is a char *, and invites 10200 `raster' here because RasterBits below is a char *, and invites
10200 problems with bytes >= 0x80. */ 10201 problems with bytes >= 0x80. */
10201 raster = (unsigned char *) gif->SavedImages[ino].RasterBits; 10202 raster = (unsigned char *) gif->SavedImages[ino].RasterBits;
10202 10203
10203 if (gif->SavedImages[ino].ImageDesc.Interlace) 10204 if (gif->SavedImages[ino].ImageDesc.Interlace)
10204 { 10205 {
10205 static int interlace_start[] = {0, 4, 2, 1}; 10206 static int interlace_start[] = {0, 4, 2, 1};
@@ -10217,14 +10218,14 @@ gif_load (f, img)
10217 while (row >= image_height) 10218 while (row >= image_height)
10218 row = interlace_start[++pass]; 10219 row = interlace_start[++pass];
10219 } 10220 }
10220 10221
10221 for (x = 0; x < image_width; x++) 10222 for (x = 0; x < image_width; x++)
10222 { 10223 {
10223 int i = raster[(y * image_width) + x]; 10224 int i = raster[(y * image_width) + x];
10224 XPutPixel (ximg, x + image_left, row + image_top, 10225 XPutPixel (ximg, x + image_left, row + image_top,
10225 pixel_colors[i]); 10226 pixel_colors[i]);
10226 } 10227 }
10227 10228
10228 row += interlace_increment[pass]; 10229 row += interlace_increment[pass];
10229 } 10230 }
10230 } 10231 }
@@ -10237,17 +10238,17 @@ gif_load (f, img)
10237 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); 10238 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
10238 } 10239 }
10239 } 10240 }
10240 10241
10241 DGifCloseFile (gif); 10242 DGifCloseFile (gif);
10242 10243
10243 /* Maybe fill in the background field while we have ximg handy. */ 10244 /* Maybe fill in the background field while we have ximg handy. */
10244 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 10245 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
10245 IMAGE_BACKGROUND (img, f, ximg); 10246 IMAGE_BACKGROUND (img, f, ximg);
10246 10247
10247 /* Put the image into the pixmap, then free the X image and its buffer. */ 10248 /* Put the image into the pixmap, then free the X image and its buffer. */
10248 x_put_x_image (f, ximg, img->pixmap, width, height); 10249 x_put_x_image (f, ximg, img->pixmap, width, height);
10249 x_destroy_x_image (ximg); 10250 x_destroy_x_image (ximg);
10250 10251
10251 UNGCPRO; 10252 UNGCPRO;
10252 return 1; 10253 return 1;
10253} 10254}
@@ -10347,9 +10348,9 @@ gs_image_p (object)
10347 struct image_keyword fmt[GS_LAST]; 10348 struct image_keyword fmt[GS_LAST];
10348 Lisp_Object tem; 10349 Lisp_Object tem;
10349 int i; 10350 int i;
10350 10351
10351 bcopy (gs_format, fmt, sizeof fmt); 10352 bcopy (gs_format, fmt, sizeof fmt);
10352 10353
10353 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) 10354 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
10354 return 0; 10355 return 0;
10355 10356
@@ -10415,7 +10416,7 @@ gs_load (f, img)
10415 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); 10416 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
10416 return 0; 10417 return 0;
10417 } 10418 }
10418 10419
10419 /* Call the loader to fill the pixmap. It returns a process object 10420 /* Call the loader to fill the pixmap. It returns a process object
10420 if successful. We do not record_unwind_protect here because 10421 if successful. We do not record_unwind_protect here because
10421 other places in redisplay like calling window scroll functions 10422 other places in redisplay like calling window scroll functions
@@ -10426,12 +10427,12 @@ gs_load (f, img)
10426 (unsigned long) FRAME_X_WINDOW (f), 10427 (unsigned long) FRAME_X_WINDOW (f),
10427 (unsigned long) img->pixmap); 10428 (unsigned long) img->pixmap);
10428 window_and_pixmap_id = build_string (buffer); 10429 window_and_pixmap_id = build_string (buffer);
10429 10430
10430 sprintf (buffer, "%lu %lu", 10431 sprintf (buffer, "%lu %lu",
10431 FRAME_FOREGROUND_PIXEL (f), 10432 FRAME_FOREGROUND_PIXEL (f),
10432 FRAME_BACKGROUND_PIXEL (f)); 10433 FRAME_BACKGROUND_PIXEL (f));
10433 pixel_colors = build_string (buffer); 10434 pixel_colors = build_string (buffer);
10434 10435
10435 XSETFRAME (frame, f); 10436 XSETFRAME (frame, f);
10436 loader = image_spec_value (img->spec, QCloader, NULL); 10437 loader = image_spec_value (img->spec, QCloader, NULL);
10437 if (NILP (loader)) 10438 if (NILP (loader))
@@ -10469,7 +10470,7 @@ x_kill_gs_process (pixmap, f)
10469 instance, give up. */ 10470 instance, give up. */
10470 if (i == c->used) 10471 if (i == c->used)
10471 return; 10472 return;
10472 10473
10473 /* Kill the GS process. We should have found PIXMAP in the image 10474 /* Kill the GS process. We should have found PIXMAP in the image
10474 cache and its image should contain a process object. */ 10475 cache and its image should contain a process object. */
10475 img = c->images[i]; 10476 img = c->images[i];
@@ -10493,10 +10494,10 @@ x_kill_gs_process (pixmap, f)
10493 if (ximg) 10494 if (ximg)
10494 { 10495 {
10495 int x, y; 10496 int x, y;
10496 10497
10497 /* Initialize the color table. */ 10498 /* Initialize the color table. */
10498 init_color_table (); 10499 init_color_table ();
10499 10500
10500 /* For each pixel of the image, look its color up in the 10501 /* For each pixel of the image, look its color up in the
10501 color table. After having done so, the color table will 10502 color table. After having done so, the color table will
10502 contain an entry for each color used by the image. */ 10503 contain an entry for each color used by the image. */
@@ -10525,7 +10526,7 @@ x_kill_gs_process (pixmap, f)
10525 else 10526 else
10526 image_error ("Cannot get X image of `%s'; colors will not be freed", 10527 image_error ("Cannot get X image of `%s'; colors will not be freed",
10527 img->spec, Qnil); 10528 img->spec, Qnil);
10528 10529
10529 UNBLOCK_INPUT; 10530 UNBLOCK_INPUT;
10530 } 10531 }
10531 10532
@@ -10628,8 +10629,8 @@ value. */)
10628 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 10629 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
10629 prop_atom, 0, bytes_remaining, 10630 prop_atom, 0, bytes_remaining,
10630 False, XA_STRING, 10631 False, XA_STRING,
10631 &actual_type, &actual_format, 10632 &actual_type, &actual_format,
10632 &actual_size, &bytes_remaining, 10633 &actual_size, &bytes_remaining,
10633 (unsigned char **) &tmp_data); 10634 (unsigned char **) &tmp_data);
10634 if (rc == Success && tmp_data) 10635 if (rc == Success && tmp_data)
10635 prop_value = make_string (tmp_data, size); 10636 prop_value = make_string (tmp_data, size);
@@ -10678,7 +10679,7 @@ start_hourglass ()
10678{ 10679{
10679 EMACS_TIME delay; 10680 EMACS_TIME delay;
10680 int secs, usecs = 0; 10681 int secs, usecs = 0;
10681 10682
10682 cancel_hourglass (); 10683 cancel_hourglass ();
10683 10684
10684 if (INTEGERP (Vhourglass_delay) 10685 if (INTEGERP (Vhourglass_delay)
@@ -10694,7 +10695,7 @@ start_hourglass ()
10694 } 10695 }
10695 else 10696 else
10696 secs = DEFAULT_HOURGLASS_DELAY; 10697 secs = DEFAULT_HOURGLASS_DELAY;
10697 10698
10698 EMACS_SET_SECS_USECS (delay, secs, usecs); 10699 EMACS_SET_SECS_USECS (delay, secs, usecs);
10699 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, 10700 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
10700 show_hourglass, NULL); 10701 show_hourglass, NULL);
@@ -10712,7 +10713,7 @@ cancel_hourglass ()
10712 cancel_atimer (hourglass_atimer); 10713 cancel_atimer (hourglass_atimer);
10713 hourglass_atimer = NULL; 10714 hourglass_atimer = NULL;
10714 } 10715 }
10715 10716
10716 if (hourglass_shown_p) 10717 if (hourglass_shown_p)
10717 hide_hourglass (); 10718 hide_hourglass ();
10718} 10719}
@@ -10738,17 +10739,17 @@ show_hourglass (timer)
10738 if (!hourglass_shown_p) 10739 if (!hourglass_shown_p)
10739 { 10740 {
10740 Lisp_Object rest, frame; 10741 Lisp_Object rest, frame;
10741 10742
10742 BLOCK_INPUT; 10743 BLOCK_INPUT;
10743 10744
10744 FOR_EACH_FRAME (rest, frame) 10745 FOR_EACH_FRAME (rest, frame)
10745 { 10746 {
10746 struct frame *f = XFRAME (frame); 10747 struct frame *f = XFRAME (frame);
10747 10748
10748 if (FRAME_LIVE_P (f) && FRAME_X_P (f) && FRAME_X_DISPLAY (f)) 10749 if (FRAME_LIVE_P (f) && FRAME_X_P (f) && FRAME_X_DISPLAY (f))
10749 { 10750 {
10750 Display *dpy = FRAME_X_DISPLAY (f); 10751 Display *dpy = FRAME_X_DISPLAY (f);
10751 10752
10752#ifdef USE_X_TOOLKIT 10753#ifdef USE_X_TOOLKIT
10753 if (f->output_data.x->widget) 10754 if (f->output_data.x->widget)
10754#else 10755#else
@@ -10756,14 +10757,14 @@ show_hourglass (timer)
10756#endif 10757#endif
10757 { 10758 {
10758 f->output_data.x->hourglass_p = 1; 10759 f->output_data.x->hourglass_p = 1;
10759 10760
10760 if (!f->output_data.x->hourglass_window) 10761 if (!f->output_data.x->hourglass_window)
10761 { 10762 {
10762 unsigned long mask = CWCursor; 10763 unsigned long mask = CWCursor;
10763 XSetWindowAttributes attrs; 10764 XSetWindowAttributes attrs;
10764 10765
10765 attrs.cursor = f->output_data.x->hourglass_cursor; 10766 attrs.cursor = f->output_data.x->hourglass_cursor;
10766 10767
10767 f->output_data.x->hourglass_window 10768 f->output_data.x->hourglass_window
10768 = XCreateWindow (dpy, FRAME_OUTER_WINDOW (f), 10769 = XCreateWindow (dpy, FRAME_OUTER_WINDOW (f),
10769 0, 0, 32000, 32000, 0, 0, 10770 0, 0, 32000, 32000, 0, 0,
@@ -10771,7 +10772,7 @@ show_hourglass (timer)
10771 CopyFromParent, 10772 CopyFromParent,
10772 mask, &attrs); 10773 mask, &attrs);
10773 } 10774 }
10774 10775
10775 XMapRaised (dpy, f->output_data.x->hourglass_window); 10776 XMapRaised (dpy, f->output_data.x->hourglass_window);
10776 XFlush (dpy); 10777 XFlush (dpy);
10777 } 10778 }
@@ -10798,7 +10799,7 @@ hide_hourglass ()
10798 FOR_EACH_FRAME (rest, frame) 10799 FOR_EACH_FRAME (rest, frame)
10799 { 10800 {
10800 struct frame *f = XFRAME (frame); 10801 struct frame *f = XFRAME (frame);
10801 10802
10802 if (FRAME_X_P (f) 10803 if (FRAME_X_P (f)
10803 /* Watch out for newly created frames. */ 10804 /* Watch out for newly created frames. */
10804 && f->output_data.x->hourglass_window) 10805 && f->output_data.x->hourglass_window)
@@ -10827,7 +10828,7 @@ static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *,
10827 Lisp_Object, Lisp_Object)); 10828 Lisp_Object, Lisp_Object));
10828static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, 10829static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
10829 Lisp_Object, int, int, int *, int *)); 10830 Lisp_Object, int, int, int *, int *));
10830 10831
10831/* The frame of a currently visible tooltip. */ 10832/* The frame of a currently visible tooltip. */
10832 10833
10833Lisp_Object tip_frame; 10834Lisp_Object tip_frame;
@@ -10860,7 +10861,7 @@ unwind_create_tip_frame (frame)
10860 tip_window = None; 10861 tip_window = None;
10861 tip_frame = Qnil; 10862 tip_frame = Qnil;
10862 } 10863 }
10863 10864
10864 return deleted; 10865 return deleted;
10865} 10866}
10866 10867
@@ -10924,7 +10925,7 @@ x_create_tip_frame (dpyinfo, parms, text)
10924 Ferase_buffer (); 10925 Ferase_buffer ();
10925 Finsert (1, &text); 10926 Finsert (1, &text);
10926 set_buffer_internal_1 (old_buffer); 10927 set_buffer_internal_1 (old_buffer);
10927 10928
10928 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 10929 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
10929 record_unwind_protect (unwind_create_tip_frame, frame); 10930 record_unwind_protect (unwind_create_tip_frame, frame);
10930 10931
@@ -10960,7 +10961,7 @@ x_create_tip_frame (dpyinfo, parms, text)
10960 { 10961 {
10961 Lisp_Object black; 10962 Lisp_Object black;
10962 struct gcpro gcpro1; 10963 struct gcpro gcpro1;
10963 10964
10964 black = build_string ("black"); 10965 black = build_string ("black");
10965 GCPRO1 (black); 10966 GCPRO1 (black);
10966 f->output_data.x->foreground_pixel 10967 f->output_data.x->foreground_pixel
@@ -11010,7 +11011,7 @@ x_create_tip_frame (dpyinfo, parms, text)
11010 else 11011 else
11011 font = x_new_font (f, SDATA (font)); 11012 font = x_new_font (f, SDATA (font));
11012 } 11013 }
11013 11014
11014 /* Try out a font which we hope has bold and italic variations. */ 11015 /* Try out a font which we hope has bold and italic variations. */
11015 if (!STRINGP (font)) 11016 if (!STRINGP (font))
11016 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); 11017 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
@@ -11035,7 +11036,7 @@ x_create_tip_frame (dpyinfo, parms, text)
11035 11036
11036 x_default_parameter (f, parms, Qborder_width, make_number (2), 11037 x_default_parameter (f, parms, Qborder_width, make_number (2),
11037 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 11038 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
11038 11039
11039 /* This defaults to 2 in order to match xterm. We recognize either 11040 /* This defaults to 2 in order to match xterm. We recognize either
11040 internalBorderWidth or internalBorder (which is what xterm calls 11041 internalBorderWidth or internalBorder (which is what xterm calls
11041 it). */ 11042 it). */
@@ -11073,7 +11074,7 @@ x_create_tip_frame (dpyinfo, parms, text)
11073 end up in init_iterator with a null face cache, which should not 11074 end up in init_iterator with a null face cache, which should not
11074 happen. */ 11075 happen. */
11075 init_frame_faces (f); 11076 init_frame_faces (f);
11076 11077
11077 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; 11078 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
11078 window_prompting = x_figure_window_size (f, parms); 11079 window_prompting = x_figure_window_size (f, parms);
11079 11080
@@ -11096,12 +11097,12 @@ x_create_tip_frame (dpyinfo, parms, text)
11096 { 11097 {
11097 XSetWindowAttributes attrs; 11098 XSetWindowAttributes attrs;
11098 unsigned long mask; 11099 unsigned long mask;
11099 11100
11100 BLOCK_INPUT; 11101 BLOCK_INPUT;
11101 mask = CWBackPixel | CWOverrideRedirect | CWEventMask; 11102 mask = CWBackPixel | CWOverrideRedirect | CWEventMask;
11102 if (DoesSaveUnders (dpyinfo->screen)) 11103 if (DoesSaveUnders (dpyinfo->screen))
11103 mask |= CWSaveUnder; 11104 mask |= CWSaveUnder;
11104 11105
11105 /* Window managers look at the override-redirect flag to determine 11106 /* Window managers look at the override-redirect flag to determine
11106 whether or net to give windows a decoration (Xlib spec, chapter 11107 whether or net to give windows a decoration (Xlib spec, chapter
11107 3.2.8). */ 11108 3.2.8). */
@@ -11140,12 +11141,12 @@ x_create_tip_frame (dpyinfo, parms, text)
11140 f->height = 0; 11141 f->height = 0;
11141 SET_FRAME_WIDTH (f, 0); 11142 SET_FRAME_WIDTH (f, 0);
11142 change_frame_size (f, height, width, 1, 0, 0); 11143 change_frame_size (f, height, width, 1, 0, 0);
11143 11144
11144 /* Add `tooltip' frame parameter's default value. */ 11145 /* Add `tooltip' frame parameter's default value. */
11145 if (NILP (Fframe_parameter (frame, intern ("tooltip")))) 11146 if (NILP (Fframe_parameter (frame, intern ("tooltip"))))
11146 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 11147 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
11147 Qnil)); 11148 Qnil));
11148 11149
11149 /* Set up faces after all frame parameters are known. This call 11150 /* Set up faces after all frame parameters are known. This call
11150 also merges in face attributes specified for new frames. 11151 also merges in face attributes specified for new frames.
11151 11152
@@ -11160,12 +11161,12 @@ x_create_tip_frame (dpyinfo, parms, text)
11160 /* Set tip_frame here, so that */ 11161 /* Set tip_frame here, so that */
11161 tip_frame = frame; 11162 tip_frame = frame;
11162 call1 (Qface_set_after_frame_default, frame); 11163 call1 (Qface_set_after_frame_default, frame);
11163 11164
11164 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) 11165 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
11165 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), 11166 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg),
11166 Qnil)); 11167 Qnil));
11167 } 11168 }
11168 11169
11169 f->no_split = 1; 11170 f->no_split = 1;
11170 11171
11171 UNGCPRO; 11172 UNGCPRO;
@@ -11208,11 +11209,11 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
11208 int win_x, win_y; 11209 int win_x, win_y;
11209 Window root, child; 11210 Window root, child;
11210 unsigned pmask; 11211 unsigned pmask;
11211 11212
11212 /* User-specified position? */ 11213 /* User-specified position? */
11213 left = Fcdr (Fassq (Qleft, parms)); 11214 left = Fcdr (Fassq (Qleft, parms));
11214 top = Fcdr (Fassq (Qtop, parms)); 11215 top = Fcdr (Fassq (Qtop, parms));
11215 11216
11216 /* Move the tooltip window where the mouse pointer is. Resize and 11217 /* Move the tooltip window where the mouse pointer is. Resize and
11217 show it. */ 11218 show it. */
11218 if (!INTEGERP (left) || !INTEGERP (top)) 11219 if (!INTEGERP (left) || !INTEGERP (top))
@@ -11281,7 +11282,7 @@ Text larger than the specified size is clipped. */)
11281 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 11282 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
11282 int old_windows_or_buffers_changed = windows_or_buffers_changed; 11283 int old_windows_or_buffers_changed = windows_or_buffers_changed;
11283 int count = SPECPDL_INDEX (); 11284 int count = SPECPDL_INDEX ();
11284 11285
11285 specbind (Qinhibit_redisplay, Qt); 11286 specbind (Qinhibit_redisplay, Qt);
11286 11287
11287 GCPRO4 (string, parms, frame, timeout); 11288 GCPRO4 (string, parms, frame, timeout);
@@ -11292,12 +11293,12 @@ Text larger than the specified size is clipped. */)
11292 timeout = make_number (5); 11293 timeout = make_number (5);
11293 else 11294 else
11294 CHECK_NATNUM (timeout); 11295 CHECK_NATNUM (timeout);
11295 11296
11296 if (NILP (dx)) 11297 if (NILP (dx))
11297 dx = make_number (5); 11298 dx = make_number (5);
11298 else 11299 else
11299 CHECK_NUMBER (dx); 11300 CHECK_NUMBER (dx);
11300 11301
11301 if (NILP (dy)) 11302 if (NILP (dy))
11302 dy = make_number (-10); 11303 dy = make_number (-10);
11303 else 11304 else
@@ -11317,7 +11318,7 @@ Text larger than the specified size is clipped. */)
11317 && !NILP (Fequal (last_parms, parms))) 11318 && !NILP (Fequal (last_parms, parms)))
11318 { 11319 {
11319 struct frame *f = XFRAME (tip_frame); 11320 struct frame *f = XFRAME (tip_frame);
11320 11321
11321 /* Only DX and DY have changed. */ 11322 /* Only DX and DY have changed. */
11322 if (!NILP (tip_timer)) 11323 if (!NILP (tip_timer))
11323 { 11324 {
@@ -11364,7 +11365,7 @@ Text larger than the specified size is clipped. */)
11364 /* Set up the frame's root window. */ 11365 /* Set up the frame's root window. */
11365 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 11366 w = XWINDOW (FRAME_ROOT_WINDOW (f));
11366 w->left = w->top = make_number (0); 11367 w->left = w->top = make_number (0);
11367 11368
11368 if (CONSP (Vx_max_tooltip_size) 11369 if (CONSP (Vx_max_tooltip_size)
11369 && INTEGERP (XCAR (Vx_max_tooltip_size)) 11370 && INTEGERP (XCAR (Vx_max_tooltip_size))
11370 && XINT (XCAR (Vx_max_tooltip_size)) > 0 11371 && XINT (XCAR (Vx_max_tooltip_size)) > 0
@@ -11379,7 +11380,7 @@ Text larger than the specified size is clipped. */)
11379 w->width = make_number (80); 11380 w->width = make_number (80);
11380 w->height = make_number (40); 11381 w->height = make_number (40);
11381 } 11382 }
11382 11383
11383 f->window_width = XINT (w->width); 11384 f->window_width = XINT (w->width);
11384 adjust_glyphs (f); 11385 adjust_glyphs (f);
11385 w->pseudo_window_p = 1; 11386 w->pseudo_window_p = 1;
@@ -11417,7 +11418,7 @@ Text larger than the specified size is clipped. */)
11417 } 11418 }
11418 else 11419 else
11419 row_width = row->pixel_width; 11420 row_width = row->pixel_width;
11420 11421
11421 height += row->height; 11422 height += row->height;
11422 width = max (width, row_width); 11423 width = max (width, row_width);
11423 } 11424 }
@@ -11436,7 +11437,7 @@ Text larger than the specified size is clipped. */)
11436 root_x, root_y, width, height); 11437 root_x, root_y, width, height);
11437 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 11438 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
11438 UNBLOCK_INPUT; 11439 UNBLOCK_INPUT;
11439 11440
11440 /* Draw into the window. */ 11441 /* Draw into the window. */
11441 w->must_be_updated_p = 1; 11442 w->must_be_updated_p = 1;
11442 update_single_window (w, 1); 11443 update_single_window (w, 1);
@@ -11467,16 +11468,16 @@ Value is t if tooltip was open, nil otherwise. */)
11467 /* Return quickly if nothing to do. */ 11468 /* Return quickly if nothing to do. */
11468 if (NILP (tip_timer) && NILP (tip_frame)) 11469 if (NILP (tip_timer) && NILP (tip_frame))
11469 return Qnil; 11470 return Qnil;
11470 11471
11471 frame = tip_frame; 11472 frame = tip_frame;
11472 timer = tip_timer; 11473 timer = tip_timer;
11473 GCPRO2 (frame, timer); 11474 GCPRO2 (frame, timer);
11474 tip_frame = tip_timer = deleted = Qnil; 11475 tip_frame = tip_timer = deleted = Qnil;
11475 11476
11476 count = SPECPDL_INDEX (); 11477 count = SPECPDL_INDEX ();
11477 specbind (Qinhibit_redisplay, Qt); 11478 specbind (Qinhibit_redisplay, Qt);
11478 specbind (Qinhibit_quit, Qt); 11479 specbind (Qinhibit_quit, Qt);
11479 11480
11480 if (!NILP (timer)) 11481 if (!NILP (timer))
11481 call1 (Qcancel_timer, timer); 11482 call1 (Qcancel_timer, timer);
11482 11483
@@ -11579,7 +11580,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
11579 dir = Fexpand_file_name (dir, Qnil); 11580 dir = Fexpand_file_name (dir, Qnil);
11580 dir_xmstring = XmStringCreateLocalized (SDATA (dir)); 11581 dir_xmstring = XmStringCreateLocalized (SDATA (dir));
11581 pattern_xmstring = XmStringCreateLocalized ("*"); 11582 pattern_xmstring = XmStringCreateLocalized ("*");
11582 11583
11583 XtSetArg (al[ac], XmNtitle, SDATA (prompt)); ++ac; 11584 XtSetArg (al[ac], XmNtitle, SDATA (prompt)); ++ac;
11584 XtSetArg (al[ac], XmNdirectory, dir_xmstring); ++ac; 11585 XtSetArg (al[ac], XmNdirectory, dir_xmstring); ++ac;
11585 XtSetArg (al[ac], XmNpattern, pattern_xmstring); ++ac; 11586 XtSetArg (al[ac], XmNpattern, pattern_xmstring); ++ac;
@@ -11602,7 +11603,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
11602 help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); 11603 help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
11603 XtSetSensitive (help, False); 11604 XtSetSensitive (help, False);
11604 11605
11605 /* Mark OK button as default. */ 11606 /* Mark OK button as default. */
11606 XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), 11607 XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
11607 XmNshowAsDefault, True, NULL); 11608 XmNshowAsDefault, True, NULL);
11608 11609
@@ -11666,7 +11667,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
11666 { 11667 {
11667 XmString text; 11668 XmString text;
11668 String data; 11669 String data;
11669 11670
11670 XtVaGetValues (dialog, XmNtextString, &text, NULL); 11671 XtVaGetValues (dialog, XmNtextString, &text, NULL);
11671 XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data); 11672 XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
11672 XmStringFree (text); 11673 XmStringFree (text);
@@ -11685,7 +11686,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */)
11685 /* Make "Cancel" equivalent to C-g. */ 11686 /* Make "Cancel" equivalent to C-g. */
11686 if (NILP (file)) 11687 if (NILP (file))
11687 Fsignal (Qquit, Qnil); 11688 Fsignal (Qquit, Qnil);
11688 11689
11689 return unbind_to (count, file); 11690 return unbind_to (count, file);
11690} 11691}
11691 11692
@@ -11737,7 +11738,7 @@ usual X keysyms. */)
11737 UNBLOCK_INPUT; 11738 UNBLOCK_INPUT;
11738 return Qnil; 11739 return Qnil;
11739 } 11740 }
11740 11741
11741 have_keys = Qnil; 11742 have_keys = Qnil;
11742 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); 11743 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
11743 if (kb) 11744 if (kb)
@@ -11764,7 +11765,7 @@ usual X keysyms. */)
11764 } 11765 }
11765 11766
11766 XkbFreeClientMap (kb, 0, True); 11767 XkbFreeClientMap (kb, 0, True);
11767 11768
11768 if (delete_keycode 11769 if (delete_keycode
11769 && backspace_keycode 11770 && backspace_keycode
11770 && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode 11771 && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode
@@ -11894,7 +11895,7 @@ syms_of_xfns ()
11894 staticpro (&QCcolor_adjustment); 11895 staticpro (&QCcolor_adjustment);
11895 QCmask = intern (":mask"); 11896 QCmask = intern (":mask");
11896 staticpro (&QCmask); 11897 staticpro (&QCmask);
11897 11898
11898 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); 11899 Qface_set_after_frame_default = intern ("face-set-after-frame-default");
11899 staticpro (&Qface_set_after_frame_default); 11900 staticpro (&Qface_set_after_frame_default);
11900 11901
@@ -11962,7 +11963,7 @@ or when you set the mouse color. */);
11962 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, 11963 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
11963 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); 11964 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */);
11964 display_hourglass_p = 1; 11965 display_hourglass_p = 1;
11965 11966
11966 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, 11967 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
11967 doc: /* *Seconds to wait before displaying an hourglass pointer. 11968 doc: /* *Seconds to wait before displaying an hourglass pointer.
11968Value must be an integer or float. */); 11969Value must be an integer or float. */);
@@ -11998,7 +11999,7 @@ or when you set the mouse color. */);
11998 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). 11999 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS).
11999Text larger than this is clipped. */); 12000Text larger than this is clipped. */);
12000 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); 12001 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
12001 12002
12002 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, 12003 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
12003 doc: /* Non-nil if no X window manager is in use. 12004 doc: /* Non-nil if no X window manager is in use.
12004Emacs doesn't try to figure this out; this is always nil 12005Emacs doesn't try to figure this out; this is always nil
@@ -12067,7 +12068,7 @@ meaning don't clear the cache. */);
12067 defsubr (&Sx_synchronize); 12068 defsubr (&Sx_synchronize);
12068 defsubr (&Sx_focus_frame); 12069 defsubr (&Sx_focus_frame);
12069 defsubr (&Sx_backspace_delete_keys_p); 12070 defsubr (&Sx_backspace_delete_keys_p);
12070 12071
12071 /* Setting callback functions for fontset handler. */ 12072 /* Setting callback functions for fontset handler. */
12072 get_font_info_func = x_get_font_info; 12073 get_font_info_func = x_get_font_info;
12073 12074
@@ -12075,7 +12076,7 @@ meaning don't clear the cache. */);
12075 And the pointer assigned has the wrong type, anyway. */ 12076 And the pointer assigned has the wrong type, anyway. */
12076 list_fonts_func = x_list_fonts; 12077 list_fonts_func = x_list_fonts;
12077#endif 12078#endif
12078 12079
12079 load_font_func = x_load_font; 12080 load_font_func = x_load_font;
12080 find_ccl_program_func = x_find_ccl_program; 12081 find_ccl_program_func = x_find_ccl_program;
12081 query_font_func = x_query_font; 12082 query_font_func = x_query_font;
@@ -12116,16 +12117,16 @@ meaning don't clear the cache. */);
12116 Qxpm = intern ("xpm"); 12117 Qxpm = intern ("xpm");
12117 staticpro (&Qxpm); 12118 staticpro (&Qxpm);
12118#endif 12119#endif
12119 12120
12120#if HAVE_JPEG 12121#if HAVE_JPEG
12121 Qjpeg = intern ("jpeg"); 12122 Qjpeg = intern ("jpeg");
12122 staticpro (&Qjpeg); 12123 staticpro (&Qjpeg);
12123#endif 12124#endif
12124 12125
12125#if HAVE_TIFF 12126#if HAVE_TIFF
12126 Qtiff = intern ("tiff"); 12127 Qtiff = intern ("tiff");
12127 staticpro (&Qtiff); 12128 staticpro (&Qtiff);
12128#endif 12129#endif
12129 12130
12130#if HAVE_GIF 12131#if HAVE_GIF
12131 Qgif = intern ("gif"); 12132 Qgif = intern ("gif");
@@ -12165,27 +12166,27 @@ init_xfns ()
12165{ 12166{
12166 image_types = NULL; 12167 image_types = NULL;
12167 Vimage_types = Qnil; 12168 Vimage_types = Qnil;
12168 12169
12169 define_image_type (&xbm_type); 12170 define_image_type (&xbm_type);
12170 define_image_type (&gs_type); 12171 define_image_type (&gs_type);
12171 define_image_type (&pbm_type); 12172 define_image_type (&pbm_type);
12172 12173
12173#if HAVE_XPM 12174#if HAVE_XPM
12174 define_image_type (&xpm_type); 12175 define_image_type (&xpm_type);
12175#endif 12176#endif
12176 12177
12177#if HAVE_JPEG 12178#if HAVE_JPEG
12178 define_image_type (&jpeg_type); 12179 define_image_type (&jpeg_type);
12179#endif 12180#endif
12180 12181
12181#if HAVE_TIFF 12182#if HAVE_TIFF
12182 define_image_type (&tiff_type); 12183 define_image_type (&tiff_type);
12183#endif 12184#endif
12184 12185
12185#if HAVE_GIF 12186#if HAVE_GIF
12186 define_image_type (&gif_type); 12187 define_image_type (&gif_type);
12187#endif 12188#endif
12188 12189
12189#if HAVE_PNG 12190#if HAVE_PNG
12190 define_image_type (&png_type); 12191 define_image_type (&png_type);
12191#endif 12192#endif