GNU bug report logs -
#76275
31.0.50; frame-inhibit-implied-resize broken on recent master
Previous Next
Reported by: Sean Whitton <spwhitton <at> spwhitton.name>
Date: Fri, 14 Feb 2025 03:29:01 UTC
Severity: normal
Found in version 31.0.50
Done: Sean Whitton <spwhitton <at> spwhitton.name>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello,
On Tue 18 Feb 2025 at 11:08am +01, martin rudalics wrote:
> OTOH, one reason for implementing 'frame-inhibit-implied-resize' was
> to make using Emacs with tiling WMs simpler. Hence instead of all the
> tribulations with running spw/scale-default from
> 'window-size-change-functions' we should be able to find a better
> solution.
>
> With the patch attached would
>
> (defun spw/sway-completing-read (prompt collection &rest optional-args)
> (let* ((frame-inhibit-implied-resize 'force)
> (frame (make-frame `((title . "Emacs Sway input")
> (minibuffer . only)
> (display . ,(getenv "WAYLAND_DISPLAY"))))))
>
> (set-face-attribute 'default frame :height 120)
>
> (unwind-protect
> (with-selected-frame frame
> (set-window-scroll-bars (minibuffer-window frame) 0 nil 0 nil t)
> (apply #'completing-read prompt collection optional-args))
> (delete-frame frame))))
>
> do what you want?
Actually, your patch is even better than that.
The following works as expected, now:
--8<---------------cut here---------------start------------->8---
(defun spw/scale-default (frame)
(set-face-attribute 'default frame :height 120))
(add-to-list 'window-size-change-functions #'spw/scale-default)
(defun spw/sway-completing-read (prompt collection &rest optional-args)
(let* ((frame-inhibit-implied-resize 'force)
(frame (make-frame `((title . "Emacs Sway input")
(minibuffer . only)
(display . ,(getenv "WAYLAND_DISPLAY"))))))
(with-selected-frame frame
(apply #'completing-read prompt collection optional-args))))
--8<---------------cut here---------------end--------------->8---
The reason that this is better for me is that my spw/scale-default is
just a dummy reproducer. My actual window-size-change-functions entry
is more complicated, and long predates spw/sway-completing-read.
I've included it at the bottom of this message
My point is: I am not trying to use window-size-change-functions to work
around anything. It's just that this value for
window-size-change-functions I alrady have stopped working properly in
the case of spw/sway-completing-read, recently.
It would be okay if I just had to call my window-size-change-functions
entry from spw/sway-completing-read. I am not myself in a position to
judge whether having a `force' entry makes sense. If you think it does,
then that's fine.
>> I'm not sure what you mean "while the function with the same name
>> returned false" -- there isn't a function called
>> frame_inhibit_implied_resize, I think?
>
> Right. I meant the function frame_inhibit_resize.
Ah. Do you still want me to do any testing with that?
=*=*=*=
--8<---------------cut here---------------start------------->8---
(custom-theme-set-faces
'user
'(default ((t (:weight medium :height 105 :foundry "SRC" :family "Hack"))))
'(variable-pitch ((t (:weight regular :height 120
:foundry "bitstream" :family "Bitstream Charter")))))
(defun spw/maybe-scale-basic-faces (frame)
"Entry for `window-size-change-functions' to increase font sizes,
relative to those set by the call to `custom-theme-set-faces' above, for
frames on wide monitors, except where doing so would itself prevent fitting
two 80-column windows side-by-side in the frame."
(when (display-graphic-p frame)
(let ((wide-monitor-p (> (cadddr (assoc 'geometry
(frame-monitor-attributes frame)))
1635)))
(when (or wide-monitor-p
;; Check whether a previous call made any changes we might
;; need to undo if FRAME has moved to a smaller display.
(not (eq scroll-bar-mode
(frame-parameter frame 'vertical-scroll-bars)))
(= (face-attribute 'default :height frame) 120)
(= (face-attribute 'variable-pitch :height frame) 151))
(let* ;; Above 1635 you can scale up and still fit two 80-col windows.
;; Below 1315 you can't fit the two windows even w/o scaling up.
((medium-p (> 1635 (frame-pixel-width frame) 1315))
(scale-up-p (and wide-monitor-p (not medium-p))))
(modify-frame-parameters
frame
`(;; Can fit two 80-col windows only if we disable scroll bars.
(vertical-scroll-bars . ,(and (not (and wide-monitor-p medium-p))
scroll-bar-mode))))
;; Check Emacs found the relevant font on this window system, else
;; our height values might be invalid.
(when (find-font (font-spec :foundry "SRC" :family "Hack") frame)
(set-face-attribute 'default frame
:height (if scale-up-p 120 105)))
(when (find-font (font-spec :foundry "bitstream"
:family "Bitstream Charter")
frame)
(set-face-attribute 'variable-pitch frame
:height (if scale-up-p 151 120))))))))
(add-to-list 'window-size-change-functions #'spw/maybe-scale-basic-faces)
--8<---------------cut here---------------end--------------->8---
--
Sean Whitton
This bug report was last modified 64 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.