Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ugly in-between frames when resizing the box #110

Open
poniponiponiponiponiponiponiponiponi opened this issue Aug 24, 2024 · 1 comment
Open

Comments

@poniponiponiponiponiponiponiponiponi
Copy link

poniponiponiponiponiponiponiponiponi commented Aug 24, 2024

Hey, first thank you for this package!
I've noticed there are some ugly in-between frames when resizing the box.
image
1

I'm on Fedora 40 with Emacs 31, the same behavior persists between i3 and Sway.
Personally I fixed this by overwriting a function in my config like this:

(setq prev-size '(0 . 0))
(defun eldoc-box--update-childframe-geometry (frame window)
  "Update the size and the position of childframe.
FRAME is the childframe, WINDOW is the primary window."
  (setcdr eldoc-box--markdown-separator-display-props nil)

  (let* ((size
          (window-text-pixel-size
           window nil nil
           (if (functionp eldoc-box-max-pixel-width) (funcall eldoc-box-max-pixel-width) eldoc-box-max-pixel-width)
           (if (functionp eldoc-box-max-pixel-height) (funcall eldoc-box-max-pixel-height) eldoc-box-max-pixel-height)
           t))
         (width (car size))
         (height (cdr size))
         (width (+ width (frame-char-width frame))) ; add margin
         (frame-resize-pixelwise t)
         (pos (funcall eldoc-box-position-function width height)))
    (if (not (equal prev-size size))
        (eldoc-box--maybe-cleanup))
    (setq prev-size size)
    (set-frame-size frame width height t)

    ;; Set the display property back.
    (setcdr eldoc-box--markdown-separator-display-props
            '(:width text))

    ;; move position
    (set-frame-position frame (car pos) (cdr pos))))

It's not perfect, because now sometimes there's a "flicking effect" (the box disappears for one frame) but I prefer it this way. The check (if (not (equal prev-size size)) is there so there isn't any flicking when the box isn't resized.

@casouri
Copy link
Owner

casouri commented Jan 7, 2025

Thank you! So IIUC you made Emacs to hide the frame before resizing it? I don't want to use this technique since, as you said, there might be flickering. The problem is probably due to Emacs's childframe implementation and the toolkit, wm and maybe x11/wayland. I would see if you can reproduce this with some minimal childframe and make a bug report to Emacs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants