emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/macfns.c
Date: Fri, 06 Sep 2002 05:04:22 -0400

Index: emacs/src/macfns.c
diff -c emacs/src/macfns.c:1.13 emacs/src/macfns.c:1.14
*** emacs/src/macfns.c:1.13     Fri Aug 30 15:47:57 2002
--- emacs/src/macfns.c  Fri Sep  6 05:04:22 2002
***************
*** 194,200 ****
        (insert (format "\");\n  staticpro (&%s);\n" (car symbol-list)))
        (setq symbol-list (cdr symbol-list)))))
  
!   */        
  
  /*&&& symbols declared here &&&*/
  Lisp_Object Qauto_raise;
--- 194,200 ----
        (insert (format "\");\n  staticpro (&%s);\n" (car symbol-list)))
        (setq symbol-list (cdr symbol-list)))))
  
!   */
  
  /*&&& symbols declared here &&&*/
  Lisp_Object Qauto_raise;
***************
*** 301,307 ****
  
  /* Nonzero if we can use mouse menus.
     You should not call this unless HAVE_MENUS is defined.  */
!   
  int
  have_menus_p ()
  {
--- 301,307 ----
  
  /* Nonzero if we can use mouse menus.
     You should not call this unless HAVE_MENUS is defined.  */
! 
  int
  have_menus_p ()
  {
***************
*** 343,349 ****
    if (NILP (frame))
      {
        struct frame *sf = XFRAME (selected_frame);
!       
        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
        return FRAME_MAC_DISPLAY_INFO (sf);
        else
--- 343,349 ----
    if (NILP (frame))
      {
        struct frame *sf = XFRAME (selected_frame);
! 
        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
        return FRAME_MAC_DISPLAY_INFO (sf);
        else
***************
*** 494,500 ****
    /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */
  
    id = x_allocate_bitmap_record (f);
!   
    if (width % 16 != 0)
      return -1;
  
--- 494,500 ----
    /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */
  
    id = x_allocate_bitmap_record (f);
! 
    if (width % 16 != 0)
      return -1;
  
***************
*** 557,563 ****
    if (hinst == NULL)
        return -1;
  
!   
    result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
                            filename, &width, &height, &bitmap, &xhot, &yhot);
    if (result != BitmapSuccess)
--- 557,563 ----
    if (hinst == NULL)
        return -1;
  
! 
    result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
                            filename, &width, &height, &bitmap, &xhot, &yhot);
    if (result != BitmapSuccess)
***************
*** 780,786 ****
    /* Process foreground_color and background_color before anything else.
       They are independent of other properties, but other properties (e.g.,
       cursor_color) are dependent upon them.  */
!   for (p = 0; p < i; p++) 
      {
        Lisp_Object prop, val;
  
--- 780,786 ----
    /* Process foreground_color and background_color before anything else.
       They are independent of other properties, but other properties (e.g.,
       cursor_color) are dependent upon them.  */
!   for (p = 0; p < i; p++)
      {
        Lisp_Object prop, val;
  
***************
*** 982,988 ****
  #ifdef TARGET_API_MAC_CARBON
    {
      Rect r;
!     
      GetWindowPortBounds (f->output_data.mac->mWP, &r);
      SetPt (&pt, r.left, r.top);
    }
--- 982,988 ----
  #ifdef TARGET_API_MAC_CARBON
    {
      Rect r;
! 
      GetWindowPortBounds (f->output_data.mac->mWP, &r);
      SetPt (&pt, r.left, r.top);
    }
***************
*** 994,1000 ****
    GetPort (&oldport);
    LocalToGlobal (&pt);
    SetPort (oldport);
!   
    *xptr = pt.h;
    *yptr = pt.v;
  }
--- 994,1000 ----
    GetPort (&oldport);
    LocalToGlobal (&pt);
    SetPort (oldport);
! 
    *xptr = pt.h;
    *yptr = pt.v;
  }
***************
*** 1044,1056 ****
  }
  
  /* The default colors for the Mac color map */
! typedef struct colormap_t 
  {
    unsigned long color;
    char *name;
  } colormap_t;
  
! colormap_t mac_color_map[] = 
  {
    { RGB_TO_ULONG(255, 250, 250), "snow" },
    { RGB_TO_ULONG(248, 248, 255), "ghost white" },
--- 1044,1056 ----
  }
  
  /* The default colors for the Mac color map */
! typedef struct colormap_t
  {
    unsigned long color;
    char *name;
  } colormap_t;
  
! colormap_t mac_color_map[] =
  {
    { RGB_TO_ULONG(255, 250, 250), "snow" },
    { RGB_TO_ULONG(248, 248, 255), "ghost white" },
***************
*** 1405,1411 ****
    { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
    { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
    { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
!   { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },   
    { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
    { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
    { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
--- 1405,1411 ----
    { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
    { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
    { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
!   { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },
    { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
    { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
    { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
***************
*** 1814,1820 ****
    int i;
  
    BLOCK_INPUT;
!   
    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
      if (stricmp (colorname, mac_color_map[i].name) == 0)
        {
--- 1814,1820 ----
    int i;
  
    BLOCK_INPUT;
! 
    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
      if (stricmp (colorname, mac_color_map[i].name) == 0)
        {
***************
*** 1827,1838 ****
    return ret;
  }
  
! Lisp_Object 
  x_to_mac_color (colorname)
       char * colorname;
  {
    register Lisp_Object tail, ret = Qnil;
!   
    BLOCK_INPUT;
  
    if (colorname[0] == '#')
--- 1827,1838 ----
    return ret;
  }
  
! Lisp_Object
  x_to_mac_color (colorname)
       char * colorname;
  {
    register Lisp_Object tail, ret = Qnil;
! 
    BLOCK_INPUT;
  
    if (colorname[0] == '#')
***************
*** 1841,1847 ****
        char *color;
        int size;
        color = colorname + 1;
!       
        size = strlen(color);
        if (size == 3 || size == 6 || size == 9 || size == 12)
        {
--- 1841,1847 ----
        char *color;
        int size;
        color = colorname + 1;
! 
        size = strlen(color);
        if (size == 3 || size == 6 || size == 9 || size == 12)
        {
***************
*** 1850,1856 ****
          pos = 0;
          size /= 3;
          colorval = 0;
!         
          for (i = 0; i < 3; i++)
            {
              char *end;
--- 1850,1856 ----
          pos = 0;
          size /= 3;
          colorval = 0;
! 
          for (i = 0; i < 3; i++)
            {
              char *end;
***************
*** 1906,1912 ****
        {
          char *end;
          unsigned long value;
!         
          /* The check for 'x' in the following conditional takes into
             account the fact that strtol allows a "0x" in front of
             our numbers, and we don't.  */
--- 1906,1912 ----
        {
          char *end;
          unsigned long value;
! 
          /* The check for 'x' in the following conditional takes into
             account the fact that strtol allows a "0x" in front of
             our numbers, and we don't.  */
***************
*** 1990,1996 ****
      }
  
    ret = mac_color_map_lookup (colorname);
!   
    UNBLOCK_INPUT;
    return ret;
  }
--- 1990,1996 ----
      }
  
    ret = mac_color_map_lookup (colorname);
! 
    UNBLOCK_INPUT;
    return ret;
  }
***************
*** 2029,2035 ****
  
    tem = x_to_mac_color (color);
  
!   if (!NILP (tem)) 
      {
        if (f)
          {
--- 2029,2035 ----
  
    tem = x_to_mac_color (color);
  
!   if (!NILP (tem))
      {
        if (f)
          {
***************
*** 2046,2052 ****
  
        return 1;
      }
!   else 
      {
        return 0;
      }
--- 2046,2052 ----
  
        return 1;
      }
!   else
      {
        return 0;
      }
***************
*** 2220,2226 ****
    else
      hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
    x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
!   
    x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
    if (!EQ (Qnil, Vx_mode_pointer_shape))
      {
--- 2220,2226 ----
    else
      hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
    x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
! 
    x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
    if (!EQ (Qnil, Vx_mode_pointer_shape))
      {
***************
*** 2303,2309 ****
        && f->output_data.w32->modeline_cursor != 0)
      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
    f->output_data.w32->modeline_cursor = mode_cursor;
!   
    if (cross_cursor != f->output_data.w32->cross_cursor
        && f->output_data.w32->cross_cursor != 0)
      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
--- 2303,2309 ----
        && f->output_data.w32->modeline_cursor != 0)
      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
    f->output_data.w32->modeline_cursor = mode_cursor;
! 
    if (cross_cursor != f->output_data.w32->cross_cursor
        && f->output_data.w32->cross_cursor != 0)
      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
***************
*** 2329,2335 ****
    else
      fore_pixel = FRAME_BACKGROUND_PIXEL (f);
    f->output_data.mac->cursor_pixel = x_decode_color (f, arg, 
BLACK_PIX_DEFAULT (f));
!   
    /* Make sure that the cursor color differs from the background color.  */
    if (f->output_data.mac->cursor_pixel == FRAME_BACKGROUND_PIXEL (f))
      {
--- 2329,2335 ----
    else
      fore_pixel = FRAME_BACKGROUND_PIXEL (f);
    f->output_data.mac->cursor_pixel = x_decode_color (f, arg, 
BLACK_PIX_DEFAULT (f));
! 
    /* Make sure that the cursor color differs from the background color.  */
    if (f->output_data.mac->cursor_pixel == FRAME_BACKGROUND_PIXEL (f))
      {
***************
*** 2412,2418 ****
    if (NILP (arg) && NILP (oldval))
      return;
  
!   if (STRINGP (arg) && STRINGP (oldval) 
        && EQ (Fstring_equal (oldval, arg), Qt))
      return;
  
--- 2412,2418 ----
    if (NILP (arg) && NILP (oldval))
      return;
  
!   if (STRINGP (arg) && STRINGP (oldval)
        && EQ (Fstring_equal (oldval, arg), Qt))
      return;
  
***************
*** 2520,2526 ****
              ? 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))
--- 2520,2526 ----
              ? 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))
***************
*** 2778,2784 ****
       Lisp_Object name;
       int explicit;
  {
!   /* Make sure that requests from lisp code override requests from 
       Emacs redisplay code.  */
    if (explicit)
      {
--- 2778,2784 ----
       Lisp_Object name;
       int explicit;
  {
!   /* Make sure that requests from lisp code override requests from
       Emacs redisplay code.  */
    if (explicit)
      {
***************
*** 2826,2832 ****
  #endif
  
        BLOCK_INPUT;
!       
        {
        Str255 windowTitle;
        if (strlen (SDATA (name)) < 255)
--- 2826,2832 ----
  #endif
  
        BLOCK_INPUT;
! 
        {
        Str255 windowTitle;
        if (strlen (SDATA (name)) < 255)
***************
*** 2953,2959 ****
        = (NILP (arg)
           ? vertical_scroll_bar_none
           : EQ (Qright, arg)
!            ? vertical_scroll_bar_right 
             : vertical_scroll_bar_left);
  
        /* We set this parameter before creating the window for the
--- 2953,2959 ----
        = (NILP (arg)
           ? vertical_scroll_bar_none
           : EQ (Qright, arg)
!            ? vertical_scroll_bar_right
             : vertical_scroll_bar_left);
  
        /* We set this parameter before creating the window for the
***************
*** 2985,2991 ****
        /* 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;
--- 2985,2991 ----
        /* 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;
***************
*** 3008,3014 ****
      }
    change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
!   XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; 
  }
  
  /* Subroutines of creating an frame.  */
--- 3008,3014 ----
      }
    change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
!   XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
  }
  
  /* Subroutines of creating an frame.  */
***************
*** 3241,3247 ****
              if (!strcmp (SDATA (tem), "on")
                  || !strcmp (SDATA (tem), "true"))
                return Qt;
!             else 
                return Qnil;
  
            case RES_TYPE_STRING:
--- 3241,3247 ----
              if (!strcmp (SDATA (tem), "on")
                  || !strcmp (SDATA (tem), "true"))
                return Qt;
!             else
                return Qnil;
  
            case RES_TYPE_STRING:
***************
*** 3310,3316 ****
   *   It returns a bitmask that indicates which of the four values
   *   were actually found in the string.  For each value found,
   *   the corresponding argument is updated;  for each value
!  *   not found, the corresponding argument is left unchanged. 
   */
  
  static int
--- 3310,3316 ----
   *   It returns a bitmask that indicates which of the four values
   *   were actually found in the string.  For each value found,
   *   the corresponding argument is updated;  for each value
!  *   not found, the corresponding argument is left unchanged.
   */
  
  static int
***************
*** 3320,3326 ****
  {
    register int Result = 0;
    int Sign = 1;
!   
    if (*string == '+')
      string++;
    else if (*string == '-')
--- 3320,3326 ----
  {
    register int Result = 0;
    int Sign = 1;
! 
    if (*string == '+')
      string++;
    else if (*string == '-')
***************
*** 3339,3345 ****
      return (-Result);
  }
  
! int 
  XParseGeometry (string, x, y, width, height)
       char *string;
       int *x, *y;
--- 3339,3345 ----
      return (-Result);
  }
  
! int
  XParseGeometry (string, x, y, width, height)
       char *string;
       int *x, *y;
***************
*** 3350,3372 ****
    unsigned int tempWidth, tempHeight;
    int tempX, tempY;
    char *nextCharacter;
!   
    if ((string == NULL) || (*string == '\0')) return (mask);
    if (*string == '=')
      string++;  /* ignore possible '=' at beg of geometry spec */
!   
    strind = (char *)string;
!   if (*strind != '+' && *strind != '-' && *strind != 'x') 
      {
        tempWidth = read_integer (strind, &nextCharacter);
!       if (strind == nextCharacter) 
        return (0);
        strind = nextCharacter;
        mask |= WidthValue;
      }
!   
!   if (*strind == 'x' || *strind == 'X') 
!     { 
        strind++;
        tempHeight = read_integer (strind, &nextCharacter);
        if (strind == nextCharacter)
--- 3350,3372 ----
    unsigned int tempWidth, tempHeight;
    int tempX, tempY;
    char *nextCharacter;
! 
    if ((string == NULL) || (*string == '\0')) return (mask);
    if (*string == '=')
      string++;  /* ignore possible '=' at beg of geometry spec */
! 
    strind = (char *)string;
!   if (*strind != '+' && *strind != '-' && *strind != 'x')
      {
        tempWidth = read_integer (strind, &nextCharacter);
!       if (strind == nextCharacter)
        return (0);
        strind = nextCharacter;
        mask |= WidthValue;
      }
! 
!   if (*strind == 'x' || *strind == 'X')
!     {
        strind++;
        tempHeight = read_integer (strind, &nextCharacter);
        if (strind == nextCharacter)
***************
*** 3374,3383 ****
        strind = nextCharacter;
        mask |= HeightValue;
      }
!   
!   if ((*strind == '+') || (*strind == '-')) 
      {
!       if (*strind == '-') 
        {
          strind++;
          tempX = -read_integer (strind, &nextCharacter);
--- 3374,3383 ----
        strind = nextCharacter;
        mask |= HeightValue;
      }
! 
!   if ((*strind == '+') || (*strind == '-'))
      {
!       if (*strind == '-')
        {
          strind++;
          tempX = -read_integer (strind, &nextCharacter);
***************
*** 3388,3394 ****
  
        }
        else
!       {       
          strind++;
          tempX = read_integer (strind, &nextCharacter);
          if (strind == nextCharacter)
--- 3388,3394 ----
  
        }
        else
!       {
          strind++;
          tempX = read_integer (strind, &nextCharacter);
          if (strind == nextCharacter)
***************
*** 3396,3404 ****
          strind = nextCharacter;
        }
        mask |= XValue;
!       if ((*strind == '+') || (*strind == '-')) 
        {
!         if (*strind == '-') 
            {
              strind++;
              tempY = -read_integer (strind, &nextCharacter);
--- 3396,3404 ----
          strind = nextCharacter;
        }
        mask |= XValue;
!       if ((*strind == '+') || (*strind == '-'))
        {
!         if (*strind == '-')
            {
              strind++;
              tempY = -read_integer (strind, &nextCharacter);
***************
*** 3419,3430 ****
          mask |= YValue;
        }
      }
!   
    /* If strind isn't at the end of the string the it's an invalid
       geometry specification. */
!   
    if (*strind != '\0') return (0);
!   
    if (mask & XValue)
      *x = tempX;
    if (mask & YValue)
--- 3419,3430 ----
          mask |= YValue;
        }
      }
! 
    /* If strind isn't at the end of the string the it's an invalid
       geometry specification. */
! 
    if (*strind != '\0') return (0);
! 
    if (mask & XValue)
      *x = tempX;
    if (mask & YValue)
***************
*** 3638,3644 ****
       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);
--- 3638,3644 ----
       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);
***************
*** 3942,3948 ****
        error ("Cannot find any usable font");
      UNBLOCK_INPUT;
  
!     x_default_parameter (f, parms, Qfont, font, 
                         "font", "Font", RES_TYPE_STRING);
    }
  
--- 3942,3948 ----
        error ("Cannot find any usable font");
      UNBLOCK_INPUT;
  
!     x_default_parameter (f, parms, Qfont, font,
                         "font", "Font", RES_TYPE_STRING);
    }
  
***************
*** 3995,4001 ****
       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 (0),
--- 3995,4001 ----
       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 (0),
***************
*** 4106,4116 ****
        ;
      }
    UNGCPRO;
!   
    /* Make sure windows on this frame appear in calls to next-window
       and similar functions.  */
    Vwindow_list = Qnil;
!   
    return unbind_to (count, frame);
  }
  
--- 4106,4116 ----
        ;
      }
    UNGCPRO;
! 
    /* Make sure windows on this frame appear in calls to next-window
       and similar functions.  */
    Vwindow_list = Qnil;
! 
    return unbind_to (count, frame);
  }
  
***************
*** 4255,4261 ****
       Lisp_Object display;
  {
    struct mac_display_info *dpyinfo = check_x_display_info (display);
!   
    /* MAC_TODO: check whether this is right */
    return make_number ((unsigned long) (pow (2, dpyinfo->n_cbits)));
  }
--- 4255,4261 ----
       Lisp_Object display;
  {
    struct mac_display_info *dpyinfo = check_x_display_info (display);
! 
    /* MAC_TODO: check whether this is right */
    return make_number ((unsigned long) (pow (2, dpyinfo->n_cbits)));
  }
***************
*** 4266,4272 ****
         doc: /* Returns the maximum request size of the server of display 
DISPLAY.
  The optional argument DISPLAY specifies which display to ask about.
  DISPLAY should be either a frame or a display name (a string).
! If omitted or nil, that stands for the selected frame's display.   */)
    (display)
       Lisp_Object display;
  {
--- 4266,4272 ----
         doc: /* Returns the maximum request size of the server of display 
DISPLAY.
  The optional argument DISPLAY specifies which display to ask about.
  DISPLAY should be either a frame or a display name (a string).
! If omitted or nil, that stands for the selected frame's display.  */)
    (display)
       Lisp_Object display;
  {
***************
*** 4303,4309 ****
  
    if (Gestalt (gestaltSystemVersion, &response) != noErr)
      error ("Cannot get Mac OS version");
!   
    mac_major_version = (response >> 8) & 0xf;
    mac_minor_version = (response >> 4) & 0xf;
  
--- 4303,4309 ----
  
    if (Gestalt (gestaltSystemVersion, &response) != noErr)
      error ("Cannot get Mac OS version");
! 
    mac_major_version = (response >> 8) & 0xf;
    mac_minor_version = (response >> 4) & 0xf;
  
***************
*** 4330,4342 ****
    (display)
       Lisp_Object display;
  {
!   /* MAC_TODO: this is an approximation, and only of the main display */  
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
    short h, v;
!   
    ScreenRes (&h, &v);
!   
    return make_number ((int) (v / 72.0 * 25.4));
  }
  
--- 4330,4342 ----
    (display)
       Lisp_Object display;
  {
!   /* MAC_TODO: this is an approximation, and only of the main display */
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
    short h, v;
! 
    ScreenRes (&h, &v);
! 
    return make_number ((int) (v / 72.0 * 25.4));
  }
  
***************
*** 4348,4360 ****
    (display)
       Lisp_Object display;
  {
!   /* MAC_TODO: this is an approximation, and only of the main display */  
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
    short h, v;
!   
    ScreenRes (&h, &v);
!   
    return make_number ((int) (h / 72.0 * 25.4));
  }
  
--- 4348,4360 ----
    (display)
       Lisp_Object display;
  {
!   /* MAC_TODO: this is an approximation, and only of the main display */
  
    struct mac_display_info *dpyinfo = check_x_display_info (display);
    short h, v;
! 
    ScreenRes (&h, &v);
! 
    return make_number ((int) (h / 72.0 * 25.4));
  }
  
***************
*** 4691,4702 ****
       Lisp_Object object;
  {
    int valid_p = 0;
!   
    if (CONSP (object) && EQ (XCAR (object), Qimage))
      {
        Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);
        struct image_type *type = lookup_image_type (symbol);
!       
        if (type)
        valid_p = type->valid_p (object);
      }
--- 4691,4702 ----
       Lisp_Object object;
  {
    int valid_p = 0;
! 
    if (CONSP (object) && EQ (XCAR (object), Qimage))
      {
        Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);
        struct image_type *type = lookup_image_type (symbol);
! 
        if (type)
        valid_p = type->valid_p (object);
      }
***************
*** 4814,4820 ****
         was found more than once, it's an error.  */
        keywords[i].value = value;
        ++keywords[i].count;
!       
        if (keywords[i].count > 1)
        return 0;
  
--- 4814,4820 ----
         was found more than once, it's an error.  */
        keywords[i].value = value;
        ++keywords[i].count;
! 
        if (keywords[i].count > 1)
        return 0;
  
***************
*** 4864,4870 ****
  
        case IMAGE_FUNCTION_VALUE:
          value = indirect_function (value);
!         if (SUBRP (value) 
              || COMPILEDP (value)
              || (CONSP (value) && EQ (XCAR (value), Qlambda)))
            break;
--- 4864,4870 ----
  
        case IMAGE_FUNCTION_VALUE:
          value = indirect_function (value);
!         if (SUBRP (value)
              || COMPILEDP (value)
              || (CONSP (value) && EQ (XCAR (value), Qlambda)))
            break;
***************
*** 4913,4919 ****
       int *found;
  {
    Lisp_Object tail;
!   
    xassert (valid_image_p (spec));
  
    for (tail = XCDR (spec);
--- 4913,4919 ----
       int *found;
  {
    Lisp_Object tail;
! 
    xassert (valid_image_p (spec));
  
    for (tail = XCDR (spec);
***************
*** 4927,4938 ****
          return XCAR (XCDR (tail));
        }
      }
!   
    if (found)
      *found = 0;
    return Qnil;
  }
!      
  
  
  
--- 4927,4938 ----
          return XCAR (XCDR (tail));
        }
      }
! 
    if (found)
      *found = 0;
    return Qnil;
  }
! 
  
  
  
***************
*** 4953,4959 ****
       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));
--- 4953,4959 ----
       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));
***************
*** 5014,5020 ****
    if (img->pixmap == 0 && !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.  */
--- 5014,5020 ----
    if (img->pixmap == 0 && !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.  */
***************
*** 5073,5079 ****
    if (img->ncolors)
      {
        int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
!       
        /* If display has an immutable color map, freeing colors is not
         necessary and some servers don't allow it.  So don't do it.  */
        if (class != StaticColor
--- 5073,5079 ----
    if (img->ncolors)
      {
        int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
! 
        /* If display has an immutable color map, freeing colors is not
         necessary and some servers don't allow it.  So don't do it.  */
        if (class != StaticColor
***************
*** 5087,5093 ****
                       img->ncolors, 0);
          UNBLOCK_INPUT;
        }
!       
        xfree (img->colors);
        img->colors = NULL;
        img->ncolors = 0;
--- 5087,5093 ----
                       img->ncolors, 0);
          UNBLOCK_INPUT;
        }
! 
        xfree (img->colors);
        img->colors = NULL;
        img->ncolors = 0;
***************
*** 5149,5155 ****
  {
    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);
--- 5149,5155 ----
  {
    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);
***************
*** 5174,5180 ****
  
        /* 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);
--- 5174,5180 ----
  
        /* 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);
***************
*** 5207,5213 ****
  
        EMACS_GET_TIME (t);
        old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
!       
        for (i = 0; i < c->used; ++i)
        {
          struct image *img = c->images[i];
--- 5207,5213 ----
  
        EMACS_GET_TIME (t);
        old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
! 
        for (i = 0; i < c->used; ++i)
        {
          struct image *img = c->images[i];
***************
*** 5244,5250 ****
    if (EQ (frame, Qt))
      {
        Lisp_Object tail;
!       
        FOR_EACH_FRAME (tail, frame)
        if (FRAME_MAC_P (XFRAME (frame)))
          clear_image_cache (XFRAME (frame), 1);
--- 5244,5250 ----
    if (EQ (frame, Qt))
      {
        Lisp_Object tail;
! 
        FOR_EACH_FRAME (tail, frame)
        if (FRAME_MAC_P (XFRAME (frame)))
          clear_image_cache (XFRAME (frame), 1);
***************
*** 5275,5281 ****
       specification.  */
    xassert (FRAME_WINDOW_P (f));
    xassert (valid_image_p (spec));
!   
    GCPRO1 (spec);
  
    /* Look up SPEC in the hash table of the image cache.  */
--- 5275,5281 ----
       specification.  */
    xassert (FRAME_WINDOW_P (f));
    xassert (valid_image_p (spec));
! 
    GCPRO1 (spec);
  
    /* Look up SPEC in the hash table of the image cache.  */
***************
*** 5332,5338 ****
              if (XINT (XCDR (margin)) > 0)
                img->vmargin = XFASTINT (XCDR (margin));
            }
!         
          relief = image_spec_value (spec, QCrelief, NULL);
          if (INTEGERP (relief))
            {
--- 5332,5338 ----
              if (XINT (XCDR (margin)) > 0)
                img->vmargin = XFASTINT (XCDR (margin));
            }
! 
          relief = image_spec_value (spec, QCrelief, NULL);
          if (INTEGERP (relief))
            {
***************
*** 5346,5354 ****
    /* 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;
  }
--- 5346,5354 ----
    /* 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;
  }
***************
*** 5502,5508 ****
       Pixmap pixmap;
  {
    GC gc;
!   
    xassert (interrupt_input_blocked);
    gc = XCreateGC (NULL, pixmap, 0, NULL);
    XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);
--- 5502,5508 ----
       Pixmap pixmap;
  {
    GC gc;
! 
    xassert (interrupt_input_blocked);
    gc = XCreateGC (NULL, pixmap, 0, NULL);
    XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);
***************
*** 5536,5542 ****
  
    /* Try to find FILE in data-directory, then x-bitmap-file-path.  */
    fd = openp (search_path, file, Qnil, &file_found, Qnil);
!   
    if (fd < 0)
      file_found = Qnil;
    else
--- 5536,5542 ----
  
    /* Try to find FILE in data-directory, then x-bitmap-file-path.  */
    fd = openp (search_path, file, Qnil, &file_found, Qnil);
! 
    if (fd < 0)
      file_found = Qnil;
    else
***************
*** 5616,5622 ****
    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
--- 5616,5622 ----
    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
***************
*** 5647,5653 ****
       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;
--- 5647,5653 ----
       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;
***************
*** 5673,5685 ****
        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;
--- 5673,5685 ----
        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;
***************
*** 5724,5730 ****
    if (kw[XBM_ASCENT].count
        && XFASTINT (kw[XBM_ASCENT].value) > 100)
      return 0;
!   
    return 1;
  }
  
--- 5724,5730 ----
    if (kw[XBM_ASCENT].count
        && XFASTINT (kw[XBM_ASCENT].value) > 100)
      return 0;
! 
    return 1;
  }
  
***************
*** 5742,5748 ****
       int *ival;
  {
    int c;
!   
    /* Skip white space.  */
    while ((c = fgetc (fp)) != EOF && isspace (c))
      ;
--- 5742,5748 ----
       int *ival;
  {
    int c;
! 
    /* Skip white space.  */
    while ((c = fgetc (fp)) != EOF && isspace (c))
      ;
***************
*** 5752,5758 ****
    else if (isdigit (c))
      {
        int value = 0, digit;
!       
        if (c == '0')
        {
          c = fgetc (fp);
--- 5752,5758 ----
    else if (isdigit (c))
      {
        int value = 0, digit;
! 
        if (c == '0')
        {
          c = fgetc (fp);
***************
*** 5836,5842 ****
       if (LA1 != (TOKEN))      \
         goto failure;          \
       else                     \
!        match ()       
  
  #define expect_ident(IDENT)                                   \
       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)        \
--- 5836,5842 ----
       if (LA1 != (TOKEN))      \
         goto failure;          \
       else                     \
!        match ()
  
  #define expect_ident(IDENT)                                   \
       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)        \
***************
*** 5880,5886 ****
      {
        if (strcmp (buffer, "unsigned") == 0)
        {
!         match (); 
          expect_ident ("char");
        }
        else if (strcmp (buffer, "short") == 0)
--- 5880,5886 ----
      {
        if (strcmp (buffer, "unsigned") == 0)
        {
!         match ();
          expect_ident ("char");
        }
        else if (strcmp (buffer, "short") == 0)
***************
*** 5895,5901 ****
        else
        goto failure;
      }
!   else 
      goto failure;
  
    expect (XBM_TK_IDENT);
--- 5895,5901 ----
        else
        goto failure;
      }
!   else
      goto failure;
  
    expect (XBM_TK_IDENT);
***************
*** 5910,5916 ****
  
    if (v10)
      {
!       
        for (i = 0; i < nbytes; i += 2)
        {
          int val = value;
--- 5910,5916 ----
  
    if (v10)
      {
! 
        for (i = 0; i < nbytes; i += 2)
        {
          int val = value;
***************
*** 5919,5925 ****
          *p++ = val;
          if (!padding_p || ((i + 2) % bytes_per_line))
            *p++ = value >> 8;
!         
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
--- 5919,5925 ----
          *p++ = val;
          if (!padding_p || ((i + 2) % bytes_per_line))
            *p++ = value >> 8;
! 
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
***************
*** 5932,5940 ****
        {
          int val = value;
          expect (XBM_TK_NUMBER);
!         
          *p++ = val;
!         
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
--- 5932,5940 ----
        {
          int val = value;
          expect (XBM_TK_NUMBER);
! 
          *p++ = val;
! 
          if (LA1 == ',' || LA1 == '}')
            match ();
          else
***************
*** 5946,5952 ****
    return 1;
  
   failure:
!   
    fclose (fp);
    if (*data)
      {
--- 5946,5952 ----
    return 1;
  
   failure:
! 
    fclose (fp);
    if (*data)
      {
***************
*** 5975,5981 ****
    int success_p = 0;
    Lisp_Object file;
    struct gcpro gcpro1;
!   
    xassert (STRINGP (specified_file));
    file = Qnil;
    GCPRO1 (file);
--- 5975,5981 ----
    int success_p = 0;
    Lisp_Object file;
    struct gcpro gcpro1;
! 
    xassert (STRINGP (specified_file));
    file = Qnil;
    GCPRO1 (file);
***************
*** 5987,5993 ****
        UNGCPRO;
        return 0;
      }
!         
    rc = xbm_read_bitmap_file_data (SDATA (file), &img->width,
                                  &img->height, &data);
    if (rc)
--- 5987,5993 ----
        UNGCPRO;
        return 0;
      }
! 
    rc = xbm_read_bitmap_file_data (SDATA (file), &img->width,
                                  &img->height, &data);
    if (rc)
***************
*** 5996,6009 ****
        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.  */
        value = image_spec_value (img->spec, QCforeground, NULL);
        if (!NILP (value))
        foreground = x_alloc_image_color (f, img, value, foreground);
!       
        value = image_spec_value (img->spec, QCbackground, NULL);
        if (!NILP (value))
        background = x_alloc_image_color (f, img, value, background);
--- 5996,6009 ----
        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.  */
        value = image_spec_value (img->spec, QCforeground, NULL);
        if (!NILP (value))
        foreground = x_alloc_image_color (f, img, value, foreground);
! 
        value = image_spec_value (img->spec, QCbackground, NULL);
        if (!NILP (value))
        background = x_alloc_image_color (f, img, value, background);
***************
*** 6026,6032 ****
        }
        else
        success_p = 1;
!       
        UNBLOCK_INPUT;
  #endif /* MAC_TODO */
      }
--- 6026,6032 ----
        }
        else
        success_p = 1;
! 
        UNBLOCK_INPUT;
  #endif /* MAC_TODO */
      }
***************
*** 6076,6082 ****
        xassert (img->width > 0 && img->height > 0);
  
        BLOCK_INPUT;
!       
        if (fmt[XBM_ASCENT].count)
        img->ascent = XFASTINT (fmt[XBM_ASCENT].value);
  
--- 6076,6082 ----
        xassert (img->width > 0 && img->height > 0);
  
        BLOCK_INPUT;
! 
        if (fmt[XBM_ASCENT].count)
        img->ascent = XFASTINT (fmt[XBM_ASCENT].value);
  
***************
*** 6095,6101 ****
          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)
            {
--- 6095,6101 ----
          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)
            {
***************
*** 6137,6150 ****
  
    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));
--- 6137,6150 ----
  
    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));
***************
*** 6278,6284 ****
        Lisp_Object tail;
        XpmColorSymbol *xpm_syms;
        int i, size;
!       
        attrs.valuemask |= XpmColorSymbols;
  
        /* Count number of symbols.  */
--- 6278,6284 ----
        Lisp_Object tail;
        XpmColorSymbol *xpm_syms;
        int i, size;
! 
        attrs.valuemask |= XpmColorSymbols;
  
        /* Count number of symbols.  */
***************
*** 6319,6325 ****
            UNBLOCK_INPUT;
          return 0;
        }
!       
        rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
                                SDATA (file), &img->pixmap, &img->mask,
                                &attrs);
--- 6319,6325 ----
            UNBLOCK_INPUT;
          return 0;
        }
! 
        rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
                                SDATA (file), &img->pixmap, &img->mask,
                                &attrs);
***************
*** 6359,6377 ****
        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;
--- 6359,6377 ----
        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;
***************
*** 6520,6526 ****
        int rc;
  
        BLOCK_INPUT;
!       
        cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
        color.pixel = pixel;
        XQueryColor (NULL, cmap, &color);
--- 6520,6526 ----
        int rc;
  
        BLOCK_INPUT;
! 
        cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
        color.pixel = pixel;
        XQueryColor (NULL, cmap, &color);
***************
*** 6530,6536 ****
        if (rc)
        {
          ++ct_colors_allocated;
!       
          p = (struct ct_color *) xmalloc (sizeof *p);
          p->r = color.red;
          p->g = color.green;
--- 6530,6536 ----
        if (rc)
        {
          ++ct_colors_allocated;
! 
          p = (struct ct_color *) xmalloc (sizeof *p);
          p->r = color.red;
          p->g = color.green;
***************
*** 6567,6573 ****
        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;
--- 6567,6573 ----
        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;
***************
*** 6625,6631 ****
       int y;
  {
    int x;
!   
    for (x = 0; x < width; ++x)
      XPutPixel (ximg, x, y, pixels[x]);
  }
--- 6625,6631 ----
       int y;
  {
    int x;
! 
    for (x = 0; x < width; ++x)
      XPutPixel (ximg, x, y, pixels[x]);
  }
***************
*** 6691,6697 ****
          int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;
          int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;
          int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;
!         
          out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
                                         b & 0xffff);
        }
--- 6691,6697 ----
          int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;
          int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;
          int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;
! 
          out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
                                         b & 0xffff);
        }
***************
*** 6707,6713 ****
    /* Free the input image, and free resources of IMG.  */
    XDestroyImage (ximg);
    x_clear_image (f, img);
!   
    /* Put the output image into pixmap, and destroy it.  */
    x_put_x_image (f, oimg, pixmap, img->width, img->height);
    x_destroy_x_image (oimg);
--- 6707,6713 ----
    /* Free the input image, and free resources of IMG.  */
    XDestroyImage (ximg);
    x_clear_image (f, img);
! 
    /* Put the output image into pixmap, and destroy it.  */
    x_put_x_image (f, oimg, pixmap, img->width, img->height);
    x_destroy_x_image (oimg);
***************
*** 6742,6748 ****
    unsigned long bg;
  
    BLOCK_INPUT;
!   
    /* Create an image and pixmap serving as mask.  */
    rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
                                    &mask_img, &img->mask);
--- 6742,6748 ----
    unsigned long bg;
  
    BLOCK_INPUT;
! 
    /* Create an image and pixmap serving as mask.  */
    rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
                                    &mask_img, &img->mask);
***************
*** 6760,6766 ****
       take that as color.  Otherwise, try to determine the color
       heuristically. */
    look_at_corners_p = 1;
!   
    if (CONSP (how))
      {
        int rgb[3], i = 0;
--- 6760,6766 ----
       take that as color.  Otherwise, try to determine the color
       heuristically. */
    look_at_corners_p = 1;
! 
    if (CONSP (how))
      {
        int rgb[3], i = 0;
***************
*** 6780,6786 ****
          Colormap cmap;
  
          sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
!         
          cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
          if (XLookupColor (dpy, cmap, color_name, &exact, &color))
            {
--- 6780,6786 ----
          Colormap cmap;
  
          sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
! 
          cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
          if (XLookupColor (dpy, cmap, color_name, &exact, &color))
            {
***************
*** 6789,6795 ****
            }
        }
      }
!   
    if (look_at_corners_p)
      {
        unsigned long corners[4];
--- 6789,6795 ----
            }
        }
      }
! 
    if (look_at_corners_p)
      {
        unsigned long corners[4];
***************
*** 6805,6811 ****
        for (i = best_count = 0; i < 4; ++i)
        {
          int j, n;
!         
          for (j = n = 0; j < 4; ++j)
            if (corners[i] == corners[j])
              ++n;
--- 6805,6811 ----
        for (i = best_count = 0; i < 4; ++i)
        {
          int j, n;
! 
          for (j = n = 0; j < 4; ++j)
            if (corners[i] == corners[j])
              ++n;
***************
*** 6825,6831 ****
    x_put_x_image (f, mask_img, img->mask, img->width, img->height);
    x_destroy_x_image (mask_img);
    XDestroyImage (ximg);
!   
    UNBLOCK_INPUT;
  #endif /* MAC_TODO */
  
--- 6825,6831 ----
    x_put_x_image (f, mask_img, img->mask, img->width, img->height);
    x_destroy_x_image (mask_img);
    XDestroyImage (ximg);
! 
    UNBLOCK_INPUT;
  #endif /* MAC_TODO */
  
***************
*** 6896,6906 ****
       Lisp_Object object;
  {
    struct image_keyword fmt[PBM_LAST];
!   
    bcopy (pbm_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
!       || (fmt[PBM_ASCENT].count 
          && XFASTINT (fmt[PBM_ASCENT].value) > 100))
      return 0;
  
--- 6896,6906 ----
       Lisp_Object object;
  {
    struct image_keyword fmt[PBM_LAST];
! 
    bcopy (pbm_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
!       || (fmt[PBM_ASCENT].count
          && XFASTINT (fmt[PBM_ASCENT].value) > 100))
      return 0;
  
***************
*** 6978,6991 ****
          buf = NULL;
        }
      }
!   
    return buf;
  }
  
  
  /* Load PBM image IMG for use on frame F.  */
  
! static int 
  pbm_load (f, img)
       struct frame *f;
       struct image *img;
--- 6978,6991 ----
          buf = NULL;
        }
      }
! 
    return buf;
  }
  
  
  /* Load PBM image IMG for use on frame F.  */
  
! static int
  pbm_load (f, img)
       struct frame *f;
       struct image *img;
***************
*** 7048,7054 ****
      case '1':
        raw_p = 0, type = PBM_MONO;
        break;
!       
      case '2':
        raw_p = 0, type = PBM_GRAY;
        break;
--- 7048,7054 ----
      case '1':
        raw_p = 0, type = PBM_MONO;
        break;
! 
      case '2':
        raw_p = 0, type = PBM_GRAY;
        break;
***************
*** 7060,7070 ****
      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;
--- 7060,7070 ----
      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;
***************
*** 7085,7091 ****
        if (raw_p && max_color_idx > 255)
        max_color_idx = 255;
      }
!   
    if (width < 0
        || height < 0
        || (type != PBM_MONO && max_color_idx < 0))
--- 7085,7091 ----
        if (raw_p && max_color_idx > 255)
        max_color_idx = 255;
      }
