Index: src/EmacsFrame.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/EmacsFrame.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 EmacsFrame.c --- src/EmacsFrame.c 1998/04/05 13:05:28 1.1.1.2 +++ src/EmacsFrame.c 1998/05/06 22:02:43 @@ -371,7 +371,7 @@ static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, - ArgList dum1, Cardinal *dum2) + ArgList argv, Cardinal *argc) { EmacsFrame cur = (EmacsFrame) cur_widget; EmacsFrame new = (EmacsFrame) new_widget; @@ -397,8 +397,6 @@ x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new->emacs_frame.frame), new->emacs_frame.iconic); - if (!in_specifier_change_function) - { /* If we got here, then we were likely called as a result of the EditRes protocol, so go ahead and change scrollbar-width and scrollbar-height. Otherwise, we're merely mirroring @@ -468,8 +466,26 @@ make_int (new->emacs_frame.right_toolbar_border_width), frame, Qnil, Qnil); #endif /* HAVE_TOOLBARS */ - } + in_resource_setting--; + + /* If the request was to resize us, but the size has not changed, Xt + will do nothing, and won't call our resize callback. Since such a + request might be issued as a result of hiding/showing menubar or + changing toolbar placement, where we rely on relayout made by the + callback, we go ahead and simulate such a call */ + if (cur->core.width == new->core.width + && cur->core.height == new->core.height) + { + int i; + for (i=0; i<*argc; i++) + if (strcmp (argv[i].name, XtNwidth) == 0 + || strcmp (argv[i].name, XtNheight) == 0) + { + EmacsFrameResize (new_widget); + break; + } + } return False; Index: src/console.h =================================================================== RCS file: /var/cvsroot/ntxemacs/src/console.h,v retrieving revision 1.4 diff -u -r1.4 console.h --- src/console.h 1998/05/05 13:01:46 1.4 +++ src/console.h 1998/05/05 11:18:13 @@ -113,6 +113,7 @@ void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); Lisp_Object (*get_frame_parent_method) (struct frame *f); void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); + int (*frame_size_fixed_p_method) (struct frame *f); /* redisplay methods */ int (*left_margin_width_method) (struct window *); @@ -215,15 +216,6 @@ #ifdef HAVE_TOOLBARS /* toolbar methods */ - void (*toolbar_size_changed_in_frame_method) (struct frame *f, - enum toolbar_pos pos, - Lisp_Object oldval); - void (*toolbar_border_width_changed_in_frame_method) (struct frame *f, - enum toolbar_pos pos, - Lisp_Object oldval); - void (*toolbar_visible_p_changed_in_frame_method) (struct frame *f, - enum toolbar_pos pos, - Lisp_Object oldval); void (*output_frame_toolbars_method) (struct frame *); void (*initialize_frame_toolbars_method) (struct frame *); void (*free_frame_toolbars_method) (struct frame *); @@ -240,11 +232,6 @@ void (*release_scrollbar_instance_method) (struct scrollbar_instance *); void (*create_scrollbar_instance_method) (struct frame *, int, struct scrollbar_instance *); - void (*scrollbar_width_changed_in_frame_method) (Lisp_Object, struct frame *, - Lisp_Object); - void (*scrollbar_height_changed_in_frame_method) (Lisp_Object, - struct frame *, - Lisp_Object); void (*update_scrollbar_instance_values_method) (struct window *, struct scrollbar_instance *, int, int, int, int, int, Index: src/device-x.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/device-x.c,v retrieving revision 1.1.1.9 diff -u -r1.1.1.9 device-x.c --- src/device-x.c 1998/05/03 17:47:15 1.1.1.9 +++ src/device-x.c 1998/05/05 11:23:07 @@ -97,8 +97,6 @@ /* Functions to synchronize mirroring resources and specifiers */ int in_resource_setting; -int in_specifier_change_function; - /************************************************************************/ /* helper functions */ @@ -1790,5 +1788,4 @@ error_occurred = 0; in_resource_setting = 0; - in_specifier_change_function = 0; } Index: src/faces.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/faces.c,v retrieving revision 1.4 diff -u -r1.4 faces.c --- src/faces.c 1998/04/05 13:16:49 1.4 +++ src/faces.c 1998/05/05 10:06:43 @@ -1580,6 +1580,10 @@ update_EmacsFrame (Lisp_Object frame, Lisp_Object name) { struct frame *frm = XFRAME (frame); + + if (EQ (name, Qfont)) + MARK_FRAME_SIZE_SLIPPED (frm); + MAYBE_FRAMEMETH (frm, update_frame_external_traits, (frm, name)); } Index: src/frame-msw.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/frame-msw.c,v retrieving revision 1.9 diff -u -r1.9 frame-msw.c --- src/frame-msw.c 1998/05/05 13:05:10 1.9 +++ src/frame-msw.c 1998/05/05 11:31:58 @@ -626,38 +626,13 @@ static void mswindows_update_frame_external_traits (struct frame* frm, Lisp_Object name) { - if (EQ (name, Qfont)) - { - /* We resize the frame along with the font if user preference - of MS style compliance is turned off, and if font size has - really changed - */ - /* #### Frame gets resized after font here */ - if (1) - { - int new_char_height, new_char_width; - pixel_to_real_char_size (frm, FRAME_PIXWIDTH(frm), FRAME_PIXHEIGHT(frm), - &new_char_width, &new_char_height); - if (new_char_width != FRAME_MSWINDOWS_CHARWIDTH (frm) - || new_char_height != FRAME_MSWINDOWS_CHARHEIGHT (frm)) - { - Lisp_Object frame; - XSETFRAME (frame, frm); - Fset_frame_size (frame, - make_int(FRAME_MSWINDOWS_CHARWIDTH (frm)), - make_int(FRAME_MSWINDOWS_CHARHEIGHT (frm)), - Qnil); - } - } +} - /* This resizes minibuffer and redraws modeline. */ - { - int width, height; - pixel_to_char_size (frm, FRAME_PIXWIDTH(frm), FRAME_PIXHEIGHT(frm), - &width, &height); - change_frame_size (frm, height, width, 1); - } - } +static int +mswindows_frame_size_fixed_p (struct frame *f) +{ + /* Frame size cannot change if the frame is maximized */ + return IsZoomed (FRAME_MSWINDOWS_HANDLE (f)); } void @@ -693,6 +668,7 @@ CONSOLE_HAS_METHOD (mswindows, set_frame_icon); CONSOLE_HAS_METHOD (mswindows, get_frame_parent); CONSOLE_HAS_METHOD (mswindows, update_frame_external_traits); + CONSOLE_HAS_METHOD (mswindows, frame_size_fixed_p); } void Index: src/frame-x.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/frame-x.c,v retrieving revision 1.6 diff -u -r1.6 frame-x.c --- src/frame-x.c 1998/05/05 13:05:10 1.6 +++ src/frame-x.c 1998/05/05 10:12:00 @@ -2570,19 +2570,10 @@ MAYBE_DEVMETH (XDEVICE (frm->device), redraw_frame_toolbars, (frm)); #endif /* HAVE_TOOLBARS */ - /* The intent of this code is to cause the frame size in - characters to remain the same when the font changes, at the - expense of changing the frame size in pixels. It's not - totally clear that this is the right thing to do, but it's - not clearly wrong either. */ + /* Set window manager resize increment hints according to + the new character size */ if (EQ (name, Qfont)) - { - EmacsFrameRecomputeCellSize (FRAME_X_TEXT_WIDGET (frm)); - Fset_frame_size (frame, - make_int (frm->width), - make_int (frm->height), - Qnil); - } + EmacsFrameRecomputeCellSize (FRAME_X_TEXT_WIDGET (frm)); } Index: src/frame.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/frame.c,v retrieving revision 1.6 diff -u -r1.6 frame.c --- src/frame.c 1998/05/04 19:17:17 1.6 +++ src/frame.c 1998/05/06 22:40:00 @@ -57,6 +57,7 @@ #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS) Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions; #endif +Lisp_Object Vadjust_frame_function; Lisp_Object Vmouse_motion_handler; Lisp_Object Vsynchronize_minibuffers; Lisp_Object Qsynchronize_minibuffers; @@ -617,8 +618,71 @@ FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) unhold_one_frame_size_changes (XFRAME (XCAR (frmcons))); } + +/* + * Frame size may change due to changes in scrollbars, toolbars, + * default font etc. These changes are applied early in redisplay + * frame. + */ +void +adjust_frame_size (struct frame *f) +{ + int keep_char_size = 0; + Lisp_Object frame; + XSETFRAME (frame, f); + if (!f->size_slipped) + return; + + /* Don't adjust tty frames. #### May break when TTY have menubars. + Then, write an Vadjust_frame_function which will return t for TTY + frames. Another solution is frame_size_fixed_p method for TTYs, + which always returned yes it's fixed. + */ + if (!FRAME_WIN_P (f)) + { + CLEAR_FRAME_SIZE_SLIPPED (f); + return; + } + + /* frame_size_fixed_p tells that frame size cannot currently + be changed change due to external conditions */ + if (!FRAMEMETH_OR_GIVEN (f, frame_size_fixed_p, (f), 0)) + { + if (NILP (Vadjust_frame_function)) + keep_char_size = 1; + else if (EQ (Vadjust_frame_function, Qt)) + keep_char_size = 0; + else + keep_char_size = + NILP (call1_trapping_errors ("Error in adjust-frame-function", + Vadjust_frame_function, frame)); + + if (keep_char_size) + Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)), + make_int (FRAME_CHARHEIGHT(f)), Qnil); + } + + if (!keep_char_size) + { + int height, width; + pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f), + &width, &height); + change_frame_size (f, height, width, 0); + CLEAR_FRAME_SIZE_SLIPPED (f); + } +} +/* + * This is a "specifier changed in frame" handler for various specifiers + * changing which causes frame size adjustment + */ +void +frame_size_slipped (Lisp_Object specifier, struct frame *f, + Lisp_Object oldval) +{ + MARK_FRAME_SIZE_SLIPPED(f); +} DEFUN ("framep", Fframep, 1, 1, 0, /* Return non-nil if OBJECT is a frame. @@ -2480,6 +2544,9 @@ static void internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) { + /* An explicit size change cancels any pending frame size adjustment */ + CLEAR_FRAME_SIZE_SLIPPED(f); + if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) change_frame_size (f, rows, cols, 0); else @@ -2856,6 +2923,15 @@ f->pixwidth = newwidth; } + if (window_system_pixelated_geometry (frame)) + pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), + &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); + else + { + FRAME_CHARWIDTH (f) = FRAME_WIDTH (f); + FRAME_CHARHEIGHT (f) = FRAME_HEIGHT (f); + } + MARK_FRAME_TOOLBARS_CHANGED (f); MARK_FRAME_CHANGED (f); f->echo_area_garbaged = 1; @@ -3199,6 +3275,20 @@ */ ); Vdrag_and_drop_functions = Qnil; #endif /* HAVE_CDE || HAVE_OFFIX_DND || HAVE_MS_WINDOWS */ + + DEFVAR_LISP ("adjust-frame-function", &Vadjust_frame_function /* +Function or constant controlling adjustment of frame. +When scrollbars, toolbars, default font etc. change in frame, the frame +needs to be adjusted. The adjustment is controlled by this variable. +Legal values are: + nil to keep character frame size unchanged when possible (resize) + t to keep pixel size unchanged (never resize) + function symbol or lambda form. This function must return boolean + value which is treated as above. Function is passed one parameter, + the frame being adjusted. It function should not modify or delete + the frame. +*/ ); + Vadjust_frame_function = Qnil; DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* Handler for motion events. One arg, the event. Index: src/frame.h =================================================================== RCS file: /var/cvsroot/ntxemacs/src/frame.h,v retrieving revision 1.5 diff -u -r1.5 frame.h --- src/frame.h 1998/04/05 13:16:54 1.5 +++ src/frame.h 1998/05/05 10:00:37 @@ -47,13 +47,23 @@ through frame->device->console, but it's faster this way. */ struct console_methods *framemeths; - /* Size of this frame, in units of characters. */ - int height; - int width; - - /* Size of this frame, in units of pixels. */ - int pixheight; - int pixwidth; + /* Size of text only area of this frame, excluding scrollbars, + toolbars and end of line glyphs. The size can be in charactes + or pixels, depending on units in which window system resizes + its windows */ + int height, width; + + /* New height and width for pending size change, in the same units + as above. 0 if no change pending. */ + int new_height, new_width; + + /* Size of text-only are of the frame, in default font characters. + This may be inaccurate due to rounding error */ + int char_height, char_width; + + /* Size of the whole frame, including scrollbars, toolbars and end + of line glyphs, in pixels */ + int pixheight, pixwidth; #ifdef HAVE_TTY /* The count of frame number. This applies to TTY frames only. */ @@ -66,9 +76,6 @@ dependencies. */ int internal_border_width; - /* New height and width for pending size change. 0 if no change pending. */ - int new_height, new_width; - /* This frame's root window mirror. This structure exactly mirrors the frame's window structure but contains only pointers to the display structures. */ @@ -176,6 +183,7 @@ unsigned int windows_structure_changed :1; unsigned int window_face_cache_reset :1; /* used by expose handler */ unsigned int echo_area_garbaged :1; /* used by Fredisplay_echo_area */ + unsigned int size_slipped :1; unsigned int size_change_pending :1; unsigned int mirror_dirty :1; @@ -378,6 +386,24 @@ windows_structure_changed = 1; \ } while (0) +#define MARK_FRAME_SIZE_SLIPPED(f) do { \ + struct frame *fwsc_f = (f); \ + fwsc_f->size_slipped = 1; \ + fwsc_f->modiff++; \ + if (!NILP (fwsc_f->device)) \ + { \ + struct device *fwsc_d = XDEVICE (fwsc_f->device); \ + MARK_DEVICE_FRAME_CHANGED (fwsc_d); \ + } \ + else \ + frame_changed = 1; \ +} while (0) + +#define CLEAR_FRAME_SIZE_SLIPPED(f) do { \ + struct frame *fwsc_f = (f); \ + fwsc_f->size_slipped = 0; \ +} while (0) + #define SET_FRAME_CLEAR(f) MARK_FRAME_CHANGED (f); (f)->clear = 1 #define FRAME_DEVICE(f) ((f)->device) #define FRAME_CONSOLE(f) DEVICE_CONSOLE (XDEVICE (FRAME_DEVICE (f))) @@ -388,6 +414,8 @@ #define FRAME_HAS_MINIBUF_P(f) ((f)->has_minibuffer) #define FRAME_HEIGHT(f) ((f)->height) #define FRAME_WIDTH(f) ((f)->width) +#define FRAME_CHARHEIGHT(f) ((f)->char_height) +#define FRAME_CHARWIDTH(f) ((f)->char_width) #define FRAME_PIXHEIGHT(f) ((f)->pixheight) #define FRAME_PIXWIDTH(f) ((f)->pixwidth) #ifdef HAVE_SCROLLBARS @@ -660,6 +688,9 @@ void change_frame_size (struct frame *frame, int newlength, int newwidth, int delay); +void adjust_frame_size (struct frame *frame); +void frame_size_slipped (Lisp_Object specifier, struct frame *f, + Lisp_Object oldval); void hold_frame_size_changes (void); void unhold_one_frame_size_changes (struct frame *f); void unhold_frame_size_changes (void); Index: src/menubar-x.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/menubar-x.c,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 menubar-x.c --- src/menubar-x.c 1998/04/05 13:06:46 1.1.1.3 +++ src/menubar-x.c 1998/05/06 22:07:40 @@ -670,7 +670,6 @@ Boolean menubar_was_visible = XtIsManaged (FRAME_X_MENUBAR_WIDGET (f)); Boolean menubar_will_be_visible = menubar_was_visible; Boolean menubar_visibility_changed; - Cardinal new_num_top_widgets = 1; /* for the menubar */ Widget container = FRAME_X_CONTAINER_WIDGET (f); if (menubar_contents_changed) @@ -678,39 +677,14 @@ menubar_visibility_changed = menubar_was_visible != menubar_will_be_visible; - if (! (menubar_visibility_changed - )) + if (!menubar_visibility_changed) return; - /* Set menubar visibility */ - if (menubar_visibility_changed) - (menubar_will_be_visible ? XtManageChild : XtUnmanageChild) - (FRAME_X_MENUBAR_WIDGET (f)); - - /* Note that new_num_top_widgets doesn't need to reflect the actual - number of top widgets, but just the limit of FRAME_X_TOP_WIDGETS (f)[]. */ - FRAME_X_NUM_TOP_WIDGETS (f) = new_num_top_widgets; - { - /* We want to end up as close in size as possible to what we - were before. So, ask the EmacsManager what size it wants to be - (suggesting the current size), and resize it to that size. It - in turn will call our query-geometry callback, which will round - the size to something that exactly fits the text widget. */ - XtWidgetGeometry req, repl; - Arg al [2]; - - req.request_mode = CWWidth | CWHeight; - XtSetArg (al [0], XtNwidth, &req.width); - XtSetArg (al [1], XtNheight, &req.height); - XtGetValues (container, al, 2); - XtQueryGeometry (container, &req, &repl); - EmacsManagerChangeSize (container, repl.width, repl.height); - /* The window size might not have changed but the text size - did; thus, the base size might be incorrect. So update it. */ - EmacsShellUpdateSizeHints (FRAME_X_SHELL_WIDGET (f)); - } + (menubar_will_be_visible ? XtManageChild : XtUnmanageChild) + (FRAME_X_MENUBAR_WIDGET (f)); + MARK_FRAME_SIZE_SLIPPED (f); } static void Index: src/redisplay.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/redisplay.c,v retrieving revision 1.9 diff -u -r1.9 redisplay.c --- src/redisplay.c 1998/05/04 18:46:35 1.9 +++ src/redisplay.c 1998/05/05 10:13:05 @@ -5927,6 +5927,14 @@ if (f->size_change_pending) change_frame_size (f, f->new_height, f->new_width, 0); + /* If frame size might need to be changed, due to changed size + of toolbars, scroolabrs etc, change it now */ + if (f->size_slipped) + { + adjust_frame_size (f); + assert (!f->size_slipped); + } + /* The menubar, toolbar, and icon updates must be done before hold_frame_size_changes is called and we are officially 'in_display'. They may eval lisp code which may call Fsignal. @@ -6061,9 +6069,8 @@ if (f->buffers_changed || f->clip_changed || f->extents_changed || f->faces_changed || f->frame_changed || f->menubar_changed || f->modeline_changed || f->point_changed || f->size_changed || - f->toolbar_changed || f->windows_changed || - f->windows_structure_changed || - f->glyphs_changed) + f->toolbar_changed || f->windows_changed || f->size_slipped || + f->windows_structure_changed || f->glyphs_changed) { preempted = redisplay_frame (f, 0); } Index: src/scrollbar-x.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/scrollbar-x.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 scrollbar-x.c --- src/scrollbar-x.c 1998/04/05 13:07:35 1.1.1.2 +++ src/scrollbar-x.c 1998/05/05 11:21:49 @@ -294,85 +294,6 @@ } } -/* A device method. */ -static void -x_scrollbar_width_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - XtWidgetGeometry req, repl; - Lisp_Object newval = f->scrollbar_width; - - in_specifier_change_function++; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the scrollbar - width. */ - - /* mirror the value in the frame resources, unless it was already - done. */ - if (!in_resource_setting) - Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), XtNscrollBarWidth, XINT (newval)); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - req.request_mode = 0; - - /* the query-geometry method looks at the current value of - f->scrollbar_width, so temporarily set it back to the old - one. */ - f->scrollbar_width = oldval; - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->scrollbar_width = newval; - - repl.width += XINT (newval) - XINT (oldval); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - - in_specifier_change_function--; -} - -/* A device method. */ -static void -x_scrollbar_height_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - XtWidgetGeometry req, repl; - Lisp_Object newval = f->scrollbar_height; - - in_specifier_change_function++; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the scrollbar - height. */ - - /* mirror the value in the frame resources, unless it was already - done. Also don't do it if this is the when the frame is being - created -- the widgets don't even exist yet, and even if they - did, we wouldn't want to overwrite the resource information - (which might specify a user preference). */ - if (!in_resource_setting) - Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), XtNscrollBarHeight, XINT (newval)); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - req.request_mode = 0; - - /* the query-geometry method looks at the current value of - f->scrollbar_height, so temporarily set it back to the old - one. */ - f->scrollbar_height = oldval; - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->scrollbar_height = newval; - - repl.height += XINT (newval) - XINT (oldval); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - - in_specifier_change_function--; -} - enum x_scrollbar_loop { X_FIND_SCROLLBAR_WINDOW_MIRROR, @@ -817,8 +738,6 @@ CONSOLE_HAS_METHOD (x, create_scrollbar_instance); CONSOLE_HAS_METHOD (x, update_scrollbar_instance_values); CONSOLE_HAS_METHOD (x, update_scrollbar_instance_status); - CONSOLE_HAS_METHOD (x, scrollbar_width_changed_in_frame); - CONSOLE_HAS_METHOD (x, scrollbar_height_changed_in_frame); CONSOLE_HAS_METHOD (x, scrollbar_pointer_changed_in_window); #ifdef MEMORY_USAGE_STATS CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage); Index: src/scrollbar.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/scrollbar.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 scrollbar.c --- src/scrollbar.c 1998/05/03 17:49:03 1.1.1.4 +++ src/scrollbar.c 1998/05/05 11:37:21 @@ -581,27 +581,6 @@ } } - -/* This function is called as a result of a change to the - `scrollbar-width' specifier. */ -static void -scrollbar_width_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - MAYBE_FRAMEMETH (f, scrollbar_width_changed_in_frame, - (specifier, f, oldval)); -} - -/* This function is called as a result of a change to the - `scrollbar-height' specifier. */ -static void -scrollbar_height_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - MAYBE_FRAMEMETH (f, scrollbar_height_changed_in_frame, - (specifier, f, oldval)); -} - /* This function is called as a result of a change to the `scrollbar-pointer' glyph. */ static void @@ -946,7 +925,7 @@ some_window_value_changed, slot_offset (struct frame, scrollbar_width), - scrollbar_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("scrollbar-height", &Vscrollbar_height /* *Height of horizontal scrollbars. @@ -962,7 +941,7 @@ some_window_value_changed, slot_offset (struct frame, scrollbar_height), - scrollbar_height_changed_in_frame); + frame_size_slipped); } void Index: src/toolbar-x.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/toolbar-x.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 toolbar-x.c --- src/toolbar-x.c 1998/04/05 13:07:58 1.1.1.2 +++ src/toolbar-x.c 1998/05/05 11:26:17 @@ -656,181 +656,6 @@ static void -x_toolbar_size_changed_in_frame_1 (struct frame *f, enum toolbar_pos pos, - Lisp_Object old_visibility) -{ - XtWidgetGeometry req, repl; - int newval; - int oldval = FRAME_X_OLD_TOOLBAR_SIZE (f, pos); - - if (NILP (f->toolbar_visible_p[pos])) - newval = 0; - else if (!f->init_finished && !INTP (f->toolbar_size[pos])) - /* the size might not be set at all if we're in the process of - creating the frame. Otherwise it better be, and we'll crash - out if not. */ - newval = 0; - else - { - Lisp_Object frame; - - XSETFRAME (frame, f); - newval = XINT (Fspecifier_instance (Vtoolbar_size[pos], frame, Qzero, - Qnil)); - } - - if (oldval == newval) - return; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the toolbar - size. */ - - in_specifier_change_function++; - - if (!in_resource_setting) - /* mirror the value in the frame resources, unless already done. */ - Xt_SET_VALUE (FRAME_X_CONTAINER_WIDGET (f), - pos == TOP_TOOLBAR ? XtNtopToolBarHeight : - pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight : - pos == LEFT_TOOLBAR ? XtNleftToolBarWidth : - XtNrightToolBarWidth, - newval); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - int change = newval - oldval; - Lisp_Object new_visibility = f->toolbar_visible_p[pos]; - - req.request_mode = 0; - /* the query-geometry method looks at the current value of - f->toolbar_size[pos], so temporarily set it back to the old - one. If we were called because of a visibility change we - also have to temporarily restore its old status as well. */ - f->toolbar_size[pos] = make_int (oldval); - if (!EQ (old_visibility, Qzero)) - f->toolbar_visible_p[pos] = old_visibility; - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->toolbar_size[pos] = make_int (newval); - if (!EQ (old_visibility, Qzero)) - f->toolbar_visible_p[pos] = new_visibility; - - if (change < 0) - { - x_clear_toolbar (f, pos, change); - mark_frame_toolbar_buttons_dirty (f, pos); - } - if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) - repl.width += change; - else - repl.height += change; - - MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - /* #### should this go within XtIsRealized()? probably not ... */ - FRAME_X_OLD_TOOLBAR_SIZE (f, pos) = newval; - in_specifier_change_function--; -} - -static void -x_toolbar_size_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object oldval) -{ - x_toolbar_size_changed_in_frame_1 (f, pos, Qzero); -} - -static void -x_toolbar_visible_p_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object oldval) -{ - x_toolbar_size_changed_in_frame_1 (f, pos, oldval); -} - -static void -x_toolbar_border_width_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object lispoldval) -{ - XtWidgetGeometry req, repl; - int newval, oldval; - - if (NILP (f->toolbar_visible_p[pos]) || ZEROP (f->toolbar_size[pos])) - { - return; - } - else if (!f->init_finished && !INTP (f->toolbar_border_width[pos])) - /* the size might not be set at all if we're in the process of - creating the frame. Otherwise it better be, and we'll crash - out if not. */ - { - newval = 0; - } - else - { - Lisp_Object frame; - - XSETFRAME (frame, f); - newval = XINT (Fspecifier_instance (Vtoolbar_border_width[pos], - frame, Qzero, Qnil)); - } - - if (INTP (lispoldval)) - oldval = XINT (lispoldval); - else - oldval = 0; - - if (oldval == newval) - return; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the toolbar - size. */ - - in_specifier_change_function++; - - if (!in_resource_setting) - /* mirror the value in the frame resources, unless already done. */ - Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), - pos == TOP_TOOLBAR ? XtNtopToolBarBorderWidth : - pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth : - pos == LEFT_TOOLBAR ? XtNleftToolBarBorderWidth : - XtNrightToolBarBorderWidth, - newval); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - int change = 2 * (newval - oldval); - - req.request_mode = 0; - - /* - * We want the current size, not the future size, so briefly - * reset the border width value so the query method returns - * the correct value. - */ - f->toolbar_border_width[pos] = make_int (oldval); - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->toolbar_border_width[pos] = make_int (newval); - - if (change < 0) - { - x_clear_toolbar (f, pos, change); - mark_frame_toolbar_buttons_dirty (f, pos); - } - if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) - repl.width += change; - else - repl.height += change; - - MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - in_specifier_change_function--; -} - -static void x_initialize_frame_toolbar_gcs (struct frame *f) { EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); @@ -971,7 +796,4 @@ CONSOLE_HAS_METHOD (x, output_toolbar_button); CONSOLE_HAS_METHOD (x, redraw_exposed_toolbars); CONSOLE_HAS_METHOD (x, redraw_frame_toolbars); - CONSOLE_HAS_METHOD (x, toolbar_size_changed_in_frame); - CONSOLE_HAS_METHOD (x, toolbar_border_width_changed_in_frame); - CONSOLE_HAS_METHOD (x, toolbar_visible_p_changed_in_frame); } Index: src/toolbar.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/toolbar.c,v retrieving revision 1.1.1.6 diff -u -r1.1.1.6 toolbar.c --- src/toolbar.c 1998/05/03 17:49:22 1.1.1.6 +++ src/toolbar.c 1998/05/06 16:16:02 @@ -759,14 +759,6 @@ set_frame_toolbar (f, BOTTOM_TOOLBAR); set_frame_toolbar (f, LEFT_TOOLBAR); set_frame_toolbar (f, RIGHT_TOOLBAR); - - if (!first_time_p) - { - int height, width; - pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f), - &width, &height); - change_frame_size (f, height, width, 0); - } } void @@ -1233,65 +1225,6 @@ } static void -toolbar_size_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - int pos; - - for (pos = 0; pos < countof (Vtoolbar_size); pos++) - if (EQ (specifier, Vtoolbar_size[(enum toolbar_pos) pos])) - break; - - assert (pos < countof (Vtoolbar_size)); - - MAYBE_FRAMEMETH (f, toolbar_size_changed_in_frame, - (f, (enum toolbar_pos) pos, oldval)); - - /* Let redisplay know that something has possibly changed. */ - MARK_TOOLBAR_CHANGED; -} - -static void -toolbar_border_width_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - int pos; - - for (pos = 0; pos < countof (Vtoolbar_border_width); pos++) - { - if (EQ (specifier, Vtoolbar_border_width[(enum toolbar_pos) pos])) - break; - } - - assert (pos < countof (Vtoolbar_border_width)); - - MAYBE_FRAMEMETH (f, toolbar_border_width_changed_in_frame, - (f, (enum toolbar_pos) pos, oldval)); - - /* Let redisplay know that something has possibly changed. */ - MARK_TOOLBAR_CHANGED; -} - -static void -toolbar_visible_p_changed_in_frame (Lisp_Object specifier, struct frame *f, - Lisp_Object oldval) -{ - int pos; - - for (pos = 0; pos < countof (Vtoolbar_visible_p); pos++) - if (EQ (specifier, Vtoolbar_visible_p[(enum toolbar_pos) pos])) - break; - - assert (pos < countof (Vtoolbar_visible_p)); - - MAYBE_FRAMEMETH (f, toolbar_visible_p_changed_in_frame, - (f, (enum toolbar_pos) pos, oldval)); - - /* Let redisplay know that something has possibly changed. */ - MARK_TOOLBAR_CHANGED; -} - -static void default_toolbar_size_changed_in_frame (Lisp_Object specifier, struct frame *f, Lisp_Object oldval) { @@ -1673,7 +1606,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_size[TOP_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-height", &Vtoolbar_size[BOTTOM_TOOLBAR] /* @@ -1689,7 +1622,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_size[BOTTOM_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-width", &Vtoolbar_size[LEFT_TOOLBAR] /* @@ -1705,7 +1638,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_size[LEFT_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-width", &Vtoolbar_size[RIGHT_TOOLBAR] /* @@ -1721,7 +1654,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_size[RIGHT_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); fb = Qnil; #ifdef HAVE_TTY @@ -1802,7 +1735,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_border_width[TOP_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-border-width", &Vtoolbar_border_width[BOTTOM_TOOLBAR] /* @@ -1818,7 +1751,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_border_width[BOTTOM_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-border-width", &Vtoolbar_border_width[LEFT_TOOLBAR] /* @@ -1834,7 +1767,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_border_width[LEFT_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-border-width", &Vtoolbar_border_width[RIGHT_TOOLBAR] /* @@ -1850,7 +1783,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_border_width[RIGHT_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); fb = Qnil; #ifdef HAVE_TTY @@ -1914,7 +1847,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_visible_p[TOP_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-visible-p", &Vtoolbar_visible_p[BOTTOM_TOOLBAR] /* @@ -1930,7 +1863,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_visible_p[BOTTOM_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-visible-p", &Vtoolbar_visible_p[LEFT_TOOLBAR] /* @@ -1946,7 +1879,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_visible_p[LEFT_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-visible-p", &Vtoolbar_visible_p[RIGHT_TOOLBAR] /* @@ -1962,7 +1895,7 @@ toolbar_geometry_changed_in_window, slot_offset (struct frame, toolbar_visible_p[RIGHT_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); /* initially, top inherits from default; this can be changed with `set-default-toolbar-position'. */