/[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.21 by kfstorm, Fri Mar 21 13:49:48 2003 UTC revision 1.22 by kfstorm, Mon Mar 31 20:34:30 2003 UTC
# Line 109  int gray_bitmap_width = gray_width; Line 109  int gray_bitmap_width = gray_width;
109  int gray_bitmap_height = gray_height;  int gray_bitmap_height = gray_height;
110  unsigned char *gray_bitmap_bits = gray_bits;  unsigned char *gray_bitmap_bits = gray_bits;
111    
 /* The name we're using in resource queries.  */  
   
 Lisp_Object Vx_resource_name;  
   
112  /* Non-zero means we're allowed to display an hourglass cursor.  */  /* Non-zero means we're allowed to display an hourglass cursor.  */
113    
114  int display_hourglass_p;  int display_hourglass_p;
# Line 187  Lisp_Object Vx_pixel_size_width_font_reg Line 183  Lisp_Object Vx_pixel_size_width_font_reg
183    */    */
184    
185  /*&&& symbols declared here &&&*/  /*&&& symbols declared here &&&*/
 Lisp_Object Qauto_raise;  
 Lisp_Object Qauto_lower;  
 Lisp_Object Qborder_color;  
 Lisp_Object Qborder_width;  
 Lisp_Object Qcursor_color;  
 Lisp_Object Qcursor_type;  
 Lisp_Object Qgeometry;  
 Lisp_Object Qicon_left;  
 Lisp_Object Qicon_top;  
 Lisp_Object Qicon_type;  
 Lisp_Object Qicon_name;  
 Lisp_Object Qinternal_border_width;  
 Lisp_Object Qleft;  
 Lisp_Object Qright;  
 Lisp_Object Qmouse_color;  
186  Lisp_Object Qnone;  Lisp_Object Qnone;
 Lisp_Object Qparent_id;  
 Lisp_Object Qscroll_bar_width;  
187  Lisp_Object Qsuppress_icon;  Lisp_Object Qsuppress_icon;
188  Lisp_Object Qundefined_color;  Lisp_Object Qundefined_color;
 Lisp_Object Qvertical_scroll_bars;  
 Lisp_Object Qvisibility;  
 Lisp_Object Qwindow_id;  
 Lisp_Object Qx_frame_parameter;  
 Lisp_Object Qx_resource_name;  
 Lisp_Object Quser_position;  
 Lisp_Object Quser_size;  
 Lisp_Object Qscreen_gamma;  
 Lisp_Object Qline_spacing;  
189  Lisp_Object Qcenter;  Lisp_Object Qcenter;
190  Lisp_Object Qcancel_timer;  Lisp_Object Qcancel_timer;
191  Lisp_Object Qhyper;  Lisp_Object Qhyper;
# Line 226  Lisp_Object Qctrl; Line 196  Lisp_Object Qctrl;
196  Lisp_Object Qcontrol;  Lisp_Object Qcontrol;
197  Lisp_Object Qshift;  Lisp_Object Qshift;
198    
 extern Lisp_Object Qtop;  
 extern Lisp_Object Qdisplay;  
 Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;  
 extern Lisp_Object Qtool_bar_lines;  
   
 /* These are defined in frame.c.  */  
 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;  
 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;  
 extern Lisp_Object Qtool_bar_lines;  
   
199  extern Lisp_Object Vwindow_system_version;  extern Lisp_Object Vwindow_system_version;
200    
 extern Lisp_Object Qbox;  
   
 Lisp_Object Qface_set_after_frame_default;  
   
201  extern int mac_initialized;  extern int mac_initialized;
202    
203  /* Functions in macterm.c.  */  /* Functions in macterm.c.  */
 extern void x_set_offset (struct frame *, int, int, int);  
 extern void x_wm_set_icon_position (struct frame *, int, int);  
204  extern void x_set_window_size (struct frame *, int, int, int);  extern void x_set_window_size (struct frame *, int, int, int);
205  extern void x_make_frame_visible (struct frame *);  extern void x_make_frame_visible (struct frame *);
206  extern struct mac_display_info *mac_term_init (Lisp_Object, char *, char *);  extern struct mac_display_info *mac_term_init (Lisp_Object, char *, char *);
# Line 319  check_x_frame (frame) Line 273  check_x_frame (frame)
273     nil stands for the selected frame--or, if that is not a mac frame,     nil stands for the selected frame--or, if that is not a mac frame,
274     the first display on the list.  */     the first display on the list.  */
275    
276  static struct mac_display_info *  struct mac_display_info *
277  check_x_display_info (frame)  check_x_display_info (frame)
278       Lisp_Object frame;       Lisp_Object frame;
279  {  {
# Line 606  x_destroy_all_bitmaps (dpyinfo) Line 560  x_destroy_all_bitmaps (dpyinfo)
560     has an `x-frame-parameter' property which is an integer in Lisp     has an `x-frame-parameter' property which is an integer in Lisp
561     but can be interpreted as an `enum x_frame_parm' in C.  */     but can be interpreted as an `enum x_frame_parm' in C.  */
562    
 struct x_frame_parm_table  
 {  
   char *name;  
   void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));  
 };  
   
563  void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));  
564  void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
565  void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
566  void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
# Line 621  void x_set_border_color P_ ((struct fram Line 568  void x_set_border_color P_ ((struct fram
568  void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
569  void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
570  void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object));  
 void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object));  
 void x_set_internal_border_width P_ ((struct frame *, Lisp_Object,  
                                       Lisp_Object));  
571  void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object));  
 void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object));  
 void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object,  
                                      Lisp_Object));  
 void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object));  
572  void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object));  
573  void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
 void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object));  
574  void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));  void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
575  void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object,  void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object,
576                                        Lisp_Object));                                        Lisp_Object));
# Line 645  static Lisp_Object x_default_scroll_bar_ Line 581  static Lisp_Object x_default_scroll_bar_
581                                                               Lisp_Object,                                                               Lisp_Object,
582                                                               char *, char *,                                                               char *, char *,
583                                                               int));                                                               int));
 static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object));  
   
 static struct x_frame_parm_table x_frame_parms[] =  
 {  
   "auto-raise", x_set_autoraise,  
   "auto-lower", x_set_autolower,  
   "background-color", x_set_background_color,  
   "border-color", x_set_border_color,  
   "border-width", x_set_border_width,  
   "cursor-color", x_set_cursor_color,  
   "cursor-type", x_set_cursor_type,  
   "font", x_set_font,  
   "foreground-color", x_set_foreground_color,  
   "icon-name", x_set_icon_name,  
 #if 0 /* MAC_TODO: no icons for Mac */  
   "icon-type", x_set_icon_type,  
 #endif  
   "internal-border-width", x_set_internal_border_width,  
   "menu-bar-lines", x_set_menu_bar_lines,  
   "mouse-color", x_set_mouse_color,  
   "name", x_explicitly_set_name,  
   "scroll-bar-width", x_set_scroll_bar_width,  
   "title", x_set_title,  
   "unsplittable", x_set_unsplittable,  
   "vertical-scroll-bars", x_set_vertical_scroll_bars,  
   "visibility", x_set_visibility,  
   "tool-bar-lines", x_set_tool_bar_lines,  
 #if 0 /* MAC_TODO: cannot set color of scroll bar on the Mac? */  
   "scroll-bar-foreground", x_set_scroll_bar_foreground,  
   "scroll-bar-background", x_set_scroll_bar_background,  
 #endif  
   "screen-gamma", x_set_screen_gamma,  
   "line-spacing", x_set_line_spacing  
 };  
   
 /* Attach the `x-frame-parameter' properties to  
    the Lisp symbol names of parameters relevant to Mac.  */  
   
 void  
 init_x_parm_symbols ()  
 {  
   int i;  
   
   for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)  
     Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,  
           make_number (i));  
 }  
   
 /* Change the parameters of frame F as specified by ALIST.  
    If a parameter is not specially recognized, do nothing;  
    otherwise call the `x_set_...' function for that parameter.  */  
   
 void  
 x_set_frame_parameters (f, alist)  
      FRAME_PTR f;  
      Lisp_Object alist;  
 {  
   Lisp_Object tail;  
   
   /* If both of these parameters are present, it's more efficient to  
      set them both at once.  So we wait until we've looked at the  
      entire list before we set them.  */  
   int width, height;  
   
   /* Same here.  */  
   Lisp_Object left, top;  
   
   /* Same with these.  */  
   Lisp_Object icon_left, icon_top;  
   
   /* Record in these vectors all the parms specified.  */  
   Lisp_Object *parms;  
   Lisp_Object *values;  
   int i, p;  
   int left_no_change = 0, top_no_change = 0;  
   int icon_left_no_change = 0, icon_top_no_change = 0;  
   
   struct gcpro gcpro1, gcpro2;  
   
   i = 0;  
   for (tail = alist; CONSP (tail); tail = Fcdr (tail))  
     i++;  
   
   parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));  
   values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));  
   
   /* Extract parm names and values into those vectors.  */  
   
   i = 0;  
   for (tail = alist; CONSP (tail); tail = Fcdr (tail))  
     {  
       Lisp_Object elt;  
   
       elt = Fcar (tail);  
       parms[i] = Fcar (elt);  
       values[i] = Fcdr (elt);  
       i++;  
     }  
   /* TAIL and ALIST are not used again below here.  */  
   alist = tail = Qnil;  
   
   GCPRO2 (*parms, *values);  
   gcpro1.nvars = i;  
   gcpro2.nvars = i;  
   
   /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,  
      because their values appear in VALUES and strings are not valid.  */  
   top = left = Qunbound;  
   icon_left = icon_top = Qunbound;  
   
   /* Provide default values for HEIGHT and WIDTH.  */  
   if (FRAME_NEW_WIDTH (f))  
     width = FRAME_NEW_WIDTH (f);  
   else  
     width = FRAME_WIDTH (f);  
   
   if (FRAME_NEW_HEIGHT (f))  
     height = FRAME_NEW_HEIGHT (f);  
   else  
     height = FRAME_HEIGHT (f);  
   
   /* Process foreground_color and background_color before anything else.  
      They are independent of other properties, but other properties (e.g.,  
      cursor_color) are dependent upon them.  */  
   for (p = 0; p < i; p++)  
     {  
       Lisp_Object prop, val;  
   
       prop = parms[p];  
       val = values[p];  
       if (EQ (prop, Qforeground_color) || EQ (prop, Qbackground_color))  
         {  
           register Lisp_Object param_index, old_value;  
   
           param_index = Fget (prop, Qx_frame_parameter);  
           old_value = get_frame_param (f, prop);  
           store_frame_param (f, prop, val);  
           if (NATNUMP (param_index)  
               && (XFASTINT (param_index)  
                   < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))  
             (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);  
         }  
     }  
   
   /* Now process them in reverse of specified order.  */  
   for (i--; i >= 0; i--)  
     {  
       Lisp_Object prop, val;  
   
       prop = parms[i];  
       val = values[i];  
   
       if (EQ (prop, Qwidth) && NUMBERP (val))  
         width = XFASTINT (val);  
       else if (EQ (prop, Qheight) && NUMBERP (val))  
         height = XFASTINT (val);  
       else if (EQ (prop, Qtop))  
         top = val;  
       else if (EQ (prop, Qleft))  
         left = val;  
       else if (EQ (prop, Qicon_top))  
         icon_top = val;  
       else if (EQ (prop, Qicon_left))  
         icon_left = val;  
       else if (EQ (prop, Qforeground_color) || EQ (prop, Qbackground_color))  
         /* Processed above.  */  
         continue;  
       else  
         {  
           register Lisp_Object param_index, old_value;  
   
           param_index = Fget (prop, Qx_frame_parameter);  
           old_value = get_frame_param (f, prop);  
           store_frame_param (f, prop, val);  
           if (NATNUMP (param_index)  
               && (XFASTINT (param_index)  
                   < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))  
             (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);  
         }  
     }  
   
   /* Don't die if just one of these was set.  */  
   if (EQ (left, Qunbound))  
     {  
       left_no_change = 1;  
       if (f->output_data.mac->left_pos < 0)  
         left = Fcons (Qplus,  
                       Fcons (make_number (f->output_data.mac->left_pos),  
                              Qnil));  
       else  
         XSETINT (left, f->output_data.mac->left_pos);  
     }  
   if (EQ (top, Qunbound))  
     {  
       top_no_change = 1;  
       if (f->output_data.mac->top_pos < 0)  
         top = Fcons (Qplus,  
                      Fcons (make_number (f->output_data.mac->top_pos), Qnil));  
       else  
         XSETINT (top, f->output_data.mac->top_pos);  
     }  
   
   /* If one of the icon positions was not set, preserve or default it.  */  
   if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))  
     {  
       icon_left_no_change = 1;  
       icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));  
       if (NILP (icon_left))  
         XSETINT (icon_left, 0);  
     }  
   if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))  
     {  
       icon_top_no_change = 1;  
       icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));  
       if (NILP (icon_top))  
         XSETINT (icon_top, 0);  
     }  
   
   /* Don't set these parameters unless they've been explicitly  
      specified.  The window might be mapped or resized while we're in  
      this function, and we don't want to override that unless the lisp  
      code has asked for it.  
   
      Don't set these parameters unless they actually differ from the  
      window's current parameters; the window may not actually exist  
      yet.  */  
   {  
     Lisp_Object frame;  
   
     check_frame_size (f, &height, &width);  
   
     XSETFRAME (frame, f);  
   
     if (width != FRAME_WIDTH (f)  
         || height != FRAME_HEIGHT (f)  
         || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f))  
       Fset_frame_size (frame, make_number (width), make_number (height));  
   
     if ((!NILP (left) || !NILP (top))  
         && ! (left_no_change && top_no_change)  
         && ! (NUMBERP (left) && XINT (left) == f->output_data.mac->left_pos  
               && NUMBERP (top) && XINT (top) == f->output_data.mac->top_pos))  
       {  
         int leftpos = 0;  
         int toppos = 0;  
   
         /* Record the signs.  */  
         f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative);  
         if (EQ (left, Qminus))  
           f->output_data.mac->size_hint_flags |= XNegative;  
         else if (INTEGERP (left))  
           {  
             leftpos = XINT (left);  
             if (leftpos < 0)  
               f->output_data.mac->size_hint_flags |= XNegative;  
           }  
         else if (CONSP (left) && EQ (XCAR (left), Qminus)  
                  && CONSP (XCDR (left))  
                  && INTEGERP (XCAR (XCDR (left))))  
           {  
             leftpos = - XINT (XCAR (XCDR (left)));  
             f->output_data.mac->size_hint_flags |= XNegative;  
           }  
         else if (CONSP (left) && EQ (XCAR (left), Qplus)  
                  && CONSP (XCDR (left))  
                  && INTEGERP (XCAR (XCDR (left))))  
           {  
             leftpos = XINT (XCAR (XCDR (left)));  
           }  
   
         if (EQ (top, Qminus))  
           f->output_data.mac->size_hint_flags |= YNegative;  
         else if (INTEGERP (top))  
           {  
             toppos = XINT (top);  
             if (toppos < 0)  
               f->output_data.mac->size_hint_flags |= YNegative;  
           }  
         else if (CONSP (top) && EQ (XCAR (top), Qminus)  
                  && CONSP (XCDR (top))  
                  && INTEGERP (XCAR (XCDR (top))))  
           {  
             toppos = - XINT (XCAR (XCDR (top)));  
             f->output_data.mac->size_hint_flags |= YNegative;  
           }  
         else if (CONSP (top) && EQ (XCAR (top), Qplus)  
                  && CONSP (XCDR (top))  
                  && INTEGERP (XCAR (XCDR (top))))  
           {  
             toppos = XINT (XCAR (XCDR (top)));  
           }  
   
   
         /* Store the numeric value of the position.  */  
         f->output_data.mac->top_pos = toppos;  
         f->output_data.mac->left_pos = leftpos;  
   
         f->output_data.mac->win_gravity = NorthWestGravity;  
   
         /* Actually set that position, and convert to absolute.  */  
         x_set_offset (f, leftpos, toppos, -1);  
       }  
   
     if ((!NILP (icon_left) || !NILP (icon_top))  
         && ! (icon_left_no_change && icon_top_no_change))  
       x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));  
   }  
   
   UNGCPRO;  
 }  
584    
585  /* Store the screen positions of frame F into XPTR and YPTR.  /* Store the screen positions of frame F into XPTR and YPTR.
586     These are the positions of the containing window manager window,     These are the positions of the containing window manager window,
# Line 988  x_real_positions (f, xptr, yptr) Line 614  x_real_positions (f, xptr, yptr)
614    *yptr = pt.v;    *yptr = pt.v;
615  }  }
616    
 /* Insert a description of internally-recorded parameters of frame X  
    into the parameter alist *ALISTPTR that is to be given to the user.  
    Only parameters that are specific to Mac and whose values are not  
    correctly recorded in the frame's param_alist need to be considered  
    here.  */  
   
 void  
 x_report_frame_params (f, alistptr)  
      struct frame *f;  
      Lisp_Object *alistptr;  
 {  
   char buf[16];  
   Lisp_Object tem;  
   
   /* Represent negative positions (off the top or left screen edge)  
      in a way that Fmodify_frame_parameters will understand correctly.  */  
   XSETINT (tem, f->output_data.mac->left_pos);  
   if (f->output_data.mac->left_pos >= 0)  
     store_in_alist (alistptr, Qleft, tem);  
   else  
     store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));  
   
   XSETINT (tem, f->output_data.mac->top_pos);  
   if (f->output_data.mac->top_pos >= 0)  
     store_in_alist (alistptr, Qtop, tem);  
   else  
     store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));  
   
   store_in_alist (alistptr, Qborder_width,  
            make_number (f->output_data.mac->border_width));  
   store_in_alist (alistptr, Qinternal_border_width,  
            make_number (f->output_data.mac->internal_border_width));  
   sprintf (buf, "%ld", (long) FRAME_MAC_WINDOW (f));  
   store_in_alist (alistptr, Qwindow_id,  
            build_string (buf));  
   store_in_alist (alistptr, Qicon_name, f->icon_name);  
   FRAME_SAMPLE_VISIBILITY (f);  
   store_in_alist (alistptr, Qvisibility,  
                   (FRAME_VISIBLE_P (f) ? Qt  
                    : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));  
   store_in_alist (alistptr, Qdisplay,  
                   XCAR (FRAME_MAC_DISPLAY_INFO (f)->name_list_element));  
 }  
617    
618  /* The default colors for the Mac color map */  /* The default colors for the Mac color map */
619  typedef struct colormap_t  typedef struct colormap_t
# Line 2074  x_decode_color (f, arg, def) Line 1657  x_decode_color (f, arg, def)
1657    return def;    return def;
1658  }  }
1659    
 /* Change the `line-spacing' frame parameter of frame F.  OLD_VALUE is  
    the previous value of that parameter, NEW_VALUE is the new value.  */  
   
 static void  
 x_set_line_spacing (f, new_value, old_value)  
      struct frame *f;  
      Lisp_Object new_value, old_value;  
 {  
   if (NILP (new_value))  
     f->extra_line_spacing = 0;  
   else if (NATNUMP (new_value))  
     f->extra_line_spacing = XFASTINT (new_value);  
   else  
     Fsignal (Qerror, Fcons (build_string ("Illegal line-spacing"),  
                             Fcons (new_value, Qnil)));  
   if (FRAME_VISIBLE_P (f))  
     redraw_frame (f);  
 }  
   
   
 /* Change the `screen-gamma' frame parameter of frame F.  OLD_VALUE is  
    the previous value of that parameter, NEW_VALUE is the new value.  */  
   
 static void  
 x_set_screen_gamma (f, new_value, old_value)  
      struct frame *f;  
      Lisp_Object new_value, old_value;  
 {  
   if (NILP (new_value))  
     f->gamma = 0;  
   else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)  
     /* The value 0.4545 is the normal viewing gamma.  */  
     f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));  
   else  
     Fsignal (Qerror, Fcons (build_string ("Illegal screen-gamma"),  
                             Fcons (new_value, Qnil)));  
   
   clear_face_cache (0);  
 }  
   
   
1660  /* Functions called only from `x_set_frame_param'  /* Functions called only from `x_set_frame_param'
1661     to set individual parameters.     to set individual parameters.
1662    
# Line 2423  x_set_icon_type (f, arg, oldval) Line 1965  x_set_icon_type (f, arg, oldval)
1965  }  }
1966  #endif /* MAC_TODO */  #endif /* MAC_TODO */
1967    
 /* Return non-nil if frame F wants a bitmap icon.  */  
   
 Lisp_Object  
 x_icon_type (f)  
      FRAME_PTR f;  
 {  
   Lisp_Object tem;  
   
   tem = assq_no_quit (Qicon_type, f->param_alist);  
   if (CONSP (tem))  
     return XCDR (tem);  
   else  
     return Qnil;  
 }  
   
1968  void  void
1969  x_set_icon_name (f, arg, oldval)  x_set_icon_name (f, arg, oldval)
1970       struct frame *f;       struct frame *f;
# Line 2489  x_set_icon_name (f, arg, oldval) Line 2016  x_set_icon_name (f, arg, oldval)
2016  #endif /* MAC_TODO */  #endif /* MAC_TODO */
2017  }  }
2018    
 extern Lisp_Object x_new_font ();  
 extern Lisp_Object x_new_fontset();  
   
 void  
 x_set_font (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   Lisp_Object result;  
   Lisp_Object fontset_name;  
   Lisp_Object frame;  
   int old_fontset = FRAME_FONTSET(f);  
   
   CHECK_STRING (arg);  
   
   fontset_name = Fquery_fontset (arg, Qnil);  
   
   BLOCK_INPUT;  
   result = (STRINGP (fontset_name)  
             ? x_new_fontset (f, SDATA (fontset_name))  
             : x_new_font (f, SDATA (arg)));  
   UNBLOCK_INPUT;  
   
   if (EQ (result, Qnil))  
     error ("Font `%s' is not defined", SDATA (arg));  
   else if (EQ (result, Qt))  
     error ("The characters of the given font have varying widths");  
   else if (STRINGP (result))  
     {  
       if (STRINGP (fontset_name))  
         {  
           /* Fontset names are built from ASCII font names, so the  
              names may be equal despite there was a change.  */  
           if (old_fontset == FRAME_FONTSET (f))  
             return;  
         }  
       else if (!NILP (Fequal (result, oldval)))  
         return;  
   
       store_frame_param (f, Qfont, result);  
       recompute_basic_faces (f);  
     }  
   else  
     abort ();  
   
   do_pending_window_change (0);  
   
   /* Don't call `face-set-after-frame-default' when faces haven't been  
      initialized yet.  This is the case when called from  
      Fx_create_frame.  In that case, the X widget or window doesn't  
      exist either, and we can end up in x_report_frame_params with a  
      null widget which gives a segfault.  */  
   if (FRAME_FACE_CACHE (f))  
     {  
       XSETFRAME (frame, f);  
       call1 (Qface_set_after_frame_default, frame);  
     }  
 }  
   
 void  
 x_set_border_width (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   CHECK_NUMBER (arg);  
   
   if (XINT (arg) == f->output_data.mac->border_width)  
     return;  
   
 #if 0 /* MAC_TODO */  
   if (FRAME_MAC_WINDOW (f) != 0)  
     error ("Cannot change the border width of a window");  
 #endif  
   
   f->output_data.mac->border_width = XINT (arg);  
 }  
   
 void  
 x_set_internal_border_width (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   int old = f->output_data.mac->internal_border_width;  
   
   CHECK_NUMBER (arg);  
   f->output_data.mac->internal_border_width = XINT (arg);  
   if (f->output_data.mac->internal_border_width < 0)  
     f->output_data.mac->internal_border_width = 0;  
   
   if (f->output_data.mac->internal_border_width == old)  
     return;  
   
   if (FRAME_MAC_WINDOW (f) != 0)  
     {  
       x_set_window_size (f, 0, f->width, f->height);  
       SET_FRAME_GARBAGED (f);  
       do_pending_window_change (0);  
     }  
   else  
     SET_FRAME_GARBAGED (f);  
 }  
   
 void  
 x_set_visibility (f, value, oldval)  
      struct frame *f;  
      Lisp_Object value, oldval;  
 {  
   Lisp_Object frame;  
   XSETFRAME (frame, f);  
   
   if (NILP (value))  
     Fmake_frame_invisible (frame, Qt);  
   else if (EQ (value, Qicon))  
     Ficonify_frame (frame);  
   else  
     Fmake_frame_visible (frame);  
 }  
   
2019    
 /* Change window heights in windows rooted in WINDOW by N lines.  */  
   
 static void  
 x_change_window_heights (window, n)  
   Lisp_Object window;  
   int n;  
 {  
   struct window *w = XWINDOW (window);  
   
   XSETFASTINT (w->top, XFASTINT (w->top) + n);  
   XSETFASTINT (w->height, XFASTINT (w->height) - n);  
   
   if (INTEGERP (w->orig_top))  
     XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n);  
   if (INTEGERP (w->orig_height))  
     XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n);  
   
   /* Handle just the top child in a vertical split.  */  
   if (!NILP (w->vchild))  
     x_change_window_heights (w->vchild, n);  
   
   /* Adjust all children in a horizontal split.  */  
   for (window = w->hchild; !NILP (window); window = w->next)  
     {  
       w = XWINDOW (window);  
       x_change_window_heights (window, n);  
     }  
 }  
   
2020  void  void
2021  x_set_menu_bar_lines (f, value, oldval)  x_set_menu_bar_lines (f, value, oldval)
2022       struct frame *f;       struct frame *f;
# Line 2715  x_set_tool_bar_lines (f, value, oldval) Line 2095  x_set_tool_bar_lines (f, value, oldval)
2095      }      }
2096    
2097    FRAME_TOOL_BAR_LINES (f) = nlines;    FRAME_TOOL_BAR_LINES (f) = nlines;
2098    x_change_window_heights (root_window, delta);    change_window_heights (root_window, delta);
2099    adjust_glyphs (f);    adjust_glyphs (f);
2100    
2101    /* We also have to make sure that the internal border at the top of    /* We also have to make sure that the internal border at the top of
# Line 2905  x_set_title (f, name, old_name) Line 2285  x_set_title (f, name, old_name)
2285        UNBLOCK_INPUT;        UNBLOCK_INPUT;
2286      }      }
2287  }  }
   
 void  
 x_set_autoraise (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   f->auto_raise = !EQ (Qnil, arg);  
 }  
   
 void  
 x_set_autolower (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   f->auto_lower = !EQ (Qnil, arg);  
 }  
   
 void  
 x_set_unsplittable (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   f->no_split = !NILP (arg);  
 }  
   
 void  
 x_set_vertical_scroll_bars (f, arg, oldval)  
      struct frame *f;  
      Lisp_Object arg, oldval;  
 {  
   if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))  
       || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))  
       || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))  
       || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))  
     {  
       FRAME_VERTICAL_SCROLL_BAR_TYPE (f)  
         = (NILP (arg)  
            ? vertical_scroll_bar_none  
            : EQ (Qright, arg)  
              ? vertical_scroll_bar_right  
              : vertical_scroll_bar_left);  
   
       /* We set this parameter before creating the window for the  
          frame, so we can get the geometry right from the start.  
          However, if the window hasn't been created yet, we shouldn't  
          call x_set_window_size.  */  
       if (FRAME_MAC_WINDOW (f))  
         x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));  
       do_pending_window_change (0);  
     }  
 }  