! 
    if (width < 0
        || height < 0
        || (type != PBM_MONO && max_color_idx < 0))
***************
*** 7098,7111 ****
        UNBLOCK_INPUT;
        goto error;
      }
!   
    /* Initialize the color hash table.  */
    init_color_table ();
  
    if (type == PBM_MONO)
      {
        int c = 0, g;
!       
        for (y = 0; y < height; ++y)
        for (x = 0; x < width; ++x)
          {
--- 7098,7111 ----
        UNBLOCK_INPUT;
        goto error;
      }
! 
    /* Initialize the color hash table.  */
    init_color_table ();
  
    if (type == PBM_MONO)
      {
        int c = 0, g;
! 
        for (y = 0; y < height; ++y)
        for (x = 0; x < width; ++x)
          {
***************
*** 7130,7136 ****
        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)
--- 7130,7136 ----
        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)
***************
*** 7145,7151 ****
                g = pbm_scan_number (&p, end);
                b = pbm_scan_number (&p, end);
              }
!           
            if (r < 0 || g < 0 || b < 0)
              {
                xfree (ximg->data);
--- 7145,7151 ----
                g = pbm_scan_number (&p, end);
                b = pbm_scan_number (&p, end);
              }
! 
            if (r < 0 || g < 0 || b < 0)
              {
                xfree (ximg->data);
***************
*** 7156,7162 ****
                             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;
--- 7156,7162 ----
                             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;
***************
*** 7165,7181 ****
            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);
    free_color_table ();
