Mercurial > emacs
changeset 48692:b2929bf0de68
(png_load): Avoid double gamma correction for PNG images.
author | Francesco Potortì <pot@gnu.org> |
---|---|
date | Fri, 06 Dec 2002 17:04:48 +0000 |
parents | 8b8ac89456e2 |
children | 057cea5b1f68 |
files | src/xfns.c |
diffstat | 1 files changed, 304 insertions(+), 303 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xfns.c Fri Dec 06 09:10:19 2002 +0000 +++ b/src/xfns.c Fri Dec 06 17:04:48 2002 +0000 @@ -284,11 +284,11 @@ Lisp_Object frame; { struct x_display_info *dpyinfo = NULL; - + if (NILP (frame)) { struct frame *sf = XFRAME (selected_frame); - + if (FRAME_X_P (sf) && FRAME_LIVE_P (sf)) dpyinfo = FRAME_X_DISPLAY_INFO (sf); else if (x_display_list != 0) @@ -332,7 +332,7 @@ if (f->output_data.x->hourglass_window == wdesc) return f; #ifdef USE_X_TOOLKIT - if ((f->output_data.x->edit_widget + if ((f->output_data.x->edit_widget && XtWindow (f->output_data.x->edit_widget) == wdesc) /* A tooltip frame? */ || (!f->output_data.x->edit_widget @@ -367,7 +367,7 @@ frame = XCAR (tail); if (!GC_FRAMEP (frame)) continue; - + f = XFRAME (frame); if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo) { @@ -377,8 +377,8 @@ found = f; else if (x->widget) { - if (wdesc == XtWindow (x->widget) - || wdesc == XtWindow (x->column_widget) + if (wdesc == XtWindow (x->widget) + || wdesc == XtWindow (x->column_widget) || wdesc == XtWindow (x->edit_widget)) found = f; /* Match if the window is this frame's menubar. */ @@ -390,7 +390,7 @@ found = f; } } - + return found; } @@ -419,8 +419,8 @@ return f; else if (x->widget) { - if (wdesc == XtWindow (x->widget) - || wdesc == XtWindow (x->column_widget) + if (wdesc == XtWindow (x->widget) + || wdesc == XtWindow (x->column_widget) || wdesc == XtWindow (x->edit_widget)) return f; } @@ -490,7 +490,7 @@ but it seems logically wrong, and it causes trouble for MapNotify events. */ /* Match if the window is this frame's menubar. */ - if (x->menubar_widget + if (x->menubar_widget && wdesc == XtWindow (x->menubar_widget)) return f; #endif @@ -806,7 +806,7 @@ {"right-fringe", x_set_fringe_width}, {"wait-for-wm", x_set_wait_for_wm}, {"fullscreen", x_set_fullscreen}, - + }; /* Attach the `x-frame-parameter' properties to @@ -925,7 +925,7 @@ cursor_color) are dependent upon them. */ /* Process default font as well, since fringe widths depends on it. */ /* Also, process fullscreen, width and height depend upon that */ - for (p = 0; p < i; p++) + for (p = 0; p < i; p++) { Lisp_Object prop, val; @@ -940,7 +940,7 @@ old_value = get_frame_param (f, prop); fullscreen_is_being_set |= EQ (prop, Qfullscreen); - + if (NILP (Fequal (val, old_value))) { store_frame_param (f, prop, val); @@ -1040,11 +1040,11 @@ position. Resize of the frame is taken care of in the code after this if-statement. */ int new_left, new_top; - + x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); x_fullscreen_move (f, new_top, new_left); } - + /* Don't set these parameters unless they've been explicitly specified. The window might be mapped or resized while we're in this function, and we don't want to override that unless the lisp @@ -1188,12 +1188,12 @@ win = wm_window; } - + if (! had_errors) { int ign; Window child, rootw; - + /* Get the real coordinates for the WM window upper left corner */ XGetGeometry (FRAME_X_DISPLAY (f), win, &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); @@ -1232,23 +1232,23 @@ /* From-window, to-window. */ FRAME_X_DISPLAY_INFO (f)->root_window, FRAME_OUTER_WINDOW (f), - + /* From-position, to-position. */ real_x, real_y, &outer_x, &outer_y, - + /* Child of win. */ &child); } had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); } - + x_uncatch_errors (FRAME_X_DISPLAY (f), count); - + UNBLOCK_INPUT; if (had_errors) return; - + f->output_data.x->x_pixels_diff = -win_x; f->output_data.x->y_pixels_diff = -win_y; f->output_data.x->x_pixels_outer_diff = -outer_x; @@ -1508,7 +1508,7 @@ if (FRAME_X_WINDOW (f) != 0) { Display *dpy = FRAME_X_DISPLAY (f); - + BLOCK_INPUT; XSetForeground (dpy, x->normal_gc, fg); XSetBackground (dpy, x->reverse_gc, fg); @@ -1519,15 +1519,15 @@ x->cursor_pixel = x_copy_color (f, fg); XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); } - + UNBLOCK_INPUT; - + update_face_from_frame_parameter (f, Qforeground_color, arg); - + if (FRAME_VISIBLE_P (f)) redraw_frame (f); } - + unload_color (f, old_fg); } @@ -1546,7 +1546,7 @@ if (FRAME_X_WINDOW (f) != 0) { Display *dpy = FRAME_X_DISPLAY (f); - + BLOCK_INPUT; XSetBackground (dpy, x->normal_gc, bg); XSetForeground (dpy, x->reverse_gc, bg); @@ -1631,7 +1631,7 @@ else hourglass_cursor = XCreateFontCursor (dpy, XC_watch); x_check_errors (dpy, "bad hourglass pointer cursor: %s"); - + x_check_errors (dpy, "bad nontext pointer cursor: %s"); if (!NILP (Vx_mode_pointer_shape)) { @@ -1672,7 +1672,7 @@ x_query_color (f, &fore_color); back_color.pixel = mask_color; x_query_color (f, &back_color); - + XRecolorCursor (dpy, cursor, &fore_color, &back_color); XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color); XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color); @@ -1703,7 +1703,7 @@ && x->modeline_cursor != 0) XFreeCursor (dpy, f->output_data.x->modeline_cursor); x->modeline_cursor = mode_cursor; - + if (cross_cursor != x->cross_cursor && x->cross_cursor != 0) XFreeCursor (dpy, x->cross_cursor); @@ -1737,7 +1737,7 @@ } else fore_pixel = x->background_pixel; - + pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); pixel_allocated_p = 1; @@ -1749,7 +1749,7 @@ x_free_colors (f, &pixel, 1); pixel_allocated_p = 0; } - + pixel = x->mouse_pixel; if (pixel == fore_pixel) { @@ -1957,7 +1957,7 @@ ? x_new_fontset (f, SDATA (fontset_name)) : x_new_font (f, SDATA (arg))); UNBLOCK_INPUT; - + if (EQ (result, Qnil)) error ("Font `%s' is not defined", SDATA (arg)); else if (EQ (result, Qt)) @@ -1973,7 +1973,7 @@ } else if (!NILP (Fequal (result, oldval))) return; - + store_frame_param (f, Qfont, result); recompute_basic_faces (f); } @@ -2185,7 +2185,7 @@ FRAME_TOOL_BAR_LINES (f) = nlines; x_change_window_heights (root_window, delta); adjust_glyphs (f); - + /* We also have to make sure that the internal border at the top of the frame, below the menu bar or tool bar, is redrawn when the tool bar disappears. This is so because the internal border is @@ -2231,7 +2231,7 @@ Lisp_Object value, oldval; { unsigned long pixel; - + if (STRINGP (value)) pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f)); else @@ -2239,7 +2239,7 @@ if (f->output_data.x->scroll_bar_foreground_pixel != -1) unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); - + f->output_data.x->scroll_bar_foreground_pixel = pixel; if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) { @@ -2271,10 +2271,10 @@ pixel = x_decode_color (f, value, WHITE_PIX_DEFAULT (f)); else pixel = -1; - + if (f->output_data.x->scroll_bar_background_pixel != -1) unload_color (f, f->output_data.x->scroll_bar_background_pixel); - + #ifdef USE_TOOLKIT_SCROLL_BARS /* Scrollbar shadow colors. */ if (f->output_data.x->scroll_bar_top_shadow_pixel != -1) @@ -2297,7 +2297,7 @@ (*condemn_scroll_bars_hook) (f); if (judge_scroll_bars_hook) (*judge_scroll_bars_hook) (f); - + update_face_from_frame_parameter (f, Qscroll_bar_background, value); redraw_frame (f); } @@ -2392,7 +2392,7 @@ Lisp_Object name; int explicit; { - /* Make sure that requests from lisp code override requests from + /* Make sure that requests from lisp code override requests from Emacs redisplay code. */ if (explicit) { @@ -2627,7 +2627,7 @@ = (NILP (arg) ? vertical_scroll_bar_none : EQ (Qright, arg) - ? vertical_scroll_bar_right + ? vertical_scroll_bar_right : vertical_scroll_bar_left); /* We set this parameter before creating the X window for the @@ -2658,7 +2658,7 @@ /* Make the actual width at least 14 pixels and a multiple of a character width. */ FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; - + /* Use all of that space (aside from required margins) for the scroll bar. */ FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; @@ -2987,7 +2987,7 @@ if (!strcmp (SDATA (tem), "on") || !strcmp (SDATA (tem), "true")) return Qt; - else + else return Qnil; case RES_TYPE_STRING: @@ -3106,11 +3106,11 @@ specified. */ tem = Qnil; } - + #else /* not USE_TOOLKIT_SCROLL_BARS */ - + tem = Qnil; - + #endif /* not USE_TOOLKIT_SCROLL_BARS */ } @@ -3308,7 +3308,7 @@ { int left, top; int width, height; - + /* It takes both for some WM:s to place it where we want */ window_prompting = USPosition | PPosition; x_fullscreen_adjust (f, &width, &height, &top, &left); @@ -3319,7 +3319,7 @@ f->output_data.x->left_pos = left; f->output_data.x->top_pos = top; } - + return window_prompting; } @@ -3442,13 +3442,13 @@ char **missing_list; int missing_count; char *def_string; - + xfs = XCreateFontSet (FRAME_X_DISPLAY (f), base_fontname, &missing_list, &missing_count, &def_string); if (missing_list) XFreeStringList (missing_list); - + /* No need to free def_string. */ return xfs; } @@ -3488,7 +3488,7 @@ if (FRAME_XIC (f)) return; - + xim = FRAME_X_XIM (f); if (xim) { @@ -3586,7 +3586,7 @@ XFree (preedit_attr); XFree (status_attr); } - + FRAME_XIC (f) = xic; FRAME_XIC_STYLE (f) = xic_style; FRAME_XIC_FONTSET (f) = xfs; @@ -3601,7 +3601,7 @@ { if (FRAME_XIC (f) == NULL) return; - + XDestroyIC (FRAME_XIC (f)); if (FRAME_XIC_FONTSET (f)) XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); @@ -3622,7 +3622,7 @@ struct frame *f = XFRAME (w->frame); XVaNestedList attr; XPoint spot; - + spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x); spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f)); attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL); @@ -3648,7 +3648,7 @@ attr = XVaCreateNestedList (0, XNAreaNeeded, &area, NULL); XSetICValues (xic, XNStatusAttributes, attr, NULL); XFree (attr); - + attr = XVaCreateNestedList (0, XNAreaNeeded, &needed, NULL); XGetICValues (xic, XNStatusAttributes, attr, NULL); XFree (attr); @@ -3692,7 +3692,7 @@ if (FRAME_XIC_STYLE (f) & XIMStatusArea) XSetICValues (FRAME_XIC (f), XNStatusAttributes, attr, NULL); XFree (attr); - + if (FRAME_XIC_FONTSET (f)) XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); FRAME_XIC_FONTSET (f) = xfs; @@ -3728,7 +3728,7 @@ for the window manager, so GC relocation won't bother it. Elsewhere we specify the window name for the window manager. */ - + { char *str = (char *) SDATA (Vx_resource_name); f->namebuf = (char *) xmalloc (strlen (str) + 1); @@ -3765,7 +3765,7 @@ XtSetValues (pane_widget, al, ac); f->output_data.x->column_widget = pane_widget; - /* mappedWhenManaged to false tells to the paned window to not map/unmap + /* mappedWhenManaged to false tells to the paned window to not map/unmap the emacs screen when changing menubar. This reduces flickering. */ ac = 0; @@ -3779,10 +3779,10 @@ XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, al, ac); - + f->output_data.x->edit_widget = frame_widget; - - XtManageChild (frame_widget); + + XtManageChild (frame_widget); /* Do some needed geometry management. */ { @@ -3791,7 +3791,7 @@ Arg al[2]; int ac = 0; int extra_borders = 0; - int menubar_size + int menubar_size = (f->output_data.x->menubar_widget ? (f->output_data.x->menubar_widget->core.height + f->output_data.x->menubar_widget->core.border_width) @@ -3835,13 +3835,13 @@ if (window_prompting & USPosition) sprintf (shell_position, "=%dx%d%c%d%c%d", - PIXEL_WIDTH (f) + extra_borders, + PIXEL_WIDTH (f) + extra_borders, PIXEL_HEIGHT (f) + menubar_size + extra_borders, (xneg ? '-' : '+'), left, (yneg ? '-' : '+'), top); else sprintf (shell_position, "=%dx%d", - PIXEL_WIDTH (f) + extra_borders, + PIXEL_WIDTH (f) + extra_borders, PIXEL_HEIGHT (f) + menubar_size + extra_borders); } @@ -3859,7 +3859,7 @@ XtManageChild (pane_widget); XtRealizeWidget (shell_widget); - FRAME_X_WINDOW (f) = XtWindow (frame_widget); + FRAME_X_WINDOW (f) = XtWindow (frame_widget); validate_x_resource_name (); @@ -3906,7 +3906,7 @@ attributes.event_mask |= fevent; } #endif /* HAVE_X_I18N */ - + attribute_mask = CWEventMask; XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget), attribute_mask, &attributes); @@ -3988,7 +3988,7 @@ } #endif #endif /* HAVE_X_I18N */ - + validate_x_resource_name (); class_hints.res_name = (char *) SDATA (Vx_resource_name); @@ -4152,7 +4152,7 @@ this must be done on a per-frame basis. */ f->output_data.x->border_tile = (XCreatePixmapFromBitmapData - (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, + (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, gray_bits, gray_width, gray_height, f->output_data.x->foreground_pixel, f->output_data.x->background_pixel, @@ -4171,7 +4171,7 @@ Display *dpy = FRAME_X_DISPLAY (f); BLOCK_INPUT; - + if (f->output_data.x->normal_gc) { XFreeGC (dpy, f->output_data.x->normal_gc); @@ -4183,7 +4183,7 @@ XFreeGC (dpy, f->output_data.x->reverse_gc); f->output_data.x->reverse_gc = 0; } - + if (f->output_data.x->cursor_gc) { XFreeGC (dpy, f->output_data.x->cursor_gc); @@ -4216,7 +4216,7 @@ #if GLYPH_DEBUG struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); #endif - + x_free_frame_resources (f); /* Check that reference counts are indeed correct. */ @@ -4224,7 +4224,7 @@ xassert (dpyinfo->image_cache->refcount == image_cache_refcount); return Qt; } - + return Qnil; } @@ -4355,7 +4355,7 @@ f->output_data.x->cursor_foreground_pixel = -1; f->output_data.x->border_pixel = -1; f->output_data.x->mouse_pixel = -1; - + black = build_string ("black"); GCPRO1 (black); f->output_data.x->foreground_pixel @@ -4418,7 +4418,7 @@ else font = x_new_font (f, SDATA (font)); } - + /* Try out a font which we hope has bold and italic variations. */ if (!STRINGP (font)) font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); @@ -4449,7 +4449,7 @@ x_default_parameter (f, parms, Qborder_width, make_number (2), "borderWidth", "BorderWidth", RES_TYPE_NUMBER); - + /* This defaults to 1 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls it). */ @@ -4504,7 +4504,7 @@ end up in init_iterator with a null face cache, which should not happen. */ init_frame_faces (f); - + x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), "menuBar", "MenuBar", RES_TYPE_NUMBER); x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), @@ -4530,7 +4530,7 @@ if (FRAME_TOOL_BAR_LINES (f)) { int margin, relief, bar_height; - + relief = (tool_bar_button_relief >= 0 ? tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF); @@ -4544,7 +4544,7 @@ margin = XFASTINT (XCDR (Vtool_bar_button_margin)); else margin = 0; - + bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); } @@ -4578,7 +4578,7 @@ #else x_window (f); #endif - + x_icon (f, parms); x_make_gc (f); @@ -4606,7 +4606,7 @@ f->height. */ width = f->width; height = f->height; - + f->height = 0; SET_FRAME_WIDTH (f, 0); change_frame_size (f, height, width, 1, 0, 0); @@ -4667,7 +4667,7 @@ /* Make sure windows on this frame appear in calls to next-window and similar functions. */ Vwindow_list = Qnil; - + return unbind_to (count, frame); } @@ -4715,7 +4715,7 @@ RevertToParent, CurrentTime); x_uncatch_errors (dpy, count); UNBLOCK_INPUT; - + return Qnil; } @@ -5032,7 +5032,7 @@ error ("Display has an unknown visual class"); result = Qnil; } - + return result; } @@ -5187,14 +5187,14 @@ || !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen), dpyinfo->n_planes, class, &vinfo)) fatal ("Invalid visual specification `%s'", SDATA (value)); - + dpyinfo->visual = vinfo.visual; } else { int n_visuals; XVisualInfo *vinfo, vinfo_template; - + dpyinfo->visual = DefaultVisualOfScreen (screen); #ifdef HAVE_X11R4 @@ -5488,7 +5488,7 @@ Lisp_Object object; { int valid_p = 0; - + if (CONSP (object) && EQ (XCAR (object), Qimage)) { Lisp_Object tem; @@ -5504,7 +5504,7 @@ if (type) valid_p = type->valid_p (object); } - + break; } } @@ -5623,7 +5623,7 @@ was found more than once, it's an error. */ keywords[i].value = value; ++keywords[i].count; - + if (keywords[i].count > 1) return 0; @@ -5667,7 +5667,7 @@ && XINT (value) <= 100) break; return 0; - + case IMAGE_NON_NEGATIVE_INTEGER_VALUE: if (!INTEGERP (value) || XINT (value) < 0) return 0; @@ -5678,7 +5678,7 @@ case IMAGE_FUNCTION_VALUE: value = indirect_function (value); - if (SUBRP (value) + if (SUBRP (value) || COMPILEDP (value) || (CONSP (value) && EQ (XCAR (value), Qlambda))) break; @@ -5727,7 +5727,7 @@ int *found; { Lisp_Object tail; - + xassert (valid_image_p (spec)); for (tail = XCDR (spec); @@ -5741,12 +5741,12 @@ return XCAR (XCDR (tail)); } } - + if (found) *found = 0; return Qnil; } - + DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). @@ -5767,7 +5767,7 @@ struct image *img = IMAGE_FROM_ID (f, id); int width = img->width + 2 * img->hmargin; int height = img->height + 2 * img->vmargin; - + if (NILP (pixels)) size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), make_float ((double) height / CANON_Y_UNIT (f))); @@ -5824,7 +5824,7 @@ unsigned hash; { struct image *img = (struct image *) xmalloc (sizeof *img); - + xassert (valid_image_p (spec)); bzero (img, sizeof *img); img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); @@ -5885,7 +5885,7 @@ if (img->pixmap == None && !img->load_failed_p) img->load_failed_p = img->type->load (f, img) == 0; } - + /* Value is the number of pixels for the ascent of image IMG when drawn in face FACE. */ @@ -5937,7 +5937,7 @@ for (i = best_count = 0; i < 4; ++i) { int j, n; - + for (j = n = 0; j < 4; ++j) if (corners[i] == corners[j]) ++n; @@ -6053,7 +6053,7 @@ img->mask = None; img->background_transparent_valid = 0; } - + if (colors_p && img->ncolors) { x_free_colors (f, img->colors, img->ncolors); @@ -6128,7 +6128,7 @@ { struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); int size; - + bzero (c, sizeof *c); c->size = 50; c->images = (struct image **) xmalloc (c->size * sizeof *c->images); @@ -6153,7 +6153,7 @@ /* Cache should not be referenced by any frame when freed. */ xassert (c->refcount == 0); - + for (i = 0; i < c->used; ++i) free_image (f, c->images[i]); xfree (c->images); @@ -6190,7 +6190,7 @@ /* Block input so that we won't be interrupted by a SIGIO while being in an inconsistent state. */ BLOCK_INPUT; - + for (i = nfreed = 0; i < c->used; ++i) { struct image *img = c->images[i]; @@ -6209,7 +6209,7 @@ if (nfreed) { Lisp_Object tail, frame; - + FOR_EACH_FRAME (tail, frame) { struct frame *f = XFRAME (frame); @@ -6237,7 +6237,7 @@ if (EQ (frame, Qt)) { Lisp_Object tail; - + FOR_EACH_FRAME (tail, frame) if (FRAME_X_P (XFRAME (frame))) clear_image_cache (XFRAME (frame), 1); @@ -6264,7 +6264,7 @@ Lisp_Object mask; spec = img->spec; - + /* `:heuristic-mask t' `:mask heuristic' means build a mask heuristically. @@ -6274,16 +6274,16 @@ image. `:mask nil' means remove a mask, if any. */ - + mask = image_spec_value (spec, QCheuristic_mask, NULL); if (!NILP (mask)) x_build_heuristic_mask (f, img, mask); else { int found_p; - + mask = image_spec_value (spec, QCmask, &found_p); - + if (EQ (mask, Qheuristic)) x_build_heuristic_mask (f, img, Qt); else if (CONSP (mask) @@ -6300,8 +6300,8 @@ img->mask = None; } } - - + + /* Should we apply an image transformation algorithm? */ conversion = image_spec_value (spec, QCconversion, NULL); if (EQ (conversion, Qdisabled)) @@ -6343,7 +6343,7 @@ specification. */ xassert (FRAME_WINDOW_P (f)); xassert (valid_image_p (spec)); - + GCPRO1 (spec); /* Look up SPEC in the hash table of the image cache. */ @@ -6358,7 +6358,7 @@ if (img == NULL) { extern Lisp_Object Qpostscript; - + BLOCK_INPUT; img = make_image (spec, hash); cache_image (f, img); @@ -6390,7 +6390,7 @@ img->ascent = XFASTINT (ascent); else if (EQ (ascent, Qcenter)) img->ascent = CENTERED_IMAGE_ASCENT; - + margin = image_spec_value (spec, QCmargin, NULL); if (INTEGERP (margin) && XINT (margin) >= 0) img->vmargin = img->hmargin = XFASTINT (margin); @@ -6402,7 +6402,7 @@ if (XINT (XCDR (margin)) > 0) img->vmargin = XFASTINT (XCDR (margin)); } - + relief = image_spec_value (spec, QCrelief, NULL); if (INTEGERP (relief)) { @@ -6436,9 +6436,9 @@ /* We're using IMG, so set its timestamp to `now'. */ EMACS_GET_TIME (now); img->timestamp = EMACS_SECS (now); - + UNGCPRO; - + /* Value is the image id. */ return img->id; } @@ -6590,7 +6590,7 @@ int width, height; { GC gc; - + xassert (interrupt_input_blocked); gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); @@ -6625,7 +6625,7 @@ /* Try to find FILE in data-directory, then x-bitmap-file-path. */ fd = openp (search_path, file, Qnil, &file_found, Qnil); - + if (fd == -1) file_found = Qnil; else @@ -6667,7 +6667,7 @@ buf = NULL; } } - + return buf; } @@ -6746,7 +6746,7 @@ XBM_TK_NUMBER }; - + /* Return non-zero if OBJECT is a valid XBM-type image specification. A valid specification is a list starting with the symbol `image' The rest of the list is a property list which must contain an @@ -6781,7 +6781,7 @@ Lisp_Object object; { struct image_keyword kw[XBM_LAST]; - + bcopy (xbm_format, kw, sizeof kw); if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) return 0; @@ -6813,13 +6813,13 @@ data = kw[XBM_DATA].value; width = XFASTINT (kw[XBM_WIDTH].value); height = XFASTINT (kw[XBM_HEIGHT].value); - + /* Check type of data, and width and height against contents of data. */ if (VECTORP (data)) { int i; - + /* Number of elements of the vector must be >= height. */ if (XVECTOR (data)->size < height) return 0; @@ -6879,7 +6879,7 @@ int c; loop: - + /* Skip white space. */ while (*s < end && (c = *(*s)++, isspace (c))) ; @@ -6889,7 +6889,7 @@ else if (isdigit (c)) { int value = 0, digit; - + if (c == '0' && *s < end) { c = *(*s)++; @@ -6987,7 +6987,7 @@ if (LA1 != (TOKEN)) \ goto failure; \ else \ - match () + match () #define expect_ident(IDENT) \ if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ @@ -7030,7 +7030,7 @@ { if (strcmp (buffer, "unsigned") == 0) { - match (); + match (); expect_ident ("char"); } else if (strcmp (buffer, "short") == 0) @@ -7045,7 +7045,7 @@ else goto failure; } - else + else goto failure; expect (XBM_TK_IDENT); @@ -7068,7 +7068,7 @@ *p++ = val; if (!padding_p || ((i + 2) % bytes_per_line)) *p++ = value >> 8; - + if (LA1 == ',' || LA1 == '}') match (); else @@ -7081,9 +7081,9 @@ { int val = value; expect (XBM_TK_NUMBER); - + *p++ = val; - + if (LA1 == ',' || LA1 == '}') match (); else @@ -7095,7 +7095,7 @@ return 1; failure: - + if (data && *data) { xfree (*data); @@ -7122,7 +7122,7 @@ int rc; unsigned char *data; int success_p = 0; - + rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); if (rc) { @@ -7130,7 +7130,7 @@ unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); unsigned long background = FRAME_BACKGROUND_PIXEL (f); Lisp_Object value; - + xassert (img->width > 0 && img->height > 0); /* Get foreground and background colors, maybe allocate colors. */ @@ -7183,7 +7183,7 @@ &w, &h, NULL)); } - + /* Fill image IMG which is used on frame F with pixmap data. Value is non-zero if successful. */ @@ -7205,7 +7205,7 @@ char *contents; int size; struct gcpro gcpro1; - + file = x_find_image_file (file_name); GCPRO1 (file); if (!STRINGP (file)) @@ -7275,7 +7275,7 @@ int i; char *p; int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; - + p = bits = (char *) alloca (nbytes * img->height); for (i = 0; i < img->height; ++i, p += nbytes) { @@ -7313,14 +7313,14 @@ return success_p; } - + /*********************************************************************** XPM images ***********************************************************************/ -#if HAVE_XPM +#if HAVE_XPM static int xpm_image_p P_ ((Lisp_Object object)); static int xpm_load P_ ((struct frame *f, struct image *img)); @@ -7437,7 +7437,7 @@ { int i; XColor color; - + for (i = 0; i < attrs->numsymbols; ++i) if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), attrs->colorsymbols[i].value, &color)) @@ -7480,7 +7480,7 @@ { unsigned h = 0; char *s; - + for (s = color_name; *s; ++s) h = (h << 2) ^ *s; return h %= XPM_COLOR_CACHE_BUCKETS; @@ -7500,10 +7500,10 @@ { size_t nbytes; struct xpm_cached_color *p; - + if (bucket < 0) bucket = xpm_color_bucket (color_name); - + nbytes = sizeof *p + strlen (color_name); p = (struct xpm_cached_color *) xmalloc (nbytes); strcpy (p->name, color_name); @@ -7541,7 +7541,7 @@ color->blue); p = xpm_cache_color (f, color_name, color, h); } - + return p != NULL; } @@ -7668,7 +7668,7 @@ Lisp_Object tail; XpmColorSymbol *xpm_syms; int i, size; - + attrs.valuemask |= XpmColorSymbols; /* Count number of symbols. */ @@ -7701,7 +7701,7 @@ #ifdef ALLOC_XPM_COLORS xpm_init_color_cache (f, &attrs); #endif - + specified_file = image_spec_value (img->spec, QCfile, NULL); if (STRINGP (specified_file)) { @@ -7711,7 +7711,7 @@ image_error ("Cannot find image file `%s'", specified_file, Qnil); return 0; } - + rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), SDATA (file), &img->pixmap, &img->mask, &attrs); @@ -7758,19 +7758,19 @@ case XpmOpenFailed: image_error ("Error opening XPM file (%s)", img->spec, Qnil); break; - + case XpmFileInvalid: image_error ("Invalid XPM file (%s)", img->spec, Qnil); break; - + case XpmNoMemory: image_error ("Out of memory (%s)", img->spec, Qnil); break; - + case XpmColorFailed: image_error ("Color allocation error (%s)", img->spec, Qnil); break; - + default: image_error ("Unknown error (%s)", img->spec, Qnil); break; @@ -7876,14 +7876,14 @@ color.red = r; color.green = g; color.blue = b; - + cmap = FRAME_X_COLORMAP (f); rc = x_alloc_nearest_color (f, cmap, &color); if (rc) { ++ct_colors_allocated; - + p = (struct ct_color *) xmalloc (sizeof *p); p->r = r; p->g = g; @@ -7929,7 +7929,7 @@ if (rc) { ++ct_colors_allocated; - + p = (struct ct_color *) xmalloc (sizeof *p); p->r = color.red; p->g = color.green; @@ -7941,7 +7941,7 @@ else return FRAME_FOREGROUND_PIXEL (f); } - + return p->pixel; } @@ -7967,7 +7967,7 @@ colors = (unsigned long *) xmalloc (ct_colors_allocated * sizeof *colors); *n = ct_colors_allocated; - + for (i = j = 0; i < CT_SIZE; ++i) for (p = ct_table[i]; p; p = p->next) colors[j++] = p->pixel; @@ -8042,7 +8042,7 @@ for (y = 0; y < img->height; ++y) { XColor *row = p; - + for (x = 0; x < img->width; ++x, ++p) p->pixel = XGetPixel (ximg, x, y); @@ -8069,9 +8069,9 @@ XImage *oimg; Pixmap pixmap; XColor *p; - + init_color_table (); - + x_create_x_image_and_pixmap (f, img->width, img->height, 0, &oimg, &pixmap); p = colors; @@ -8098,7 +8098,7 @@ MATRIX is a nine-element array specifying the transformation matrix. See emboss_matrix for an example. - + COLOR_ADJUST is a color adjustment added to each pixel of the outgoing image. */ @@ -8126,7 +8126,7 @@ p = COLOR (new, img->width - 1, y); p->red = p->green = p->blue = 0xffff/2; } - + for (x = 1; x < img->width - 1; ++x) { p = COLOR (new, x, 0); @@ -8138,7 +8138,7 @@ for (y = 1; y < img->height - 1; ++y) { p = COLOR (new, 1, y); - + for (x = 1; x < img->width - 1; ++x, ++p) { int r, g, b, y1, x1; @@ -8211,7 +8211,7 @@ { int i = 0; int trans[9]; - + if (CONSP (matrix)) { for (i = 0; @@ -8331,7 +8331,7 @@ /* Determine the background color of ximg. If HOW is `(R G B)' take that as color. Otherwise, use the image's background color. */ use_img_background = 1; - + if (CONSP (how)) { int rgb[3], i; @@ -8350,7 +8350,7 @@ use_img_background = 0; } } - + if (use_img_background) bg = four_corners_best (ximg, img->width, img->height); @@ -8367,7 +8367,7 @@ x_put_x_image (f, mask_img, img->mask, img->width, img->height); x_destroy_x_image (mask_img); XDestroyImage (ximg); - + return 1; } @@ -8440,9 +8440,9 @@ Lisp_Object object; { struct image_keyword fmt[PBM_LAST]; - + bcopy (pbm_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) return 0; @@ -8491,7 +8491,7 @@ /* Load PBM image IMG for use on frame F. */ -static int +static int pbm_load (f, img) struct frame *f; struct image *img; @@ -8554,7 +8554,7 @@ case '1': raw_p = 0, type = PBM_MONO; break; - + case '2': raw_p = 0, type = PBM_GRAY; break; @@ -8566,11 +8566,11 @@ case '4': raw_p = 1, type = PBM_MONO; break; - + case '5': raw_p = 1, type = PBM_GRAY; break; - + case '6': raw_p = 1, type = PBM_COLOR; break; @@ -8591,7 +8591,7 @@ if (raw_p && max_color_idx > 255) max_color_idx = 255; } - + if (width < 0 || height < 0 || (type != PBM_MONO && max_color_idx < 0)) @@ -8600,7 +8600,7 @@ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) goto error; - + /* Initialize the color hash table. */ init_color_table (); @@ -8614,7 +8614,7 @@ /* Parse the image specification. */ bcopy (pbm_format, fmt, sizeof fmt); parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); - + /* Get foreground and background colors, maybe allocate colors. */ if (fmt[PBM_FOREGROUND].count && STRINGP (fmt[PBM_FOREGROUND].value)) @@ -8626,7 +8626,7 @@ img->background = bg; img->background_valid = 1; } - + for (y = 0; y < height; ++y) for (x = 0; x < width; ++x) { @@ -8649,7 +8649,7 @@ for (x = 0; x < width; ++x) { int r, g, b; - + if (type == PBM_GRAY) r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); else if (raw_p) @@ -8664,7 +8664,7 @@ g = pbm_scan_number (&p, end); b = pbm_scan_number (&p, end); } - + if (r < 0 || g < 0 || b < 0) { xfree (ximg->data); @@ -8674,7 +8674,7 @@ img->spec, Qnil); goto error; } - + /* RGB values are now in the range 0..max_color_idx. Scale this to the range 0..0xffff supported by X. */ r = (double) r * 65535 / max_color_idx; @@ -8683,7 +8683,7 @@ XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); } } - + /* Store in IMG->colors the colors allocated for the image, and free the color table. */ img->colors = colors_in_color_table (&img->ncolors); @@ -8692,11 +8692,11 @@ /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) IMAGE_BACKGROUND (img, f, ximg); - + /* Put the image into a pixmap. */ x_put_x_image (f, ximg, img->pixmap, width, height); x_destroy_x_image (ximg); - + img->width = width; img->height = height; @@ -8778,7 +8778,7 @@ { struct image_keyword fmt[PNG_LAST]; bcopy (png_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) return 0; @@ -8835,7 +8835,7 @@ if (length > tbr->len - tbr->index) png_error (png_ptr, "Read error"); - + bcopy (tbr->bytes + tbr->index, data, length); tbr->index = tbr->index + length; } @@ -8977,14 +8977,14 @@ png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, NULL, NULL); - /* If image contains simply transparency data, we prefer to + /* If image contains simply transparency data, we prefer to construct a clipping mask. */ if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) transparent_p = 1; else transparent_p = 0; - /* This function is easier to write if we only have to handle + /* This function is easier to write if we only have to handle one data format: RGB or RGBA with 8 bits per channel. Let's transform other formats into that format. */ @@ -8997,14 +8997,14 @@ png_set_expand (png_ptr); /* Convert grayscale images to RGB. */ - if (color_type == PNG_COLOR_TYPE_GRAY + if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb (png_ptr); screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2); +#if 0 /* avoid double gamma correction for PNG images */ /* Tell the PNG lib to handle gamma correction for us. */ - #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) if (png_get_sRGB (png_ptr, info_ptr, &intent)) /* The libpng documentation says this is right in this case. */ @@ -9017,6 +9017,7 @@ else /* Use the standard default for the image gamma. */ png_set_gamma (png_ptr, screen_gamma, 0.45455); +#endif /* if 0 */ /* Handle alpha channel by combining the image with a background color. Do this only if a real alpha channel is supplied. For @@ -9045,14 +9046,14 @@ } } else if (png_get_bKGD (png_ptr, info_ptr, &image_bg)) - /* Image contains a background color with which to + /* Image contains a background color with which to combine the image. */ png_set_background (png_ptr, image_bg, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); else { /* Image does not contain a background color with which - to combine the image data via an alpha channel. Use + to combine the image data via an alpha channel. Use the frame's background instead. */ XColor color; Colormap cmap; @@ -9100,12 +9101,12 @@ fclose (fp); fp = NULL; } - + /* Create the X image and pixmap. */ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) goto error; - + /* Create an image and pixmap serving as mask if the PNG image contains an alpha channel. */ if (channels == 4 @@ -9136,16 +9137,16 @@ XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); /* An alpha channel, aka mask channel, associates variable - transparency with an image. Where other image formats - support binary transparency---fully transparent or fully + transparency with an image. Where other image formats + support binary transparency---fully transparent or fully opaque---PNG allows up to 254 levels of partial transparency. The PNG library implements partial transparency by combining the image with a specified background color. I'm not sure how to handle this here nicely: because the background on which the image is displayed may change, for - real alpha channel support, it would be necessary to create - a new image for each possible background. + real alpha channel support, it would be necessary to create + a new image for each possible background. What I'm doing now is that a mask is created if we have boolean transparency information. Otherwise I'm using @@ -9291,9 +9292,9 @@ Lisp_Object object; { struct image_keyword fmt[JPEG_LAST]; - + bcopy (jpeg_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) return 0; @@ -9364,7 +9365,7 @@ { if (num_bytes > src->bytes_in_buffer) ERREXIT (cinfo, JERR_INPUT_EOF); - + src->bytes_in_buffer -= num_bytes; src->next_input_byte += num_bytes; } @@ -9402,7 +9403,7 @@ src = (struct jpeg_source_mgr *) cinfo->src; src->next_input_byte = data; } - + src = (struct jpeg_source_mgr *) cinfo->src; src->init_source = our_init_source; src->fill_input_buffer = our_fill_input_buffer; @@ -9417,7 +9418,7 @@ /* Load image IMG for use on frame F. Patterned after example.c from the JPEG lib. */ -static int +static int jpeg_load (f, img) struct frame *f; struct image *img; @@ -9450,7 +9451,7 @@ UNGCPRO; return 0; } - + fp = fopen (SDATA (file), "r"); if (fp == NULL) { @@ -9464,7 +9465,7 @@ error is detected. This function will perform a longjmp. */ cinfo.err = jpeg_std_error (&mgr.pub); mgr.pub.error_exit = my_error_exit; - + if ((rc = setjmp (mgr.setjmp_buffer)) != 0) { if (rc == 1) @@ -9475,7 +9476,7 @@ image_error ("Error reading JPEG image `%s': %s", img->spec, build_string (buffer)); } - + /* Close the input file and destroy the JPEG object. */ if (fp) fclose ((FILE *) fp); @@ -9486,7 +9487,7 @@ /* Free pixmap and colors. */ x_clear_image (f, img); - + UNGCPRO; return 0; } @@ -9536,7 +9537,7 @@ init_color_table (); colors = (unsigned long *) alloca (cinfo.actual_number_of_colors * sizeof *colors); - + for (i = 0; i < cinfo.actual_number_of_colors; ++i) { /* Multiply RGB values with 255 because X expects RGB values @@ -9572,7 +9573,7 @@ /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) IMAGE_BACKGROUND (img, f, ximg); - + /* Put the image into the pixmap. */ x_put_x_image (f, ximg, img->pixmap, width, height); x_destroy_x_image (ximg); @@ -9653,10 +9654,10 @@ { struct image_keyword fmt[TIFF_LAST]; bcopy (tiff_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) return 0; - + /* Must specify either the :data or :file keyword. */ return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; } @@ -9720,22 +9721,22 @@ case SEEK_SET: /* Go from beginning of source. */ idx = off; break; - + case SEEK_END: /* Go from end of source. */ idx = src->len + off; break; - + case SEEK_CUR: /* Go from current position. */ idx = src->index + off; break; - + default: /* Invalid `whence'. */ return -1; } - + if (idx > src->len || idx < 0) return -1; - + src->index = idx; return src->index; } @@ -9786,7 +9787,7 @@ { char buf[512]; int len; - + len = sprintf (buf, "TIFF error: %s ", title); vsprintf (buf + len, format, ap); add_to_log (buf, Qnil, Qnil); @@ -9800,7 +9801,7 @@ { char buf[512]; int len; - + len = sprintf (buf, "TIFF warning: %s ", title); vsprintf (buf + len, format, ap); add_to_log (buf, Qnil, Qnil); @@ -9843,7 +9844,7 @@ UNGCPRO; return 0; } - + /* Try to open the image file. */ tiff = TIFFOpen (SDATA (file), "r"); if (tiff == NULL) @@ -9882,7 +9883,7 @@ TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); buf = (uint32 *) xmalloc (width * height * sizeof *buf); - + rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); TIFFClose (tiff); if (!rc) @@ -9908,21 +9909,21 @@ for (y = 0; y < height; ++y) { uint32 *row = buf + y * width; - + for (x = 0; x < width; ++x) { uint32 abgr = row[x]; int r = TIFFGetR (abgr) << 8; int g = TIFFGetG (abgr) << 8; int b = TIFFGetB (abgr) << 8; - XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); + XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); } } /* Remember the colors allocated for the image. Free the color table. */ img->colors = colors_in_color_table (&img->ncolors); free_color_table (); - + img->width = width; img->height = height; @@ -10014,10 +10015,10 @@ { struct image_keyword fmt[GIF_LAST]; bcopy (gif_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) return 0; - + /* Must specify either the :data or :file keyword. */ return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; } @@ -10092,7 +10093,7 @@ UNGCPRO; return 0; } - + /* Open the GIF file. */ gif = DGifOpenFileName (SDATA (file)); if (gif == NULL) @@ -10150,14 +10151,14 @@ UNGCPRO; return 0; } - + /* Allocate colors. */ gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; if (!gif_color_map) gif_color_map = gif->SColorMap; init_color_table (); bzero (pixel_colors, sizeof pixel_colors); - + for (i = 0; i < gif_color_map->ColorCount; ++i) { int r = gif_color_map->Colors[i].Red << 8; @@ -10170,7 +10171,7 @@ free_color_table (); /* Clear the part of the screen image that are not covered by - the image from the GIF file. Full animated GIF support + the image from the GIF file. Full animated GIF support requires more than can be done here (see the gif89 spec, disposal methods). Let's simply assume that the part not covered by a sub-image is in the frame's background color. */ @@ -10199,7 +10200,7 @@ `raster' here because RasterBits below is a char *, and invites problems with bytes >= 0x80. */ raster = (unsigned char *) gif->SavedImages[ino].RasterBits; - + if (gif->SavedImages[ino].ImageDesc.Interlace) { static int interlace_start[] = {0, 4, 2, 1}; @@ -10217,14 +10218,14 @@ while (row >= image_height) row = interlace_start[++pass]; } - + for (x = 0; x < image_width; x++) { int i = raster[(y * image_width) + x]; XPutPixel (ximg, x + image_left, row + image_top, pixel_colors[i]); } - + row += interlace_increment[pass]; } } @@ -10237,17 +10238,17 @@ XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); } } - + DGifCloseFile (gif); /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) IMAGE_BACKGROUND (img, f, ximg); - + /* Put the image into the pixmap, then free the X image and its buffer. */ x_put_x_image (f, ximg, img->pixmap, width, height); x_destroy_x_image (ximg); - + UNGCPRO; return 1; } @@ -10347,9 +10348,9 @@ struct image_keyword fmt[GS_LAST]; Lisp_Object tem; int i; - + bcopy (gs_format, fmt, sizeof fmt); - + if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) return 0; @@ -10415,7 +10416,7 @@ image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); return 0; } - + /* Call the loader to fill the pixmap. It returns a process object if successful. We do not record_unwind_protect here because other places in redisplay like calling window scroll functions @@ -10426,12 +10427,12 @@ (unsigned long) FRAME_X_WINDOW (f), (unsigned long) img->pixmap); window_and_pixmap_id = build_string (buffer); - + sprintf (buffer, "%lu %lu", FRAME_FOREGROUND_PIXEL (f), FRAME_BACKGROUND_PIXEL (f)); pixel_colors = build_string (buffer); - + XSETFRAME (frame, f); loader = image_spec_value (img->spec, QCloader, NULL); if (NILP (loader)) @@ -10469,7 +10470,7 @@ instance, give up. */ if (i == c->used) return; - + /* Kill the GS process. We should have found PIXMAP in the image cache and its image should contain a process object. */ img = c->images[i]; @@ -10493,10 +10494,10 @@ if (ximg) { int x, y; - + /* Initialize the color table. */ init_color_table (); - + /* For each pixel of the image, look its color up in the color table. After having done so, the color table will contain an entry for each color used by the image. */ @@ -10525,7 +10526,7 @@ else image_error ("Cannot get X image of `%s'; colors will not be freed", img->spec, Qnil); - + UNBLOCK_INPUT; } @@ -10628,8 +10629,8 @@ rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom, 0, bytes_remaining, False, XA_STRING, - &actual_type, &actual_format, - &actual_size, &bytes_remaining, + &actual_type, &actual_format, + &actual_size, &bytes_remaining, (unsigned char **) &tmp_data); if (rc == Success && tmp_data) prop_value = make_string (tmp_data, size); @@ -10678,7 +10679,7 @@ { EMACS_TIME delay; int secs, usecs = 0; - + cancel_hourglass (); if (INTEGERP (Vhourglass_delay) @@ -10694,7 +10695,7 @@ } else secs = DEFAULT_HOURGLASS_DELAY; - + EMACS_SET_SECS_USECS (delay, secs, usecs); hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, show_hourglass, NULL); @@ -10712,7 +10713,7 @@ cancel_atimer (hourglass_atimer); hourglass_atimer = NULL; } - + if (hourglass_shown_p) hide_hourglass (); } @@ -10738,17 +10739,17 @@ if (!hourglass_shown_p) { Lisp_Object rest, frame; - + BLOCK_INPUT; - + FOR_EACH_FRAME (rest, frame) { struct frame *f = XFRAME (frame); - + if (FRAME_LIVE_P (f) && FRAME_X_P (f) && FRAME_X_DISPLAY (f)) { Display *dpy = FRAME_X_DISPLAY (f); - + #ifdef USE_X_TOOLKIT if (f->output_data.x->widget) #else @@ -10756,14 +10757,14 @@ #endif { f->output_data.x->hourglass_p = 1; - + if (!f->output_data.x->hourglass_window) { unsigned long mask = CWCursor; XSetWindowAttributes attrs; - + attrs.cursor = f->output_data.x->hourglass_cursor; - + f->output_data.x->hourglass_window = XCreateWindow (dpy, FRAME_OUTER_WINDOW (f), 0, 0, 32000, 32000, 0, 0, @@ -10771,7 +10772,7 @@ CopyFromParent, mask, &attrs); } - + XMapRaised (dpy, f->output_data.x->hourglass_window); XFlush (dpy); } @@ -10798,7 +10799,7 @@ FOR_EACH_FRAME (rest, frame) { struct frame *f = XFRAME (frame); - + if (FRAME_X_P (f) /* Watch out for newly created frames. */ && f->output_data.x->hourglass_window) @@ -10827,7 +10828,7 @@ Lisp_Object, Lisp_Object)); static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, int, int, int *, int *)); - + /* The frame of a currently visible tooltip. */ Lisp_Object tip_frame; @@ -10860,7 +10861,7 @@ tip_window = None; tip_frame = Qnil; } - + return deleted; } @@ -10924,7 +10925,7 @@ Ferase_buffer (); Finsert (1, &text); set_buffer_internal_1 (old_buffer); - + FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; record_unwind_protect (unwind_create_tip_frame, frame); @@ -10960,7 +10961,7 @@ { Lisp_Object black; struct gcpro gcpro1; - + black = build_string ("black"); GCPRO1 (black); f->output_data.x->foreground_pixel @@ -11010,7 +11011,7 @@ else font = x_new_font (f, SDATA (font)); } - + /* Try out a font which we hope has bold and italic variations. */ if (!STRINGP (font)) font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); @@ -11035,7 +11036,7 @@ x_default_parameter (f, parms, Qborder_width, make_number (2), "borderWidth", "BorderWidth", RES_TYPE_NUMBER); - + /* This defaults to 2 in order to match xterm. We recognize either internalBorderWidth or internalBorder (which is what xterm calls it). */ @@ -11073,7 +11074,7 @@ end up in init_iterator with a null face cache, which should not happen. */ init_frame_faces (f); - + f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; window_prompting = x_figure_window_size (f, parms); @@ -11096,12 +11097,12 @@ { XSetWindowAttributes attrs; unsigned long mask; - + BLOCK_INPUT; mask = CWBackPixel | CWOverrideRedirect | CWEventMask; if (DoesSaveUnders (dpyinfo->screen)) mask |= CWSaveUnder; - + /* Window managers look at the override-redirect flag to determine whether or net to give windows a decoration (Xlib spec, chapter 3.2.8). */ @@ -11140,12 +11141,12 @@ f->height = 0; SET_FRAME_WIDTH (f, 0); change_frame_size (f, height, width, 1, 0, 0); - + /* Add `tooltip' frame parameter's default value. */ if (NILP (Fframe_parameter (frame, intern ("tooltip")))) Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), Qnil)); - + /* Set up faces after all frame parameters are known. This call also merges in face attributes specified for new frames. @@ -11160,12 +11161,12 @@ /* Set tip_frame here, so that */ tip_frame = frame; call1 (Qface_set_after_frame_default, frame); - + if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), Qnil)); } - + f->no_split = 1; UNGCPRO; @@ -11208,11 +11209,11 @@ int win_x, win_y; Window root, child; unsigned pmask; - + /* User-specified position? */ left = Fcdr (Fassq (Qleft, parms)); top = Fcdr (Fassq (Qtop, parms)); - + /* Move the tooltip window where the mouse pointer is. Resize and show it. */ if (!INTEGERP (left) || !INTEGERP (top)) @@ -11281,7 +11282,7 @@ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int old_windows_or_buffers_changed = windows_or_buffers_changed; int count = SPECPDL_INDEX (); - + specbind (Qinhibit_redisplay, Qt); GCPRO4 (string, parms, frame, timeout); @@ -11292,12 +11293,12 @@ timeout = make_number (5); else CHECK_NATNUM (timeout); - + if (NILP (dx)) dx = make_number (5); else CHECK_NUMBER (dx); - + if (NILP (dy)) dy = make_number (-10); else @@ -11317,7 +11318,7 @@ && !NILP (Fequal (last_parms, parms))) { struct frame *f = XFRAME (tip_frame); - + /* Only DX and DY have changed. */ if (!NILP (tip_timer)) { @@ -11364,7 +11365,7 @@ /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); w->left = w->top = make_number (0); - + if (CONSP (Vx_max_tooltip_size) && INTEGERP (XCAR (Vx_max_tooltip_size)) && XINT (XCAR (Vx_max_tooltip_size)) > 0 @@ -11379,7 +11380,7 @@ w->width = make_number (80); w->height = make_number (40); } - + f->window_width = XINT (w->width); adjust_glyphs (f); w->pseudo_window_p = 1; @@ -11417,7 +11418,7 @@ } else row_width = row->pixel_width; - + height += row->height; width = max (width, row_width); } @@ -11436,7 +11437,7 @@ root_x, root_y, width, height); XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); UNBLOCK_INPUT; - + /* Draw into the window. */ w->must_be_updated_p = 1; update_single_window (w, 1); @@ -11467,16 +11468,16 @@ /* Return quickly if nothing to do. */ if (NILP (tip_timer) && NILP (tip_frame)) return Qnil; - + frame = tip_frame; timer = tip_timer; GCPRO2 (frame, timer); tip_frame = tip_timer = deleted = Qnil; - + count = SPECPDL_INDEX (); specbind (Qinhibit_redisplay, Qt); specbind (Qinhibit_quit, Qt); - + if (!NILP (timer)) call1 (Qcancel_timer, timer); @@ -11579,7 +11580,7 @@ dir = Fexpand_file_name (dir, Qnil); dir_xmstring = XmStringCreateLocalized (SDATA (dir)); pattern_xmstring = XmStringCreateLocalized ("*"); - + XtSetArg (al[ac], XmNtitle, SDATA (prompt)); ++ac; XtSetArg (al[ac], XmNdirectory, dir_xmstring); ++ac; XtSetArg (al[ac], XmNpattern, pattern_xmstring); ++ac; @@ -11602,7 +11603,7 @@ help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); XtSetSensitive (help, False); - /* Mark OK button as default. */ + /* Mark OK button as default. */ XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), XmNshowAsDefault, True, NULL); @@ -11666,7 +11667,7 @@ { XmString text; String data; - + XtVaGetValues (dialog, XmNtextString, &text, NULL); XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data); XmStringFree (text); @@ -11685,7 +11686,7 @@ /* Make "Cancel" equivalent to C-g. */ if (NILP (file)) Fsignal (Qquit, Qnil); - + return unbind_to (count, file); } @@ -11737,7 +11738,7 @@ UNBLOCK_INPUT; return Qnil; } - + have_keys = Qnil; kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); if (kb) @@ -11764,7 +11765,7 @@ } XkbFreeClientMap (kb, 0, True); - + if (delete_keycode && backspace_keycode && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode @@ -11894,7 +11895,7 @@ staticpro (&QCcolor_adjustment); QCmask = intern (":mask"); staticpro (&QCmask); - + Qface_set_after_frame_default = intern ("face-set-after-frame-default"); staticpro (&Qface_set_after_frame_default); @@ -11962,7 +11963,7 @@ DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); display_hourglass_p = 1; - + DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, doc: /* *Seconds to wait before displaying an hourglass pointer. Value must be an integer or float. */); @@ -11998,7 +11999,7 @@ doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); - + DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, doc: /* Non-nil if no X window manager is in use. Emacs doesn't try to figure this out; this is always nil @@ -12067,7 +12068,7 @@ defsubr (&Sx_synchronize); defsubr (&Sx_focus_frame); defsubr (&Sx_backspace_delete_keys_p); - + /* Setting callback functions for fontset handler. */ get_font_info_func = x_get_font_info; @@ -12075,7 +12076,7 @@ And the pointer assigned has the wrong type, anyway. */ list_fonts_func = x_list_fonts; #endif - + load_font_func = x_load_font; find_ccl_program_func = x_find_ccl_program; query_font_func = x_query_font; @@ -12116,16 +12117,16 @@ Qxpm = intern ("xpm"); staticpro (&Qxpm); #endif - + #if HAVE_JPEG Qjpeg = intern ("jpeg"); staticpro (&Qjpeg); -#endif +#endif #if HAVE_TIFF Qtiff = intern ("tiff"); staticpro (&Qtiff); -#endif +#endif #if HAVE_GIF Qgif = intern ("gif"); @@ -12165,27 +12166,27 @@ { image_types = NULL; Vimage_types = Qnil; - + define_image_type (&xbm_type); define_image_type (&gs_type); define_image_type (&pbm_type); - + #if HAVE_XPM define_image_type (&xpm_type); #endif - + #if HAVE_JPEG define_image_type (&jpeg_type); #endif - + #if HAVE_TIFF define_image_type (&tiff_type); #endif - + #if HAVE_GIF define_image_type (&gif_type); #endif - + #if HAVE_PNG define_image_type (&png_type); #endif