Subject: bug#76481: 31.0.50; Extreme weirdness with GDK_SCALE=

From: Jonathan Corbet <[email-masked]>
Date: Mon, 24 Feb 2025 10:08:54 -0700

Po Lu <[email-masked]> writes:

> Jonathan Corbet <[email-masked]> writes:
>
>> OK, if I run it normally (without GDK_SCALE=), I get this
>>
>> First return, called from x_set_scroll_bar_default_width(): 32
>>  from xg_update_frame_menubar(): 2
>>  from xg_wm_set_size_hint(): 2
>>  from xg_frame_set_char_size(): 2
>>
>> from here on it's always 2
>>
>> with GDK_SCALE= :
>>
>> First return, called from x_set_scroll_bar_default_width(): 16
>>  from xg_update_frame_menubar(): 1
>>  from xg_wm_set_size_hint(): 1
>>  from xg_frame_set_char_size(): 1
>>
>> ...and always 1 thereafter.
>>
>> Hope that helps?
>>
>> Thanks,
>>
>> jon
>
> My recollection is that on Wayland the scale is decided by the
> compositor, but apparently GDK continues to report and use the value of
> GDK_SCALE in some contexts, if present, which moves the two out of sync.
> Or so I suspect.

Something that I think may be related and easier to reproduce... with a
pgtk build:

  $ emacs -q
  <get initial frame, which looks normal>
  C-x 5 b <ret>
  <get *scratch*, probably a tiny frame at most 8 lines high>

It's not 100% reproducible, but happens at least 50% of the time.

FWIW, I also get this in the terminal where I run the editor:

> (emacs:64577): Gtk-CRITICAL **: 10:06:02.686: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed

Thanks,

jon