Subject: bug#58556: 28.2; Emacs pgtk branch make-frame-visible/make-frame-invisible slower than Emacs X11 branch.

From: Andy Stewart <[email-masked]>
Date: Sun, 16 Oct 2022 01:16:57 +0800

I'm author of lsp-bridge, I found Emacs pgtk's
make-frame-visible/make-frame-invisible is much slower than Emacs x11
branch.

I read source code of pgtk_make_frame_visible at
https://github.com/bqv/emacs/blob/0f468a2f8bd6b8950be92431905b79f4d36ef8fd/src/pgtkterm.c#L508
, why pgtk_make_frame_visible add while loop here to wait map-event
callback?

XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000 equal 100ms, if wait
here too long, it will slow down user type next char even
`gtk_widget_show' has execute.

Can someone fix this issue?

Thanks

  -- Andy

In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34,
cairo version 1.17.6)
 of 2022-09-12 built on frederik
Windowing system distributor 'The X.Org Foundation', version 11.0.12201003
System Description: Manjaro Linux

Configured using:
 'configure --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --localstatedir=/var --with-cairo --with-harfbuzz --with-libsystemd
 --with-modules --with-x-toolkit=gtk3 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2
 -Wformat -Werror=format-security -fstack-clash-protection
 -fcf-protection -g -ffile-prefix-map=/build/emacs/src=/usr/src/debug
 -flto=auto' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
 -flto=auto''

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

Important settings:
  value of $LC_ALL: zh_CN.UTF-8
  value of $LANG: zh_CN.UTF-8
  value of $XMODIFIERS: @im=fcitx5
  locale-coding-system: utf-8-unix

Major mode: EAF/file-manager

Minor modes in effect:
  windmove-mode: t
  sort-tab-mode: t
  shell-dirtrack-mode: t
  global-pangu-spacing-mode: t
  pangu-spacing-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-hl-line-mode: t
  winpoint-mode: t
  change-cursor-mode: t
  isearch-mb-mode: t
  awesome-tray-mode: t
  global-tree-sitter-mode: t
  global-subword-mode: t
  subword-mode: t
  global-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides /usr/share/emacs/lazycat/extensions/coffee-mode/test/test-helper
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides /usr/share/emacs/lazycat/extensions/elixir-mode/tests/test-helper
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides /usr/share/emacs/lazycat/extensions/f/test/test-helper
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides /usr/share/emacs/lazycat/extensions/json-reformat/test/test-helper
/usr/share/emacs/site-lisp/po-mode hides
/usr/share/emacs/lazycat/extensions/lazycat/po-mode
/usr/share/emacs/site-lisp/po-compat hides
/usr/share/emacs/lazycat/extensions/lazycat/po-compat
/usr/share/emacs/lazycat/extensions/emacs-websocket/websocket hides
/usr/share/emacs/lazycat/extensions/lazycat/websocket
/usr/share/emacs/site-lisp/cmake-mode hides
/usr/share/emacs/lazycat/extensions/lazycat/cmake-mode
/usr/share/emacs/28.2/lisp/env hides
/usr/share/emacs/lazycat/extensions/multiple-cursor/features/support/env
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides /usr/share/emacs/lazycat/extensions/pangu-spacing/test/test-helper
/usr/share/emacs/lazycat/extensions/request/doc/eldomain/example/source/conf
hides /usr/share/emacs/lazycat/extensions/request/doc/source/conf
/usr/share/emacs/28.2/lisp/env hides
/usr/share/emacs/lazycat/extensions/ruby-tools/features/support/env
/usr/share/emacs/28.2/lisp/emacs-lisp/cl-lib hides
/usr/share/emacs/lazycat/extensions/slime/lib/cl-lib
/usr/share/emacs/28.2/lisp/emacs-lisp/ert-x hides
/usr/share/emacs/lazycat/extensions/slime/lib/ert-x
/usr/share/emacs/28.2/lisp/emacs-lisp/ert hides
/usr/share/emacs/lazycat/extensions/slime/lib/ert
/usr/share/emacs/lazycat/extensions/slime/hyperspec hides
/usr/share/emacs/lazycat/extensions/slime/lib/hyperspec
/usr/share/emacs/lazycat/extensions/emacs-rime/test hides
/usr/share/emacs/lazycat/extensions/telega.el/test
/usr/share/emacs/28.2/lisp/transient hides
/usr/share/emacs/lazycat/extensions/transient/lisp/transient
/usr/share/emacs/lazycat/extensions/clojure-mode/test/utils/test-helper
hides
/usr/share/emacs/lazycat/extensions/visual-fill-column/test/test-helper
/usr/share/emacs/28.2/lisp/env hides
/usr/share/emacs/lazycat/extensions/wrap-region/features/support/env
/usr/share/emacs/28.2/lisp/emacs-lisp/ert hides
/usr/share/emacs/lazycat/extensions/wrap-region/vendor/ert
/usr/share/emacs/lazycat/snippets/fundamental-mode/.yas-setup hides
/usr/share/emacs/lazycat/snippets/prog-mode/.yas-setup
/usr/share/emacs/lazycat/snippets/fundamental-mode/.yas-setup hides
/usr/share/emacs/lazycat/snippets/python-mode/.yas-setup

Features:
(shadow sort mail-extr delete-block emacsbug message rfc822 mml mml-sec
epa epg rfc6068 epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail mail-utils
init-smex smex ido typescript-mode cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons memoize face-remap
multiple-cursors mc-separate-operations rectangular-region-mode
mc-mark-pop mc-edit-lines mc-hide-unmatched-lines-mode mc-mark-more
mc-cycle-cursors multiple-cursors-core rect network-stream puny nsm rmc
init-sort-tab windmove sort-tab init-python python tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
parse-time ls-lisp desktop frameset init-session init-proxy socks
init-eaf popweb-dict-youdao popweb-dict-bing popweb-dict popweb
popweb-epc eaf-git eaf-rss-reader eaf-vue-demo eaf-demo eaf-file-browser
eaf-system-monitor eaf-music-player eaf-netease-cloud-music eaf-jupyter
eaf-camera eaf-terminal eaf-mail eaf-mindmap eaf-org-previewer 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
org-refile ox-html table ox-ascii ox-publish ox org-element org ob
ob-tangle ob-ref ob-lob ob-table org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete org-list org-faces org-entities
org-version ob-emacs-lisp org-table org-keys org-loaddefs find-func
cal-menu calendar cal-loaddefs avl-tree ol oc-basic bibtex iso8601
time-date oc ob-exp ob-core org-compat ob-eval org-macs eaf-image-viewer
eaf-video-player eaf-markdown-previewer eaf-pdf-viewer eaf-browser
init-markdown-mode pangu-spacing olivetti eldoc-extension yasnippet
lisp-mnt mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr init-idle hl-line init-org init-c init-info init-winpoint
winpoint init-cursor-chg cursor-chg init-yasnippet init-eldoc
init-tree-sitter tree-sitter-query scheme tree-sitter-debug generator
tree-sitter-langs tree-sitter-langs-build tar-mode arc-mode archive-mode
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap tree-sitter-hl elf-mode browse-kill-ring
pretty-lambdada format-spec init init-rime rime rime-predicates xdg
popup dash init-performance init-isearch-mb isearch-mb init-vi-navigate
vi-navigate init-key init-one-key eaf-file-manager eaf eaf-epc bookmark
pp init-indent init-grammatical-edit init-mode init-auto-save auto-save
init-lsp-bridge lsp-bridge acm acm-quick-access acm-backend-citre
acm-backend-tabnine acm-backend-telega acm-backend-tempel
acm-backend-search-sdcv-words acm-backend-search-file-words
acm-backend-path acm-backend-lsp acm-backend-elisp acm-backend-yas
acm-icon svg dom lsp-bridge-lsp-installer markdown-mode rx color
url-parse auth-source eieio eieio-core eieio-loaddefs password-cache
url-vars noutline outline posframe lsp-bridge-jdtls lsp-bridge-ref
derived edmacro kmacro grep lsp-bridge-epc json init-line-number
init-awesome-tray awesome-tray vc-git diff-mode vc-dispatcher battery
dbus xml init-highlight-parentheses highlight-parentheses redo
basic-toolkit display-line-numbers grammatical-edit tree-sitter
easy-mmode tree-sitter-load tree-sitter-cli map tsc tsc-dyn tsc-dyn-get
pcase compile text-property-search comint ansi-color ring dired-aux
dired dired-loaddefs tsc-obsolete thingatpt subr-x one-key cl lazy-load
lazycat-dark-theme lazycat-theme cl-macs init-generic warnings advice
cap-words superword subword init-fullscreen fullscreen init-font
init-accelerate cl-extra help-mode seq byte-opt gv bytecomp byte-compile
cconv cl-seq cl-loaddefs cl-lib china-util iso-transl tooltip 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 cl-generic 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 simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 550671 99886)
 (symbols 48 33343 1)
 (strings 32 112368 4347)
 (string-bytes 1 3849672)
 (vectors 16 47649)
 (vector-slots 8 648295 17640)
 (floats 8 713 399)
 (intervals 56 11873 3168)
 (buffers 992 28))