/[emacs]/emacs/src/macfns.c
ViewVC logotype

Diff of /emacs/src/macfns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by akochoi, Fri Aug 30 19:47:57 2002 UTC revision 1.14 by lektu, Fri Sep 6 09:04:22 2002 UTC
# Line 194  Lisp_Object Vx_pixel_size_width_font_reg Line 194  Lisp_Object Vx_pixel_size_width_font_reg
194        (insert (format "\");\n  staticpro (&%s);\n" (car symbol-list)))        (insert (format "\");\n  staticpro (&%s);\n" (car symbol-list)))
195        (setq symbol-list (cdr symbol-list)))))        (setq symbol-list (cdr symbol-list)))))
196    
197    */            */
198    
199  /*&&& symbols declared here &&&*/  /*&&& symbols declared here &&&*/
200  Lisp_Object Qauto_raise;  Lisp_Object Qauto_raise;
# Line 301  check_mac () Line 301  check_mac ()
301    
302  /* Nonzero if we can use mouse menus.  /* Nonzero if we can use mouse menus.
303     You should not call this unless HAVE_MENUS is defined.  */     You should not call this unless HAVE_MENUS is defined.  */
304      
305  int  int
306  have_menus_p ()  have_menus_p ()
307  {  {
# Line 343  check_x_display_info (frame) Line 343  check_x_display_info (frame)
343    if (NILP (frame))    if (NILP (frame))
344      {      {
345        struct frame *sf = XFRAME (selected_frame);        struct frame *sf = XFRAME (selected_frame);
346          
347        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
348          return FRAME_MAC_DISPLAY_INFO (sf);          return FRAME_MAC_DISPLAY_INFO (sf);
349        else        else
# Line 494  x_create_bitmap_from_data (f, bits, widt Line 494  x_create_bitmap_from_data (f, bits, widt
494    /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */    /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */
495    
496    id = x_allocate_bitmap_record (f);    id = x_allocate_bitmap_record (f);
497      
498    if (width % 16 != 0)    if (width % 16 != 0)
499      return -1;      return -1;
500    
# Line 557  x_create_bitmap_from_file (f, file) Line 557  x_create_bitmap_from_file (f, file)
557    if (hinst == NULL)    if (hinst == NULL)
558        return -1;        return -1;
559    
560      
561    result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),    result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
562                              filename, &width, &height, &bitmap, &xhot, &yhot);                              filename, &width, &height, &bitmap, &xhot, &yhot);
563    if (result != BitmapSuccess)    if (result != BitmapSuccess)
# Line 780  x_set_frame_parameters (f, alist) Line 780  x_set_frame_parameters (f, alist)
780    /* Process foreground_color and background_color before anything else.    /* Process foreground_color and background_color before anything else.
781       They are independent of other properties, but other properties (e.g.,       They are independent of other properties, but other properties (e.g.,
782       cursor_color) are dependent upon them.  */       cursor_color) are dependent upon them.  */
783    for (p = 0; p < i; p++)    for (p = 0; p < i; p++)
784      {      {
785        Lisp_Object prop, val;        Lisp_Object prop, val;
786    
# Line 982  x_real_positions (f, xptr, yptr) Line 982  x_real_positions (f, xptr, yptr)
982  #ifdef TARGET_API_MAC_CARBON  #ifdef TARGET_API_MAC_CARBON
983    {    {
984      Rect r;      Rect r;
985        
986      GetWindowPortBounds (f->output_data.mac->mWP, &r);      GetWindowPortBounds (f->output_data.mac->mWP, &r);
987      SetPt (&pt, r.left, r.top);      SetPt (&pt, r.left, r.top);
988    }    }
# Line 994  x_real_positions (f, xptr, yptr) Line 994  x_real_positions (f, xptr, yptr)
994    GetPort (&oldport);    GetPort (&oldport);
995    LocalToGlobal (&pt);    LocalToGlobal (&pt);
996    SetPort (oldport);    SetPort (oldport);
997      
998    *xptr = pt.h;    *xptr = pt.h;
999    *yptr = pt.v;    *yptr = pt.v;
1000  }  }
# Line 1044  x_report_frame_params (f, alistptr) Line 1044  x_report_frame_params (f, alistptr)
1044  }  }
1045    
1046  /* The default colors for the Mac color map */  /* The default colors for the Mac color map */
1047  typedef struct colormap_t  typedef struct colormap_t
1048  {  {
1049    unsigned long color;    unsigned long color;
1050    char *name;    char *name;
1051  } colormap_t;  } colormap_t;
1052    
1053  colormap_t mac_color_map[] =  colormap_t mac_color_map[] =
1054  {  {
1055    { RGB_TO_ULONG(255, 250, 250), "snow" },    { RGB_TO_ULONG(255, 250, 250), "snow" },
1056    { RGB_TO_ULONG(248, 248, 255), "ghost white" },    { RGB_TO_ULONG(248, 248, 255), "ghost white" },
# Line 1405  colormap_t mac_color_map[] = Line 1405  colormap_t mac_color_map[] =
1405    { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },    { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
1406    { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },    { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
1407    { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },    { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
1408    { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },      { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },
1409    { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },    { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
1410    { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },    { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
1411    { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },    { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
# Line 1814  mac_color_map_lookup (colorname) Line 1814  mac_color_map_lookup (colorname)
1814    int i;    int i;
1815    
1816    BLOCK_INPUT;    BLOCK_INPUT;
1817      
1818    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
1819      if (stricmp (colorname, mac_color_map[i].name) == 0)      if (stricmp (colorname, mac_color_map[i].name) == 0)
1820        {        {
# Line 1827  mac_color_map_lookup (colorname) Line 1827  mac_color_map_lookup (colorname)
1827    return ret;    return ret;
1828  }  }
1829    
1830  Lisp_Object  Lisp_Object
1831  x_to_mac_color (colorname)  x_to_mac_color (colorname)
1832       char * colorname;       char * colorname;
1833  {  {
1834    register Lisp_Object tail, ret = Qnil;    register Lisp_Object tail, ret = Qnil;
1835      
1836    BLOCK_INPUT;    BLOCK_INPUT;
1837    
1838    if (colorname[0] == '#')    if (colorname[0] == '#')
# Line 1841  x_to_mac_color (colorname) Line 1841  x_to_mac_color (colorname)
1841        char *color;        char *color;
1842        int size;        int size;
1843        color = colorname + 1;        color = colorname + 1;
1844          
1845        size = strlen(color);        size = strlen(color);
1846        if (size == 3 || size == 6 || size == 9 || size == 12)        if (size == 3 || size == 6 || size == 9 || size == 12)
1847          {          {
# Line 1850  x_to_mac_color (colorname) Line 1850  x_to_mac_color (colorname)
1850            pos = 0;            pos = 0;
1851            size /= 3;            size /= 3;
1852            colorval = 0;            colorval = 0;
1853              
1854            for (i = 0; i < 3; i++)            for (i = 0; i < 3; i++)
1855              {              {
1856                char *end;                char *end;
# Line 1906  x_to_mac_color (colorname) Line 1906  x_to_mac_color (colorname)
1906          {          {
1907            char *end;            char *end;
1908            unsigned long value;            unsigned long value;
1909              
1910            /* The check for 'x' in the following conditional takes into            /* The check for 'x' in the following conditional takes into
1911               account the fact that strtol allows a "0x" in front of               account the fact that strtol allows a "0x" in front of
1912               our numbers, and we don't.  */               our numbers, and we don't.  */
# Line 1990  x_to_mac_color (colorname) Line 1990  x_to_mac_color (colorname)
1990      }      }
1991    
1992    ret = mac_color_map_lookup (colorname);    ret = mac_color_map_lookup (colorname);
1993      
1994    UNBLOCK_INPUT;    UNBLOCK_INPUT;
1995    return ret;    return ret;
1996  }  }
# Line 2029  mac_defined_color (f, color, color_def, Line 2029  mac_defined_color (f, color, color_def,
2029    
2030    tem = x_to_mac_color (color);    tem = x_to_mac_color (color);
2031    
2032    if (!NILP (tem))    if (!NILP (tem))
2033      {      {
2034        if (f)        if (f)
2035          {          {
# Line 2046  mac_defined_color (f, color, color_def, Line 2046  mac_defined_color (f, color, color_def,
2046    
2047        return 1;        return 1;
2048      }      }
2049    else    else
2050      {      {
2051        return 0;        return 0;
2052      }      }
# Line 2220  x_set_mouse_color (f, arg, oldval) Line 2220  x_set_mouse_color (f, arg, oldval)
2220    else    else
2221      hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);      hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
2222    x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");    x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
2223      
2224    x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");    x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
2225    if (!EQ (Qnil, Vx_mode_pointer_shape))    if (!EQ (Qnil, Vx_mode_pointer_shape))
2226      {      {
# Line 2303  x_set_mouse_color (f, arg, oldval) Line 2303  x_set_mouse_color (f, arg, oldval)
2303        && f->output_data.w32->modeline_cursor != 0)        && f->output_data.w32->modeline_cursor != 0)
2304      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
2305    f->output_data.w32->modeline_cursor = mode_cursor;    f->output_data.w32->modeline_cursor = mode_cursor;
2306      
2307    if (cross_cursor != f->output_data.w32->cross_cursor    if (cross_cursor != f->output_data.w32->cross_cursor
2308        && f->output_data.w32->cross_cursor != 0)        && f->output_data.w32->cross_cursor != 0)
2309      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);      XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
# Line 2329  x_set_cursor_color (f, arg, oldval) Line 2329  x_set_cursor_color (f, arg, oldval)
2329    else    else
2330      fore_pixel = FRAME_BACKGROUND_PIXEL (f);      fore_pixel = FRAME_BACKGROUND_PIXEL (f);
2331    f->output_data.mac->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));    f->output_data.mac->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
2332      
2333    /* Make sure that the cursor color differs from the background color.  */    /* Make sure that the cursor color differs from the background color.  */
2334    if (f->output_data.mac->cursor_pixel == FRAME_BACKGROUND_PIXEL (f))    if (f->output_data.mac->cursor_pixel == FRAME_BACKGROUND_PIXEL (f))
2335      {      {
# Line 2412  x_set_icon_type (f, arg, oldval) Line 2412  x_set_icon_type (f, arg, oldval)
2412    if (NILP (arg) && NILP (oldval))    if (NILP (arg) && NILP (oldval))
2413      return;      return;
2414    
2415    if (STRINGP (arg) && STRINGP (oldval)    if (STRINGP (arg) && STRINGP (oldval)
2416        && EQ (Fstring_equal (oldval, arg), Qt))        && EQ (Fstring_equal (oldval, arg), Qt))
2417      return;      return;
2418    
# Line 2520  x_set_font (f, arg, oldval) Line 2520  x_set_font (f, arg, oldval)
2520              ? x_new_fontset (f, SDATA (fontset_name))              ? x_new_fontset (f, SDATA (fontset_name))
2521              : x_new_font (f, SDATA (arg)));              : x_new_font (f, SDATA (arg)));
2522    UNBLOCK_INPUT;    UNBLOCK_INPUT;
2523      
2524    if (EQ (result, Qnil))    if (EQ (result, Qnil))
2525      error ("Font `%s' is not defined", SDATA (arg));      error ("Font `%s' is not defined", SDATA (arg));
2526    else if (EQ (result, Qt))    else if (EQ (result, Qt))
# Line 2778  x_set_name (f, name, explicit) Line 2778  x_set_name (f, name, explicit)
2778       Lisp_Object name;       Lisp_Object name;
2779       int explicit;       int explicit;
2780  {  {
2781    /* Make sure that requests from lisp code override requests from    /* Make sure that requests from lisp code override requests from
2782       Emacs redisplay code.  */       Emacs redisplay code.  */
2783    if (explicit)    if (explicit)
2784      {      {
# Line 2826  x_set_name (f, name, explicit) Line 2826  x_set_name (f, name, explicit)
2826  #endif  #endif
2827    
2828        BLOCK_INPUT;        BLOCK_INPUT;
2829          
2830        {        {
2831          Str255 windowTitle;          Str255 windowTitle;
2832          if (strlen (SDATA (name)) < 255)          if (strlen (SDATA (name)) < 255)
# Line 2953  x_set_vertical_scroll_bars (f, arg, oldv Line 2953  x_set_vertical_scroll_bars (f, arg, oldv
2953          = (NILP (arg)          = (NILP (arg)
2954             ? vertical_scroll_bar_none             ? vertical_scroll_bar_none
2955             : EQ (Qright, arg)             : EQ (Qright, arg)
2956               ? vertical_scroll_bar_right               ? vertical_scroll_bar_right
2957               : vertical_scroll_bar_left);               : vertical_scroll_bar_left);
2958    
2959        /* We set this parameter before creating the window for the        /* We set this parameter before creating the window for the
# Line 2985  x_set_scroll_bar_width (f, arg, oldval) Line 2985  x_set_scroll_bar_width (f, arg, oldval)
2985        /* Make the actual width at least 14 pixels and a multiple of a        /* Make the actual width at least 14 pixels and a multiple of a
2986           character width.  */           character width.  */
2987        FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;        FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
2988          
2989        /* Use all of that space (aside from required margins) for the        /* Use all of that space (aside from required margins) for the
2990           scroll bar.  */           scroll bar.  */
2991        FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;        FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
# Line 3008  x_set_scroll_bar_width (f, arg, oldval) Line 3008  x_set_scroll_bar_width (f, arg, oldval)
3008      }      }
3009    change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);    change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
3010    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
3011    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;    XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
3012  }  }
3013    
3014  /* Subroutines of creating an frame.  */  /* Subroutines of creating an frame.  */
# Line 3241  mac_get_arg (alist, param, attribute, cl Line 3241  mac_get_arg (alist, param, attribute, cl
3241                if (!strcmp (SDATA (tem), "on")                if (!strcmp (SDATA (tem), "on")
3242                    || !strcmp (SDATA (tem), "true"))                    || !strcmp (SDATA (tem), "true"))
3243                  return Qt;                  return Qt;
3244                else                else
3245                  return Qnil;                  return Qnil;
3246    
3247              case RES_TYPE_STRING:              case RES_TYPE_STRING:
# Line 3310  x_default_parameter (f, alist, prop, def Line 3310  x_default_parameter (f, alist, prop, def
3310   *   It returns a bitmask that indicates which of the four values   *   It returns a bitmask that indicates which of the four values
3311   *   were actually found in the string.  For each value found,   *   were actually found in the string.  For each value found,
3312   *   the corresponding argument is updated;  for each value   *   the corresponding argument is updated;  for each value
3313   *   not found, the corresponding argument is left unchanged.   *   not found, the corresponding argument is left unchanged.
3314   */   */
3315    
3316  static int  static int
# Line 3320  read_integer (string, NextString) Line 3320  read_integer (string, NextString)
3320  {  {
3321    register int Result = 0;    register int Result = 0;
3322    int Sign = 1;    int Sign = 1;
3323      
3324    if (*string == '+')    if (*string == '+')
3325      string++;      string++;
3326    else if (*string == '-')    else if (*string == '-')
# Line 3339  read_integer (string, NextString) Line 3339  read_integer (string, NextString)
3339      return (-Result);      return (-Result);
3340  }  }
3341    
3342  int  int
3343  XParseGeometry (string, x, y, width, height)  XParseGeometry (string, x, y, width, height)
3344       char *string;       char *string;
3345       int *x, *y;       int *x, *y;
# Line 3350  XParseGeometry (string, x, y, width, hei Line 3350  XParseGeometry (string, x, y, width, hei
3350    unsigned int tempWidth, tempHeight;    unsigned int tempWidth, tempHeight;
3351    int tempX, tempY;    int tempX, tempY;
3352    char *nextCharacter;    char *nextCharacter;
3353      
3354    if ((string == NULL) || (*string == '\0')) return (mask);    if ((string == NULL) || (*string == '\0')) return (mask);
3355    if (*string == '=')    if (*string == '=')
3356      string++;  /* ignore possible '=' at beg of geometry spec */      string++;  /* ignore possible '=' at beg of geometry spec */
3357      
3358    strind = (char *)string;    strind = (char *)string;
3359    if (*strind != '+' && *strind != '-' && *strind != 'x')    if (*strind != '+' && *strind != '-' && *strind != 'x')
3360      {      {
3361        tempWidth = read_integer (strind, &nextCharacter);        tempWidth = read_integer (strind, &nextCharacter);
3362        if (strind == nextCharacter)        if (strind == nextCharacter)
3363          return (0);          return (0);
3364        strind = nextCharacter;        strind = nextCharacter;
3365        mask |= WidthValue;        mask |= WidthValue;
3366      }      }
3367      
3368    if (*strind == 'x' || *strind == 'X')    if (*strind == 'x' || *strind == 'X')
3369      {        {
3370        strind++;        strind++;
3371        tempHeight = read_integer (strind, &nextCharacter);        tempHeight = read_integer (strind, &nextCharacter);
3372        if (strind == nextCharacter)        if (strind == nextCharacter)
# Line 3374  XParseGeometry (string, x, y, width, hei Line 3374  XParseGeometry (string, x, y, width, hei
3374        strind = nextCharacter;        strind = nextCharacter;
3375        mask |= HeightValue;        mask |= HeightValue;
3376      }      }
3377      
3378    if ((*strind == '+') || (*strind == '-'))    if ((*strind == '+') || (*strind == '-'))
3379      {      {
3380        if (*strind == '-')        if (*strind == '-')
3381          {          {
3382            strind++;            strind++;
3383            tempX = -read_integer (strind, &nextCharacter);            tempX = -read_integer (strind, &nextCharacter);
# Line 3388  XParseGeometry (string, x, y, width, hei Line 3388  XParseGeometry (string, x, y, width, hei
3388    
3389          }          }
3390        else        else
3391          {                {
3392            strind++;            strind++;
3393            tempX = read_integer (strind, &nextCharacter);            tempX = read_integer (strind, &nextCharacter);
3394            if (strind == nextCharacter)            if (strind == nextCharacter)
# Line 3396  XParseGeometry (string, x, y, width, hei Line 3396  XParseGeometry (string, x, y, width, hei
3396            strind = nextCharacter;            strind = nextCharacter;
3397          }          }
3398        mask |= XValue;        mask |= XValue;
3399        if ((*strind == '+') || (*strind == '-'))        if ((*strind == '+') || (*strind == '-'))
3400          {          {
3401            if (*strind == '-')            if (*strind == '-')
3402              {              {
3403                strind++;                strind++;
3404                tempY = -read_integer (strind, &nextCharacter);                tempY = -read_integer (strind, &nextCharacter);
# Line 3419  XParseGeometry (string, x, y, width, hei Line 3419  XParseGeometry (string, x, y, width, hei
3419            mask |= YValue;            mask |= YValue;
3420          }          }
3421      }      }
3422      
3423    /* If strind isn't at the end of the string the it's an invalid    /* If strind isn't at the end of the string the it's an invalid
3424       geometry specification. */       geometry specification. */
3425      
3426    if (*strind != '\0') return (0);    if (*strind != '\0') return (0);
3427      
3428    if (mask & XValue)    if (mask & XValue)
3429      *x = tempX;      *x = tempX;
3430    if (mask & YValue)    if (mask & YValue)
# Line 3638  mac_window (f, window_prompting, minibuf Line 3638  mac_window (f, window_prompting, minibuf
3638       for the window manager, so GC relocation won't bother it.       for the window manager, so GC relocation won't bother it.
3639    
3640       Elsewhere we specify the window name for the window manager.  */       Elsewhere we specify the window name for the window manager.  */
3641        
3642    {    {
3643      char *str = (char *) SDATA (Vx_resource_name);      char *str = (char *) SDATA (Vx_resource_name);
3644      f->namebuf = (char *) xmalloc (strlen (str) + 1);      f->namebuf = (char *) xmalloc (strlen (str) + 1);
# Line 3942  This function is an internal primitive-- Line 3942  This function is an internal primitive--
3942        error ("Cannot find any usable font");        error ("Cannot find any usable font");
3943      UNBLOCK_INPUT;      UNBLOCK_INPUT;
3944    
3945      x_default_parameter (f, parms, Qfont, font,      x_default_parameter (f, parms, Qfont, font,
3946                           "font", "Font", RES_TYPE_STRING);                           "font", "Font", RES_TYPE_STRING);
3947    }    }
3948    
# Line 3995  This function is an internal primitive-- Line 3995  This function is an internal primitive--
3995       end up in init_iterator with a null face cache, which should not       end up in init_iterator with a null face cache, which should not
3996       happen.  */       happen.  */
3997    init_frame_faces (f);    init_frame_faces (f);
3998      
3999    x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),    x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
4000                         "menuBar", "MenuBar", RES_TYPE_NUMBER);                         "menuBar", "MenuBar", RES_TYPE_NUMBER);
4001    x_default_parameter (f, parms, Qtool_bar_lines, make_number (0),    x_default_parameter (f, parms, Qtool_bar_lines, make_number (0),
# Line 4106  This function is an internal primitive-- Line 4106  This function is an internal primitive--
4106          ;          ;
4107      }      }
4108    UNGCPRO;    UNGCPRO;
4109      
4110    /* Make sure windows on this frame appear in calls to next-window    /* Make sure windows on this frame appear in calls to next-window
4111       and similar functions.  */       and similar functions.  */
4112    Vwindow_list = Qnil;    Vwindow_list = Qnil;
4113      
4114    return unbind_to (count, frame);    return unbind_to (count, frame);
4115  }  }
4116    
# Line 4255  If omitted or nil, that stands for the s Line 4255  If omitted or nil, that stands for the s
4255       Lisp_Object display;       Lisp_Object display;
4256  {  {
4257    struct mac_display_info *dpyinfo = check_x_display_info (display);    struct mac_display_info *dpyinfo = check_x_display_info (display);
4258      
4259    /* MAC_TODO: check whether this is right */    /* MAC_TODO: check whether this is right */
4260    return make_number ((unsigned long) (pow (2, dpyinfo->n_cbits)));    return make_number ((unsigned long) (pow (2, dpyinfo->n_cbits)));
4261  }  }
# Line 4266  DEFUN ("x-server-max-request-size", Fx_s Line 4266  DEFUN ("x-server-max-request-size", Fx_s
4266         doc: /* Returns the maximum request size of the server of display DISPLAY.         doc: /* Returns the maximum request size of the server of display DISPLAY.
4267  The optional argument DISPLAY specifies which display to ask about.  The optional argument DISPLAY specifies which display to ask about.
4268  DISPLAY should be either a frame or a display name (a string).  DISPLAY should be either a frame or a display name (a string).
4269  If omitted or nil, that stands for the selected frame's display.   */)  If omitted or nil, that stands for the selected frame's display.  */)
4270    (display)    (display)
4271       Lisp_Object display;       Lisp_Object display;
4272  {  {
# Line 4303  If omitted or nil, that stands for the s Line 4303  If omitted or nil, that stands for the s
4303    
4304    if (Gestalt (gestaltSystemVersion, &response) != noErr)    if (Gestalt (gestaltSystemVersion, &response) != noErr)
4305      error ("Cannot get Mac OS version");      error ("Cannot get Mac OS version");
4306      
4307    mac_major_version = (response >> 8) & 0xf;    mac_major_version = (response >> 8) & 0xf;
4308    mac_minor_version = (response >> 4) & 0xf;    mac_minor_version = (response >> 4) & 0xf;
4309    
# Line 4330  If omitted or nil, that stands for the s Line 4330  If omitted or nil, that stands for the s
4330    (display)    (display)
4331       Lisp_Object display;       Lisp_Object display;
4332  {  {
4333    /* MAC_TODO: this is an approximation, and only of the main display */      /* MAC_TODO: this is an approximation, and only of the main display */
4334    
4335    struct mac_display_info *dpyinfo = check_x_display_info (display);    struct mac_display_info *dpyinfo = check_x_display_info (display);
4336    short h, v;    short h, v;
4337      
4338    ScreenRes (&h, &v);    ScreenRes (&h, &v);
4339      
4340    return make_number ((int) (v / 72.0 * 25.4));    return make_number ((int) (v / 72.0 * 25.4));
4341  }  }
4342    
# Line 4348  If omitted or nil, that stands for the s Line 4348  If omitted or nil, that stands for the s
4348    (display)    (display)
4349       Lisp_Object display;       Lisp_Object display;
4350  {  {
4351    /* MAC_TODO: this is an approximation, and only of the main display */      /* MAC_TODO: this is an approximation, and only of the main display */
4352    
4353    struct mac_display_info *dpyinfo = check_x_display_info (display);    struct mac_display_info *dpyinfo = check_x_display_info (display);
4354    short h, v;    short h, v;
4355      
4356    ScreenRes (&h, &v);    ScreenRes (&h, &v);
4357      
4358    return make_number ((int) (h / 72.0 * 25.4));    return make_number ((int) (h / 72.0 * 25.4));
4359  }  }
4360    
# Line 4691  valid_image_p (object) Line 4691  valid_image_p (object)
4691       Lisp_Object object;       Lisp_Object object;
4692  {  {
4693    int valid_p = 0;    int valid_p = 0;
4694      
4695    if (CONSP (object) && EQ (XCAR (object), Qimage))    if (CONSP (object) && EQ (XCAR (object), Qimage))
4696      {      {
4697        Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);        Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);
4698        struct image_type *type = lookup_image_type (symbol);        struct image_type *type = lookup_image_type (symbol);
4699          
4700        if (type)        if (type)
4701          valid_p = type->valid_p (object);          valid_p = type->valid_p (object);
4702      }      }
# Line 4814  parse_image_spec (spec, keywords, nkeywo Line 4814  parse_image_spec (spec, keywords, nkeywo
4814           was found more than once, it's an error.  */           was found more than once, it's an error.  */
4815        keywords[i].value = value;        keywords[i].value = value;
4816        ++keywords[i].count;        ++keywords[i].count;
4817          
4818        if (keywords[i].count > 1)        if (keywords[i].count > 1)
4819          return 0;          return 0;
4820    
# Line 4864  parse_image_spec (spec, keywords, nkeywo Line 4864  parse_image_spec (spec, keywords, nkeywo
4864    
4865          case IMAGE_FUNCTION_VALUE:          case IMAGE_FUNCTION_VALUE:
4866            value = indirect_function (value);            value = indirect_function (value);
4867            if (SUBRP (value)            if (SUBRP (value)
4868                || COMPILEDP (value)                || COMPILEDP (value)
4869                || (CONSP (value) && EQ (XCAR (value), Qlambda)))                || (CONSP (value) && EQ (XCAR (value), Qlambda)))
4870              break;              break;
# Line 4913  image_spec_value (spec, key, found) Line 4913  image_spec_value (spec, key, found)
4913       int *found;       int *found;
4914  {  {
4915    Lisp_Object tail;    Lisp_Object tail;
4916      
4917    xassert (valid_image_p (spec));    xassert (valid_image_p (spec));
4918    
4919    for (tail = XCDR (spec);    for (tail = XCDR (spec);
# Line 4927  image_spec_value (spec, key, found) Line 4927  image_spec_value (spec, key, found)
4927            return XCAR (XCDR (tail));            return XCAR (XCDR (tail));
4928          }          }
4929      }      }
4930      
4931    if (found)    if (found)
4932      *found = 0;      *found = 0;
4933    return Qnil;    return Qnil;
4934  }  }
4935        
4936    
4937    
4938    
# Line 4953  make_image (spec, hash) Line 4953  make_image (spec, hash)
4953       unsigned hash;       unsigned hash;
4954  {  {
4955    struct image *img = (struct image *) xmalloc (sizeof *img);    struct image *img = (struct image *) xmalloc (sizeof *img);
4956      
4957    xassert (valid_image_p (spec));    xassert (valid_image_p (spec));
4958    bzero (img, sizeof *img);    bzero (img, sizeof *img);
4959    img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));    img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
# Line 5014  prepare_image_for_display (f, img) Line 5014  prepare_image_for_display (f, img)
5014    if (img->pixmap == 0 && !img->load_failed_p)    if (img->pixmap == 0 && !img->load_failed_p)
5015      img->load_failed_p = img->type->load (f, img) == 0;      img->load_failed_p = img->type->load (f, img) == 0;
5016  }  }
5017        
5018    
5019  /* Value is the number of pixels for the ascent of image IMG when  /* Value is the number of pixels for the ascent of image IMG when
5020     drawn in face FACE.  */     drawn in face FACE.  */
# Line 5073  x_clear_image (f, img) Line 5073  x_clear_image (f, img)
5073    if (img->ncolors)    if (img->ncolors)
5074      {      {
5075        int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;        int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
5076          
5077        /* If display has an immutable color map, freeing colors is not        /* If display has an immutable color map, freeing colors is not
5078           necessary and some servers don't allow it.  So don't do it.  */           necessary and some servers don't allow it.  So don't do it.  */
5079        if (class != StaticColor        if (class != StaticColor
# Line 5087  x_clear_image (f, img) Line 5087  x_clear_image (f, img)
5087                         img->ncolors, 0);                         img->ncolors, 0);
5088            UNBLOCK_INPUT;            UNBLOCK_INPUT;
5089          }          }
5090          
5091        xfree (img->colors);        xfree (img->colors);
5092        img->colors = NULL;        img->colors = NULL;
5093        img->ncolors = 0;        img->ncolors = 0;
# Line 5149  make_image_cache () Line 5149  make_image_cache ()
5149  {  {
5150    struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);    struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
5151    int size;    int size;
5152      
5153    bzero (c, sizeof *c);    bzero (c, sizeof *c);
5154    c->size = 50;    c->size = 50;
5155    c->images = (struct image **) xmalloc (c->size * sizeof *c->images);    c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
# Line 5174  free_image_cache (f) Line 5174  free_image_cache (f)
5174    
5175        /* Cache should not be referenced by any frame when freed.  */        /* Cache should not be referenced by any frame when freed.  */
5176        xassert (c->refcount == 0);        xassert (c->refcount == 0);
5177          
5178        for (i = 0; i < c->used; ++i)        for (i = 0; i < c->used; ++i)
5179          free_image (f, c->images[i]);          free_image (f, c->images[i]);
5180        xfree (c->images);        xfree (c->images);
# Line 5207  clear_image_cache (f, force_p) Line 5207  clear_image_cache (f, force_p)
5207    
5208        EMACS_GET_TIME (t);        EMACS_GET_TIME (t);
5209        old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);        old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
5210          
5211        for (i = 0; i < c->used; ++i)        for (i = 0; i < c->used; ++i)
5212          {          {
5213            struct image *img = c->images[i];            struct image *img = c->images[i];
# Line 5244  FRAME t means clear the image caches of Line 5244  FRAME t means clear the image caches of
5244    if (EQ (frame, Qt))    if (EQ (frame, Qt))
5245      {      {
5246        Lisp_Object tail;        Lisp_Object tail;
5247          
5248        FOR_EACH_FRAME (tail, frame)        FOR_EACH_FRAME (tail, frame)
5249          if (FRAME_MAC_P (XFRAME (frame)))          if (FRAME_MAC_P (XFRAME (frame)))
5250            clear_image_cache (XFRAME (frame), 1);            clear_image_cache (XFRAME (frame), 1);
# Line 5275  lookup_image (f, spec) Line 5275  lookup_image (f, spec)
5275       specification.  */       specification.  */
5276    xassert (FRAME_WINDOW_P (f));    xassert (FRAME_WINDOW_P (f));
5277    xassert (valid_image_p (spec));    xassert (valid_image_p (spec));
5278      
5279    GCPRO1 (spec);    GCPRO1 (spec);
5280    
5281    /* Look up SPEC in the hash table of the image cache.  */    /* Look up SPEC in the hash table of the image cache.  */
# Line 5332  lookup_image (f, spec) Line 5332  lookup_image (f, spec)
5332                if (XINT (XCDR (margin)) > 0)                if (XINT (XCDR (margin)) > 0)
5333                  img->vmargin = XFASTINT (XCDR (margin));                  img->vmargin = XFASTINT (XCDR (margin));
5334              }              }
5335              
5336            relief = image_spec_value (spec, QCrelief, NULL);            relief = image_spec_value (spec, QCrelief, NULL);
5337            if (INTEGERP (relief))            if (INTEGERP (relief))
5338              {              {
# Line 5346  lookup_image (f, spec) Line 5346  lookup_image (f, spec)
5346    /* We're using IMG, so set its timestamp to `now'.  */    /* We're using IMG, so set its timestamp to `now'.  */
5347    EMACS_GET_TIME (now);    EMACS_GET_TIME (now);
5348    img->timestamp = EMACS_SECS (now);    img->timestamp = EMACS_SECS (now);
5349      
5350    UNGCPRO;    UNGCPRO;
5351      
5352    /* Value is the image id.  */    /* Value is the image id.  */
5353    return img->id;    return img->id;
5354  }  }
# Line 5502  x_put_x_image (f, ximg, pixmap, width, h Line 5502  x_put_x_image (f, ximg, pixmap, width, h
5502       Pixmap pixmap;       Pixmap pixmap;
5503  {  {
5504    GC gc;    GC gc;
5505      
5506    xassert (interrupt_input_blocked);    xassert (interrupt_input_blocked);
5507    gc = XCreateGC (NULL, pixmap, 0, NULL);    gc = XCreateGC (NULL, pixmap, 0, NULL);
5508    XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);    XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);
# Line 5536  x_find_image_file (file) Line 5536  x_find_image_file (file)
5536    
5537    /* Try to find FILE in data-directory, then x-bitmap-file-path.  */    /* Try to find FILE in data-directory, then x-bitmap-file-path.  */
5538    fd = openp (search_path, file, Qnil, &file_found, Qnil);    fd = openp (search_path, file, Qnil, &file_found, Qnil);
5539      
5540    if (fd < 0)    if (fd < 0)
5541      file_found = Qnil;      file_found = Qnil;
5542    else    else
# Line 5616  enum xbm_token Line 5616  enum xbm_token
5616    XBM_TK_NUMBER    XBM_TK_NUMBER
5617  };  };
5618    
5619      
5620  /* Return non-zero if OBJECT is a valid XBM-type image specification.  /* Return non-zero if OBJECT is a valid XBM-type image specification.
5621     A valid specification is a list starting with the symbol `image'     A valid specification is a list starting with the symbol `image'
5622     The rest of the list is a property list which must contain an     The rest of the list is a property list which must contain an
# Line 5647  xbm_image_p (object) Line 5647  xbm_image_p (object)
5647       Lisp_Object object;       Lisp_Object object;
5648  {  {
5649    struct image_keyword kw[XBM_LAST];    struct image_keyword kw[XBM_LAST];
5650      
5651    bcopy (xbm_format, kw, sizeof kw);    bcopy (xbm_format, kw, sizeof kw);
5652    if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))    if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
5653      return 0;      return 0;
# Line 5673  xbm_image_p (object) Line 5673  xbm_image_p (object)
5673        data = kw[XBM_DATA].value;        data = kw[XBM_DATA].value;
5674        width = XFASTINT (kw[XBM_WIDTH].value);        width = XFASTINT (kw[XBM_WIDTH].value);
5675        height = XFASTINT (kw[XBM_HEIGHT].value);        height = XFASTINT (kw[XBM_HEIGHT].value);
5676          
5677        /* Check type of data, and width and height against contents of        /* Check type of data, and width and height against contents of
5678           data.  */           data.  */
5679        if (VECTORP (data))        if (VECTORP (data))
5680          {          {
5681            int i;            int i;
5682              
5683            /* Number of elements of the vector must be >= height.  */            /* Number of elements of the vector must be >= height.  */
5684            if (XVECTOR (data)->size < height)            if (XVECTOR (data)->size < height)
5685              return 0;              return 0;
# Line 5724  xbm_image_p (object) Line 5724  xbm_image_p (object)
5724    if (kw[XBM_ASCENT].count    if (kw[XBM_ASCENT].count
5725        && XFASTINT (kw[XBM_ASCENT].value) > 100)        && XFASTINT (kw[XBM_ASCENT].value) > 100)
5726      return 0;      return 0;
5727      
5728    return 1;    return 1;
5729  }  }
5730    
# Line 5742  xbm_scan (fp, sval, ival) Line 5742  xbm_scan (fp, sval, ival)
5742       int *ival;       int *ival;
5743  {  {
5744    int c;    int c;
5745      
5746    /* Skip white space.  */    /* Skip white space.  */
5747    while ((c = fgetc (fp)) != EOF && isspace (c))    while ((c = fgetc (fp)) != EOF && isspace (c))
5748      ;      ;
# Line 5752  xbm_scan (fp, sval, ival) Line 5752  xbm_scan (fp, sval, ival)
5752    else if (isdigit (c))    else if (isdigit (c))
5753      {      {
5754        int value = 0, digit;        int value = 0, digit;
5755          
5756        if (c == '0')        if (c == '0')
5757          {          {
5758            c = fgetc (fp);            c = fgetc (fp);
# Line 5836  xbm_read_bitmap_file_data (file, width, Line 5836  xbm_read_bitmap_file_data (file, width,
5836       if (LA1 != (TOKEN))        \       if (LA1 != (TOKEN))        \
5837         goto failure;            \         goto failure;            \
5838       else                       \       else                       \
5839         match ()         match ()
5840    
5841  #define expect_ident(IDENT)                                     \  #define expect_ident(IDENT)                                     \
5842       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)  \       if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0)  \
# Line 5880  xbm_read_bitmap_file_data (file, width, Line 5880  xbm_read_bitmap_file_data (file, width,
5880      {      {
5881        if (strcmp (buffer, "unsigned") == 0)        if (strcmp (buffer, "unsigned") == 0)
5882          {          {
5883            match ();            match ();
5884            expect_ident ("char");            expect_ident ("char");
5885          }          }
5886        else if (strcmp (buffer, "short") == 0)        else if (strcmp (buffer, "short") == 0)
# Line 5895  xbm_read_bitmap_file_data (file, width, Line 5895  xbm_read_bitmap_file_data (file, width,
5895        else        else
5896          goto failure;          goto failure;
5897      }      }
5898    else    else
5899      goto failure;      goto failure;
5900    
5901    expect (XBM_TK_IDENT);    expect (XBM_TK_IDENT);
# Line 5910  xbm_read_bitmap_file_data (file, width, Line 5910  xbm_read_bitmap_file_data (file, width,
5910    
5911    if (v10)    if (v10)
5912      {      {
5913          
5914        for (i = 0; i < nbytes; i += 2)        for (i = 0; i < nbytes; i += 2)
5915          {          {
5916            int val = value;            int val = value;
# Line 5919  xbm_read_bitmap_file_data (file, width, Line 5919  xbm_read_bitmap_file_data (file, width,
5919            *p++ = val;            *p++ = val;
5920            if (!padding_p || ((i + 2) % bytes_per_line))            if (!padding_p || ((i + 2) % bytes_per_line))
5921              *p++ = value >> 8;              *p++ = value >> 8;
5922              
5923            if (LA1 == ',' || LA1 == '}')            if (LA1 == ',' || LA1 == '}')
5924              match ();              match ();
5925            else            else
# Line 5932  xbm_read_bitmap_file_data (file, width, Line 5932  xbm_read_bitmap_file_data (file, width,
5932          {          {
5933            int val = value;            int val = value;
5934            expect (XBM_TK_NUMBER);            expect (XBM_TK_NUMBER);
5935              
5936            *p++ = val;            *p++ = val;
5937              
5938            if (LA1 == ',' || LA1 == '}')            if (LA1 == ',' || LA1 == '}')
5939              match ();              match ();
5940            else            else
# Line 5946  xbm_read_bitmap_file_data (file, width, Line 5946  xbm_read_bitmap_file_data (file, width,
5946    return 1;    return 1;
5947    
5948   failure:   failure:
5949      
5950    fclose (fp);    fclose (fp);
5951    if (*data)    if (*data)
5952      {      {
# Line 5975  xbm_load_image_from_file (f, img, specif Line 5975  xbm_load_image_from_file (f, img, specif
5975    int success_p = 0;    int success_p = 0;
5976    Lisp_Object file;    Lisp_Object file;
5977    struct gcpro gcpro1;    struct gcpro gcpro1;
5978      
5979    xassert (STRINGP (specified_file));    xassert (STRINGP (specified_file));
5980    file = Qnil;    file = Qnil;
5981    GCPRO1 (file);    GCPRO1 (file);
# Line 5987  xbm_load_image_from_file (f, img, specif Line 5987  xbm_load_image_from_file (f, img, specif
5987        UNGCPRO;        UNGCPRO;
5988        return 0;        return 0;
5989      }      }
5990              
5991    rc = xbm_read_bitmap_file_data (SDATA (file), &img->width,    rc = xbm_read_bitmap_file_data (SDATA (file), &img->width,
5992                                    &img->height, &data);                                    &img->height, &data);
5993    if (rc)    if (rc)
# Line 5996  xbm_load_image_from_file (f, img, specif Line 5996  xbm_load_image_from_file (f, img, specif
5996        unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);        unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
5997        unsigned long background = FRAME_BACKGROUND_PIXEL (f);        unsigned long background = FRAME_BACKGROUND_PIXEL (f);
5998        Lisp_Object value;        Lisp_Object value;
5999          
6000        xassert (img->width > 0 && img->height > 0);        xassert (img->width > 0 && img->height > 0);
6001    
6002        /* Get foreground and background colors, maybe allocate colors.  */        /* Get foreground and background colors, maybe allocate colors.  */
6003        value = image_spec_value (img->spec, QCforeground, NULL);        value = image_spec_value (img->spec, QCforeground, NULL);
6004        if (!NILP (value))        if (!NILP (value))
6005          foreground = x_alloc_image_color (f, img, value, foreground);          foreground = x_alloc_image_color (f, img, value, foreground);
6006          
6007        value = image_spec_value (img->spec, QCbackground, NULL);        value = image_spec_value (img->spec, QCbackground, NULL);
6008        if (!NILP (value))        if (!NILP (value))
6009          background = x_alloc_image_color (f, img, value, background);          background = x_alloc_image_color (f, img, value, background);
# Line 6026  xbm_load_image_from_file (f, img, specif Line 6026  xbm_load_image_from_file (f, img, specif
6026          }          }
6027        else        else
6028          success_p = 1;          success_p = 1;
6029          
6030        UNBLOCK_INPUT;        UNBLOCK_INPUT;
6031  #endif /* MAC_TODO */  #endif /* MAC_TODO */
6032      }      }
# Line 6076  xbm_load (f, img) Line 6076  xbm_load (f, img)
6076        xassert (img->width > 0 && img->height > 0);        xassert (img->width > 0 && img->height > 0);
6077    
6078        BLOCK_INPUT;        BLOCK_INPUT;
6079          
6080        if (fmt[XBM_ASCENT].count)        if (fmt[XBM_ASCENT].count)
6081          img->ascent = XFASTINT (fmt[XBM_ASCENT].value);          img->ascent = XFASTINT (fmt[XBM_ASCENT].value);
6082    
# Line 6095  xbm_load (f, img) Line 6095  xbm_load (f, img)
6095            int i;            int i;
6096            char *p;            char *p;
6097            int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;            int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
6098              
6099            p = bits = (char *) alloca (nbytes * img->height);            p = bits = (char *) alloca (nbytes * img->height);
6100            for (i = 0; i < img->height; ++i, p += nbytes)            for (i = 0; i < img->height; ++i, p += nbytes)
6101              {              {
# Line 6137  xbm_load (f, img) Line 6137  xbm_load (f, img)
6137    
6138    return success_p;    return success_p;
6139  }  }
6140      
6141    
6142    
6143  /***********************************************************************  /***********************************************************************
6144                                XPM images                                XPM images
6145   ***********************************************************************/   ***********************************************************************/
6146    
6147  #if HAVE_XPM  #if HAVE_XPM
6148    
6149  static int xpm_image_p P_ ((Lisp_Object object));  static int xpm_image_p P_ ((Lisp_Object object));
6150  static int xpm_load P_ ((struct frame *f, struct image *img));  static int xpm_load P_ ((struct frame *f, struct image *img));
# Line 6278  xpm_load (f, img) Line 6278  xpm_load (f, img)
6278        Lisp_Object tail;        Lisp_Object tail;
6279        XpmColorSymbol *xpm_syms;        XpmColorSymbol *xpm_syms;
6280        int i, size;        int i, size;
6281          
6282        attrs.valuemask |= XpmColorSymbols;        attrs.valuemask |= XpmColorSymbols;
6283    
6284        /* Count number of symbols.  */        /* Count number of symbols.  */
# Line 6319  xpm_load (f, img) Line 6319  xpm_load (f, img)
6319            UNBLOCK_INPUT;            UNBLOCK_INPUT;
6320            return 0;            return 0;
6321          }          }
6322          
6323        rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),        rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
6324                                  SDATA (file), &img->pixmap, &img->mask,                                  SDATA (file), &img->pixmap, &img->mask,
6325                                  &attrs);                                  &attrs);
# Line 6359  xpm_load (f, img) Line 6359  xpm_load (f, img)
6359          case XpmOpenFailed:          case XpmOpenFailed:
6360            image_error ("Error opening XPM file (%s)", img->spec, Qnil);            image_error ("Error opening XPM file (%s)", img->spec, Qnil);
6361            break;            break;
6362              
6363          case XpmFileInvalid:          case XpmFileInvalid:
6364            image_error ("Invalid XPM file (%s)", img->spec, Qnil);            image_error ("Invalid XPM file (%s)", img->spec, Qnil);
6365            break;            break;
6366              
6367          case XpmNoMemory:          case XpmNoMemory:
6368            image_error ("Out of memory (%s)", img->spec, Qnil);            image_error ("Out of memory (%s)", img->spec, Qnil);
6369            break;            break;
6370              
6371          case XpmColorFailed:          case XpmColorFailed:
6372            image_error ("Color allocation error (%s)", img->spec, Qnil);            image_error ("Color allocation error (%s)", img->spec, Qnil);
6373            break;            break;
6374              
6375          default:          default:
6376            image_error ("Unknown error (%s)", img->spec, Qnil);            image_error ("Unknown error (%s)", img->spec, Qnil);
6377            break;            break;
# Line 6520  lookup_pixel_color (f, pixel) Line 6520  lookup_pixel_color (f, pixel)
6520        int rc;        int rc;
6521    
6522        BLOCK_INPUT;        BLOCK_INPUT;
6523          
6524        cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));        cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
6525        color.pixel = pixel;        color.pixel = pixel;
6526        XQueryColor (NULL, cmap, &color);        XQueryColor (NULL, cmap, &color);
# Line 6530  lookup_pixel_color (f, pixel) Line 6530  lookup_pixel_color (f, pixel)
6530        if (rc)        if (rc)
6531          {          {
6532            ++ct_colors_allocated;            ++ct_colors_allocated;
6533          
6534            p = (struct ct_color *) xmalloc (sizeof *p);            p = (struct ct_color *) xmalloc (sizeof *p);
6535            p->r = color.red;            p->r = color.red;
6536            p->g = color.green;            p->g = color.green;
# Line 6567  colors_in_color_table (n) Line 6567  colors_in_color_table (n)
6567        colors = (unsigned long *) xmalloc (ct_colors_allocated        colors = (unsigned long *) xmalloc (ct_colors_allocated
6568                                            * sizeof *colors);                                            * sizeof *colors);
6569        *n = ct_colors_allocated;        *n = ct_colors_allocated;
6570          
6571        for (i = j = 0; i < CT_SIZE; ++i)        for (i = j = 0; i < CT_SIZE; ++i)
6572          for (p = ct_table[i]; p; p = p->next)          for (p = ct_table[i]; p; p = p->next)
6573            colors[j++] = p->pixel;            colors[j++] = p->pixel;
# Line 6625  x_laplace_write_row (f, pixels, width, x Line 6625  x_laplace_write_row (f, pixels, width, x
6625       int y;       int y;
6626  {  {
6627    int x;    int x;
6628      
6629    for (x = 0; x < width; ++x)    for (x = 0; x < width; ++x)
6630      XPutPixel (ximg, x, y, pixels[x]);      XPutPixel (ximg, x, y, pixels[x]);
6631  }  }
# Line 6691  x_laplace (f, img) Line 6691  x_laplace (f, img)
6691            int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;            int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;
6692            int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;            int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;
6693            int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;            int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;
6694              
6695            out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,            out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
6696                                           b & 0xffff);                                           b & 0xffff);
6697          }          }
# Line 6707  x_laplace (f, img) Line 6707  x_laplace (f, img)
6707    /* Free the input image, and free resources of IMG.  */    /* Free the input image, and free resources of IMG.  */
6708    XDestroyImage (ximg);    XDestroyImage (ximg);
6709    x_clear_image (f, img);    x_clear_image (f, img);
6710      
6711    /* Put the output image into pixmap, and destroy it.  */    /* Put the output image into pixmap, and destroy it.  */
6712    x_put_x_image (f, oimg, pixmap, img->width, img->height);    x_put_x_image (f, oimg, pixmap, img->width, img->height);
6713    x_destroy_x_image (oimg);    x_destroy_x_image (oimg);
# Line 6742  x_build_heuristic_mask (f, img, how) Line 6742  x_build_heuristic_mask (f, img, how)
6742    unsigned long bg;    unsigned long bg;
6743    
6744    BLOCK_INPUT;    BLOCK_INPUT;
6745      
6746    /* Create an image and pixmap serving as mask.  */    /* Create an image and pixmap serving as mask.  */
6747    rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,    rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
6748                                      &mask_img, &img->mask);                                      &mask_img, &img->mask);
# Line 6760  x_build_heuristic_mask (f, img, how) Line 6760  x_build_heuristic_mask (f, img, how)
6760       take that as color.  Otherwise, try to determine the color       take that as color.  Otherwise, try to determine the color
6761       heuristically. */       heuristically. */
6762    look_at_corners_p = 1;    look_at_corners_p = 1;
6763      
6764    if (CONSP (how))    if (CONSP (how))
6765      {      {
6766        int rgb[3], i = 0;        int rgb[3], i = 0;
# Line 6780  x_build_heuristic_mask (f, img, how) Line 6780  x_build_heuristic_mask (f, img, how)
6780            Colormap cmap;            Colormap cmap;
6781    
6782            sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);            sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
6783              
6784            cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));            cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
6785            if (XLookupColor (dpy, cmap, color_name, &exact, &color))            if (XLookupColor (dpy, cmap, color_name, &exact, &color))
6786              {              {
# Line 6789  x_build_heuristic_mask (f, img, how) Line 6789  x_build_heuristic_mask (f, img, how)
6789              }              }
6790          }          }
6791      }      }
6792      
6793    if (look_at_corners_p)    if (look_at_corners_p)
6794      {      {
6795        unsigned long corners[4];        unsigned long corners[4];
# Line 6805  x_build_heuristic_mask (f, img, how) Line 6805  x_build_heuristic_mask (f, img, how)
6805        for (i = best_count = 0; i < 4; ++i)        for (i = best_count = 0; i < 4; ++i)
6806          {          {
6807            int j, n;            int j, n;
6808              
6809            for (j = n = 0; j < 4; ++j)            for (j = n = 0; j < 4; ++j)
6810              if (corners[i] == corners[j])              if (corners[i] == corners[j])
6811                ++n;                ++n;
# Line 6825  x_build_heuristic_mask (f, img, how) Line 6825  x_build_heuristic_mask (f, img, how)
6825    x_put_x_image (f, mask_img, img->mask, img->width, img->height);    x_put_x_image (f, mask_img, img->mask, img->width, img->height);
6826    x_destroy_x_image (mask_img);    x_destroy_x_image (mask_img);
6827    XDestroyImage (ximg);    XDestroyImage (ximg);
6828      
6829    UNBLOCK_INPUT;    UNBLOCK_INPUT;
6830  #endif /* MAC_TODO */  #endif /* MAC_TODO */
6831    
# Line 6896  pbm_image_p (object) Line 6896  pbm_image_p (object)
6896       Lisp_Object object;       Lisp_Object object;
6897  {  {
6898    struct image_keyword fmt[PBM_LAST];    struct image_keyword fmt[PBM_LAST];
6899      
6900    bcopy (pbm_format, fmt, sizeof fmt);    bcopy (pbm_format, fmt, sizeof fmt);
6901      
6902    if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)    if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
6903        || (fmt[PBM_ASCENT].count        || (fmt[PBM_ASCENT].count
6904            && XFASTINT (fmt[PBM_ASCENT].value) > 100))            && XFASTINT (fmt[PBM_ASCENT].value) > 100))
6905      return 0;      return 0;
6906    
# Line 6978  pbm_read_file (file, size) Line 6978  pbm_read_file (file, size)
6978            buf = NULL;            buf = NULL;
6979          }          }
6980      }      }
6981      
6982    return buf;    return buf;
6983  }  }
6984    
6985    
6986  /* Load PBM image IMG for use on frame F.  */  /* Load PBM image IMG for use on frame F.  */
6987    
6988  static int  static int
6989  pbm_load (f, img)  pbm_load (f, img)
6990       struct frame *f;       struct frame *f;
6991       struct image *img;       struct image *img;
# Line 7048  pbm_load (f, img) Line 7048  pbm_load (f, img)
7048      case '1':      case '1':
7049        raw_p = 0, type = PBM_MONO;        raw_p = 0, type = PBM_MONO;
7050        break;        break;
7051          
7052      case '2':      case '2':
7053        raw_p = 0, type = PBM_GRAY;        raw_p = 0, type = PBM_GRAY;
7054        break;        break;
# Line 7060  pbm_load (f, img) Line 7060  pbm_load (f, img)
7060      case '4':      case '4':
7061        raw_p = 1, type = PBM_MONO;        raw_p = 1, type = PBM_MONO;
7062        break;        break;
7063          
7064      case '5':      case '5':
7065        raw_p = 1, type = PBM_GRAY;        raw_p = 1, type = PBM_GRAY;
7066        break;        break;
7067          
7068      case '6':      case '6':
7069        raw_p = 1, type = PBM_COLOR;        raw_p = 1, type = PBM_COLOR;
7070        break;        break;
# Line 7085  pbm_load (f, img) Line 7085  pbm_load (f, img)
7085        if (raw_p && max_color_idx > 255)        if (raw_p && max_color_idx > 255)
7086          max_color_idx = 255;          max_color_idx = 255;
7087      }      }
7088      
7089    if (width < 0    if (width < 0
7090        || height < 0        || height < 0
7091        || (type != PBM_MONO && max_color_idx < 0))        || (type != PBM_MONO && max_color_idx < 0))
# Line 7098  pbm_load (f, img) Line 7098  pbm_load (f, img)
7098        UNBLOCK_INPUT;        UNBLOCK_INPUT;
7099        goto error;        goto error;
7100      }      }
7101      
7102    /* Initialize the color hash table.  */    /* Initialize the color hash table.  */
7103    init_color_table ();    init_color_table ();
7104    
7105    if (type == PBM_MONO)    if (type == PBM_MONO)
7106      {      {
7107        int c = 0, g;        int c = 0, g;
7108          
7109        for (y = 0; y < height; ++y)        for (y = 0; y < height; ++y)
7110          for (x = 0; x < width; ++x)          for (x = 0; x < width; ++x)
7111            {            {
# Line 7130  pbm_load (f, img) Line 7130  pbm_load (f, img)
7130          for (x = 0; x < width; ++x)          for (x = 0; x < width; ++x)
7131            {            {
7132              int r, g, b;              int r, g, b;
7133                
7134              if (type == PBM_GRAY)              if (type == PBM_GRAY)
7135                r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);                r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
7136              else if (raw_p)              else if (raw_p)
# Line 7145  pbm_load (f, img) Line 7145  pbm_load (f, img)
7145                  g = pbm_scan_number (&p, end);                  g = pbm_scan_number (&p, end);
7146                  b = pbm_scan_number (&p, end);                  b = pbm_scan_number (&p, end);
7147                }                }
7148                
7149              if (r < 0 || g < 0 || b < 0)              if (r < 0 || g < 0 || b < 0)
7150                {                {
7151                  xfree (ximg->data);                  xfree (ximg->data);
# Line 7156  pbm_load (f, img) Line 7156  pbm_load (f, img)
7156                               img->spec, Qnil);                               img->spec, Qnil);
7157                  goto error;                  goto error;
7158                }                }
7159                
7160              /* RGB values are now in the range 0..max_color_idx.              /* RGB values are now in the range 0..max_color_idx.
7161                 Scale this to the range 0..0xffff supported by X.  */                 Scale this to the range 0..0xffff supported by X.  */
7162              r = (double) r * 65535 / max_color_idx;              r = (double) r * 65535 / max_color_idx;
# Line 7165  pbm_load (f, img) Line 7165  pbm_load (f, img)
7165              XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));              XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
7166            }            }
7167      }      }
7168      
7169    /* Store in IMG->colors the colors allocated for the image, and    /* Store in IMG->colors the colors allocated for the image, and
7170       free the color table.  */       free the color table.  */
7171    img->colors = colors_in_color_table (&img->ncolors);    img->colors = colors_in_color_table (&img->ncolors);
7172    free_color_table ();    free_color_table ();
7173      
7174    /* Put the image into a pixmap.  */    /* Put the image into a pixmap.  */
7175    x_put_x_image (f, ximg, img->pixmap, width, height);    x_put_x_image (f, ximg, img->pixmap, width, height);
7176    x_destroy_x_image (ximg);    x_destroy_x_image (ximg);
7177    UNBLOCK_INPUT;    UNBLOCK_INPUT;
7178          
7179    img->width = width;    img->width = width;
7180    img->height = height;    img->height = height;
7181    
# Line 7253  png_image_p (object) Line 7253  png_image_p (object)
7253  {  {
7254    struct image_keyword fmt[PNG_LAST];    struct image_keyword fmt[PNG_LAST];
7255    bcopy (png_format, fmt, sizeof fmt);    bcopy (png_format, fmt, sizeof fmt);
7256      
7257    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)    if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
7258        || (fmt[PNG_ASCENT].count        || (fmt[PNG_ASCENT].count
7259            && XFASTINT (fmt[PNG_ASCENT].value) > 100))            && XFASTINT (fmt[PNG_ASCENT].value) > 100))
7260      return 0;      return 0;
7261    
# Line 7312  png_read_from_memory (png_ptr, data, len Line 7312  png_read_from_memory (png_ptr, data, len
7312    
7313    if (length > tbr->len - tbr->index)    if (length > tbr->len - tbr->index)
7314      png_error (png_ptr, "Read error");      png_error (png_ptr, "Read error");
7315      
7316    bcopy (tbr->bytes + tbr->index, data, length);    bcopy (tbr->bytes + tbr->index, data, length);
7317    tbr->index = tbr->index + length;    tbr->index = tbr->index + length;
7318  }  }
# Line 7455  png_load (f, img) Line 7455  png_load (f, img)
7455    png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,    png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
7456                  &interlace_type, NULL, NULL);                  &interlace_type, NULL, NULL);
7457    
7458    /* If image contains simply transparency data, we prefer to    /* If image contains simply transparency data, we prefer to
7459       construct a clipping mask.  */       construct a clipping mask.  */
7460    if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))    if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
7461      transparent_p = 1;      transparent_p = 1;
7462    else    else
7463      transparent_p = 0;      transparent_p = 0;
7464    
7465    /* This function is easier to write if we only have to handle    /* This function is easier to write if we only have to handle
7466       one data format: RGB or RGBA with 8 bits per channel.  Let's       one data format: RGB or RGBA with 8 bits per channel.  Let's
7467       transform other formats into that format.  */       transform other formats into that format.  */
7468    
# Line 7475  png_load (f, img) Line 7475  png_load (f, img)
7475    png_set_expand (png_ptr);    png_set_expand (png_ptr);
7476    
7477    /* Convert grayscale images to RGB.  */    /* Convert grayscale images to RGB.  */
7478    if (color_type == PNG_COLOR_TYPE_GRAY    if (color_type == PNG_COLOR_TYPE_GRAY
7479        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
7480      png_set_gray_to_rgb (png_ptr);      png_set_gray_to_rgb (png_ptr);
7481    
# Line 7506  png_load (f, img) Line 7506  png_load (f, img)
7506        png_color_16 *image_background;        png_color_16 *image_background;
7507    
7508        if (png_get_bKGD (png_ptr, info_ptr, &image_background))        if (png_get_bKGD (png_ptr, info_ptr, &image_background))
7509          /* Image contains a background color with which to          /* Image contains a background color with which to
7510             combine the image.  */             combine the image.  */
7511          png_set_background (png_ptr, image_background,          png_set_background (png_ptr, image_background,
7512                              PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);                              PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
7513        else        else
7514          {          {
7515            /* Image does not contain a background color with which            /* Image does not contain a background color with which
7516               to combine the image data via an alpha channel.  Use               to combine the image data via an alpha channel.  Use
7517               the frame's background instead.  */               the frame's background instead.  */
7518            XColor color;            XColor color;
7519            Colormap cmap;            Colormap cmap;
# Line 7573  png_load (f, img) Line 7573  png_load (f, img)
7573        UNBLOCK_INPUT;        UNBLOCK_INPUT;
7574        goto error;        goto error;
7575      }      }
7576      
7577    /* Create an image and pixmap serving as mask if the PNG image    /* Create an image and pixmap serving as mask if the PNG image
7578       contains an alpha channel.  */       contains an alpha channel.  */
7579    if (channels == 4    if (channels == 4
# Line 7605  png_load (f, img) Line 7605  png_load (f, img)
7605            XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));            XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
7606    
7607            /* An alpha channel, aka mask channel, associates variable            /* An alpha channel, aka mask channel, associates variable
7608               transparency with an image.  Where other image formats               transparency with an image.  Where other image formats
7609               support binary transparency---fully transparent or fully               support binary transparency---fully transparent or fully
7610               opaque---PNG allows up to 254 levels of partial transparency.               opaque---PNG allows up to 254 levels of partial transparency.
7611               The PNG library implements partial transparency by combining               The PNG library implements partial transparency by combining
7612               the image with a specified background color.               the image with a specified background color.
7613    
7614               I'm not sure how to handle this here nicely: because the               I'm not sure how to handle this here nicely: because the
7615               background on which the image is displayed may change, for               background on which the image is displayed may change, for
7616               real alpha channel support, it would be necessary to create               real alpha channel support, it would be necessary to create
7617               a new image for each possible background.                 a new image for each possible background.
7618    
7619               What I'm doing now is that a mask is created if we have               What I'm doing now is that a mask is created if we have
7620               boolean transparency information.  Otherwise I'm using               boolean transparency information.  Otherwise I'm using
# Line 7738  jpeg_image_p (object) Line 7738  jpeg_image_p (object)
7738       Lisp_Object object;       Lisp_Object object;
7739  {  {
7740    struct image_keyword fmt[JPEG_LAST];    struct image_keyword fmt[JPEG_LAST];
7741      
7742    bcopy (jpeg_format, fmt, sizeof fmt);    bcopy (jpeg_format, fmt, sizeof fmt);
7743      
7744    if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)    if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
7745        || (fmt[JPEG_ASCENT].count        || (fmt[JPEG_ASCENT].count
7746            && XFASTINT (fmt[JPEG_ASCENT].value) > 100))            && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
7747      return 0;      return 0;
7748    
# Line 7811  our_skip_input_data (cinfo, num_bytes) Line 7811  our_skip_input_data (cinfo, num_bytes)
7811      {      {
7812        if (num_bytes > src->bytes_in_buffer)        if (num_bytes > src->bytes_in_buffer)
7813          ERREXIT (cinfo, JERR_INPUT_EOF);          ERREXIT (cinfo, JERR_INPUT_EOF);
7814          
7815        src->bytes_in_buffer -= num_bytes;        src->bytes_in_buffer -= num_bytes;
7816        src->next_input_byte += num_bytes;        src->next_input_byte += num_bytes;
7817      }      }
# Line 7849  jpeg_memory_src (cinfo, data, len) Line 7849  jpeg_memory_src (cinfo, data, len)
7849        src = (struct jpeg_source_mgr *) cinfo->src;        src = (struct jpeg_source_mgr *) cinfo->src;
7850        src->next_input_byte = data;        src->next_input_byte = data;
7851      }      }
7852      
7853    src = (struct jpeg_source_mgr *) cinfo->src;    src = (struct jpeg_source_mgr *) cinfo->src;
7854    src->init_source = our_init_source;    src->init_source = our_init_source;
7855    src->fill_input_buffer = our_fill_input_buffer;    src->fill_input_buffer = our_fill_input_buffer;
# Line 7864  jpeg_memory_src (cinfo, data, len) Line 7864  jpeg_memory_src (cinfo, data, len)
7864  /* Load image IMG for use on frame F.  Patterned after example.c  /* Load image IMG for use on frame F.  Patterned after example.c
7865     from the JPEG lib.  */     from the JPEG lib.  */
7866    
7867  static int  static int
7868  jpeg_load (f, img)  jpeg_load (f, img)
7869       struct frame *f;       struct frame *f;
7870       struct image *img;       struct image *img;
# Line 7897  jpeg_load (f, img) Line 7897  jpeg_load (f, img)
7897            UNGCPRO;            UNGCPRO;
7898            return 0;            return 0;
7899          }          }
7900      
7901        fp = fopen (SDATA (file), "r");        fp = fopen (SDATA (file), "r");
7902        if (fp == NULL)        if (fp == NULL)
7903          {          {
# Line 7906  jpeg_load (f, img) Line 7906  jpeg_load (f, img)
7906            return 0;            return 0;
7907          }          }
7908      }      }
7909      
7910    /* Customize libjpeg's error handling to call my_error_exit when an    /* Customize libjpeg's error handling to call my_error_exit when an
7911       error is detected. This function will perform a longjmp. */       error is detected. This function will perform a longjmp. */
7912    mgr.pub.error_exit = my_error_exit;    mgr.pub.error_exit = my_error_exit;
7913    cinfo.err = jpeg_std_error (&mgr.pub);    cinfo.err = jpeg_std_error (&mgr.pub);
7914      
7915    if ((rc = setjmp (mgr.setjmp_buffer)) != 0)    if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
7916      {      {
7917        if (rc == 1)        if (rc == 1)
# Line 7922  jpeg_load (f, img) Line 7922  jpeg_load (f, img)
7922            image_error ("Error reading JPEG image `%s': %s", img->spec,            image_error ("Error reading JPEG image `%s': %s", img->spec,
7923                         build_string (buffer));                         build_string (buffer));
7924          }          }
7925              
7926        /* Close the input file and destroy the JPEG object.  */        /* Close the input file and destroy the JPEG object.  */
7927        if (fp)        if (fp)
7928          fclose (fp);          fclose (fp);
7929        jpeg_destroy_decompress (&cinfo);        jpeg_destroy_decompress (&cinfo);
7930    
7931        BLOCK_INPUT;        BLOCK_INPUT;
7932          
7933        /* If we already have an XImage, free that.  */        /* If we already have an XImage, free that.  */
7934        x_destroy_x_image (ximg);        x_destroy_x_image (ximg);
7935    
7936        /* Free pixmap and colors.  */        /* Free pixmap and colors.  */
7937        x_clear_image (f, img);        x_clear_image (f, img);
7938          
7939        UNBLOCK_INPUT;        UNBLOCK_INPUT;
7940        UNGCPRO;        UNGCPRO;
7941        return 0;        return 0;
# Line 7992  jpeg_load (f, img) Line 7992  jpeg_load (f, img)
7992      init_color_table ();      init_color_table ();
7993      colors = (unsigned long *) alloca (cinfo.actual_number_of_colors      colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
7994                                         * sizeof *colors);                                         * sizeof *colors);
7995      
7996      for (i = 0; i < cinfo.actual_number_of_colors; ++i)      for (i = 0; i < cinfo.actual_number_of_colors; ++i)
7997        {        {
7998          /* Multiply RGB values with 255 because X expects RGB values          /* Multiply RGB values with 255 because X expects RGB values
# Line 8024  jpeg_load (f, img) Line 8024  jpeg_load (f, img)
8024    jpeg_destroy_decompress (&cinfo);    jpeg_destroy_decompress (&cinfo);
8025    if (fp)    if (fp)
8026      fclose (fp);      fclose (fp);
8027      
8028    /* Put the image into the pixmap.  */    /* Put the image into the pixmap.  */
8029    x_put_x_image (f, ximg, img->pixmap, width, height);    x_put_x_image (f, ximg, img->pixmap, width, height);
8030    x_destroy_x_image (ximg);    x_destroy_x_image (ximg);
# Line 8102  tiff_image_p (object) Line 8102  tiff_image_p (object)
8102  {  {
8103    struct image_keyword fmt[TIFF_LAST];    struct image_keyword fmt[TIFF_LAST];
8104    bcopy (tiff_format, fmt, sizeof fmt);    bcopy (tiff_format, fmt, sizeof fmt);
8105      
8106    if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)    if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
8107        || (fmt[TIFF_ASCENT].count        || (fmt[TIFF_ASCENT].count
8108            && XFASTINT (fmt[TIFF_ASCENT].value) > 100))            && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
8109      return 0;      return 0;
8110      
8111    /* Must specify either the :data or :file keyword.  */    /* Must specify either the :data or :file keyword.  */
8112    return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;    return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
8113  }  }
# Line 8168  tiff_seek_in_memory (data, off, whence) Line 8168  tiff_seek_in_memory (data, off, whence)
8168      case SEEK_SET:              /* Go from beginning of source.  */      case SEEK_SET:              /* Go from beginning of source.  */
8169        idx = off;        idx = off;
8170        break;        break;
8171          
8172      case SEEK_END:              /* Go from end of source.  */      case SEEK_END:              /* Go from end of source.  */
8173        idx = src->len + off;        idx = src->len + off;
8174        break;        break;
8175          
8176      case SEEK_CUR:              /* Go from current position.  */      case SEEK_CUR:              /* Go from current position.  */
8177        idx = src->index + off;        idx = src->index + off;
8178        break;        break;
8179          
8180      default:                    /* Invalid `whence'.   */      default:                    /* Invalid `whence'.  */
8181        return -1;        return -1;
8182      }      }
8183      
8184    if (idx > src->len || idx < 0)    if (idx > src->len || idx < 0)
8185      return -1;      return -1;
8186      
8187    src->index = idx;    src->index = idx;
8188    return src->index;    return src->index;
8189  }  }
# Line 8255  tiff_load (f, img) Line 8255  tiff_load (f, img)
8255            UNGCPRO;            UNGCPRO;
8256            return 0;            return 0;
8257          }          }
8258      
8259        /* Try to open the image file.  */        /* Try to open the image file.  */
8260        tiff = TIFFOpen (SDATA (file), "r");        tiff = TIFFOpen (SDATA (file), "r");
8261        if (tiff == NULL)        if (tiff == NULL)
# Line 8294  tiff_load (f, img) Line 8294  tiff_load (f, img)
8294    TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);    TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
8295    TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);    TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
8296    buf = (uint32 *) xmalloc (width * height * sizeof *buf);    buf = (uint32 *) xmalloc (width * height * sizeof *buf);
8297      
8298    rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);    rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
8299    TIFFClose (tiff);    TIFFClose (tiff);
8300    if (!rc)    if (!rc)
# Line 8323  tiff_load (f, img) Line 8323  tiff_load (f, img)
8323    for (y = 0; y < height; ++y)    for (y = 0; y < height; ++y)
8324      {      {
8325        uint32 *row = buf + y * width;        uint32 *row = buf + y * width;
8326          
8327        for (x = 0; x < width; ++x)        for (x = 0; x < width; ++x)
8328          {          {
8329            uint32 abgr = row[x];            uint32 abgr = row[x];
8330            int r = TIFFGetR (abgr) << 8;            int r = TIFFGetR (abgr) << 8;
8331            int g = TIFFGetG (abgr) << 8;            int g = TIFFGetG (abgr) << 8;
8332            int b = TIFFGetB (abgr) << 8;            int b = TIFFGetB (abgr) << 8;
8333            XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));            XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
8334          }          }
8335      }      }
8336    
# Line 8343  tiff_load (f, img) Line 8343  tiff_load (f, img)
8343    x_destroy_x_image (ximg);    x_destroy_x_image (ximg);
8344    xfree (buf);    xfree (buf);
8345    UNBLOCK_INPUT;    UNBLOCK_INPUT;
8346          
8347    img->width = width;    img->width = width;
8348    img->height = height;    img->height = height;
8349    
# Line 8421  gif_image_p (object) Line 8421  gif_image_p (object)
8421  {  {
8422    struct image_keyword fmt[GIF_LAST];    struct image_keyword fmt[GIF_LAST];
8423    bcopy (gif_format, fmt, sizeof fmt);    bcopy (gif_format, fmt, sizeof fmt);
8424      
8425    if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)    if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
8426        || (fmt[GIF_ASCENT].count        || (fmt[GIF_ASCENT].count
8427            && XFASTINT (fmt[GIF_ASCENT].value) > 100))            && XFASTINT (fmt[GIF_ASCENT].value) > 100))
8428      return 0;      return 0;
8429      
8430    /* Must specify either the :data or :file keyword.  */    /* Must specify either the :data or :file keyword.  */
8431    return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;    return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
8432  }  }
# Line 8499  gif_load (f, img) Line 8499  gif_load (f, img)
8499            UNGCPRO;            UNGCPRO;
8500            return 0;            return 0;
8501          }          }
8502      
8503        /* Open the GIF file.  */        /* Open the GIF file.  */
8504        gif = DGifOpenFileName (SDATA (file));        gif = DGifOpenFileName (SDATA (file));
8505        if (gif == NULL)        if (gif == NULL)
# Line 8560  gif_load (f, img) Line 8560  gif_load (f, img)
8560        UNGCPRO;        UNGCPRO;
8561        return 0;        return 0;
8562      }      }
8563      
8564    /* Allocate colors.  */    /* Allocate colors.  */
8565    gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;    gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
8566    if (!gif_color_map)    if (!gif_color_map)
8567      gif_color_map = gif->SColorMap;      gif_color_map = gif->SColorMap;
8568    init_color_table ();    init_color_table ();
8569    bzero (pixel_colors, sizeof pixel_colors);    bzero (pixel_colors, sizeof pixel_colors);
8570      
8571    for (i = 0; i < gif_color_map->ColorCount; ++i)    for (i = 0; i < gif_color_map->ColorCount; ++i)
8572      {      {
8573        int r = gif_color_map->Colors[i].Red << 8;        int r = gif_color_map->Colors[i].Red << 8;
# Line 8580  gif_load (f, img) Line 8580  gif_load (f, img)
8580    free_color_table ();    free_color_table ();
8581    
8582    /* Clear the part of the screen image that are not covered by    /* Clear the part of the screen image that are not covered by
8583       the image from the GIF file.  Full animated GIF support       the image from the GIF file.  Full animated GIF support
8584       requires more than can be done here (see the gif89 spec,       requires more than can be done here (see the gif89 spec,
8585       disposal methods).  Let's simply assume that the part       disposal methods).  Let's simply assume that the part
8586       not covered by a sub-image is in the frame's background color.  */       not covered by a sub-image is in the frame's background color.  */
# Line 8627  gif_load (f, img) Line 8627  gif_load (f, img)
8627                while (row >= image_height)                while (row >= image_height)
8628                  row = interlace_start[++pass];                  row = interlace_start[++pass];
8629              }              }
8630              
8631            for (x = 0; x < image_width; x++)            for (x = 0; x < image_width; x++)
8632              {              {
8633                int i = raster[(y * image_width) + x];                int i = raster[(y * image_width) + x];
8634                XPutPixel (ximg, x + image_left, row + image_top,                XPutPixel (ximg, x + image_left, row + image_top,
8635                           pixel_colors[i]);                           pixel_colors[i]);
8636              }              }
8637              
8638            row += interlace_increment[pass];            row += interlace_increment[pass];
8639          }          }
8640      }      }
# Line 8647  gif_load (f, img) Line 8647  gif_load (f, img)
8647              XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);              XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
8648            }            }
8649      }      }
8650      
8651    DGifCloseFile (gif);    DGifCloseFile (gif);
8652      
8653    /* Put the image into the pixmap, then free the X image and its buffer.  */    /* Put the image into the pixmap, then free the X image and its buffer.  */
8654    x_put_x_image (f, ximg, img->pixmap, width, height);    x_put_x_image (f, ximg, img->pixmap, width, height);
8655    x_destroy_x_image (ximg);    x_destroy_x_image (ximg);
8656    UNBLOCK_INPUT;    UNBLOCK_INPUT;
8657          
8658    UNGCPRO;    UNGCPRO;
8659    return 1;    return 1;
8660  }  }
# Line 8751  gs_image_p (object) Line 8751  gs_image_p (object)
8751    struct image_keyword fmt[GS_LAST];    struct image_keyword fmt[GS_LAST];
8752    Lisp_Object tem;    Lisp_Object tem;
8753    int i;    int i;
8754      
8755    bcopy (gs_format, fmt, sizeof fmt);    bcopy (gs_format, fmt, sizeof fmt);
8756      
8757    if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)    if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)
8758        || (fmt[GS_ASCENT].count        || (fmt[GS_ASCENT].count
8759            && XFASTINT (fmt[GS_ASCENT].value) > 100))            && XFASTINT (fmt[GS_ASCENT].value) > 100))
8760      return 0;      return 0;
8761    
# Line 8823  gs_load (f, img) Line 8823  gs_load (f, img)
8823        image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);        image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
8824        return 0;        return 0;
8825      }      }
8826        
8827    /* Call the loader to fill the pixmap.  It returns a process object    /* Call the loader to fill the pixmap.  It returns a process object
8828       if successful.  We do not record_unwind_protect here because       if successful.  We do not record_unwind_protect here because
8829       other places in redisplay like calling window scroll functions       other places in redisplay like calling window scroll functions
# Line 8834  gs_load (f, img) Line 8834  gs_load (f, img)
8834             (unsigned long) FRAME_W32_WINDOW (f),             (unsigned long) FRAME_W32_WINDOW (f),
8835             (unsigned long) img->pixmap);             (unsigned long) img->pixmap);
8836    window_and_pixmap_id = build_string (buffer);    window_and_pixmap_id = build_string (buffer);
8837      
8838    sprintf (buffer, "%lu %lu",    sprintf (buffer, "%lu %lu",
8839             FRAME_FOREGROUND_PIXEL (f),             FRAME_FOREGROUND_PIXEL (f),
8840             FRAME_BACKGROUND_PIXEL (f));             FRAME_BACKGROUND_PIXEL (f));
8841    pixel_colors = build_string (buffer);    pixel_colors = build_string (buffer);
8842      
8843    XSETFRAME (frame, f);    XSETFRAME (frame, f);
8844    loader = image_spec_value (img->spec, QCloader, NULL);    loader = image_spec_value (img->spec, QCloader, NULL);
8845    if (NILP (loader))    if (NILP (loader))
# Line 8897  x_kill_gs_process (pixmap, f) Line 8897  x_kill_gs_process (pixmap, f)
8897        if (ximg)        if (ximg)
8898          {          {
8899            int x, y;            int x, y;
8900              
8901            /* Initialize the color table.  */            /* Initialize the color table.  */
8902            init_color_table ();            init_color_table ();
8903          
8904            /* For each pixel of the image, look its color up in the            /* For each pixel of the image, look its color up in the
8905               color table.  After having done so, the color table will               color table.  After having done so, the color table will
8906               contain an entry for each color used by the image.  */               contain an entry for each color used by the image.  */
# Line 8933  x_kill_gs_process (pixmap, f) Line 8933  x_kill_gs_process (pixmap, f)
8933        else        else
8934          image_error ("Cannot get X image of `%s'; colors will not be freed",          image_error ("Cannot get X image of `%s'; colors will not be freed",
8935                       img->spec, Qnil);                       img->spec, Qnil);
8936          
8937        UNBLOCK_INPUT;        UNBLOCK_INPUT;
8938      }      }
8939  }  }
# Line 9039  value.  */) Line 9039  value.  */)
9039        rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),        rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
9040                                 prop_atom, 0, bytes_remaining,                                 prop_atom, 0, bytes_remaining,
9041                                 False, XA_STRING,                                 False, XA_STRING,
9042                                 &actual_type, &actual_format,                                 &actual_type, &actual_format,
9043                                 &actual_size, &bytes_remaining,                                 &actual_size, &bytes_remaining,
9044                                 (unsigned char **) &tmp_data);                                 (unsigned char **) &tmp_data);
9045        if (rc == Success)        if (rc == Success)
9046          prop_value = make_string (tmp_data, size);          prop_value = make_string (tmp_data, size);
# Line 9094  start_hourglass () Line 9094  start_hourglass ()
9094  #if 0 /* MAC_TODO: cursor shape changes.  */  #if 0 /* MAC_TODO: cursor shape changes.  */
9095    EMACS_TIME delay;    EMACS_TIME delay;
9096    int secs, usecs = 0;    int secs, usecs = 0;
9097      
9098    cancel_hourglass ();    cancel_hourglass ();
9099    
9100    if (INTEGERP (Vhourglass_delay)    if (INTEGERP (Vhourglass_delay)
# Line 9110  start_hourglass () Line 9110  start_hourglass ()
9110      }      }
9111    else    else
9112      secs = DEFAULT_HOURGLASS_DELAY;      secs = DEFAULT_HOURGLASS_DELAY;
9113      
9114    EMACS_SET_SECS_USECS (delay, secs, usecs);    EMACS_SET_SECS_USECS (delay, secs, usecs);
9115    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,    hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
9116                                       show_hourglass, NULL);                                       show_hourglass, NULL);
# Line 9129  cancel_hourglass () Line 9129  cancel_hourglass ()
9129        cancel_atimer (hourglass_atimer);        cancel_atimer (hourglass_atimer);
9130        hourglass_atimer = NULL;        hourglass_atimer = NULL;
9131      }      }
9132      
9133    if (hourglass_shown_p)    if (hourglass_shown_p)
9134      hide_hourglass ();      hide_hourglass ();
9135  }  }
# Line 9156  show_hourglass (timer) Line 9156  show_hourglass (timer)
9156    if (!hourglass_shown_p)    if (!hourglass_shown_p)
9157      {      {
9158        Lisp_Object rest, frame;        Lisp_Object rest, frame;
9159      
9160        BLOCK_INPUT;        BLOCK_INPUT;
9161      
9162        FOR_EACH_FRAME (rest, frame)        FOR_EACH_FRAME (rest, frame)
9163          if (FRAME_W32_P (XFRAME (frame)))          if (FRAME_W32_P (XFRAME (frame)))
9164            {            {
9165              struct frame *f = XFRAME (frame);              struct frame *f = XFRAME (frame);
9166            
9167              f->output_data.w32->hourglass_p = 1;              f->output_data.w32->hourglass_p = 1;
9168            
9169              if (!f->output_data.w32->hourglass_window)              if (!f->output_data.w32->hourglass_window)
9170                {                {
9171                  unsigned long mask = CWCursor;                  unsigned long mask = CWCursor;
9172                  XSetWindowAttributes attrs;                  XSetWindowAttributes attrs;
9173                
9174                  attrs.cursor = f->output_data.w32->hourglass_cursor;                  attrs.cursor = f->output_data.w32->hourglass_cursor;
9175                
9176                  f->output_data.w32->hourglass_window                  f->output_data.w32->hourglass_window
9177                    = XCreateWindow (FRAME_X_DISPLAY (f),                    = XCreateWindow (FRAME_X_DISPLAY (f),
9178                                     FRAME_OUTER_WINDOW (f),                                     FRAME_OUTER_WINDOW (f),
# Line 9181  show_hourglass (timer) Line 9181  show_hourglass (timer)
9181                                     CopyFromParent,                                     CopyFromParent,
9182                                     mask, &attrs);                                     mask, &attrs);
9183                }                }
9184            
9185              XMapRaised (FRAME_X_DISPLAY (f),              XMapRaised (FRAME_X_DISPLAY (f),
9186                          f->output_data.w32->hourglass_window);                          f->output_data.w32->hourglass_window);
9187              XFlush (FRAME_X_DISPLAY (f));              XFlush (FRAME_X_DISPLAY (f));
# Line 9208  hide_hourglass () Line 9208  hide_hourglass ()
9208        FOR_EACH_FRAME (rest, frame)        FOR_EACH_FRAME (rest, frame)
9209          {          {
9210            struct frame *f = XFRAME (frame);            struct frame *f = XFRAME (frame);
9211          
9212            if (FRAME_W32_P (f)            if (FRAME_W32_P (f)
9213                /* Watch out for newly created frames.  */                /* Watch out for newly created frames.  */
9214                && f->output_data.x->hourglass_window)                && f->output_data.x->hourglass_window)
# Line 9236  hide_hourglass () Line 9236  hide_hourglass ()
9236    
9237  static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,  static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,
9238                                             Lisp_Object));                                             Lisp_Object));
9239        
9240  /* The frame of a currently visible tooltip, or null.  */  /* The frame of a currently visible tooltip, or null.  */
9241    
9242  Lisp_Object tip_frame;  Lisp_Object tip_frame;
# Line 9344  x_create_tip_frame (dpyinfo, parms) Line 9344  x_create_tip_frame (dpyinfo, parms)
9344          else          else
9345            font = x_new_font (f, SDATA (font));            font = x_new_font (f, SDATA (font));
9346        }        }
9347        
9348      /* Try out a font which we hope has bold and italic variations.  */      /* Try out a font which we hope has bold and italic variations.  */
9349      if (!STRINGP (font))      if (!STRINGP (font))
9350        font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");        font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
# Line 9369  x_create_tip_frame (dpyinfo, parms) Line 9369  x_create_tip_frame (dpyinfo, parms)
9369    
9370    x_default_parameter (f, parms, Qborder_width, make_number (2),    x_default_parameter (f, parms, Qborder_width, make_number (2),
9371                         "borderWidth", "BorderWidth", RES_TYPE_NUMBER);                         "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
9372      
9373    /* This defaults to 2 in order to match xterm.  We recognize either    /* This defaults to 2 in order to match xterm.  We recognize either
9374       internalBorderWidth or internalBorder (which is what xterm calls       internalBorderWidth or internalBorder (which is what xterm calls
9375       it).  */       it).  */
# Line 9407  x_create_tip_frame (dpyinfo, parms) Line 9407  x_create_tip_frame (dpyinfo, parms)
9407       end up in init_iterator with a null face cache, which should not       end up in init_iterator with a null face cache, which should not
9408       happen.  */       happen.  */
9409    init_frame_faces (f);    init_frame_faces (f);
9410      
9411    f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;    f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
9412    window_prompting = x_figure_window_size (f, parms);    window_prompting = x_figure_window_size (f, parms);
9413    
# Line 9430  x_create_tip_frame (dpyinfo, parms) Line 9430  x_create_tip_frame (dpyinfo, parms)
9430    {    {
9431      XSetWindowAttributes attrs;      XSetWindowAttributes attrs;
9432      unsigned long mask;      unsigned long mask;
9433        
9434      BLOCK_INPUT;      BLOCK_INPUT;
9435      mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;      mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
9436      /* Window managers looks at the override-redirect flag to      /* Window managers looks at the override-redirect flag to
# Line 9525  DY added (default is 10).  */) Line 9525  DY added (default is 10).  */)
9525    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9526    int old_windows_or_buffers_changed = windows_or_buffers_changed;    int old_windows_or_buffers_changed = windows_or_buffers_changed;
9527    int count = SPECPDL_INDEX ();    int count = SPECPDL_INDEX ();
9528      
9529    specbind (Qinhibit_redisplay, Qt);    specbind (Qinhibit_redisplay, Qt);
9530    
9531    GCPRO4 (string, parms, frame, timeout);    GCPRO4 (string, parms, frame, timeout);
# Line 9541  DY added (default is 10).  */) Line 9541  DY added (default is 10).  */)
9541      dx = make_number (5);      dx = make_number (5);
9542    else    else
9543      CHECK_NUMBER (dx);      CHECK_NUMBER (dx);
9544      
9545    if (NILP (dy))    if (NILP (dy))
9546      dy = make_number (-10);      dy = make_number (-10);
9547    else    else
# Line 9561  DY added (default is 10).  */) Line 9561  DY added (default is 10).  */)
9561            && !NILP (Fequal (last_parms, parms)))            && !NILP (Fequal (last_parms, parms)))
9562          {          {
9563            struct frame *f = XFRAME (tip_frame);            struct frame *f = XFRAME (tip_frame);
9564              
9565            /* Only DX and DY have changed.  */            /* Only DX and DY have changed.  */
9566            if (!NILP (tip_timer))            if (!NILP (tip_timer))
9567              {              {
# Line 9652  DY added (default is 10).  */) Line 9652  DY added (default is 10).  */)
9652          }          }
9653        else        else
9654          row_width = row->pixel_width;          row_width = row->pixel_width;
9655          
9656        height += row->height;        height += row->height;
9657        width = max (width, row_width);        width = max (width, row_width);
9658      }      }
# Line 9706  Value is t is tooltip was open, nil othe Line 9706  Value is t is tooltip was open, nil othe
9706    /* Return quickly if nothing to do.  */    /* Return quickly if nothing to do.  */
9707    if (NILP (tip_timer) && NILP (tip_frame))    if (NILP (tip_timer) && NILP (tip_frame))
9708      return Qnil;      return Qnil;
9709      
9710    frame = tip_frame;    frame = tip_frame;
9711    timer = tip_timer;    timer = tip_timer;
9712    GCPRO2 (frame, timer);    GCPRO2 (frame, timer);
9713    tip_frame = tip_timer = deleted = Qnil;    tip_frame = tip_timer = deleted = Qnil;
9714      
9715    count = SPECPDL_INDEX ();    count = SPECPDL_INDEX ();
9716    specbind (Qinhibit_redisplay, Qt);    specbind (Qinhibit_redisplay, Qt);
9717    specbind (Qinhibit_quit, Qt);    specbind (Qinhibit_quit, Qt);
9718      
9719    if (!NILP (timer))    if (!NILP (timer))
9720      call1 (Qcancel_timer, timer);      call1 (Qcancel_timer, timer);
9721    
# Line 9864  DEFUN ("lookup-image", Flookup_image, Sl Line 9864  DEFUN ("lookup-image", Flookup_image, Sl
9864       Lisp_Object spec;       Lisp_Object spec;
9865  {  {
9866    int id = -1;    int id = -1;
9867      
9868    if (valid_image_p (spec))    if (valid_image_p (spec))
9869      id = lookup_image (SELECTED_FRAME (), spec);      id = lookup_image (SELECTED_FRAME (), spec);
9870    
# Line 10012  or when you set the mouse color.  */); Line 10012  or when you set the mouse color.  */);
10012    DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,    DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
10013                 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);                 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);
10014    display_hourglass_p = 1;    display_hourglass_p = 1;
10015      
10016    DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,    DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
10017                 doc: /* *Seconds to wait before displaying an hourglass pointer.                 doc: /* *Seconds to wait before displaying an hourglass pointer.
10018  Value must be an integer or float.  */);  Value must be an integer or float.  */);
# Line 10139  meaning don't clear the cache.  */); Line 10139  meaning don't clear the cache.  */);
10139    Qxpm = intern ("xpm");    Qxpm = intern ("xpm");
10140    staticpro (&Qxpm);    staticpro (&Qxpm);
10141  #endif  #endif
10142      
10143  #if HAVE_JPEG  #if HAVE_JPEG
10144    Qjpeg = intern ("jpeg");    Qjpeg = intern ("jpeg");
10145    staticpro (&Qjpeg);    staticpro (&Qjpeg);
10146  #endif  #endif
10147    
10148  #if HAVE_TIFF  #if HAVE_TIFF
10149    Qtiff = intern ("tiff");    Qtiff = intern ("tiff");
10150    staticpro (&Qtiff);    staticpro (&Qtiff);
10151  #endif  #endif
10152    
10153  #if HAVE_GIF  #if HAVE_GIF
10154    Qgif = intern ("gif");    Qgif = intern ("gif");
# Line 10192  init_xfns () Line 10192  init_xfns ()
10192  #if 0 /* NTEMACS_TODO : Image support for W32 */  #if 0 /* NTEMACS_TODO : Image support for W32 */
10193    define_image_type (&gs_type);    define_image_type (&gs_type);
10194    define_image_type (&pbm_type);    define_image_type (&pbm_type);
10195      
10196  #if HAVE_XPM  #if HAVE_XPM
10197    define_image_type (&xpm_type);    define_image_type (&xpm_type);
10198  #endif  #endif
10199      
10200  #if HAVE_JPEG  #if HAVE_JPEG
10201    define_image_type (&jpeg_type);    define_image_type (&jpeg_type);
10202  #endif  #endif
10203      
10204  #if HAVE_TIFF  #if HAVE_TIFF
10205    define_image_type (&tiff_type);    define_image_type (&tiff_type);
10206  #endif  #endif
10207      
10208  #if HAVE_GIF  #if HAVE_GIF
10209    define_image_type (&gif_type);    define_image_type (&gif_type);
10210  #endif  #endif
10211      
10212  #if HAVE_PNG  #if HAVE_PNG
10213    define_image_type (&png_type);    define_image_type (&png_type);
10214  #endif  #endif

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26