2288    
2289  void  void
2290  x_set_scroll_bar_width (f, arg, oldval)  x_set_scroll_bar_default_width (f)
2291       struct frame *f;       struct frame *f;
      Lisp_Object arg, oldval;  
2292  {  {
2293    /* Imitate X without X Toolkit */    /* Imitate X without X Toolkit */
2294    
2295    int wid = FONT_WIDTH (f->output_data.mac->font);    int wid = FONT_WIDTH (f->output_data.mac->font);
2296    
   if (NILP (arg))  
     {  
2297  #ifdef MAC_OSX  #ifdef MAC_OSX
2298        FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 16;  /* Aqua scroll bars.  */    FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 16;  /* Aqua scroll bars.  */
2299        FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) +    FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) +
2300                                     wid - 1) / wid;                                 wid - 1) / wid;
2301  #else /* not MAC_OSX */  #else /* not MAC_OSX */
2302        /* 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
2303           character width.  */       character width.  */
2304        FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;    FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
2305    
2306        /* Use all of that space (aside from required margins) for the    /* Use all of that space (aside from required margins) for the
2307           scroll bar.  */       scroll bar.  */
2308        FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;    FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
2309  #endif /* not MAC_OSX */  #endif /* not MAC_OSX */
       if (FRAME_MAC_WINDOW (f))  
         x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));  
       do_pending_window_change (0);  
     }  
   else if (INTEGERP (arg) && XINT (arg) > 0  
            && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))  
     {  
       if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)  
         XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1);  
   
       FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);  
       FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;  
       if (FRAME_MAC_WINDOW (f))  
         x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));  
       do_pending_window_change (0);  
     }  
   change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);  
   XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;  
   XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;  
2310  }  }
2311    
2312    
2313  /* Subroutines of creating a frame.  */  /* Subroutines of creating a frame.  */
2314    
 /* Make sure that Vx_resource_name is set to a reasonable value.  
    Fix it up, or set it to `emacs' if it is too hopeless.  */  
   
 static void  
 validate_x_resource_name ()  
 {  
   int len = 0;  
   /* Number of valid characters in the resource name.  */  
   int good_count = 0;  
   /* Number of invalid characters in the resource name.  */  
   int bad_count = 0;  
   Lisp_Object new;  
   int i;  
   
   if (STRINGP (Vx_resource_name))  
     {  
       unsigned char *p = SDATA (Vx_resource_name);  
       int i;  
   
       len = SBYTES (Vx_resource_name);  
   
       /* Only letters, digits, - and _ are valid in resource names.  
          Count the valid characters and count the invalid ones.  */  
       for (i = 0; i < len; i++)  
         {  
           int c = p[i];  
           if (! ((c >= 'a' && c <= 'z')  
                  || (c >= 'A' && c <= 'Z')  
                  || (c >= '0' && c <= '9')  
                  || c == '-' || c == '_'))  
             bad_count++;  
           else  
             good_count++;  
         }  
     }  
   else  
     /* Not a string => completely invalid.  */  
     bad_count = 5, good_count = 0;  
   
   /* If name is valid already, return.  */  
   if (bad_count == 0)  
     return;  
   
   /* If name is entirely invalid, or nearly so, use `emacs'.  */  
   if (good_count == 0  
       || (good_count == 1 && bad_count > 0))  
     {  
       Vx_resource_name = build_string ("emacs");  
       return;  
     }  
   
   /* Name is partly valid.  Copy it and replace the invalid characters  
      with underscores.  */  
   
   Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);  
   
   for (i = 0; i < len; i++)  
     {  
       int c = SREF (new, i);  
       if (! ((c >= 'a' && c <= 'z')  
              || (c >= 'A' && c <= 'Z')  
              || (c >= '0' && c <= '9')  
              || c == '-' || c == '_'))  
         SSET (new, i, '_');  
     }  
 }  
   
   
 #if 0 /* MAC_TODO: implement resource strings */  
 extern char *x_get_string_resource ();  
   
 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,  
        doc: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.  
 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the  
 class, where INSTANCE is the name under which Emacs was invoked, or  
 the name specified by the `-name' or `-rn' command-line arguments.  
   
 The optional arguments COMPONENT and SUBCLASS add to the key and the  
 class, respectively.  You must specify both of them or neither.  
 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'  
 and the class is `Emacs.CLASS.SUBCLASS'.  */)  
   (attribute, class, component, subclass)  
      Lisp_Object attribute, class, component, subclass;  
 {  
   register char *value;  
   char *name_key;  
   char *class_key;  
   
   CHECK_STRING (attribute);  
   CHECK_STRING (class);  
   
   if (!NILP (component))  
     CHECK_STRING (component);  
   if (!NILP (subclass))  
     CHECK_STRING (subclass);  
   if (NILP (component) != NILP (subclass))  
     error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");  
   
   validate_x_resource_name ();  
   
   /* Allocate space for the components, the dots which separate them,  
      and the final '\0'.  Make them big enough for the worst case.  */  
   name_key = (char *) alloca (SBYTES (Vx_resource_name)  
                               + (STRINGP (component)  
                                  ? SBYTES (component) : 0)  
                               + SBYTES (attribute)  
                               + 3);  
   
   class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)  
                                + SBYTES (class)  
                                + (STRINGP (subclass)  
                                   ? SBYTES (subclass) : 0)  
                                + 3);  
   
   /* Start with emacs.FRAMENAME for the name (the specific one)  
      and with `Emacs' for the class key (the general one).  */  
   strcpy (name_key, SDATA (Vx_resource_name));  
   strcpy (class_key, EMACS_CLASS);  
   
   strcat (class_key, ".");  
   strcat (class_key, SDATA (class));  
   
   if (!NILP (component))  
     {  
       strcat (class_key, ".");  
       strcat (class_key, SDATA (subclass));  
   
       strcat (name_key, ".");  
       strcat (name_key, SDATA (component));  
     }  
   
   strcat (name_key, ".");  
   strcat (name_key, SDATA (attribute));  
   
   value = x_get_string_resource (Qnil,  
                                  name_key, class_key);  
   
   if (value != (char *) 0)  
     return build_string (value);  
   else  
     return Qnil;  
 }  
   
 /* Used when C code wants a resource value.  */  
   
2315  char *  char *
2316  x_get_resource_string (attribute, class)  x_get_string_resource (rdb, name, class)
2317       char *attribute, *class;       XrmDatabase rdb;
2318         char *name, *class;
2319  {  {
2320    char *name_key;    /* MAC_TODO: implement resource strings */
2321    char *class_key;    return (char *)0;
   struct frame *sf = SELECTED_FRAME ();  
   
   /* Allocate space for the components, the dots which separate them,  
      and the final '\0'.  */  
   name_key = (char *) alloca (SBYTES (Vinvocation_name)  
                               + strlen (attribute) + 2);  
   class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)  
                                + strlen (class) + 2);  
   
   sprintf (name_key, "%s.%s",  
            SDATA (Vinvocation_name),  
            attribute);  
   sprintf (class_key, "%s.%s", EMACS_CLASS, class);  
   
   return x_get_string_resource (sf, name_key, class_key);  