!   
    /* Put the image into a pixmap.  */
    x_put_x_image (f, ximg, img->pixmap, width, height);
    x_destroy_x_image (ximg);
    UNBLOCK_INPUT;
!       
    img->width = width;
    img->height = height;
  
--- 7165,7181 ----
            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);
    free_color_table ();
! 
    /* Put the image into a pixmap.  */
    x_put_x_image (f, ximg, img->pixmap, width, height);
    x_destroy_x_image (ximg);
    UNBLOCK_INPUT;
! 
    img->width = width;
    img->height = height;
  
***************
*** 7253,7261 ****
  {
    struct image_keyword fmt[PNG_LAST];
    bcopy (png_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
!       || (fmt[PNG_ASCENT].count 
          && XFASTINT (fmt[PNG_ASCENT].value) > 100))
      return 0;
  
--- 7253,7261 ----
  {
    struct image_keyword fmt[PNG_LAST];
    bcopy (png_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
!       || (fmt[PNG_ASCENT].count
          && XFASTINT (fmt[PNG_ASCENT].value) > 100))
      return 0;
  
***************
*** 7312,7318 ****
  
    if (length > tbr->len - tbr->index)
      png_error (png_ptr, "Read error");
!   
    bcopy (tbr->bytes + tbr->index, data, length);
    tbr->index = tbr->index + length;
  }
--- 7312,7318 ----
  
    if (length > tbr->len - tbr->index)
      png_error (png_ptr, "Read error");
! 
    bcopy (tbr->bytes + tbr->index, data, length);
    tbr->index = tbr->index + length;
  }
