emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xfns.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/xfns.c
Date: Tue, 04 Feb 2003 09:03:55 -0500

Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.572 emacs/src/xfns.c:1.573
*** emacs/src/xfns.c:1.572      Sun Jan 26 20:04:03 2003
--- emacs/src/xfns.c    Tue Feb  4 09:03:17 2003
***************
*** 288,298 ****
       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)
--- 288,298 ----
       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)
***************
*** 336,342 ****
        if (f->output_data.x->hourglass_window == wdesc)
        return f;
  #ifdef USE_X_TOOLKIT
!       if ((f->output_data.x->edit_widget 
           && XtWindow (f->output_data.x->edit_widget) == wdesc)
          /* A tooltip frame?  */
          || (!f->output_data.x->edit_widget
--- 336,342 ----
        if (f->output_data.x->hourglass_window == wdesc)
        return f;
  #ifdef USE_X_TOOLKIT
!       if ((f->output_data.x->edit_widget
           && XtWindow (f->output_data.x->edit_widget) == wdesc)
          /* A tooltip frame?  */
          || (!f->output_data.x->edit_widget
***************
*** 380,386 ****
        frame = XCAR (tail);
        if (!GC_FRAMEP (frame))
          continue;
!       
        f = XFRAME (frame);
        if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
        {
--- 380,386 ----
        frame = XCAR (tail);
        if (!GC_FRAMEP (frame))
          continue;
! 
        f = XFRAME (frame);
        if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
        {
***************
*** 399,406 ****
                        || gwdesc == x->menubar_widget))
                  found = f;
  #else
!             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.  */
--- 399,406 ----
                        || gwdesc == x->menubar_widget))
                  found = f;
  #else
!             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.  */
***************
*** 413,419 ****
            found = f;
        }
      }
!   
    return found;
  }
  
--- 413,419 ----
            found = f;
        }
      }
! 
    return found;
  }
  
***************
*** 450,457 ****
                    || gwdesc == x->vbox_widget))
              return f;
  #else
!         if (wdesc == XtWindow (x->widget) 
!             || wdesc == XtWindow (x->column_widget) 
              || wdesc == XtWindow (x->edit_widget))
            return f;
  #endif
--- 450,457 ----
                    || gwdesc == x->vbox_widget))
              return f;
  #else
!         if (wdesc == XtWindow (x->widget)
!             || wdesc == XtWindow (x->column_widget)
              || wdesc == XtWindow (x->edit_widget))
            return f;
  #endif
***************
*** 489,495 ****
          {
            GtkWidget *gwdesc = xg_win_to_widget (wdesc);
            int found = 0;
!           
            BLOCK_INPUT;
            if (gwdesc != 0
                && (gwdesc == x->menubar_widget
--- 489,495 ----
          {
            GtkWidget *gwdesc = xg_win_to_widget (wdesc);
            int found = 0;
! 
            BLOCK_INPUT;
            if (gwdesc != 0
                && (gwdesc == x->menubar_widget
***************
*** 543,549 ****
         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 
              && wdesc == XtWindow (x->menubar_widget))
            return f;
  #endif
--- 543,549 ----
         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
              && wdesc == XtWindow (x->menubar_widget))
            return f;
  #endif
***************
*** 860,866 ****
    {"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
--- 860,866 ----
    {"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
***************
*** 979,985 ****
       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++) 
      {
        Lisp_Object prop, val;
  
--- 979,985 ----
       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++)
      {
        Lisp_Object prop, val;
  
***************
*** 994,1000 ****
  
          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);
--- 994,1000 ----
  
          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);
***************
*** 1094,1104 ****
           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
--- 1094,1104 ----
           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
***************
*** 1242,1253 ****
  
        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);
--- 1242,1253 ----
  
        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);
***************
*** 1286,1308 ****
                                   /* 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;
--- 1286,1308 ----
                                   /* 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;
***************
*** 1562,1568 ****
    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);
--- 1562,1568 ----
    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);
***************
*** 1573,1587 ****
          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);
  }
  
--- 1573,1587 ----
          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);
  }
  
***************
*** 1600,1606 ****
    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);
--- 1600,1606 ----
    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);
***************
*** 1689,1695 ****
    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))
      {
--- 1689,1695 ----
    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))
      {
***************
*** 1730,1736 ****
      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);
--- 1730,1736 ----
      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);
***************
*** 1761,1767 ****
        && 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);
--- 1761,1767 ----
        && 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);
***************
*** 1795,1801 ****
      }
    else
      fore_pixel = x->background_pixel;
!   
    pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
    pixel_allocated_p = 1;
  
--- 1795,1801 ----
      }
    else
      fore_pixel = x->background_pixel;
! 
    pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
    pixel_allocated_p = 1;
  
***************
*** 1807,1813 ****
          x_free_colors (f, &pixel, 1);
          pixel_allocated_p = 0;
        }
!       
        pixel = x->mouse_pixel;
        if (pixel == fore_pixel)
        {
--- 1807,1813 ----
          x_free_colors (f, &pixel, 1);
          pixel_allocated_p = 0;
        }
! 
        pixel = x->mouse_pixel;
        if (pixel == fore_pixel)
        {
***************
*** 2015,2021 ****
            ? 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))
--- 2015,2021 ----
            ? 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))
***************
*** 2031,2037 ****
        }
        else if (!NILP (Fequal (result, oldval)))
        return;
!       
        store_frame_param (f, Qfont, result);
        recompute_basic_faces (f);
      }
--- 2031,2037 ----
        }
        else if (!NILP (Fequal (result, oldval)))
        return;
! 
        store_frame_param (f, Qfont, result);
        recompute_basic_faces (f);
      }
***************
*** 2245,2251 ****
  
    return;
  #endif
!   
       /* Make sure we redisplay all windows in this frame.  */
    ++windows_or_buffers_changed;
  
--- 2245,2251 ----
  
    return;
  #endif
! 
       /* Make sure we redisplay all windows in this frame.  */
    ++windows_or_buffers_changed;
  
***************
*** 2263,2269 ****
    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
--- 2263,2269 ----
    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
***************
*** 2309,2315 ****
       Lisp_Object value, oldval;
  {
    unsigned long pixel;
!   
    if (STRINGP (value))
      pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f));
    else
--- 2309,2315 ----
       Lisp_Object value, oldval;
  {
    unsigned long pixel;
! 
    if (STRINGP (value))
      pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f));
    else
***************
*** 2317,2323 ****
  
    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))
      {
--- 2317,2323 ----
  
    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))
      {
***************
*** 2349,2358 ****
      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)
--- 2349,2358 ----
      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)
***************
*** 2375,2381 ****
        (*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);
      }
--- 2375,2381 ----
        (*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);
      }
