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

Diff of /emacs/src/widget.c

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

revision 1.66 by rms, Fri Apr 19 00:11:58 2002 UTC revision 1.66.2.1 by miles, Fri Apr 4 06:21:05 2003 UTC
# Line 296  set_frame_size (ew) Line 296  set_frame_size (ew)
296       (the menubar and the parent of the menubar and all that sort of thing       (the menubar and the parent of the menubar and all that sort of thing
297       are managed by lwlib.)       are managed by lwlib.)
298    
299       The EmacsShell widget is simply a replacement for the Shell widget       The EmacsShell widget is simply a replacement for the Shell widget
300       which is able to deal with using an externally-supplied window instead       which is able to deal with using an externally-supplied window instead
301       of always creating its own.  It is not actually emacs specific, and       of always creating its own.  It is not actually emacs specific, and
302       should possibly have class "Shell" instead of "EmacsShell" to simplify       should possibly have class "Shell" instead of "EmacsShell" to simplify
# Line 307  set_frame_size (ew) Line 307  set_frame_size (ew)
307    /* Hairily merged geometry */    /* Hairily merged geometry */
308    unsigned int w = ew->emacs_frame.frame->width;    unsigned int w = ew->emacs_frame.frame->width;
309    unsigned int h = ew->emacs_frame.frame->height;    unsigned int h = ew->emacs_frame.frame->height;
310      
311    Widget wmshell = get_wm_shell ((Widget) ew);    Widget wmshell = get_wm_shell ((Widget) ew);
312    /* Each Emacs shell is now independent and top-level.  */    /* Each Emacs shell is now independent and top-level.  */
313      
314    if (! XtIsSubclass (wmshell, shellWidgetClass)) abort ();    if (! XtIsSubclass (wmshell, shellWidgetClass)) abort ();
315    
316    /* We don't need this for the moment. The geometry is computed in    /* We don't need this for the moment. The geometry is computed in
317       xfns.c.  */       xfns.c.  */
318  #if 0  #if 0
319    /* If the EmacsFrame doesn't have a geometry but the shell does,    /* If the EmacsFrame doesn't have a geometry but the shell does,
# Line 326  set_frame_size (ew) Line 326  set_frame_size (ew)
326       this bogus? I'm not sure.) */       this bogus? I'm not sure.) */
327    if (!ew->emacs_frame.iconic)    if (!ew->emacs_frame.iconic)
328      XtVaGetValues (wmshell, XtNiconic, &ew->emacs_frame.iconic, NULL);      XtVaGetValues (wmshell, XtNiconic, &ew->emacs_frame.iconic, NULL);
329      
330      
331    {    {
332      char *geom = 0;      char *geom = 0;
333      XtVaGetValues (app_shell, XtNgeometry, &geom, NULL);      XtVaGetValues (app_shell, XtNgeometry, &geom, NULL);
334      if (geom)      if (geom)
335        app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h);        app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h);
336    }    }
337      
338    if (ew->emacs_frame.geometry)    if (ew->emacs_frame.geometry)
339      frame_flags = XParseGeometry (ew->emacs_frame.geometry,      frame_flags = XParseGeometry (ew->emacs_frame.geometry,
340                                     &frame_x, &frame_y,                                     &frame_x, &frame_y,
341                                     &frame_w, &frame_h);                                     &frame_w, &frame_h);
342      
343    if (first_frame_p)    if (first_frame_p)
344      {      {
345        /* If this is the first frame created:        /* If this is the first frame created:
# Line 434  set_frame_size (ew) Line 434  set_frame_size (ew)
434           : (FRAME_SCROLL_BAR_COLS (frame)           : (FRAME_SCROLL_BAR_COLS (frame)
435              * FONT_WIDTH (frame->output_data.x->font)));              * FONT_WIDTH (frame->output_data.x->font)));
436    
437      x_compute_fringe_widths (frame, 0);      compute_fringe_widths (frame, 0);
438    
439  #if 0 /* This can run Lisp code, and it is dangerous to give  #if 0 /* This can run Lisp code, and it is dangerous to give
440           out the frame to Lisp code before it officially exists.           out the frame to Lisp code before it officially exists.
# Line 516  update_wm_hints (ew) Line 516  update_wm_hints (ew)
516                        &char_width, &char_height);                        &char_width, &char_height);
517    char_to_pixel_size (ew, char_width, char_height,    char_to_pixel_size (ew, char_width, char_height,
518                        &rounded_width, &rounded_height);                        &rounded_width, &rounded_height);
519    get_default_char_pixel_size (ew, &cw, &ch);    get_default_char_pixel_size (ew, &cw, &ch);
520    
521    base_width = (wmshell->core.width - ew->core.width    base_width = (wmshell->core.width - ew->core.width
522                  + (rounded_width - (char_width * cw)));                  + (rounded_width - (char_width * cw)));
# Line 531  update_wm_hints (ew) Line 531  update_wm_hints (ew)
531    XtVaSetValues (wmshell,    XtVaSetValues (wmshell,
532                   XtNbaseWidth, (XtArgVal) base_width,                   XtNbaseWidth, (XtArgVal) base_width,
533                   XtNbaseHeight, (XtArgVal) base_height,                   XtNbaseHeight, (XtArgVal) base_height,
534                   XtNwidthInc, (XtArgVal) cw,                   XtNwidthInc, (XtArgVal) cw,
535                   XtNheightInc, (XtArgVal) ch,                   XtNheightInc, (XtArgVal) ch,
536                   XtNminWidth, (XtArgVal) (base_width + min_cols * cw),                   XtNminWidth, (XtArgVal) (base_width + min_cols * cw),
537                   XtNminHeight, (XtArgVal) (base_height + min_rows * ch),                   XtNminHeight, (XtArgVal) (base_height + min_rows * ch),
# Line 667  update_from_various_frame_slots (ew) Line 667  update_from_various_frame_slots (ew)
667    ew->core.border_pixel = x->border_pixel;    ew->core.border_pixel = x->border_pixel;
668  }  }
669    
670  static void  static void
671  EmacsFrameInitialize (request, new, dum1, dum2)  EmacsFrameInitialize (request, new, dum1, dum2)
672       Widget request;       Widget request;
673       Widget new;       Widget new;
# Line 706  EmacsFrameInitialize (request, new, dum1 Line 706  EmacsFrameInitialize (request, new, dum1
706      face_res.default_addr = 0;      face_res.default_addr = 0;
707      XtGetSubresources ((Widget) ew, (XtPointer) &f, "default", "Face",      XtGetSubresources ((Widget) ew, (XtPointer) &f, "default", "Face",
708                         &face_res, 1, NULL, 0);                         &face_res, 1, NULL, 0);
709          
710      if (f)      if (f)
711          ew->emacs_frame.font = f;          ew->emacs_frame.font = f;
712      else if (! ew->emacs_frame.font)      else if (! ew->emacs_frame.font)
# Line 721  EmacsFrameInitialize (request, new, dum1 Line 721  EmacsFrameInitialize (request, new, dum1
721  #endif  #endif
722    
723    update_from_various_frame_slots (ew);    update_from_various_frame_slots (ew);
724    set_frame_size (ew);    set_frame_size (ew);
725  /*create_frame_gcs (ew);  /*create_frame_gcs (ew);
726    setup_frame_gcs (ew);    setup_frame_gcs (ew);
727    update_various_frame_slots (ew); */    update_various_frame_slots (ew); */
# Line 745  EmacsFrameRealize (widget, mask, attrs) Line 745  EmacsFrameRealize (widget, mask, attrs)
745    *mask |= CWEventMask;    *mask |= CWEventMask;
746    XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,    XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
747                    attrs);                    attrs);
748    update_wm_hints (ew);    update_wm_hints (ew);
749  }  }
750    
751  extern void free_frame_faces (/* struct frame * */);  extern void free_frame_faces (/* struct frame * */);
# Line 781  EmacsFrameResize (widget) Line 781  EmacsFrameResize (widget)
781    
782    pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);    pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);
783    change_frame_size (f, rows, columns, 0, 1, 0);    change_frame_size (f, rows, columns, 0, 1, 0);
784    update_wm_hints (ew);    update_wm_hints (ew);
785    update_various_frame_slots (ew);    update_various_frame_slots (ew);
786    
787    cancel_mouse_face (f);    cancel_mouse_face (f);
# Line 806  EmacsFrameSetValues (cur_widget, req_wid Line 806  EmacsFrameSetValues (cur_widget, req_wid
806    int char_width, char_height;    int char_width, char_height;
807    Dimension pixel_width;    Dimension pixel_width;
808    Dimension pixel_height;    Dimension pixel_height;
809      
810    has_to_recompute_gcs = (cur->emacs_frame.font != new->emacs_frame.font    has_to_recompute_gcs = (cur->emacs_frame.font != new->emacs_frame.font
811                            || (cur->emacs_frame.foreground_pixel                            || (cur->emacs_frame.foreground_pixel
812                                != new->emacs_frame.foreground_pixel)                                != new->emacs_frame.foreground_pixel)
813                            || (cur->core.background_pixel                            || (cur->core.background_pixel
814                                != new->core.background_pixel)                                != new->core.background_pixel)
815                            );                            );
816      
817    has_to_recompute_size = (cur->emacs_frame.font != new->emacs_frame.font    has_to_recompute_size = (cur->emacs_frame.font != new->emacs_frame.font
818                             && cur->core.width == new->core.width                             && cur->core.width == new->core.width
819                             && cur->core.height == new->core.height);                             && cur->core.height == new->core.height);
# Line 825  EmacsFrameSetValues (cur_widget, req_wid Line 825  EmacsFrameSetValues (cur_widget, req_wid
825        setup_frame_gcs (new);        setup_frame_gcs (new);
826        needs_a_refresh = True;        needs_a_refresh = True;
827      }      }
828                              
829    if (has_to_recompute_size)    if (has_to_recompute_size)
830      {      {
831        pixel_width = new->core.width;        pixel_width = new->core.width;
# Line 906  EmacsFrameSetCharSize (widget, columns, Line 906  EmacsFrameSetCharSize (widget, columns,
906    EmacsFrame ew = (EmacsFrame) widget;    EmacsFrame ew = (EmacsFrame) widget;
907    Dimension pixel_width, pixel_height;    Dimension pixel_width, pixel_height;
908    struct frame *f = ew->emacs_frame.frame;    struct frame *f = ew->emacs_frame.frame;
909      
910    if (columns < 3) columns = 3;  /* no way buddy */    if (columns < 3) columns = 3;  /* no way buddy */
911    
912    check_frame_size (f, &rows, &columns);    check_frame_size (f, &rows, &columns);
# Line 915  EmacsFrameSetCharSize (widget, columns, Line 915  EmacsFrameSetCharSize (widget, columns,
915         ? 0         ? 0
916         : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font)));         : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font)));
917    
918    x_compute_fringe_widths (f, 0);    compute_fringe_widths (f, 0);
919    
920    char_to_pixel_size (ew, columns, rows, &pixel_width, &pixel_height);    char_to_pixel_size (ew, columns, rows, &pixel_width, &pixel_height);
921    
# Line 968  EmacsFrameSetCharSize (widget, columns, Line 968  EmacsFrameSetCharSize (widget, columns,
968  #ifdef SIGIO  #ifdef SIGIO
969        sigblock (sigmask (SIGIO));        sigblock (sigmask (SIGIO));
970  #endif  #endif
971          
972        /* Do parents first, otherwise LessTif's geometry management        /* Do parents first, otherwise LessTif's geometry management
973           enters an infinite loop (as of 2000-01-15).  This is fixed in           enters an infinite loop (as of 2000-01-15).  This is fixed in
974           later versions of LessTif (as of 2001-03-13); I'll leave it           later versions of LessTif (as of 2001-03-13); I'll leave it
# Line 991  EmacsFrameSetCharSize (widget, columns, Line 991  EmacsFrameSetCharSize (widget, columns,
991        sigunblock (sigmask (SIGIO));        sigunblock (sigmask (SIGIO));
992  #endif  #endif
993        turn_on_atimers (1);        turn_on_atimers (1);
994          
995        lw_refigure_widget (f->output_data.x->column_widget, True);        lw_refigure_widget (f->output_data.x->column_widget, True);
996    
997        update_hints_inhibit = 0;        update_hints_inhibit = 0;

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.66.2.1

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