GNU bug report logs - #61710
30.0.50; frame parameter `(fullscreen . maximized)' does not work with PGTK and emacsclient --create-frame

Previous Next

Package: emacs;

Reported by: Alynx Zhou <alynx.zhou <at> suse.com>

Date: Wed, 22 Feb 2023 14:56:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 61710 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Wed, 22 Feb 2023 14:56:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alynx Zhou <alynx.zhou <at> suse.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 22 Feb 2023 14:56:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alynx Zhou <alynx.zhou <at> suse.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; frame parameter `(fullscreen . maximized)' does not work
 with PGTK and emacsclient --create-frame
Date: Wed, 22 Feb 2023 21:27:42 +0800
This problem could be reproduced with those minimal steps:

1. `emacs -Q --eval "(add-to-list 'default-frame-alist '(fullscreen . 
maximized))" --daemon`
2. `emacsclient --create-frame WHATEVER_FILES`

What's expected:

Every frame created by emacsclient should be maximized.

What's happened:

Emacs's content only fills part of the screen space, the frame looks 
like in full screen state (no window shadows, you cannot maximize it 
manually), except the frame size is incorrect.

I am using GNOME Shell 43.3 Wayland session. It also has some other 
strange behaviors which may be helpful to debug:

- Emacs itself cannot reproduce this bug, only emacsclient.
- If you restore the misbehave window, and maximize it again, it works 
fine then.
- If you open whatever files with `emacsclient --create-frame 
WHATEVER_FILES`, this bug should happen, but if emacs frame starts with 
scratch buffer first, this bug cannot be reproduced (for example don't 
appened files to emacsclient's arguments, or you opened a _soft linked_ 
file, then emacs will _display scratch buffer and asking you whether you 
follow link_). That's the most strange behavior.
- This bug cannot be reproduced under X11 session.

Thanks ahead.

Alynx Zhou

---

In GNU Emacs 30.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.17.8) of 2023-02-22 built on camelot
Repository revision: cac13e360547f95ec64d34f38003dfc7ff1a97ee
Repository branch: makepkg
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=aot --with-xinput2 --with-pgtk
 --without-xaw3d --with-sound=alsa --with-xwidgets --with-tree-sitter
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 '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'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

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

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

Major mode: Lisp Interaction

Minor modes in effect:
  display-fill-column-indicator-mode: t
  highlight-indent-guides-mode: t
  hl-todo-mode: t
  rainbow-mode: t
  flycheck-mode: t
  lsp-bridge-mode: t
  yas-minor-mode: t
  vertico-mode: t
  popper-echo-mode: t
  popper-mode: t
  editorconfig-mode: t
  which-key-mode: t
  global-diff-hl-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  whole-line-or-region-global-mode: t
  whole-line-or-region-local-mode: t
  alynx-mode-line-mode: t
  global-auto-revert-mode: t
  savehist-mode: t
  save-place-mode: t
  recentf-mode: t
  pixel-scroll-precision-mode: t
  global-hl-line-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  delete-selection-mode: t
  windmove-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
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package hides 
/usr/share/emacs/30.0.50/lisp/use-package/use-package
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-lint 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-jump 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-ensure 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-diminish 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-delight 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-core 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/alynx/.emacs.d/elpa/use-package-20221209.2013/use-package-bind-key 
hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/alynx/.emacs.d/elpa/bind-key-20221209.2013/bind-key hides 
/usr/share/emacs/30.0.50/lisp/use-package/bind-key

Features:
(shadow sort mail-extr emacsbug message yank-media dired dired-loaddefs
rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
cursor-sensor time-date eshell esh-cmd esh-ext esh-opt esh-proc esh-io
esh-arg esh-module esh-groups esh-util cus-start files-x network-stream
puny nsm time display-fill-column-indicator highlight-indent-guides
advice hl-todo compat compat-macs rainbow-mode flycheck find-func dash
lsp-bridge lsp-bridge-lsp-installer lsp-bridge-diagnostic
lsp-bridge-code-action acm acm-quick-access acm-backend-citre
acm-backend-tailwind 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 lsp-bridge-call-hierarchy
lsp-bridge-jdtls lsp-bridge-ref derived grep compile
text-property-search comint ansi-osc ansi-color lsp-bridge-epc acm-frame
markdown-mode thingatpt noutline outline yasnippet-snippets yasnippet
posframe vertico orderless popper-echo popper editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch
which-key svg-tag-mode svg-lib color svg dom xml diff-hl face-remap
vc-hg vc-git log-view pcvs-util vc-dir ewoc diff-mode undo-tree diff
queue whole-line-or-region alynx-mode-line let-alist pcase
alynx-one-light-theme alynx-one-dark-theme xref-js2 vc vc-dispatcher
js2-mode etags fileloop generator js imenu xref project
use-package-ensure c-ts-mode c-ts-common cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cus-edit
pp cus-load treesit autorevert filenotify savehist saveplace recentf
tree-widget wid-edit pixel-scroll cua-base ring whitespace hl-line
display-line-numbers delsel comp comp-cstr warnings icons windmove
edmacro kmacro use-package-bind-key bind-key easy-mmode server cl-extra
help-mode use-package-core info rainbow-mode-autoloads popper-autoloads
diff-hl-autoloads marginalia-autoloads mood-line-autoloads
yasnippet-snippets-autoloads flycheck-autoloads pkg-info-autoloads
epl-autoloads treemacs-autoloads ace-window-autoloads avy-autoloads
pfuture-autoloads hydra-autoloads lv-autoloads ht-autoloads
cfrs-autoloads posframe-autoloads consult-autoloads vertico-autoloads
orderless-autoloads editorconfig-autoloads org-bullets-autoloads
which-key-autoloads svg-tag-mode-autoloads svg-lib-autoloads
git-gutter-fringe-autoloads fringe-helper-autoloads git-gutter-autoloads
hl-todo-autoloads compat-autoloads highlight-indent-guides-autoloads
undo-tree-autoloads queue-autoloads whole-line-or-region-autoloads
move-text-autoloads olivetti-autoloads atom-one-dark-theme-autoloads
meson-mode-autoloads yaml-mode-autoloads web-mode-autoloads
markdown-mode-autoloads lua-mode-autoloads json-mode-autoloads rx
json-snatcher-autoloads xref-js2-autoloads js2-refactor-autoloads
multiple-cursors-autoloads dash-autoloads s-autoloads
yasnippet-autoloads js2-mode-autoloads use-package-autoloads
bind-key-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/pgtk-win pgtk-win term/common-win pgtk-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
xwidget-internal dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 421267 290649)
 (symbols 48 29181 0)
 (strings 32 94697 50259)
 (string-bytes 1 3231376)
 (vectors 16 52855)
 (vector-slots 8 868112 321299)
 (floats 8 295 788)
 (intervals 56 487 86)
 (buffers 984 15))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Wed, 22 Feb 2023 15:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 61710 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alynx Zhou <alynx.zhou <at> suse.com>
Cc: 61710 <at> debbugs.gnu.org
Subject: Re: bug#61710: 30.0.50;
 frame parameter `(fullscreen . maximized)' does not work with PGTK
 and emacsclient --create-frame
Date: Wed, 22 Feb 2023 17:31:48 +0200
> Date: Wed, 22 Feb 2023 21:27:42 +0800
> From:  Alynx Zhou via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> This problem could be reproduced with those minimal steps:
> 
> 1. `emacs -Q --eval "(add-to-list 'default-frame-alist '(fullscreen . 
> maximized))" --daemon`

I think any customizations that need a real display should be done
from server-after-make-frame-hook, not at startup time.  Did you try
that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Wed, 22 Feb 2023 16:36:01 GMT) Full text and rfc822 format available.

Message #11 received at 61710 <at> debbugs.gnu.org (full text, mbox):

From: Alynx Zhou <alynx.zhou <at> suse.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61710 <at> debbugs.gnu.org
Subject: Re: bug#61710: 30.0.50; frame parameter `(fullscreen . maximized)'
 does not work with PGTK and emacsclient --create-frame
Date: Thu, 23 Feb 2023 00:34:43 +0800
On 2/22/23 23:31, Eli Zaretskii wrote:
>> Date: Wed, 22 Feb 2023 21:27:42 +0800
>> From:  Alynx Zhou via "Bug reports for GNU Emacs,
>>   the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> This problem could be reproduced with those minimal steps:
>>
>> 1. `emacs -Q --eval "(add-to-list 'default-frame-alist '(fullscreen .
>> maximized))" --daemon`
> 
> I think any customizations that need a real display should be done
> from server-after-make-frame-hook, not at startup time.  Did you try
> that?

Well, I did not try the hook, however, I think first this just adds 
default parameter, and it actually makes effect when `make-frame` is 
called, at that time client already sends server its display. Plus, GTK 
allows to set maximized before window is shown, this means the window 
will maximized once mapped, which is just what I want.

I also tried the X11 GTK version, it does not have this bug.

Alynx Zhou




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Wed, 22 Feb 2023 17:13:02 GMT) Full text and rfc822 format available.

Message #14 received at 61710 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alynx Zhou <alynx.zhou <at> suse.com>
Cc: 61710 <at> debbugs.gnu.org
Subject: Re: bug#61710: 30.0.50; frame parameter `(fullscreen . maximized)'
 does not work with PGTK and emacsclient --create-frame