***************
*** 2470,2476 ****
       Lisp_Object name;
       int explicit;
  {
!   /* Make sure that requests from lisp code override requests from 
       Emacs redisplay code.  */
    if (explicit)
      {
--- 2470,2476 ----
       Lisp_Object name;
       int explicit;
  {
!   /* Make sure that requests from lisp code override requests from
       Emacs redisplay code.  */
    if (explicit)
      {
***************
*** 2736,2742 ****
        = (NILP (arg)
           ? vertical_scroll_bar_none
           : EQ (Qright, arg)
!          ? vertical_scroll_bar_right 
           : vertical_scroll_bar_left);
  
        /* We set this parameter before creating the X window for the
--- 2736,2742 ----
        = (NILP (arg)
           ? vertical_scroll_bar_none
           : EQ (Qright, arg)
!          ? vertical_scroll_bar_right
           : vertical_scroll_bar_left);
  
        /* We set this parameter before creating the X window for the
***************
*** 2767,2773 ****
        /* 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;
--- 2767,2773 ----
        /* 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;
***************
*** 3096,3102 ****
              if (!strcmp (SDATA (tem), "on")
                  || !strcmp (SDATA (tem), "true"))
                return Qt;
!             else 
                return Qnil;
  
            case RES_TYPE_STRING:
--- 3096,3102 ----
              if (!strcmp (SDATA (tem), "on")
                  || !strcmp (SDATA (tem), "true"))
                return Qt;
!             else
                return Qnil;
  
            case RES_TYPE_STRING:
***************
*** 3215,3225 ****
             specified.  */
          tem = Qnil;
        }
!       
  #else /* not USE_TOOLKIT_SCROLL_BARS */
!       
        tem = Qnil;
!       
  #endif /* not USE_TOOLKIT_SCROLL_BARS */
      }
  
--- 3215,3225 ----
             specified.  */
          tem = Qnil;
        }
! 
  #else /* not USE_TOOLKIT_SCROLL_BARS */
! 
        tem = Qnil;
! 
  #endif /* not USE_TOOLKIT_SCROLL_BARS */
      }
  
***************
*** 3417,3423 ****
      {
        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);
--- 3417,3423 ----
      {
        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);
***************
*** 3428,3434 ****
        f->output_data.x->left_pos = left;
        f->output_data.x->top_pos = top;
      }
!   
    return window_prompting;
  }
  
--- 3428,3434 ----
        f->output_data.x->left_pos = left;
        f->output_data.x->top_pos = top;
      }
! 
    return window_prompting;
  }
  
***************
*** 3551,3563 ****
    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;
  }
--- 3551,3563 ----
    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;
  }
***************
*** 3597,3603 ****
  
    if (FRAME_XIC (f))
      return;
!   
    xim = FRAME_X_XIM (f);
    if (xim)
      {
--- 3597,3603 ----
  
    if (FRAME_XIC (f))
      return;
! 
    xim = FRAME_X_XIM (f);
    if (xim)
      {
***************
*** 3695,3701 ****
        XFree (preedit_attr);
        XFree (status_attr);
      }
!   
    FRAME_XIC (f) = xic;
    FRAME_XIC_STYLE (f) = xic_style;
    FRAME_XIC_FONTSET (f) = xfs;
--- 3695,3701 ----
        XFree (preedit_attr);
        XFree (status_attr);
      }
! 
    FRAME_XIC (f) = xic;
    FRAME_XIC_STYLE (f) = xic_style;
    FRAME_XIC_FONTSET (f) = xfs;
***************
*** 3710,3716 ****
  {
    if (FRAME_XIC (f) == NULL)
      return;
!   
    XDestroyIC (FRAME_XIC (f));
    if (FRAME_XIC_FONTSET (f))
      XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
--- 3710,3716 ----
  {
    if (FRAME_XIC (f) == NULL)
      return;
! 
    XDestroyIC (FRAME_XIC (f));
    if (FRAME_XIC_FONTSET (f))
      XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
***************
*** 3731,3737 ****
    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);
--- 3731,3737 ----
    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);
***************
*** 3757,3763 ****
    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);
--- 3757,3763 ----
    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);
***************
*** 3803,3809 ****
    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;
--- 3803,3809 ----
    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;
***************
*** 3839,3845 ****
       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);
--- 3839,3845 ----
       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);
***************
*** 3876,3882 ****
    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 
       the emacs screen when changing menubar.  This reduces flickering.  */
  
    ac = 0;
--- 3876,3882 ----
    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
       the emacs screen when changing menubar.  This reduces flickering.  */
  
    ac = 0;
***************
*** 3890,3899 ****
    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); 
  
    /* Do some needed geometry management.  */
    {
--- 3890,3899 ----
    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);
  
    /* Do some needed geometry management.  */
    {
***************
*** 3902,3908 ****
      Arg al[2];
      int ac = 0;
      int extra_borders = 0;
!     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)
--- 3902,3908 ----
      Arg al[2];
      int ac = 0;
      int extra_borders = 0;
!     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)
***************
*** 3946,3958 ****
  
        if (window_prompting & USPosition)
        sprintf (shell_position, "=%dx%d%c%d%c%d",
!                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_HEIGHT (f) + menubar_size + extra_borders);
      }
  
--- 3946,3958 ----
  
        if (window_prompting & USPosition)
        sprintf (shell_position, "=%dx%d%c%d%c%d",
!                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_HEIGHT (f) + menubar_size + extra_borders);
      }
  
***************
*** 3970,3976 ****
    XtManageChild (pane_widget);
    XtRealizeWidget (shell_widget);
  
!   FRAME_X_WINDOW (f) = XtWindow (frame_widget); 
  
    validate_x_resource_name ();
  
--- 3970,3976 ----
    XtManageChild (pane_widget);
    XtRealizeWidget (shell_widget);
  
!   FRAME_X_WINDOW (f) = XtWindow (frame_widget);
  
    validate_x_resource_name ();
  
***************
*** 4017,4023 ****
        attributes.event_mask |= fevent;
      }
  #endif /* HAVE_X_I18N */
!   
    attribute_mask = CWEventMask;
    XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget),
                           attribute_mask, &attributes);
--- 4017,4023 ----
        attributes.event_mask |= fevent;
      }
  #endif /* HAVE_X_I18N */
! 
    attribute_mask = CWEventMask;
    XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget),
                           attribute_mask, &attributes);
***************
*** 4137,4143 ****
      }
  #endif
  #endif /* HAVE_X_I18N */
!   
    validate_x_resource_name ();
  
    class_hints.res_name = (char *) SDATA (Vx_resource_name);
--- 4137,4143 ----
      }
  #endif
  #endif /* HAVE_X_I18N */
! 
    validate_x_resource_name ();
  
    class_hints.res_name = (char *) SDATA (Vx_resource_name);
***************
*** 4302,4308 ****
       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, 
        gray_bits, gray_width, gray_height,
        f->output_data.x->foreground_pixel,
        f->output_data.x->background_pixel,
--- 4302,4308 ----
       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,
        gray_bits, gray_width, gray_height,
        f->output_data.x->foreground_pixel,
        f->output_data.x->background_pixel,
***************
*** 4321,4327 ****
    Display *dpy = FRAME_X_DISPLAY (f);
  
    BLOCK_INPUT;