***************
*** 7455,7468 ****
    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.  */
  
--- 7455,7468 ----
    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.  */
  
***************
*** 7475,7481 ****
    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);
  
--- 7475,7481 ----
    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);
  
***************
*** 7506,7519 ****
        png_color_16 *image_background;
  
        if (png_get_bKGD (png_ptr, info_ptr, &image_background))
!       /* Image contains a background color with which to 
           combine the image.  */
        png_set_background (png_ptr, image_background,
                            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;
--- 7506,7519 ----
        png_color_16 *image_background;
  
        if (png_get_bKGD (png_ptr, info_ptr, &image_background))
!       /* Image contains a background color with which to
           combine the image.  */
        png_set_background (png_ptr, image_background,
                            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;
***************
*** 7573,7579 ****
        UNBLOCK_INPUT;
        goto error;
      }
!   
    /* Create an image and pixmap serving as mask if the PNG image
       contains an alpha channel.  */
    if (channels == 4
--- 7573,7579 ----
        UNBLOCK_INPUT;
        goto error;
      }
! 
    /* Create an image and pixmap serving as mask if the PNG image
       contains an alpha channel.  */
    if (channels == 4
***************
*** 7605,7620 ****
          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
--- 7605,7620 ----
          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
***************
*** 7738,7748 ****
       Lisp_Object object;
  {
    struct image_keyword fmt[JPEG_LAST];
!   
    bcopy (jpeg_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
!       || (fmt[JPEG_ASCENT].count 
          && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
      return 0;
  
--- 7738,7748 ----
       Lisp_Object object;
  {
    struct image_keyword fmt[JPEG_LAST];
! 
    bcopy (jpeg_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
!       || (fmt[JPEG_ASCENT].count
          && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
      return 0;
  
***************
*** 7811,7817 ****
      {
        if (num_bytes > src->bytes_in_buffer)
        ERREXIT (cinfo, JERR_INPUT_EOF);
!       
        src->bytes_in_buffer -= num_bytes;
        src->next_input_byte += num_bytes;
      }
--- 7811,7817 ----
      {
        if (num_bytes > src->bytes_in_buffer)
        ERREXIT (cinfo, JERR_INPUT_EOF);
! 
        src->bytes_in_buffer -= num_bytes;
        src->next_input_byte += num_bytes;
      }
***************
*** 7849,7855 ****
        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;
--- 7849,7855 ----
        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;
***************
*** 7864,7870 ****
  /* 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;
--- 7864,7870 ----
  /* 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;
***************
*** 7897,7903 ****
            UNGCPRO;
            return 0;
          }
!   
        fp = fopen (SDATA (file), "r");
        if (fp == NULL)
          {
--- 7897,7903 ----
            UNGCPRO;
            return 0;
          }
! 
        fp = fopen (SDATA (file), "r");
        if (fp == NULL)
          {
***************
*** 7906,7917 ****
            return 0;
          }
      }
!   
    /* Customize libjpeg's error handling to call my_error_exit when an
       error is detected. This function will perform a longjmp. */
    mgr.pub.error_exit = my_error_exit;
    cinfo.err = jpeg_std_error (&mgr.pub);
!   
    if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
      {
        if (rc == 1)
--- 7906,7917 ----
            return 0;
          }
      }
! 
    /* Customize libjpeg's error handling to call my_error_exit when an
       error is detected. This function will perform a longjmp. */
    mgr.pub.error_exit = my_error_exit;
    cinfo.err = jpeg_std_error (&mgr.pub);
! 
    if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
      {
        if (rc == 1)
***************
*** 7922,7941 ****
          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 (fp);
        jpeg_destroy_decompress (&cinfo);
  
        BLOCK_INPUT;
!       
        /* If we already have an XImage, free that.  */
        x_destroy_x_image (ximg);
  
        /* Free pixmap and colors.  */
        x_clear_image (f, img);
!       
        UNBLOCK_INPUT;
        UNGCPRO;
        return 0;
--- 7922,7941 ----
          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 (fp);
        jpeg_destroy_decompress (&cinfo);
  
        BLOCK_INPUT;
! 
        /* If we already have an XImage, free that.  */
        x_destroy_x_image (ximg);
  
        /* Free pixmap and colors.  */
        x_clear_image (f, img);
! 
        UNBLOCK_INPUT;
        UNGCPRO;
        return 0;
***************
*** 7992,7998 ****
      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
--- 7992,7998 ----
      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
***************
*** 8024,8030 ****
    jpeg_destroy_decompress (&cinfo);
    if (fp)
      fclose (fp);
!   
    /* Put the image into the pixmap.  */
    x_put_x_image (f, ximg, img->pixmap, width, height);
    x_destroy_x_image (ximg);
--- 8024,8030 ----
    jpeg_destroy_decompress (&cinfo);
    if (fp)
      fclose (fp);
! 
    /* Put the image into the pixmap.  */
    x_put_x_image (f, ximg, img->pixmap, width, height);
    x_destroy_x_image (ximg);
***************
*** 8102,8113 ****
  {
    struct image_keyword fmt[TIFF_LAST];
    bcopy (tiff_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
!       || (fmt[TIFF_ASCENT].count 
          && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
      return 0;
!   
    /* Must specify either the :data or :file keyword.  */
    return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
  }
--- 8102,8113 ----
  {
    struct image_keyword fmt[TIFF_LAST];
    bcopy (tiff_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
!       || (fmt[TIFF_ASCENT].count
          && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
      return 0;
! 
    /* Must specify either the :data or :file keyword.  */
    return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
  }
***************
*** 8168,8189 ****
      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;
  }
--- 8168,8189 ----
      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;
  }
***************
*** 8255,8261 ****
            UNGCPRO;
            return 0;
          }
!   
        /* Try to open the image file.  */
        tiff = TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
--- 8255,8261 ----
            UNGCPRO;
            return 0;
          }
! 
        /* Try to open the image file.  */
        tiff = TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
***************
*** 8294,8300 ****
    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)
--- 8294,8300 ----
    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)
***************
*** 8323,8336 ****
    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)); 
        }
      }
  
--- 8323,8336 ----
    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));
        }
      }
  
