https://bugs.kde.org/show_bug.cgi?id=252314

--- Comment #56 from Tristan Miller <[email protected]> ---
The workarounds discussed here (i.e., adding ignoregeometry/strictgeometry
rules for Emacs windows to ~/.config/kwinrulesrc and/or adding (setq
frame-resize-pixelwise t) to ~/.emacs.d/init.el) were generally working for me
in X11 sessions up to and including Plasma 6.7.  However, they stopped working
when I upgraded to Plasma 6.8, which requires Wayland.  The behaviour of the
bug is also subtly different in that when the Emacs window shrinks, it's not
the bottom edge that goes up but rather the top edge that goes down.

The bug is triggered for me whenever I use Emacs's forward incremental search
(Ctrl+S) because invoking this command makes Emacs apply a new toolbar that (at
least in my configuration) has taller icons than the default toolbar.  In order
to accommodate the taller toolbar, the height of the entire Emacs window
increases.  This can end up pushing its bottom edge down off the visible area
of the screen (in my case, behind the Plasma panel).  When the search command
completes, Emacs restores its default toolbar and the entire Emacs window
shrinks from the top down to its previous height.  If the window was previously
vertically maximized, then its top edge is now positioned several pixels below
the top edge of the screen, while the bottom edge of the window remains
obscured by the panel.

Here are steps to reproduce the problem with a fresh installation of GTK Emacs
(i.e., without any pre-existing user configuration in ~/.emacs.d) on openSUSE:

1. Launch Emacs.
2. Press Alt+: and then type (setq tool-bar-style 'image) and press Enter. 
This tells Emacs to use an icon-only toolbar.
3. Maximize the Emacs window vertically but not horizontally by middle-clicking
on the maximize button in the window title bar, or by using the mouse to drag
the window's top and bottom edges to the top and bottom edges of the visible
area of the screen, respectively.
4.  Press Ctrl+S to start a forward incremental search.  The search toolbar
with taller icons is swapped in and the overall window height grows, exceeding
the visible area of the screen.
5. Press Ctrl+G to abort the search.  The default toolbar with shorter icons is
swapped back in, and the window shrinks in height by having its top edge
lowered.

I believe the problem here is still with KWin: in step 4, Emacs requests that
its window increase in height, and in its capacity as a Wayland compositor,
KWin agrees to this request when it shouldn't (because the Emacs window is
already maximized).  In Step 5, Emacs requests that its window decrease in
height, and KWin correctly agrees to this request, but makes a poor choice of
which window edge gets to maintain its position.  Interestingly, the problem
doesn't occur when the Emacs window is maximized both horizontally *and*
vertically.

I believe I've discovered a workaround to this particular manifestation of the
bug:  putting

> (setq frame-inhibit-implied-resize t)

in one's ~/.emacs.d/init.el file prevents Emacs from asking the window manager
to resize its window when its menu or toolbar changes. (There may be other
circumstances in which Emacs asks the window manager to resize the window, and
these wouldn't be affected by this workaround.)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to