!   
    if (f->output_data.x->normal_gc)
      {
        XFreeGC (dpy, f->output_data.x->normal_gc);
--- 4321,4327 ----
    Display *dpy = FRAME_X_DISPLAY (f);
  
    BLOCK_INPUT;
! 
    if (f->output_data.x->normal_gc)
      {
        XFreeGC (dpy, f->output_data.x->normal_gc);
***************
*** 4333,4339 ****
        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);
--- 4333,4339 ----
        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);
***************
*** 4366,4372 ****
  #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.  */
--- 4366,4372 ----
  #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.  */
***************
*** 4374,4380 ****
        xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
        return Qt;
      }
!   
    return Qnil;
  }
  
--- 4374,4380 ----
        xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
        return Qt;
      }
! 
    return Qnil;
  }
  
***************
*** 4505,4511 ****
      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
--- 4505,4511 ----
      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
***************
*** 4568,4574 ****
        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");
--- 4568,4574 ----
        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");
***************
*** 4599,4605 ****
  
    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).  */
--- 4599,4605 ----
  
    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).  */
***************
*** 4654,4660 ****
       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),
--- 4654,4660 ----
       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),
***************
*** 4680,4686 ****
    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);
--- 4680,4686 ----
    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);
***************
*** 4694,4700 ****
        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);
      }
--- 4694,4700 ----
        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);
      }
***************
*** 4728,4734 ****
  #else
    x_window (f);
  #endif
!   
    x_icon (f, parms);
    x_make_gc (f);
  
--- 4728,4734 ----
  #else
    x_window (f);
  #endif
! 
    x_icon (f, parms);
    x_make_gc (f);
  
***************
*** 4756,4762 ****
       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);
--- 4756,4762 ----
       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);
***************
*** 4819,4825 ****
    /* Make sure windows on this frame appear in calls to next-window
       and similar functions.  */
    Vwindow_list = Qnil;
!   
    return unbind_to (count, frame);
  }
  
--- 4819,4825 ----
    /* Make sure windows on this frame appear in calls to next-window
       and similar functions.  */
    Vwindow_list = Qnil;
! 
    return unbind_to (count, frame);
  }
  
***************
*** 4867,4873 ****
                  RevertToParent, CurrentTime);
    x_uncatch_errors (dpy, count);
    UNBLOCK_INPUT;
!   
    return Qnil;
  }
  
--- 4867,4873 ----
                  RevertToParent, CurrentTime);
    x_uncatch_errors (dpy, count);
    UNBLOCK_INPUT;
! 
    return Qnil;
  }
  
***************
*** 5184,5190 ****
        error ("Display has an unknown visual class");
        result = Qnil;
      }
!   
    return result;
  }
  
--- 5184,5190 ----
        error ("Display has an unknown visual class");
        result = Qnil;
      }
! 
    return result;
  }
  
***************
*** 5339,5352 ****
          || !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
--- 5339,5352 ----
          || !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
***************
*** 5640,5646 ****
       Lisp_Object object;
  {
    int valid_p = 0;
!   
    if (CONSP (object) && EQ (XCAR (object), Qimage))
      {
        Lisp_Object tem;
--- 5640,5646 ----
       Lisp_Object object;
  {
    int valid_p = 0;
! 
    if (CONSP (object) && EQ (XCAR (object), Qimage))
      {
        Lisp_Object tem;
***************
*** 5656,5662 ****
                if (type)
                  valid_p = type->valid_p (object);
              }
!           
            break;
          }
      }
--- 5656,5662 ----
                if (type)
                  valid_p = type->valid_p (object);
              }
! 
            break;
          }
      }
***************
*** 5775,5781 ****
         was found more than once, it's an error.  */
        keywords[i].value = value;
        ++keywords[i].count;
!       
        if (keywords[i].count > 1)
        return 0;
  
--- 5775,5781 ----
         was found more than once, it's an error.  */
        keywords[i].value = value;
        ++keywords[i].count;
! 
        if (keywords[i].count > 1)
        return 0;
  
***************
*** 5819,5825 ****
                   && XINT (value) <= 100)
            break;
          return 0;
!             
        case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
          if (!INTEGERP (value) || XINT (value) < 0)
            return 0;
--- 5819,5825 ----
                   && XINT (value) <= 100)
            break;
          return 0;
! 
        case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
          if (!INTEGERP (value) || XINT (value) < 0)
            return 0;
***************
*** 5830,5836 ****
  
        case IMAGE_FUNCTION_VALUE:
          value = indirect_function (value);
!         if (SUBRP (value) 
              || COMPILEDP (value)
              || (CONSP (value) && EQ (XCAR (value), Qlambda)))
            break;
--- 5830,5836 ----
  
        case IMAGE_FUNCTION_VALUE:
          value = indirect_function (value);
!         if (SUBRP (value)
              || COMPILEDP (value)
              || (CONSP (value) && EQ (XCAR (value), Qlambda)))
            break;
***************
*** 5879,5885 ****
       int *found;
  {
    Lisp_Object tail;
!   
    xassert (valid_image_p (spec));
  
    for (tail = XCDR (spec);
--- 5879,5885 ----
       int *found;
  {
    Lisp_Object tail;
! 
    xassert (valid_image_p (spec));
  
    for (tail = XCDR (spec);
***************
*** 5893,5904 ****
          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).
--- 5893,5904 ----
          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).
***************
*** 5919,5925 ****
        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)));
--- 5919,5925 ----
        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)));
***************
*** 5976,5982 ****
       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));
--- 5976,5982 ----
       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));
***************
*** 6037,6043 ****
    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.  */
--- 6037,6043 ----
    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.  */
***************
*** 6089,6095 ****
    for (i = best_count = 0; i < 4; ++i)
      {
        int j, n;
!         
        for (j = n = 0; j < 4; ++j)
        if (corners[i] == corners[j])
          ++n;
--- 6089,6095 ----
    for (i = best_count = 0; i < 4; ++i)
      {
        int j, n;
! 
        for (j = n = 0; j < 4; ++j)
        if (corners[i] == corners[j])
          ++n;
***************
*** 6205,6211 ****
        img->mask = None;
        img->background_transparent_valid = 0;
      }
!       
    if (colors_p && img->ncolors)
      {
        x_free_colors (f, img->colors, img->ncolors);
--- 6205,6211 ----
        img->mask = None;
        img->background_transparent_valid = 0;
      }
! 
    if (colors_p && img->ncolors)
      {
        x_free_colors (f, img->colors, img->ncolors);
***************
*** 6280,6286 ****
  {
    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);
--- 6280,6286 ----
  {
    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);
***************
*** 6305,6311 ****
  
        /* 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);
--- 6305,6311 ----
  
        /* 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);
***************
*** 6342,6348 ****
        /* 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];
--- 6342,6348 ----
        /* 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];
***************
*** 6361,6367 ****
        if (nfreed)
        {
          Lisp_Object tail, frame;
!         
          FOR_EACH_FRAME (tail, frame)
            {
              struct frame *f = XFRAME (frame);
--- 6361,6367 ----
        if (nfreed)
        {
          Lisp_Object tail, frame;
! 
          FOR_EACH_FRAME (tail, frame)
            {
              struct frame *f = XFRAME (frame);
***************
*** 6389,6395 ****
    if (EQ (frame, Qt))
      {
        Lisp_Object tail;
!       
        FOR_EACH_FRAME (tail, frame)
        if (FRAME_X_P (XFRAME (frame)))
          clear_image_cache (XFRAME (frame), 1);
--- 6389,6395 ----
    if (EQ (frame, Qt))
      {
        Lisp_Object tail;
! 
        FOR_EACH_FRAME (tail, frame)
        if (FRAME_X_P (XFRAME (frame)))
          clear_image_cache (XFRAME (frame), 1);
***************
*** 6416,6422 ****
        Lisp_Object mask;
  
        spec = img->spec;
!       
        /* `:heuristic-mask t'
         `:mask heuristic'
         means build a mask heuristically.
--- 6416,6422 ----
        Lisp_Object mask;
  
        spec = img->spec;
! 
        /* `:heuristic-mask t'
         `:mask heuristic'
         means build a mask heuristically.
***************
*** 6426,6441 ****
         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)
--- 6426,6441 ----
         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)
***************
*** 6452,6459 ****
              img->mask = None;
            }
        }
!  
!         
        /* Should we apply an image transformation algorithm?  */
        conversion = image_spec_value (spec, QCconversion, NULL);
        if (EQ (conversion, Qdisabled))
--- 6452,6459 ----
              img->mask = None;
            }
        }