Date: Wed, 22 Feb 2023 19:12:11 +0200
> Date: Thu, 23 Feb 2023 00:34:43 +0800
> Cc: 61710 <at> debbugs.gnu.org
> From: Alynx Zhou <alynx.zhou <at> suse.com>
> 
> On 2/22/23 23:31, Eli Zaretskii wrote:
> >> Date: Wed, 22 Feb 2023 21:27:42 +0800
> >> From:  Alynx Zhou via "Bug reports for GNU Emacs,
> >>   the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >>
> >> This problem could be reproduced with those minimal steps:
> >>
> >> 1. `emacs -Q --eval "(add-to-list 'default-frame-alist '(fullscreen .
> >> maximized))" --daemon`
> > 
> > I think any customizations that need a real display should be done
> > from server-after-make-frame-hook, not at startup time.  Did you try
> > that?
> 
> Well, I did not try the hook, however, I think first this just adds 
> default parameter, and it actually makes effect when `make-frame` is 
> called, at that time client already sends server its display. Plus, GTK 
> allows to set maximized before window is shown, this means the window 
> will maximized once mapped, which is just what I want.

But what exactly "maximized" means depends on the display geometry,
and the daemon doesn't have access to that, since it doesn't
initialize the X connection.

> I also tried the X11 GTK version, it does not have this bug.

Then maybe the problem is not where I think it is.  Sorry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Wed, 22 Feb 2023 17:29:02 GMT) Full text and rfc822 format available.

Message #17 received at 61710 <at> debbugs.gnu.org (full text, mbox):

From: Alynx Zhou <alynx.zhou <at> suse.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61710 <at> debbugs.gnu.org
Subject: Re: bug#61710: 30.0.50; frame parameter `(fullscreen . maximized)'
 does not work with PGTK and emacsclient --create-frame
Date: Thu, 23 Feb 2023 01:28:27 +0800
On 2/23/23 01:11, Eli Zaretskii wrote:
>> Date: Thu, 23 Feb 2023 00:34:43 +0800
>> Cc: 61710 <at> debbugs.gnu.org
>> From: Alynx Zhou <alynx.zhou <at> suse.com>
>>
>> On 2/22/23 23:31, Eli Zaretskii wrote:
>>>> Date: Wed, 22 Feb 2023 21:27:42 +0800
>>>> From:  Alynx Zhou via "Bug reports for GNU Emacs,
>>>>    the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>>>
>>>> This problem could be reproduced with those minimal steps:
>>>>
>>>> 1. `emacs -Q --eval "(add-to-list 'default-frame-alist '(fullscreen .
>>>> maximized))" --daemon`
>>>
>>> I think any customizations that need a real display should be done
>>> from server-after-make-frame-hook, not at startup time.  Did you try
>>> that?
>>
>> Well, I did not try the hook, however, I think first this just adds
>> default parameter, and it actually makes effect when `make-frame` is
>> called, at that time client already sends server its display. Plus, GTK
>> allows to set maximized before window is shown, this means the window
>> will maximized once mapped, which is just what I want.
> 
> But what exactly "maximized" means depends on the display geometry,
> and the daemon doesn't have access to that, since it doesn't
> initialize the X connection.
> 

I've read server.el for the whole afternoon, and I think when 
`make-frame` is called, Emacs server already gets Wayland Display from 
client (this bug only happens in Wayland as I mentions).

And actually Emacs doesn't need to get display geometry before maximize, 
in Wayland it works in this way: a window requires to maximize to 
compositor, and compositor decides to make it maximize, it will then 
send the width and height to window via configure event, and all of 
those are handled by GTK so I don't think Emacs should take care of 
those actually.

Plus, if I don't open file via emacsclient (just call `emacsclient 
--create-frame`), the newly create frame is maximized properly, so I 
guess that it is not a display related issue.

>> I also tried the X11 GTK version, it does not have this bug.
> 
> Then maybe the problem is not where I think it is.  Sorry.

Nevermind, I am appreciate that you take time on my problem. :-)

Alynx




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61710; Package emacs. (Fri, 24 Feb 2023 10:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 61710 <at> debbugs.gnu.org (full text, mbox):

From: Alynx Zhou <alynx.zhou <at> suse.com>
To: 61710 <at> debbugs.gnu.org
Subject: Re: bug#61710: 30.0.50; frame parameter `(fullscreen . maximized)'
 does not work with PGTK and emacsclient --create-frame
Date: Fri, 24 Feb 2023 18:21:44 +0800
So, after taking another afternoon on commenting code or adding 
`message`, the problem is located at the last 2 lines of 
`server-switch-buffer`:

```
    (when server-raise-frame
      (select-frame-set-input-focus (window-frame)))))
```

When I set `server-raise-frame` to `nil`, the newly created frame is 
maximized properly, I am not sure why `select-frame-set-input-focus` 
causes such a bug, but I guess it is related on how PGTK handles focus 
on Wayland (actually I think it should do nothing, because Wayland 
clients are not allowed to grab focus explicitly, but there must be some 
interesting things).

I'd like to find out what's wrong with it tomorrow, but at least I have 
a workaround now!

Alynx




This bug report was last modified 1 year and 54 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.