***************
*** 8343,8349 ****
    x_destroy_x_image (ximg);
    xfree (buf);
    UNBLOCK_INPUT;
!       
    img->width = width;
    img->height = height;
  
--- 8343,8349 ----
    x_destroy_x_image (ximg);
    xfree (buf);
    UNBLOCK_INPUT;
! 
    img->width = width;
    img->height = height;
  
***************
*** 8421,8432 ****
  {
    struct image_keyword fmt[GIF_LAST];
    bcopy (gif_format, fmt, sizeof fmt);
!   
    if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
!       || (fmt[GIF_ASCENT].count 
          && XFASTINT (fmt[GIF_ASCENT].value) > 100))
      return 0;
!   
    /* Must specify either the :data or :file keyword.  */
    return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
  }
--- 8421,8432 ----
  {
    struct image_keyword fmt[GIF_LAST];
    bcopy (gif_format, fmt, sizeof fmt);
! 
    if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
!       || (fmt[GIF_ASCENT].count
          && XFASTINT (fmt[GIF_ASCENT].value) > 100))
      return 0;
! 
    /* Must specify either the :data or :file keyword.  */
    return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
  }
***************
*** 8499,8505 ****
            UNGCPRO;
            return 0;
          }
!   
        /* Open the GIF file.  */
        gif = DGifOpenFileName (SDATA (file));
        if (gif == NULL)
