Subject: Emacs not always redraws while resized in xwayland

From: Julien Palard <[email-masked]>
Date: Mon, 16 Oct 2023 20:23:01 +0000

Dear maintainers,

I'm using emacs-gtk on Gnome with Wayland, with two physical screens of
different resolution. Emacs gets rendered through xwayland according to
`xlsclients`.

When I move emacs from one physical screen (of 1280px wide) to
a larger one (of 1920px wide) it has to resize,
but sometimes it does not, resulting in a black band on the right:

=> https://mdk.fr/x/emacs-not-resizing.png

Once in this state, it starts to behave very strangely when resized:

=> https://mdk.fr/x/emacs-not-resizing-bars.png

In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2023-08-30, modified by Debian built on
 x86-csail-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12302001
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-29.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Python

Minor modes in effect:
  lsp-diagnostics-mode: t
  company-mode: t
  lsp-headerline-breadcrumb-mode: t
  lsp-modeline-workspace-status-mode: t
  lsp-modeline-diagnostics-mode: t
  lsp-modeline-code-actions-mode: t
  lsp-completion-mode: t
  blacken-mode: t
  whitespace-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  lsp-ui-mode: t
  lsp-ui-doc-mode: t
  lsp-ui-sideline-mode: t
  lsp-managed-mode: t
  lsp-mode: t
  smerge-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  shell-dirtrack-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  direnv-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  server-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/llvm-11/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-16/tablegen-mode
/usr/share/emacs/site-lisp/llvm-11/llvm-mode hides /usr/share/emacs/site-lisp/llvm-16/llvm-mode
/usr/share/emacs/site-lisp/llvm-11/emacs hides /usr/share/emacs/site-lisp/llvm-16/emacs
/usr/share/emacs/site-lisp/llvm-11/tablegen-mode hides /usr/share/emacs/site-lisp/llvm-9/tablegen-mode
/usr/share/emacs/site-lisp/llvm-11/llvm-mode hides /usr/share/emacs/site-lisp/llvm-9/llvm-mode
/usr/share/emacs/site-lisp/llvm-11/emacs hides /usr/share/emacs/site-lisp/llvm-9/emacs
/home/mdk/.emacs.d/elpa/transient-20230919.2146/transient hides /usr/share/emacs/29.1/lisp/transient
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-lint hides /usr/share/emacs/29.1/lisp/use-package/use-package-lint
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish hides /usr/share/emacs/29.1/lisp/use-package/use-package-diminish
/home/mdk/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides /usr/share/emacs/29.1/lisp/use-package/bind-key
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure hides /usr/share/emacs/29.1/lisp/use-package/use-package-ensure
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package hides /usr/share/emacs/29.1/lisp/use-package/use-package
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key hides /usr/share/emacs/29.1/lisp/use-package/use-package-bind-key
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-jump hides /usr/share/emacs/29.1/lisp/use-package/use-package-jump
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-core hides /usr/share/emacs/29.1/lisp/use-package/use-package-core
/home/mdk/.emacs.d/elpa/use-package-20230426.2324/use-package-delight hides /usr/share/emacs/29.1/lisp/use-package/use-package-delight
/usr/share/emacs/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/29.1/lisp/language/thai-word
/home/mdk/.emacs.d/elpa/seq-2.24/seq hides /usr/share/emacs/29.1/lisp/emacs-lisp/seq
/home/mdk/.emacs.d/elpa/eldoc-1.14.0/eldoc hides /usr/share/emacs/29.1/lisp/emacs-lisp/eldoc