! 
! 
        /* Should we apply an image transformation algorithm?  */
        conversion = image_spec_value (spec, QCconversion, NULL);
        if (EQ (conversion, Qdisabled))
***************
*** 6495,6501 ****
       specification.  */
    xassert (FRAME_WINDOW_P (f));
    xassert (valid_image_p (spec));
!   
    GCPRO1 (spec);
  
    /* Look up SPEC in the hash table of the image cache.  */
--- 6495,6501 ----
       specification.  */
    xassert (FRAME_WINDOW_P (f));
    xassert (valid_image_p (spec));
! 
    GCPRO1 (spec);
  
    /* Look up SPEC in the hash table of the image cache.  */
***************
*** 6510,6516 ****
    if (img == NULL)
      {
        extern Lisp_Object Qpostscript;
!       
        BLOCK_INPUT;
        img = make_image (spec, hash);
        cache_image (f, img);
--- 6510,6516 ----
    if (img == NULL)
      {
        extern Lisp_Object Qpostscript;
! 
        BLOCK_INPUT;
        img = make_image (spec, hash);
        cache_image (f, img);
***************
*** 6542,6548 ****
            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);
--- 6542,6548 ----
            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);
***************
*** 6554,6560 ****
              if (XINT (XCDR (margin)) > 0)
                img->vmargin = XFASTINT (XCDR (margin));
            }
!         
          relief = image_spec_value (spec, QCrelief, NULL);
          if (INTEGERP (relief))
            {
--- 6554,6560 ----
              if (XINT (XCDR (margin)) > 0)
                img->vmargin = XFASTINT (XCDR (margin));
            }
! 
          relief = image_spec_value (spec, QCrelief, NULL);
          if (INTEGERP (relief))
            {
***************
*** 6588,6596 ****
    /* 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;
  }
--- 6588,6596 ----
    /* 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;
  }
***************
*** 6742,6748 ****
       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);
--- 6742,6748 ----
       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);
***************
*** 6777,6783 ****
  
    /* 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
--- 6777,6783 ----
  
    /* 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
***************
*** 6819,6825 ****
          buf = NULL;
        }
      }
!   
    return buf;
  }
  
--- 6819,6825 ----
          buf = NULL;
        }
      }
! 
    return buf;
  }
  
***************
*** 6898,6904 ****
    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
--- 6898,6904 ----
    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
***************
*** 6933,6939 ****
       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;
--- 6933,6939 ----
       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;
***************
*** 6965,6977 ****
        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;
--- 6965,6977 ----
        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;
***************
*** 7031,7037 ****
    int c;
  
   loop:
!   
    /* Skip white space.  */
    while (*s < end && (c = *(*s)++, isspace (c)))
      ;
--- 7031,7037 ----
    int c;
  
   loop:
! 
    /* Skip white space.  */
    while (*s < end && (c = *(*s)++, isspace (c)))
      ;
***************
*** 7041,7047 ****
    else if (isdigit (c))
      {
        int value = 0, digit;
!       
        if (c == '0' && *s < end)
        {
          c = *(*s)++;
--- 7041,7047 ----
    else if (isdigit (c))
      {
        int value = 0, digit;
! 
        if (c == '0' && *s < end)
        {
          c = *(*s)++;
***************
*** 7139,7145 ****
       if (LA1 != (TOKEN))      \
         goto failure;          \
       else                     \
!        match ()       
  
  #define expect_ident(IDENT)                                   \
       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)        \
--- 7139,7145 ----
       if (LA1 != (TOKEN))      \
         goto failure;          \
       else                     \
!        match ()
  
  #define expect_ident(IDENT)                                   \
       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)        \
***************
*** 7182,7188 ****
      {
        if (strcmp (buffer, "unsigned") == 0)
        {
!         match (); 
          expect_ident ("char");
        }
        else if (strcmp (buffer, "short") == 0)
--- 7182,7188 ----
      {
        if (strcmp (buffer, "unsigned") == 0)
        {
!         match ();
          expect_ident ("char");
        }
        else if (strcmp (buffer, "short") == 0)
***************
*** 7197,7203 ****
        else
        goto failure;
      }
!   else 
      goto failure;
  
    expect (XBM_TK_IDENT);
--- 7197,7203 ----
        else
        goto failure;
      }
!   else
      goto failure;
  
    expect (XBM_TK_IDENT);
***************
*** 7220,7226 ****
          *p++ = val;
          if (!padding_p || ((i + 2) % bytes_per_line))
            *p++ = value >> 8;
!         
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
--- 7220,7226 ----
          *p++ = val;
          if (!padding_p || ((i + 2) % bytes_per_line))
            *p++ = value >> 8;
! 
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
***************
*** 7233,7241 ****
        {
          int val = value;
          expect (XBM_TK_NUMBER);
!         
          *p++ = val;
!         
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
--- 7233,7241 ----
        {
          int val = value;
          expect (XBM_TK_NUMBER);
! 
          *p++ = val;
! 
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
***************
*** 7247,7253 ****
    return 1;
  
   failure:
!   
    if (data && *data)
      {
        xfree (*data);
--- 7247,7253 ----
    return 1;
  
   failure:
! 
    if (data && *data)
      {
        xfree (*data);
***************
*** 7274,7280 ****
    int rc;
    unsigned char *data;
    int success_p = 0;
!   
    rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data);
    if (rc)
      {
--- 7274,7280 ----
    int rc;
    unsigned char *data;
    int success_p = 0;
! 
    rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data);
    if (rc)
      {
***************
*** 7282,7288 ****
        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.  */
--- 7282,7288 ----
        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.  */
***************
*** 7335,7341 ****
                                   &w, &h, NULL));
  }
  
!     
  /* Fill image IMG which is used on frame F with pixmap data.  Value is
     non-zero if successful.  */
  
--- 7335,7341 ----
                                   &w, &h, NULL));
  }
  
! 
  /* Fill image IMG which is used on frame F with pixmap data.  Value is
     non-zero if successful.  */
  
***************
*** 7357,7363 ****
        char *contents;
        int size;
        struct gcpro gcpro1;
!       
        file = x_find_image_file (file_name);
        GCPRO1 (file);
        if (!STRINGP (file))
--- 7357,7363 ----
        char *contents;
        int size;
        struct gcpro gcpro1;
! 
        file = x_find_image_file (file_name);
        GCPRO1 (file);
        if (!STRINGP (file))
***************
*** 7427,7433 ****
              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)
                {
--- 7427,7433 ----
              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)
                {
***************
*** 7465,7478 ****
  
    return success_p;
  }
