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 --- EmacsFrame.c 1998/04/05 13:05:28 1.1.1.2 +++ EmacsFrame.c 1998/05/05 11:22:50 @@ -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,7 +466,7 @@ make_int (new->emacs_frame.right_toolbar_border_width), frame, Qnil, Qnil); #endif /* HAVE_TOOLBARS */ - } + in_resource_setting--; 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 --- console.h 1998/05/05 13:01:46 1.4 +++ 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 --- device-x.c 1998/05/03 17:47:15 1.1.1.9 +++ 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 --- faces.c 1998/04/05 13:16:49 1.4 +++ 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 --- frame-msw.c 1998/05/05 13:05:10 1.9 +++ 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 --- frame-x.c 1998/05/05 13:05:10 1.6 +++ 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 --- frame.c 1998/05/04 19:17:17 1.6 +++ frame.c 1998/05/06 15:29:53 @@ -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,57 @@ 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); + /* 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, FRAME_CHARWIDTH(f), + 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 +2530,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 +2909,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 +3261,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 no 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 --- frame.h 1998/04/05 13:16:54 1.5 +++ 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/redisplay.c =================================================================== RCS file: /var/cvsroot/ntxemacs/src/redisplay.c,v retrieving revision 1.9 diff -u -r1.9 redisplay.c --- redisplay.c 1998/05/04 18:46:35 1.9 +++ 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 --- scrollbar-x.c 1998/04/05 13:07:35 1.1.1.2 +++ 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 --- scrollbar.c 1998/05/03 17:49:03 1.1.1.4 +++ 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 --- toolbar-x.c 1998/04/05 13:07:58 1.1.1.2 +++ 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 --unified=2 -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 @@ -760,12 +760,4 @@ 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); - } } @@ -1234,63 +1226,4 @@ 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) @@ -1674,5 +1607,5 @@ slot_offset (struct frame, toolbar_size[TOP_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-height", @@ -1690,5 +1623,5 @@ slot_offset (struct frame, toolbar_size[BOTTOM_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-width", @@ -1706,5 +1639,5 @@ slot_offset (struct frame, toolbar_size[LEFT_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-width", @@ -1722,5 +1655,5 @@ slot_offset (struct frame, toolbar_size[RIGHT_TOOLBAR]), - toolbar_size_changed_in_frame); + frame_size_slipped); fb = Qnil; @@ -1803,5 +1736,5 @@ slot_offset (struct frame, toolbar_border_width[TOP_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-border-width", @@ -1819,5 +1752,5 @@ slot_offset (struct frame, toolbar_border_width[BOTTOM_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-border-width", @@ -1835,5 +1768,5 @@ slot_offset (struct frame, toolbar_border_width[LEFT_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-border-width", @@ -1851,5 +1784,5 @@ slot_offset (struct frame, toolbar_border_width[RIGHT_TOOLBAR]), - toolbar_border_width_changed_in_frame); + frame_size_slipped); fb = Qnil; @@ -1915,5 +1848,5 @@ slot_offset (struct frame, toolbar_visible_p[TOP_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("bottom-toolbar-visible-p", @@ -1931,5 +1864,5 @@ slot_offset (struct frame, toolbar_visible_p[BOTTOM_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("left-toolbar-visible-p", @@ -1947,5 +1880,5 @@ slot_offset (struct frame, toolbar_visible_p[LEFT_TOOLBAR]), - toolbar_visible_p_changed_in_frame); + frame_size_slipped); DEFVAR_SPECIFIER ("right-toolbar-visible-p", @@ -1963,5 +1896,5 @@ 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