Features:
(shadow sort emacsbug mule-util cal-move novice shortdoc help-fns
radix-tree sh-script smie executable mail-extr cap-words superword
subword tabify man cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs org-indent oc-basic yaml-mode
dired-aux rect git-rebase dabbrev conf-mode vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view bug-reference pulse misearch multi-isearch
vc lsp-diagnostics company-oddmuse company-keywords company-etags etags
fileloop company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb company lsp-headerline lsp-icons
lsp-modeline lsp-lens vc-git vc-dispatcher view lsp-zig lsp-tilt
lsp-steep lsp-svelte lsp-sqls lsp-ruby-syntax-tree lsp-ruby-lsp lsp-yaml
lsp-xml lsp-vimscript lsp-vhdl lsp-volar lsp-vetur lsp-html lsp-verilog
lsp-vala lsp-v lsp-typeprof lsp-ttcn3 lsp-toml lsp-terraform lsp-tex
lsp-sorbet lsp-solargraph lsp-semgrep lsp-rust lsp-rubocop lsp-rf
lsp-ruff-lsp lsp-remark lsp-racket lsp-r lsp-purescript lsp-pylsp
lsp-pyls lsp-pwsh lsp-php lsp-pls lsp-perlnavigator lsp-perl
lsp-openscad lsp-ocaml lsp-magik lsp-nix lsp-nim lsp-nginx lsp-move
lsp-mint lsp-mdx lsp-marksman lsp-markdown lsp-lua lsp-kotlin lsp-json
lsp-javascript lsp-idris lsp-haxe lsp-groovy lsp-hack lsp-graphql
lsp-glsl lsp-gleam lsp-go lsp-completion lsp-gdscript lsp-fsharp
lsp-fortran lsp-eslint lsp-erlang lsp-emmet lsp-elixir lsp-elm
lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp lsp-crystal lsp-credo
lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd lsp-beancount
lsp-bash lsp-astro lsp-awk lsp-ansible lsp-angular lsp-ada
lsp-actionscript blacken whitespace cus-edit pp cus-start
spacemacs-light-theme spacemacs-theme ol-w3m ol-rmail ol-mhe ol-irc
ol-info org-habit ol-gnus nnselect gnus-art mm-uu mml2015 mm-view
mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start
gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time
gnus-spec gnus-int gnus-range gnus-win ol-eww eww url-queue shr
pixel-fill kinsoku url-file svg xml dom mm-url gnus nnheader range
ol-doi org-link-doi ol-docview doc-view jka-compr image-mode exif
ol-bibtex bibtex iso8601 ol-bbdb icomplete cus-load org-bullets lsp-jedi
lsp-ui lsp-ui-flycheck lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek
lsp-ui-sideline lsp-mode xref tree-widget wid-edit spinner
network-stream markdown-mode color thingatpt lv inline f f-shortdoc ewoc
compile lsp-ui-util face-remap lsp-protocol s ht python project treesit
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit message sendmail yank-media dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util text-property-search mm-decode mm-bodies mm-encode mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor comp comp-cstr warnings shell magit-mode
transient edmacro kmacro magit-git magit-base magit-section
cursor-sensor crm compat diminish flycheck-grammalecte pkg-info url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm puny lisp-mnt epl grammalecte flycheck direnv
diff-mode dash ox-odt rng-loc rng-uri rng-parse rng-match rng-dt
rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox org-element
org-persist xdg org-id org-refile org ob ob-tangle ob-ref ob-lob
ob-table org-macro org-src ob-comint org-pcomplete pcomplete comint
ansi-osc ansi-color org-list org-footnote org-faces org-entities
time-date noutline outline icons ob-emacs-lisp org-table org-keys
org-loaddefs find-func cal-menu calendar cal-loaddefs ring avl-tree
generator ol rx oc ob-exp ob-core org-cycle org-fold org-fold-core
org-compat ob-eval org-version org-macs format-spec yasnippet-snippets
yasnippet cl-extra help-mode server finder-inf use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core devhelp
blacken-autoloads company-autoloads direnv-autoloads
flycheck-grammalecte-autoloads flycheck-autoloads lsp-jedi-autoloads
lsp-ui-autoloads lsp-mode-autoloads ht-autoloads f-autoloads
magit-autoloads pcase git-commit-autoloads magit-section-autoloads
dash-autoloads markdown-mode-autoloads po-mode-autoloads
rust-mode-autoloads spacemacs-theme-autoloads transient-autoloads
websocket-autoloads with-editor-autoloads info compat-autoloads
seq-autoloads yaml-mode-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1071536 134022)
 (symbols 48 51258 80)
 (strings 32 210498 20018)
 (string-bytes 1 6442879)
 (vectors 16 118163)
 (vector-slots 8 2982348 213541)
 (floats 8 758 553)
 (intervals 56 62508 2943)
 (buffers 984 48))

-- 
[Julien Palard](https://mdk.fr)