!   
  
  
  /***********************************************************************
                              XPM images
   ***********************************************************************/
  
! #if HAVE_XPM 
  
  static int xpm_image_p P_ ((Lisp_Object object));
  static int xpm_load P_ ((struct frame *f, struct image *img));
--- 7465,7478 ----
  
    return success_p;
  }
! 
  
  
  /***********************************************************************
                              XPM images
   ***********************************************************************/
  
! #if HAVE_XPM
  
  static int xpm_image_p P_ ((Lisp_Object object));
  static int xpm_load P_ ((struct frame *f, struct image *img));
***************
*** 7589,7595 ****
      {
        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))
--- 7589,7595 ----
      {
        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))
***************
*** 7632,7638 ****
  {
    unsigned h = 0;
    char *s;
!   
    for (s = color_name; *s; ++s)
      h = (h << 2) ^ *s;
    return h %= XPM_COLOR_CACHE_BUCKETS;
--- 7632,7638 ----
  {
    unsigned h = 0;
    char *s;
! 
    for (s = color_name; *s; ++s)
      h = (h << 2) ^ *s;
    return h %= XPM_COLOR_CACHE_BUCKETS;
***************
*** 7652,7661 ****
  {
    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);
--- 7652,7661 ----
  {
    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);
***************
*** 7693,7699 ****
                                       color->blue);
        p = xpm_cache_color (f, color_name, color, h);
      }
!   
    return p != NULL;
  }
  
--- 7693,7699 ----
                                       color->blue);
        p = xpm_cache_color (f, color_name, color, h);
      }
! 
    return p != NULL;
  }
  
***************
*** 7820,7826 ****
        Lisp_Object tail;
        XpmColorSymbol *xpm_syms;
        int i, size;
!       
        attrs.valuemask |= XpmColorSymbols;
  
        /* Count number of symbols.  */
--- 7820,7826 ----
        Lisp_Object tail;
        XpmColorSymbol *xpm_syms;
        int i, size;
! 
        attrs.valuemask |= XpmColorSymbols;
  
        /* Count number of symbols.  */
***************
*** 7853,7859 ****
  #ifdef ALLOC_XPM_COLORS
    xpm_init_color_cache (f, &attrs);
  #endif
!   
    specified_file = image_spec_value (img->spec, QCfile, NULL);
    if (STRINGP (specified_file))
      {
--- 7853,7859 ----
  #ifdef ALLOC_XPM_COLORS
    xpm_init_color_cache (f, &attrs);
  #endif
! 
    specified_file = image_spec_value (img->spec, QCfile, NULL);
    if (STRINGP (specified_file))
      {
***************
*** 7863,7869 ****
          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);
--- 7863,7869 ----
          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);
***************
*** 7910,7928 ****
        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;
--- 7910,7928 ----
        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;
***************
*** 8028,8041 ****
        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;
--- 8028,8041 ----
        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;
***************
*** 8081,8087 ****
        if (rc)
        {
          ++ct_colors_allocated;
!       
          p = (struct ct_color *) xmalloc (sizeof *p);
          p->r = color.red;
          p->g = color.green;
--- 8081,8087 ----
        if (rc)
        {
          ++ct_colors_allocated;
! 
          p = (struct ct_color *) xmalloc (sizeof *p);
          p->r = color.red;
          p->g = color.green;
***************
*** 8093,8099 ****
        else
        return FRAME_FOREGROUND_PIXEL (f);
      }
!   
    return p->pixel;
  }
  
--- 8093,8099 ----
        else
        return FRAME_FOREGROUND_PIXEL (f);
      }
! 
    return p->pixel;
  }
  
***************
*** 8119,8125 ****
        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;
--- 8119,8125 ----
        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;
***************
*** 8194,8200 ****
    for (y = 0; y < img->height; ++y)
      {
        XColor *row = p;
!       
        for (x = 0; x < img->width; ++x, ++p)
        p->pixel = XGetPixel (ximg, x, y);
  
--- 8194,8200 ----
    for (y = 0; y < img->height; ++y)
      {
        XColor *row = p;
! 
        for (x = 0; x < img->width; ++x, ++p)
        p->pixel = XGetPixel (ximg, x, y);
  
***************
*** 8221,8229 ****
    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;
--- 8221,8229 ----
    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;
***************
*** 8250,8256 ****
  
     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.  */
  
--- 8250,8256 ----
  
     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.  */
  
***************
*** 8278,8284 ****
        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);
--- 8278,8284 ----
        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);
***************
*** 8290,8296 ****
    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;
--- 8290,8296 ----
    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;