2322  }  }
 #endif /* MAC_TODO */  
   
 /* Types we might convert a resource string into.  */  
 enum resource_types  
 {  
   RES_TYPE_NUMBER,  
   RES_TYPE_FLOAT,  
   RES_TYPE_BOOLEAN,  
   RES_TYPE_STRING,  
   RES_TYPE_SYMBOL  
 };  
2323    
2324  /* Return the value of parameter PARAM.  /* Return the value of parameter PARAM.
2325    
# Line 3191  enum resource_types Line 2329  enum resource_types
2329     Convert the resource to the type specified by desired_type.     Convert the resource to the type specified by desired_type.
2330    
2331     If no default is specified, return Qunbound.  If you call     If no default is specified, return Qunbound.  If you call
2332     w32_get_arg, make sure you deal with Qunbound in a reasonable way,     mac_get_arg, make sure you deal with Qunbound in a reasonable way,
2333     and don't let it get stored in any Lisp-visible variables!  */     and don't let it get stored in any Lisp-visible variables!  */
2334    
2335  static Lisp_Object  static Lisp_Object
# Line 3201  mac_get_arg (alist, param, attribute, cl Line 2339  mac_get_arg (alist, param, attribute, cl
2339       char *class;       char *class;
2340       enum resource_types type;       enum resource_types type;
2341  {  {
2342    register Lisp_Object tem;    return x_get_arg (check_x_display_info (Qnil),
2343                        alist, param, attribute, class, type);
   tem = Fassq (param, alist);  
   if (EQ (tem, Qnil))  
     tem = Fassq (param, Vdefault_frame_alist);  
   if (EQ (tem, Qnil))  
     {  
   
 #if 0 /* MAC_TODO: search resource also */  
       if (attribute)  
         {  
           tem = Fx_get_resource (build_string (attribute),  
                                  build_string (class),  
                                  Qnil, Qnil);  
   
           if (NILP (tem))  
             return Qunbound;  
   
           switch (type)  
             {  
             case RES_TYPE_NUMBER:  
               return make_number (atoi (SDATA (tem)));  
   
             case RES_TYPE_FLOAT:  
               return make_float (atof (SDATA (tem)));  
   
             case RES_TYPE_BOOLEAN:  
               tem = Fdowncase (tem);  
               if (!strcmp (SDATA (tem), "on")  
                   || !strcmp (SDATA (tem), "true"))  
                 return Qt;  
               else  
                 return Qnil;  
   
             case RES_TYPE_STRING:  
               return tem;  
   
             case RES_TYPE_SYMBOL:  
               /* As a special case, we map the values `true' and `on'  
                  to Qt, and `false' and `off' to Qnil.  */  
               {  
                 Lisp_Object lower;  
                 lower = Fdowncase (tem);  
                 if (!strcmp (SDATA (lower), "on")  
                     || !strcmp (SDATA (lower), "true"))  
                   return Qt;  
                 else if (!strcmp (SDATA (lower), "off")  
                       || !strcmp (SDATA (lower), "false"))  
                   return Qnil;  
                 else  
                   return Fintern (tem, Qnil);  
               }  
   
             default:  
               abort ();  
             }  
         }  
       else  
 #endif /* MAC_TODO */  
         return Qunbound;  
     }  
   return Fcdr (tem);  
2344  }  }
2345    
 /* Record in frame F the specified or default value according to ALIST  
    of the parameter named PROP (a Lisp symbol).  
    If no value is specified for PROP, look for an X default for XPROP  
    on the frame named NAME.  
    If that is not found either, use the value DEFLT.  */  
   
 static Lisp_Object  
 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)  
      struct frame *f;  
      Lisp_Object alist;  
      Lisp_Object prop;  
      Lisp_Object deflt;  
      char *xprop;  
      char *xclass;  
      enum resource_types type;  
 {  
   Lisp_Object tem;  
   
   tem = mac_get_arg (alist, prop, xprop, xclass, type);  
   if (EQ (tem, Qunbound))  
     tem = deflt;  
   x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));  
   return tem;  
 }  
