In this patch, I changed how XEmacs resizes its frame to keep its
character geometry consistent. The readjustment is done only once
upon frame redisplay, as Ben suggested couple of months ago.
This means that frame does not shake any more upon loading options.el.
I removed five trickiermost device methods which were responsible for
adjusting the frame. Fset_frame_size does the job fine.
The change withstood this test under both X and Windows. Editres also
works as expected.
(defun fiddle-with-specifier (spec &optional delta smin smax)
(let* ((oldval (specifier-instance spec))
(newval (if (boolean-specifier-p spec)
(if (oddp (random)) (oddp (random)) oldval)
(min smax (max smin (+ oldval (random (* 2 delta)) (- delta)))))))
(set-specifier spec newval)))
(set-frame-size nil 100 35)
(setq font-sentinel 0)
(while t
(fiddle-with-specifier scrollbar-width 8 0 40)
(fiddle-with-specifier scrollbar-height 8 0 40)
(fiddle-with-specifier default-toolbar-visible-p)
(fiddle-with-specifier default-toolbar-height 16 24 100)
(fiddle-with-specifier default-toolbar-border-width 4 0 40)
; Kick
(if (zerop (random 17))
(set-frame-size nil 100 35))
; Faces
(when (and (> font-sentinel -3) (zerop (random 7)))
(make-face-larger 'default)
(decf font-sentinel))
(when (and (< font-sentinel 3) (zerop (random 7)))
(make-face-smaller 'default)
(incf font-sentinel))
(if (zerop (random 17))
(set-frame-size nil 100 35))
; Toolbar position
(when (zerop (random 11))
(set-default-toolbar-position (aref [left top right bottom] (random 4))))
(sit-for 0.1)
(assert (= (frame-width) 100))
(assert (= (frame-height) 35)))
Kirill
1998-05-06 Kirill M. Katsnelson <kkm(a)kis.ru>
* frame.h (struct frame): Added char_{width,height} member
variables and access macros
Added size_slipped redisplay bit and mark/clear macros.
* redisplay.c (redisplay_frame): Adjust frame size if size slipped
bit is set.
(redisplay_device): Call redisplay_frame if size slipped bit is set.
* frame.c (adjust_frame_size): Redisplay beats frame back in shape
with this. Added.
(frame_size_slipped): Added.
(internal_set_frame_size): Clear size slipped bit.
(change_frame_size_1): Store real charsize into frame object.
(vars_of_frame): Declared adjust-frame-function.
* frame-msw.c (mswindows_update_frame_external_traits): Same
change as for frame-x.c
(mswindows_frame_size_fixed_p): Implemented the method.
* frame-x.c (x_update_frame_external_traits): Do not call
Fset_frame_size to adjust frame, redisplay will do.
* faces.c (update_EmacsFrame): Mark frame as slipped when default
font changes.
* toolbar.c (compute_frame_toolbars_data): Removed obsoleted call
to change_frame_size. Redisplay will fix it later.
Removed toolbar_*_changed_in_frame specifier
change handlers.
(specifier_vars_of_toolbar): Calls to these routed to
frame_size_slipped generic handler.
* toolbar-x.c: Removed toolbar_*_changed_in_frame device methods.
* scrollbar-x.c: Removed scrollbar_*_changed_in_frame device
methods.
* scrollbar.c: Removed scrollbar_*_changed_in_frame specifier
change handlers.
(specifier_vars_of_scrollbar): Calls to the above changed to
frame_size_slipped generic handler.
* device-x.c: Removed declaration of in_specifier_change_function.
* EmacsFrame.c (EmacsFrameSetValues): Do not check
in_specifier_change_function.
* console.h (struct console_methods): Removed declarations for all
<specifier>_changed_in_frame methods for toolbars and scrollbars.
Added frame_size_fixed_p method.