***************
*** 8363,8369 ****
  {
    int i = 0;
    int trans[9];
!   
    if (CONSP (matrix))
      {
        for (i = 0;
--- 8363,8369 ----
  {
    int i = 0;
    int trans[9];
! 
    if (CONSP (matrix))
      {
        for (i = 0;
***************
*** 8483,8489 ****
    /* 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;
--- 8483,8489 ----
    /* 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;
***************
*** 8502,8508 ****
          use_img_background = 0;
        }
      }
!   
    if (use_img_background)
      bg = four_corners_best (ximg, img->width, img->height);
  
--- 8502,8508 ----
          use_img_background = 0;
        }
      }
! 
    if (use_img_background)
      bg = four_corners_best (ximg, img->width, img->height);
  
***************
*** 8519,8525 ****
    x_put_x_image (f, mask_img, img->mask, img->width, img->height);
    x_destroy_x_image (mask_img);
    XDestroyImage (ximg);
!   
    return 1;
  }
  
--- 8519,8525 ----
    x_put_x_image (f, mask_img, img->mask, img->width, img->height);
    x_destroy_x_image (mask_img);
    XDestroyImage (ximg);
! 
    return 1;
  }
  
***************
*** 8592,8600 ****
       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;
  
--- 8592,8600 ----
       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;
  
***************
*** 8643,8649 ****
  
  /* Load PBM image IMG for use on frame F.  */
  
! static int 
  pbm_load (f, img)
       struct frame *f;
       struct image *img;
--- 8643,8649 ----
  
  /* Load PBM image IMG for use on frame F.  */
  
! static int
  pbm_load (f, img)
       struct frame *f;
       struct image *img;
***************
*** 8706,8712 ****
      case '1':
        raw_p = 0, type = PBM_MONO;
        break;
!       
      case '2':
        raw_p = 0, type = PBM_GRAY;
        break;
--- 8706,8712 ----
      case '1':
        raw_p = 0, type = PBM_MONO;
        break;
! 
      case '2':
        raw_p = 0, type = PBM_GRAY;
        break;
***************
*** 8718,8728 ****
      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;
--- 8718,8728 ----
      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;
***************
*** 8743,8749 ****
        if (raw_p && max_color_idx > 255)
        max_color_idx = 255;
      }
!   
    if (width < 0
        || height < 0
        || (type != PBM_MONO && max_color_idx < 0))
--- 8743,8749 ----
        if (raw_p && max_color_idx > 255)
        max_color_idx = 255;
      }
! 
    if (width < 0
        || height < 0
        || (type != PBM_MONO && max_color_idx < 0))
***************
*** 8752,8758 ****
    if (!x_create_x_image_and_pixmap (f, width, height, 0,
                                    &ximg, &img->pixmap))
      goto error;
!   
    /* Initialize the color hash table.  */
    init_color_table ();
  
--- 8752,8758 ----
    if (!x_create_x_image_and_pixmap (f, width, height, 0,
                                    &ximg, &img->pixmap))
      goto error;
! 
    /* Initialize the color hash table.  */
    init_color_table ();
  
***************
*** 8766,8772 ****
        /* 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))
--- 8766,8772 ----
        /* 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))
***************
*** 8778,8784 ****
          img->background = bg;
          img->background_valid = 1;
        }
!       
        for (y = 0; y < height; ++y)
        for (x = 0; x < width; ++x)
          {
--- 8778,8784 ----
          img->background = bg;
          img->background_valid = 1;
        }
! 
        for (y = 0; y < height; ++y)
        for (x = 0; x < width; ++x)
          {
***************
*** 8801,8807 ****
        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)
--- 8801,8807 ----
        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)
***************
*** 8816,8822 ****
                g = pbm_scan_number (&p, end);
                b = pbm_scan_number (&p, end);
              }
!           
            if (r < 0 || g < 0 || b < 0)
              {
                xfree (ximg->data);
--- 8816,8822 ----
                g = pbm_scan_number (&p, end);
                b = pbm_scan_number (&p, end);
              }
! 
            if (r < 0 || g < 0 || b < 0)
              {
                xfree (ximg->data);
***************
*** 8826,8832 ****
                             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;
--- 8826,8832 ----
                             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;
***************
*** 8835,8841 ****
            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);
--- 8835,8841 ----
            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);
***************
*** 8844,8854 ****
    /* 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;
  
--- 8844,8854 ----
    /* 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;
  
***************
*** 8930,8936 ****
  {
    struct image_keyword fmt[PNG_LAST];
    bcopy (png_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
      return 0;
  
--- 8930,8936 ----
  {
    struct image_keyword fmt[PNG_LAST];
    bcopy (png_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
      return 0;
  
***************
*** 8987,8993 ****
  
    if (length > tbr->len - tbr->index)
      png_error (png_ptr, "Read error");
!   
    bcopy (tbr->bytes + tbr->index, data, length);
    tbr->index = tbr->index + length;
  }
--- 8987,8993 ----
  
    if (length > tbr->len - tbr->index)
      png_error (png_ptr, "Read error");
! 
    bcopy (tbr->bytes + tbr->index, data, length);
    tbr->index = tbr->index + length;
  }
***************
*** 9129,9142 ****
    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 
       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 
       one data format: RGB or RGBA with 8 bits per channel.  Let's
       transform other formats into that format.  */
  
--- 9129,9142 ----
    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
       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
       one data format: RGB or RGBA with 8 bits per channel.  Let's
       transform other formats into that format.  */
  
***************
*** 9149,9155 ****
    png_set_expand (png_ptr);
  
    /* Convert grayscale images to RGB.  */
!   if (color_type == PNG_COLOR_TYPE_GRAY 
        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      png_set_gray_to_rgb (png_ptr);
  
--- 9149,9155 ----
    png_set_expand (png_ptr);
  
    /* Convert grayscale images to RGB.  */
!   if (color_type == PNG_COLOR_TYPE_GRAY
        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      png_set_gray_to_rgb (png_ptr);
  
***************
*** 9198,9211 ****
            }
        }
        else if (png_get_bKGD (png_ptr, info_ptr, &image_bg))
!       /* 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 
             the frame's background instead.  */
          XColor color;
          Colormap cmap;
--- 9198,9211 ----
            }
        }
        else if (png_get_bKGD (png_ptr, info_ptr, &image_bg))
!       /* 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
             the frame's background instead.  */
          XColor color;
          Colormap cmap;
***************
*** 9253,9264 ****
        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
--- 9253,9264 ----
        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
***************
*** 9289,9304 ****
          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 
             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.  
  
             What I'm doing now is that a mask is created if we have
             boolean transparency information.  Otherwise I'm using
--- 9289,9304 ----
          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
             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.
  
             What I'm doing now is that a mask is created if we have
             boolean transparency information.  Otherwise I'm using
***************
*** 9444,9452 ****
       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;
  
--- 9444,9452 ----
       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;
  
***************
*** 9517,9523 ****
      {
        if (num_bytes > src->bytes_in_buffer)
        ERREXIT (cinfo, JERR_INPUT_EOF);
!       
        src->bytes_in_buffer -= num_bytes;
        src->next_input_byte += num_bytes;
      }
--- 9517,9523 ----
      {
        if (num_bytes > src->bytes_in_buffer)
        ERREXIT (cinfo, JERR_INPUT_EOF);
! 
        src->bytes_in_buffer -= num_bytes;
        src->next_input_byte += num_bytes;
      }
***************
*** 9555,9561 ****
        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;
--- 9555,9561 ----
        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;
***************
*** 9570,9576 ****
  /* Load image IMG for use on frame F.  Patterned after example.c
     from the JPEG lib.  */
  
! static int 
  jpeg_load (f, img)
       struct frame *f;
       struct image *img;
--- 9570,9576 ----
  /* Load image IMG for use on frame F.  Patterned after example.c
     from the JPEG lib.  */
  
! static int
  jpeg_load (f, img)
       struct frame *f;
       struct image *img;
***************
*** 9603,9609 ****
          UNGCPRO;
          return 0;
        }
!   
        fp = fopen (SDATA (file), "r");
        if (fp == NULL)
        {
--- 9603,9609 ----
          UNGCPRO;
          return 0;
        }
! 
        fp = fopen (SDATA (file), "r");
        if (fp == NULL)
        {
***************
*** 9617,9623 ****
       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)
--- 9617,9623 ----
       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)
***************
*** 9628,9634 ****
          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);
--- 9628,9634 ----
          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);
***************
*** 9639,9645 ****
  
        /* Free pixmap and colors.  */
        x_clear_image (f, img);
!       
        UNGCPRO;
        return 0;
      }
--- 9639,9645 ----
  
        /* Free pixmap and colors.  */
        x_clear_image (f, img);
! 
        UNGCPRO;
        return 0;
      }
***************
*** 9689,9695 ****
      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