2346    
2347  /* XParseGeometry copied from w32xfns.c */  /* XParseGeometry copied from w32xfns.c */
2348    
# Line 3427  XParseGeometry (string, x, y, width, hei Line 2481  XParseGeometry (string, x, y, width, hei
2481    return (mask);    return (mask);
2482  }  }
2483    
 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,  
        doc: /* Parse an X-style geometry string STRING.  
 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).  
 The properties returned may include `top', `left', `height', and `width'.  
 The value of `left' or `top' may be an integer,  
 or a list (+ N) meaning N pixels relative to top/left corner,  
 or a list (- N) meaning -N pixels relative to bottom/right corner.  */)  
      (string)  
      Lisp_Object string;  
 {  
   int geometry, x, y;  
   unsigned int width, height;  
   Lisp_Object result;  
   
   CHECK_STRING (string);  
   
   geometry = XParseGeometry ((char *) SDATA (string),  
                              &x, &y, &width, &height);  
   
   result = Qnil;  
   if (geometry & XValue)  
     {  
       Lisp_Object element;  
   
       if (x >= 0 && (geometry & XNegative))  
         element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));  
       else if (x < 0 && ! (geometry & XNegative))  
         element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));  
       else  
         element = Fcons (Qleft, make_number (x));  
       result = Fcons (element, result);  
     }  
   
   if (geometry & YValue)  
     {  
       Lisp_Object element;  
   
       if (y >= 0 && (geometry & YNegative))  
         element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));  
       else if (y < 0 && ! (geometry & YNegative))  
         element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));  
       else  
         element = Fcons (Qtop, make_number (y));  
       result = Fcons (element, result);  
     }  
   
   if (geometry & WidthValue)  
     result = Fcons (Fcons (Qwidth, make_number (width)), result);  
   if (geometry & HeightValue)  
     result = Fcons (Fcons (Qheight, make_number (height)), result);  
   
   return result;  
 }  
   
 /* Calculate the desired size and position of this window,  
    and return the flags saying which aspects were specified.  
   
    This function does not make the coordinates positive.  */  
   
 #define DEFAULT_ROWS 40  
 #define DEFAULT_COLS 80  
   
 static int  
 x_figure_window_size (f, parms)  
      struct frame *f;  
      Lisp_Object parms;  
 {  
   register Lisp_Object tem0, tem1, tem2;  
   long window_prompting = 0;  
   
   /* Default values if we fall through.  
      Actually, if that happens we should get  
      window manager prompting.  */  
   SET_FRAME_WIDTH (f, DEFAULT_COLS);  
   f->height = DEFAULT_ROWS;  
   /* Window managers expect that if program-specified  
      positions are not (0,0), they're intentional, not defaults.  */  
   f->output_data.mac->top_pos = 0;  
   f->output_data.mac->left_pos = 0;  
   
   tem0 = mac_get_arg (parms, Qheight, 0, 0, RES_TYPE_NUMBER);  
   tem1 = mac_get_arg (parms, Qwidth, 0, 0, RES_TYPE_NUMBER);  
   tem2 = mac_get_arg (parms, Quser_size, 0, 0, RES_TYPE_NUMBER);  
   if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))  
     {  
       if (!EQ (tem0, Qunbound))  
         {  
           CHECK_NUMBER (tem0);  
           f->height = XINT (tem0);  
         }  
       if (!EQ (tem1, Qunbound))  
         {  
           CHECK_NUMBER (tem1);  
           SET_FRAME_WIDTH (f, XINT (tem1));  
         }  
       if (!NILP (tem2) && !EQ (tem2, Qunbound))  
         window_prompting |= USSize;  
       else  
         window_prompting |= PSize;  
     }  
   
   f->output_data.mac->vertical_scroll_bar_extra  
     = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)  
        ? 0  
        : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0  
        ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)  
        : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.mac->font)));  
   
   compute_fringe_widths (f, 0);  
   
   f->output_data.mac->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);  
   f->output_data.mac->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);  
   
   tem0 = mac_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER);  
   tem1 = mac_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER);  
   tem2 = mac_get_arg (parms, Quser_position, 0, 0, RES_TYPE_NUMBER);  
   if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))  
     {  
       if (EQ (tem0, Qminus))  
         {  
           f->output_data.mac->top_pos = 0;  
           window_prompting |= YNegative;  
         }  
       else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus)  
                && CONSP (XCDR (tem0))  
                && INTEGERP (XCAR (XCDR (tem0))))  
         {  
           f->output_data.mac->top_pos = - XINT (XCAR (XCDR (tem0)));  
           window_prompting |= YNegative;  
         }  
       else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus)  
                && CONSP (XCDR (tem0))  
                && INTEGERP (XCAR (XCDR (tem0))))  
         {  
           f->output_data.mac->top_pos = XINT (XCAR (XCDR (tem0)));  
         }  
       else if (EQ (tem0, Qunbound))  
         f->output_data.mac->top_pos = 0;  
       else  
         {  
           CHECK_NUMBER (tem0);  
           f->output_data.mac->top_pos = XINT (tem0);  
           if (f->output_data.mac->top_pos < 0)  
             window_prompting |= YNegative;  
         }  
   
       if (EQ (tem1, Qminus))  
         {  
           f->output_data.mac->left_pos = 0;  
           window_prompting |= XNegative;  
         }  
       else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus)  
                && CONSP (XCDR (tem1))  
                && INTEGERP (XCAR (XCDR (tem1))))  
         {  
           f->output_data.mac->left_pos = - XINT (XCAR (XCDR (tem1)));  
           window_prompting |= XNegative;  
         }  
       else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus)  
                && CONSP (XCDR (tem1))  
                && INTEGERP (XCAR (XCDR (tem1))))  
         {  
           f->output_data.mac->left_pos = XINT (XCAR (XCDR (tem1)));  
         }  
       else if (EQ (tem1, Qunbound))  
         f->output_data.mac->left_pos = 0;  
       else  
         {  
           CHECK_NUMBER (tem1);  
           f->output_data.mac->left_pos = XINT (tem1);  
           if (f->output_data.mac->left_pos < 0)  
             window_prompting |= XNegative;  
         }  
   
       if (!NILP (tem2) && ! EQ (tem2, Qunbound))  
         window_prompting |= USPosition;  
       else  
         window_prompting |= PPosition;  
     }  
   
   return window_prompting;  
 }  
   
2484    
2485  #if 0 /* MAC_TODO */  #if 0 /* MAC_TODO */
2486  /* Create and set up the Mac window for frame F.  */  /* Create and set up the Mac window for frame F.  */
# Line 3997  This function is an internal primitive-- Line 2868  This function is an internal primitive--
2868                         "title", "Title", RES_TYPE_STRING);                         "title", "Title", RES_TYPE_STRING);
2869    
2870    f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;    f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
   window_prompting = x_figure_window_size (f, parms);  
2871    
2872    if (window_prompting & XNegative)    /* MAC_TODO: specify 1 below when toolbars are implemented.  */
2873      {    window_prompting = x_figure_window_size (f, parms, 0);
       if (window_prompting & YNegative)  
         f->output_data.mac->win_gravity = SouthEastGravity;  
       else  
         f->output_data.mac->win_gravity = NorthEastGravity;  
     }  
   else  
     {  
       if (window_prompting & YNegative)  
         f->output_data.mac->win_gravity = SouthWestGravity;  
       else  
         f->output_data.mac->win_gravity = NorthWestGravity;  
     }  
   
   f->output_data.mac->size_hint_flags = window_prompting;  
2874    
2875    tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);    tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
2876    f->no_split = minibuffer_only || EQ (tem, Qt);    f->no_split = minibuffer_only || EQ (tem, Qt);
# Line 9400  x_create_tip_frame (dpyinfo, parms) Line 8256  x_create_tip_frame (dpyinfo, parms)
8256    init_frame_faces (f);    init_frame_faces (f);
8257    
8258    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;
   window_prompting = x_figure_window_size (f, parms);  
8259    
8260    if (window_prompting & XNegative)    window_prompting = x_figure_window_size (f, parms, 0);
     {  
       if (window_prompting & YNegative)  
         f->output_data.w32->win_gravity = SouthEastGravity;  
       else  
         f->output_data.w32->win_gravity = NorthEastGravity;  
     }  
   else  
     {  
       if (window_prompting & YNegative)  
         f->output_data.w32->win_gravity = SouthWestGravity;  
       else  
         f->output_data.w32->win_gravity = NorthWestGravity;  
     }  
8261    
   f->output_data.w32->size_hint_flags = window_prompting;  