--- 8499,8505 ----
            UNGCPRO;
            return 0;
          }
! 
        /* Open the GIF file.  */
        gif = DGifOpenFileName (SDATA (file));
        if (gif == NULL)
***************
*** 8560,8573 ****
        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;
--- 8560,8573 ----
        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;
***************
*** 8580,8586 ****
    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.  */
--- 8580,8586 ----
    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.  */
***************
*** 8627,8640 ****
              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];
        }
      }
--- 8627,8640 ----
              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];
        }
      }
***************
*** 8647,8660 ****
            XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
          }
      }
!   
    DGifCloseFile (gif);
!   
    /* 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);
    UNBLOCK_INPUT;
!       
    UNGCPRO;
    return 1;
  }
--- 8647,8660 ----
            XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
          }
      }
! 
    DGifCloseFile (gif);
! 
    /* 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);
    UNBLOCK_INPUT;
! 
    UNGCPRO;
    return 1;
  }
***************
*** 8751,8761 ****
    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)
!       || (fmt[GS_ASCENT].count 
          && XFASTINT (fmt[GS_ASCENT].value) > 100))
      return 0;
  
--- 8751,8761 ----
    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)
!       || (fmt[GS_ASCENT].count
          && XFASTINT (fmt[GS_ASCENT].value) > 100))
      return 0;
  
***************
*** 8823,8829 ****
        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
--- 8823,8829 ----
        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
***************
*** 8834,8845 ****
           (unsigned long) FRAME_W32_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))
--- 8834,8845 ----
           (unsigned long) FRAME_W32_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))
***************
*** 8897,8906 ****
        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.  */