--- 9689,9695 ----
      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
***************
*** 9725,9731 ****
    /* 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);
--- 9725,9731 ----
    /* 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);
***************
*** 9806,9815 ****
  {
    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;
  }
--- 9806,9815 ----
  {
    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;
  }
***************
*** 9873,9894 ****
      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;
  }
--- 9873,9894 ----
      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;
  }
***************
*** 9939,9945 ****
  {
    char buf[512];
    int len;
!   
    len = sprintf (buf, "TIFF error: %s ", title);
    vsprintf (buf + len, format, ap);
    add_to_log (buf, Qnil, Qnil);
--- 9939,9945 ----
  {
    char buf[512];
    int len;
! 
    len = sprintf (buf, "TIFF error: %s ", title);
    vsprintf (buf + len, format, ap);
    add_to_log (buf, Qnil, Qnil);
***************
*** 9953,9959 ****
  {
    char buf[512];
    int len;
!   
    len = sprintf (buf, "TIFF warning: %s ", title);
    vsprintf (buf + len, format, ap);
    add_to_log (buf, Qnil, Qnil);
--- 9953,9959 ----
  {
    char buf[512];
    int len;
! 
    len = sprintf (buf, "TIFF warning: %s ", title);
    vsprintf (buf + len, format, ap);
    add_to_log (buf, Qnil, Qnil);
***************
*** 9996,10002 ****
          UNGCPRO;
          return 0;
        }
!         
        /* Try to open the image file.  */
        tiff = TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
--- 9996,10002 ----
          UNGCPRO;
          return 0;
        }
! 
        /* Try to open the image file.  */
        tiff = TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
***************
*** 10035,10041 ****
    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)
--- 10035,10041 ----
    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)
***************
*** 10061,10081 ****
    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)); 
        }
      }
  
    /* 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;
  
--- 10061,10081 ----
    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));
        }
      }
  
    /* 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;
  
***************
*** 10167,10176 ****
  {
    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;
  }
--- 10167,10176 ----
  {
    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;
  }
***************
*** 10245,10251 ****
          UNGCPRO;
          return 0;
        }
!   
        /* Open the GIF file.  */
        gif = DGifOpenFileName (SDATA (file));
        if (gif == NULL)
--- 10245,10251 ----
          UNGCPRO;
          return 0;
        }
! 
        /* Open the GIF file.  */
        gif = DGifOpenFileName (SDATA (file));
        if (gif == NULL)
***************
*** 10303,10316 ****
        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;
--- 10303,10316 ----
        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;
***************
*** 10323,10329 ****
    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 
       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.  */
--- 10323,10329 ----
    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
       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.  */
***************
*** 10352,10358 ****
       `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};
--- 10352,10358 ----
       `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};
***************
*** 10370,10383 ****
              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];
        }
      }
--- 10370,10383 ----
              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];
        }
      }
***************
*** 10390,10406 ****
            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;
  }
--- 10390,10406 ----
            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;
  }
***************
*** 10500,10508 ****
    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;
  
--- 10500,10508 ----
    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;
  
***************
*** 10568,10574 ****
        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
--- 10568,10574 ----
        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
***************
*** 10579,10590 ****
           (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))
--- 10579,10590 ----
           (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))
***************
*** 10622,10628 ****
       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];
--- 10622,10628 ----
       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];
***************
*** 10646,10655 ****
        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.  */
--- 10646,10655 ----
        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.  */
***************
*** 10678,10684 ****
        else
        image_error ("Cannot get X image of `%s'; colors will not be freed",
                     img->spec, Qnil);
!       
        UNBLOCK_INPUT;
      }
  
--- 10678,10684 ----
        else
        image_error ("Cannot get X image of `%s'; colors will not be freed",
                     img->spec, Qnil);
! 
        UNBLOCK_INPUT;
      }
  
***************
*** 10781,10788 ****
        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, 
                               (unsigned char **) &tmp_data);
        if (rc == Success && tmp_data)
        prop_value = make_string (tmp_data, size);
--- 10781,10788 ----
        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,
                               (unsigned char **) &tmp_data);
        if (rc == Success && tmp_data)
        prop_value = make_string (tmp_data, size);
***************
*** 10831,10837 ****
  {
    EMACS_TIME delay;
    int secs, usecs = 0;
!   
    cancel_hourglass ();
  
    if (INTEGERP (Vhourglass_delay)
--- 10831,10837 ----
  {
    EMACS_TIME delay;
    int secs, usecs = 0;
! 
    cancel_hourglass ();
  
    if (INTEGERP (Vhourglass_delay)
***************
*** 10847,10853 ****
      }
    else
      secs = DEFAULT_HOURGLASS_DELAY;
!   
    EMACS_SET_SECS_USECS (delay, secs, usecs);
    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
                                     show_hourglass, NULL);
--- 10847,10853 ----
      }
    else
      secs = DEFAULT_HOURGLASS_DELAY;
! 
    EMACS_SET_SECS_USECS (delay, secs, usecs);
    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
                                     show_hourglass, NULL);
***************
*** 10865,10871 ****
        cancel_atimer (hourglass_atimer);
        hourglass_atimer = NULL;
      }
!   
    if (hourglass_shown_p)
      hide_hourglass ();
  }
--- 10865,10871 ----
        cancel_atimer (hourglass_atimer);
        hourglass_atimer = NULL;
      }
! 
    if (hourglass_shown_p)
      hide_hourglass ();
  }
***************
*** 10891,10907 ****
    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
--- 10891,10907 ----
    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
***************
*** 10909,10922 ****
  #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,
--- 10909,10922 ----
  #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,
***************
*** 10924,10930 ****
                                         CopyFromParent,
                                         mask, &attrs);
                    }
!       
                  XMapRaised (dpy, f->output_data.x->hourglass_window);
                  XFlush (dpy);
                }
--- 10924,10930 ----
                                         CopyFromParent,
                                         mask, &attrs);
                    }
! 
                  XMapRaised (dpy, f->output_data.x->hourglass_window);
                  XFlush (dpy);
                }
***************
*** 10951,10957 ****
        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)
--- 10951,10957 ----
        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)
***************
*** 10980,10986 ****
                                           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;
--- 10980,10986 ----
                                           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;
***************
*** 11013,11019 ****
        tip_window = None;
        tip_frame = Qnil;
      }
!   
    return deleted;
  }
  
--- 11013,11019 ----
        tip_window = None;
        tip_frame = Qnil;
      }
! 
    return deleted;
  }
  
***************
*** 11077,11083 ****
    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);
  
--- 11077,11083 ----
    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);
  
***************
*** 11113,11119 ****
    {
      Lisp_Object black;
      struct gcpro gcpro1;
!     
      black = build_string ("black");
      GCPRO1 (black);
      f->output_data.x->foreground_pixel
--- 11113,11119 ----
    {
      Lisp_Object black;
      struct gcpro gcpro1;
! 
      black = build_string ("black");
      GCPRO1 (black);
      f->output_data.x->foreground_pixel
***************
*** 11163,11169 ****
        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");
--- 11163,11169 ----
        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");
***************
*** 11188,11194 ****
  
    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).  */
--- 11188,11194 ----
  
    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).  */