8262    {    {
8263      XSetWindowAttributes attrs;      XSetWindowAttributes attrs;
8264      unsigned long mask;      unsigned long mask;
# Line 9872  DEFUN ("lookup-image", Flookup_image, Sl Line 8713  DEFUN ("lookup-image", Flookup_image, Sl
8713    
8714    
8715    
8716    /***********************************************************************
8717                                Initialization
8718     ***********************************************************************/
8719    
8720    /* Keep this list in the same order as frame_parms in frame.c.
8721       Use 0 for unsupported frame parameters.  */
8722    
8723    frame_parm_handler mac_frame_parm_handlers[] =
8724    {
8725      x_set_autoraise,
8726      x_set_autolower,
8727      x_set_background_color,
8728      x_set_border_color,
8729      x_set_border_width,
8730      x_set_cursor_color,
8731      x_set_cursor_type,
8732      x_set_font,
8733      x_set_foreground_color,
8734      x_set_icon_name,
8735      0, /* MAC_TODO: x_set_icon_type, */
8736      x_set_internal_border_width,
8737      x_set_menu_bar_lines,
8738      x_set_mouse_color,
8739      x_explicitly_set_name,
8740      x_set_scroll_bar_width,
8741      x_set_title,
8742      x_set_unsplittable,
8743      x_set_vertical_scroll_bars,
8744      x_set_visibility,
8745      x_set_tool_bar_lines,
8746      0, /* MAC_TODO: x_set_scroll_bar_foreground, */
8747      0, /* MAC_TODO: x_set_scroll_bar_background, */
8748      x_set_screen_gamma,
8749      x_set_line_spacing,
8750      0, /* MAC_TODO: x_set_fringe_width, */
8751      0, /* MAC_TODO: x_set_fringe_width, */
8752      0, /* x_set_wait_for_wm, */
8753      0, /* MAC_TODO: x_set_fullscreen, */
8754    };
8755    
8756  void  void
8757  syms_of_macfns ()  syms_of_macfns ()
8758  {  {
# Line 9881  syms_of_macfns () Line 8762  syms_of_macfns ()
8762    /* The section below is built by the lisp expression at the top of the file,    /* The section below is built by the lisp expression at the top of the file,
8763       just above where these variables are declared.  */       just above where these variables are declared.  */
8764    /*&&& init symbols here &&&*/    /*&&& init symbols here &&&*/
   Qauto_raise = intern ("auto-raise");  
   staticpro (&Qauto_raise);  
   Qauto_lower = intern ("auto-lower");  
   staticpro (&Qauto_lower);  
   Qborder_color = intern ("border-color");  
   staticpro (&Qborder_color);  
   Qborder_width = intern ("border-width");  
   staticpro (&Qborder_width);  
   Qcursor_color = intern ("cursor-color");  
   staticpro (&Qcursor_color);  
   Qcursor_type = intern ("cursor-type");  
   staticpro (&Qcursor_type);  
   Qgeometry = intern ("geometry");  
   staticpro (&Qgeometry);  
   Qicon_left = intern ("icon-left");  
   staticpro (&Qicon_left);  
   Qicon_top = intern ("icon-top");  
   staticpro (&Qicon_top);  
   Qicon_type = intern ("icon-type");  
   staticpro (&Qicon_type);  
   Qicon_name = intern ("icon-name");  
   staticpro (&Qicon_name);  
   Qinternal_border_width = intern ("internal-border-width");  
   staticpro (&Qinternal_border_width);  
   Qleft = intern ("left");  
   staticpro (&Qleft);  
   Qright = intern ("right");  
   staticpro (&Qright);  
   Qmouse_color = intern ("mouse-color");  
   staticpro (&Qmouse_color);  
8765    Qnone = intern ("none");    Qnone = intern ("none");
8766    staticpro (&Qnone);    staticpro (&Qnone);
   Qparent_id = intern ("parent-id");  
   staticpro (&Qparent_id);  
   Qscroll_bar_width = intern ("scroll-bar-width");  
   staticpro (&Qscroll_bar_width);  
8767    Qsuppress_icon = intern ("suppress-icon");    Qsuppress_icon = intern ("suppress-icon");
8768    staticpro (&Qsuppress_icon);    staticpro (&Qsuppress_icon);
8769    Qundefined_color = intern ("undefined-color");    Qundefined_color = intern ("undefined-color");
8770    staticpro (&Qundefined_color);    staticpro (&Qundefined_color);
   Qvertical_scroll_bars = intern ("vertical-scroll-bars");  
   staticpro (&Qvertical_scroll_bars);  
   Qvisibility = intern ("visibility");  
   staticpro (&Qvisibility);  
   Qwindow_id = intern ("window-id");  
   staticpro (&Qwindow_id);  
   Qx_frame_parameter = intern ("x-frame-parameter");  
   staticpro (&Qx_frame_parameter);  
   Qx_resource_name = intern ("x-resource-name");  
   staticpro (&Qx_resource_name);  
   Quser_position = intern ("user-position");  
   staticpro (&Quser_position);  
   Quser_size = intern ("user-size");  
   staticpro (&Quser_size);  
   Qscreen_gamma = intern ("screen-gamma");  
   staticpro (&Qscreen_gamma);  
   Qline_spacing = intern ("line-spacing");  
   staticpro (&Qline_spacing);  
8771    Qcenter = intern ("center");    Qcenter = intern ("center");
8772    staticpro (&Qcenter);    staticpro (&Qcenter);
8773    /* This is the end of symbol initialization.  */    /* This is the end of symbol initialization.  */
# Line 9986  Changing the value does not affect exist Line 8815  Changing the value does not affect exist
8815  unless you set the mouse color.  */);  unless you set the mouse color.  */);
8816    Vx_pointer_shape = Qnil;    Vx_pointer_shape = Qnil;
8817    
   DEFVAR_LISP ("x-resource-name", &Vx_resource_name,  
                doc: /* The name Emacs uses to look up resources; for internal use only.  
 `x-get-resource' uses this as the first component of the instance name  
 when requesting resource values.  
 Emacs initially sets `x-resource-name' to the name under which Emacs  
 was invoked, or to the value specified with the `-name' or `-rn'  
 switches, if present.  */);  
   Vx_resource_name = Qnil;  
   
8818    Vx_nontext_pointer_shape = Qnil;    Vx_nontext_pointer_shape = Qnil;
8819    
8820    Vx_mode_pointer_shape = Qnil;    Vx_mode_pointer_shape = Qnil;
# Line 10050  from the image cache.  Value must be an Line 8870  from the image cache.  Value must be an
8870  meaning don't clear the cache.  */);  meaning don't clear the cache.  */);
8871    Vimage_cache_eviction_delay = make_number (30 * 60);    Vimage_cache_eviction_delay = make_number (30 * 60);
8872    
 #if 0 /* MAC_TODO: implement get X resource */  
   defsubr (&Sx_get_resource);  
 #endif  
8873    defsubr (&Sx_change_window_property);    defsubr (&Sx_change_window_property);
8874    defsubr (&Sx_delete_window_property);    defsubr (&Sx_delete_window_property);
8875    defsubr (&Sx_window_property);    defsubr (&Sx_window_property);
# Line 10073  meaning don't clear the cache.  */); Line 8890  meaning don't clear the cache.  */);
8890    defsubr (&Sx_display_visual_class);    defsubr (&Sx_display_visual_class);
8891    defsubr (&Sx_display_backing_store);    defsubr (&Sx_display_backing_store);
8892    defsubr (&Sx_display_save_under);    defsubr (&Sx_display_save_under);
 #if 0 /* MAC_TODO: implement XParseGeometry */  
   defsubr (&Sx_parse_geometry);  
 #endif  
8893    defsubr (&Sx_create_frame);    defsubr (&Sx_create_frame);
8894  #if 0 /* MAC_TODO: implement network support */  #if 0 /* MAC_TODO: implement network support */
8895    defsubr (&Sx_open_connection);    defsubr (&Sx_open_connection);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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