--- 8897,8906 ----
        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.  */
***************
*** 8933,8939 ****
        else
        image_error ("Cannot get X image of `%s'; colors will not be freed",
                     img->spec, Qnil);
!       
        UNBLOCK_INPUT;
      }
  }
--- 8933,8939 ----
        else
        image_error ("Cannot get X image of `%s'; colors will not be freed",
                     img->spec, Qnil);
! 
        UNBLOCK_INPUT;
      }
  }
***************
*** 9039,9046 ****
        rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_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)
        prop_value = make_string (tmp_data, size);
--- 9039,9046 ----
        rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_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)
        prop_value = make_string (tmp_data, size);
***************
*** 9094,9100 ****
  #if 0 /* MAC_TODO: cursor shape changes.  */
    EMACS_TIME delay;
    int secs, usecs = 0;
!   
    cancel_hourglass ();
  
    if (INTEGERP (Vhourglass_delay)
--- 9094,9100 ----
  #if 0 /* MAC_TODO: cursor shape changes.  */
    EMACS_TIME delay;
    int secs, usecs = 0;
! 
    cancel_hourglass ();
  
    if (INTEGERP (Vhourglass_delay)
***************
*** 9110,9116 ****
      }
    else
      secs = DEFAULT_HOURGLASS_DELAY;
!   
    EMACS_SET_SECS_USECS (delay, secs, usecs);
    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
                                     show_hourglass, NULL);