***************
*** 11226,11232 ****
       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);
  
--- 11226,11232 ----
       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);
  
***************
*** 11249,11260 ****
    {
      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).  */
--- 11249,11260 ----
    {
      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).  */
***************
*** 11293,11304 ****
    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.
  
--- 11293,11304 ----
    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.
  
***************
*** 11313,11324 ****
      /* 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;
--- 11313,11324 ----
      /* 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;
***************
*** 11361,11371 ****
    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))
--- 11361,11371 ----
    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))
***************
*** 11434,11440 ****
    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);
--- 11434,11440 ----
    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);
***************
*** 11445,11456 ****
      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
--- 11445,11456 ----
      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
***************
*** 11470,11476 ****
          && !NILP (Fequal (last_parms, parms)))
        {
          struct frame *f = XFRAME (tip_frame);
!         
          /* Only DX and DY have changed.  */
          if (!NILP (tip_timer))
            {
--- 11470,11476 ----
          && !NILP (Fequal (last_parms, parms)))
        {
          struct frame *f = XFRAME (tip_frame);
! 
          /* Only DX and DY have changed.  */
          if (!NILP (tip_timer))
            {
***************
*** 11517,11523 ****
    /* 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
--- 11517,11523 ----
    /* 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
***************
*** 11532,11538 ****
        w->width = make_number (80);
        w->height = make_number (40);
      }
!   
    f->window_width = XINT (w->width);
    adjust_glyphs (f);
    w->pseudo_window_p = 1;
--- 11532,11538 ----
        w->width = make_number (80);
        w->height = make_number (40);
      }
! 
    f->window_width = XINT (w->width);
    adjust_glyphs (f);
    w->pseudo_window_p = 1;
***************
*** 11570,11576 ****
        }
        else
        row_width = row->pixel_width;
!       
        height += row->height;
        width = max (width, row_width);
      }
--- 11570,11576 ----
        }
        else
        row_width = row->pixel_width;
! 
        height += row->height;
        width = max (width, row_width);
      }
***************
*** 11589,11595 ****
                     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);
--- 11589,11595 ----
                     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);
***************
*** 11620,11635 ****
    /* 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);
  
--- 11620,11635 ----
    /* 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);
  
***************
*** 11732,11738 ****
    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;
--- 11732,11738 ----
    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;
***************
*** 11755,11761 ****
    help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
    XtSetSensitive (help, False);
  
!   /* Mark OK button as default.  */ 
    XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
                 XmNshowAsDefault, True, NULL);
  
--- 11755,11761 ----
    help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
    XtSetSensitive (help, False);
  
!   /* Mark OK button as default.  */
    XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON),
                 XmNshowAsDefault, True, NULL);
  
***************
*** 11815,11821 ****
      {
        XmString text;
        String data;
!       
        XtVaGetValues (dialog, XmNtextString, &text, NULL);
        XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
        XmStringFree (text);
--- 11815,11821 ----
      {
        XmString text;
        String data;
! 
        XtVaGetValues (dialog, XmNtextString, &text, NULL);
        XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
        XmStringFree (text);
***************
*** 11834,11840 ****
    /* Make "Cancel" equivalent to C-g.  */
    if (NILP (file))
      Fsignal (Qquit, Qnil);
!   
    return unbind_to (count, file);
  }
  
--- 11834,11840 ----
    /* Make "Cancel" equivalent to C-g.  */
    if (NILP (file))
      Fsignal (Qquit, Qnil);
! 
    return unbind_to (count, file);
  }
  
***************
*** 11858,11864 ****
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
    char *cdef_file;
    char *cprompt;
!   
    GCPRO5 (prompt, dir, default_filename, mustmatch, file);
    CHECK_STRING (prompt);
    CHECK_STRING (dir);
--- 11858,11864 ----
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
    char *cdef_file;
    char *cprompt;
! 
    GCPRO5 (prompt, dir, default_filename, mustmatch, file);
    CHECK_STRING (prompt);
    CHECK_STRING (dir);
***************
*** 11874,11880 ****
      cdef_file = SDATA (dir);
  
    fn = xg_get_file_name (f, SDATA (prompt), cdef_file, ! NILP (mustmatch));
!   
    if (fn)
      {
        file = build_string (fn);
--- 11874,11880 ----
      cdef_file = SDATA (dir);
  
    fn = xg_get_file_name (f, SDATA (prompt), cdef_file, ! NILP (mustmatch));
! 
    if (fn)
      {
        file = build_string (fn);
***************
*** 11887,11893 ****
    /* Make "Cancel" equivalent to C-g.  */
    if (NILP (file))
      Fsignal (Qquit, Qnil);
!   
    return unbind_to (count, file);
  }
  
--- 11887,11893 ----
    /* Make "Cancel" equivalent to C-g.  */
    if (NILP (file))
      Fsignal (Qquit, Qnil);
! 
    return unbind_to (count, file);
  }
  
***************
*** 11938,11944 ****
        UNBLOCK_INPUT;
        return Qnil;
      }
!   
    have_keys = Qnil;
    kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
    if (kb)
--- 11938,11944 ----
        UNBLOCK_INPUT;
        return Qnil;
      }
! 
    have_keys = Qnil;
    kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
    if (kb)
***************
*** 11965,11971 ****
        }
  
        XkbFreeClientMap (kb, 0, True);
!   
        if (delete_keycode
          && backspace_keycode
          && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode
--- 11965,11971 ----
        }
  
        XkbFreeClientMap (kb, 0, True);
! 
        if (delete_keycode
          && backspace_keycode
          && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode
***************
*** 12095,12101 ****
    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);
  
--- 12095,12101 ----
    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);
  
***************
*** 12163,12169 ****
    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.  */);
--- 12163,12169 ----
    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.  */);
***************
*** 12199,12205 ****
      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
--- 12199,12205 ----
      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
***************
*** 12268,12274 ****
    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;
  
--- 12268,12274 ----
    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;
  
***************
*** 12276,12282 ****
         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;
--- 12276,12282 ----
         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;
***************
*** 12317,12332 ****
    Qxpm = intern ("xpm");
    staticpro (&Qxpm);
  #endif
!   
  #if HAVE_JPEG
    Qjpeg = intern ("jpeg");
    staticpro (&Qjpeg);
! #endif 
  
  #if HAVE_TIFF
    Qtiff = intern ("tiff");
    staticpro (&Qtiff);
! #endif 
  
  #if HAVE_GIF
    Qgif = intern ("gif");
--- 12317,12332 ----
    Qxpm = intern ("xpm");
    staticpro (&Qxpm);
  #endif
! 
  #if HAVE_JPEG
    Qjpeg = intern ("jpeg");
    staticpro (&Qjpeg);
! #endif
  
  #if HAVE_TIFF
    Qtiff = intern ("tiff");
    staticpro (&Qtiff);
! #endif
  
  #if HAVE_GIF
    Qgif = intern ("gif");
***************
*** 12366,12392 ****
  {
    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
--- 12366,12392 ----
  {
    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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]