--- 9110,9116 ----
      }
    else
      secs = DEFAULT_HOURGLASS_DELAY;
! 
    EMACS_SET_SECS_USECS (delay, secs, usecs);
    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
                                     show_hourglass, NULL);
***************
*** 9129,9135 ****
        cancel_atimer (hourglass_atimer);
        hourglass_atimer = NULL;
      }
!   
    if (hourglass_shown_p)
      hide_hourglass ();
  }
--- 9129,9135 ----
        cancel_atimer (hourglass_atimer);
        hourglass_atimer = NULL;
      }
! 
    if (hourglass_shown_p)
      hide_hourglass ();
  }
***************
*** 9156,9178 ****
    if (!hourglass_shown_p)
      {
        Lisp_Object rest, frame;
!   
        BLOCK_INPUT;
!   
        FOR_EACH_FRAME (rest, frame)
        if (FRAME_W32_P (XFRAME (frame)))
          {
            struct frame *f = XFRAME (frame);
!       
            f->output_data.w32->hourglass_p = 1;
!       
            if (!f->output_data.w32->hourglass_window)
              {
                unsigned long mask = CWCursor;
                XSetWindowAttributes attrs;
!           
                attrs.cursor = f->output_data.w32->hourglass_cursor;
!           
                f->output_data.w32->hourglass_window
                  = XCreateWindow (FRAME_X_DISPLAY (f),
                                   FRAME_OUTER_WINDOW (f),
--- 9156,9178 ----
    if (!hourglass_shown_p)
      {
        Lisp_Object rest, frame;
! 
        BLOCK_INPUT;
! 
        FOR_EACH_FRAME (rest, frame)
        if (FRAME_W32_P (XFRAME (frame)))
          {
            struct frame *f = XFRAME (frame);
! 
            f->output_data.w32->hourglass_p = 1;
! 
            if (!f->output_data.w32->hourglass_window)
              {
                unsigned long mask = CWCursor;
                XSetWindowAttributes attrs;
! 
                attrs.cursor = f->output_data.w32->hourglass_cursor;
! 
                f->output_data.w32->hourglass_window
                  = XCreateWindow (FRAME_X_DISPLAY (f),
                                   FRAME_OUTER_WINDOW (f),
***************
*** 9181,9187 ****
                                   CopyFromParent,
                                   mask, &attrs);
              }
!       
            XMapRaised (FRAME_X_DISPLAY (f),
                        f->output_data.w32->hourglass_window);
            XFlush (FRAME_X_DISPLAY (f));
--- 9181,9187 ----
                                   CopyFromParent,
                                   mask, &attrs);
              }
! 
            XMapRaised (FRAME_X_DISPLAY (f),
                        f->output_data.w32->hourglass_window);
            XFlush (FRAME_X_DISPLAY (f));
***************
*** 9208,9214 ****
        FOR_EACH_FRAME (rest, frame)
        {
          struct frame *f = XFRAME (frame);
!       
          if (FRAME_W32_P (f)
              /* Watch out for newly created frames.  */
              && f->output_data.x->hourglass_window)
--- 9208,9214 ----
        FOR_EACH_FRAME (rest, frame)
        {
          struct frame *f = XFRAME (frame);
! 
          if (FRAME_W32_P (f)
              /* Watch out for newly created frames.  */
              && f->output_data.x->hourglass_window)
***************
*** 9236,9242 ****
  
  static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,
                                           Lisp_Object));
!      
  /* The frame of a currently visible tooltip, or null.  */
  
  Lisp_Object tip_frame;
--- 9236,9242 ----
  
  static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,
                                           Lisp_Object));
! 
  /* The frame of a currently visible tooltip, or null.  */
  
  Lisp_Object tip_frame;
***************
*** 9344,9350 ****
        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");
--- 9344,9350 ----
        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");
***************
*** 9369,9375 ****
  
    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).  */
--- 9369,9375 ----
  
    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).  */
***************
*** 9407,9413 ****
       end up in init_iterator with a null face cache, which should not
       happen.  */
    init_frame_faces (f);
!   
    f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
    window_prompting = x_figure_window_size (f, parms);
  
--- 9407,9413 ----
       end up in init_iterator with a null face cache, which should not
       happen.  */
    init_frame_faces (f);
! 
    f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
    window_prompting = x_figure_window_size (f, parms);
  
***************
*** 9430,9436 ****
    {
      XSetWindowAttributes attrs;
      unsigned long mask;
!     
      BLOCK_INPUT;
      mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
      /* Window managers looks at the override-redirect flag to
--- 9430,9436 ----
    {
      XSetWindowAttributes attrs;
      unsigned long mask;
! 
      BLOCK_INPUT;
      mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
      /* Window managers looks at the override-redirect flag to
***************
*** 9525,9531 ****
    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);
--- 9525,9531 ----
    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);
***************
*** 9541,9547 ****
      dx = make_number (5);
    else
      CHECK_NUMBER (dx);
!   
    if (NILP (dy))
      dy = make_number (-10);
    else
--- 9541,9547 ----
      dx = make_number (5);
    else
      CHECK_NUMBER (dx);
! 
    if (NILP (dy))
      dy = make_number (-10);
    else
***************
*** 9561,9567 ****
          && !NILP (Fequal (last_parms, parms)))
        {
          struct frame *f = XFRAME (tip_frame);
!         
          /* Only DX and DY have changed.  */
          if (!NILP (tip_timer))
            {
--- 9561,9567 ----
          && !NILP (Fequal (last_parms, parms)))
        {
          struct frame *f = XFRAME (tip_frame);
! 
          /* Only DX and DY have changed.  */
          if (!NILP (tip_timer))
            {
***************
*** 9652,9658 ****
        }
        else
        row_width = row->pixel_width;
!       
        height += row->height;
        width = max (width, row_width);
      }
--- 9652,9658 ----
        }
        else
        row_width = row->pixel_width;
! 
        height += row->height;
        width = max (width, row_width);
      }
***************
*** 9706,9721 ****
    /* 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);
  
--- 9706,9721 ----
    /* 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);
  
***************
*** 9864,9870 ****
       Lisp_Object spec;
  {
    int id = -1;
!   
    if (valid_image_p (spec))
      id = lookup_image (SELECTED_FRAME (), spec);
  
--- 9864,9870 ----
       Lisp_Object spec;
  {
    int id = -1;
! 
    if (valid_image_p (spec))
      id = lookup_image (SELECTED_FRAME (), spec);
  
***************
*** 10012,10018 ****
    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.  */);
--- 10012,10018 ----
    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.  */);
***************
*** 10139,10154 ****
    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");
--- 10139,10154 ----
    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");
***************
*** 10192,10214 ****
  #if 0 /* NTEMACS_TODO : Image support for W32 */
    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
--- 10192,10214 ----
  #if 0 /* NTEMACS_TODO : Image support for W32 */
    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]