No Re-Layout on wxGTK when the DPI changes (Issue #25733)

48 views
Skip to first unread message

oneeyeman1

unread,
Aug 27, 2025, 3:19:24 PMAug 27
to wx-...@googlegroups.com, Subscribed
oneeyeman1 created an issue (wxWidgets/wxWidgets#25733)

Description

In my application I have a dialog with the notebook and a buttons below. This dialog is tall and will be cut short on higher DPI.

Expected vs observed behaviour:

When the DPI changes I'd expect the dialog to be Re-layout so it is displayed in full or in short.

Stack trace:

N/A
It is visual issue.

Patch or snippet allowing to reproduce the problem:

I ave only one laptop with X11/GNOME and the monitor there supports 100 and 200 scaling.

When the program have a tall dialog it will not be relayout on the DPI change

Following scenario happening:

  1. Set the monitor to 200%
  2. Start the program.
  3. Go to the dialog
  4. Change the DPI to 100%
  5. Observe that the buttons are not displayed correctly.
  6. Exit the app and start it again leaving the DPI at 100.
  7. Go to the dialog
  8. Observe that the button displays correctly.

In one of the panels of the notebook there is a GtkFontPanel class so the dialog is very tall.
But when the DPI is going to 100% the dialog is not resized to display the buttons.

I will see if I can make a patch to the dialog sample with the reprod, but at this point I'd like to know if this behavior is correct.

I can also try to make a screenshot of my application dialog on both 200%, 100% and how it behaves when started on 100%.

If this how the program should behave on wxGTK, I can catch DPI change event at call Layout there, probably conditionally.

Platform and version information

  • wxWidgets version you use:3.3.1
  • wxWidgets port you use: wxGTK
  • OS and its version: Gentoo Linux
    • GTK version: 3.24
    • Which GDK backend is used: X11
    • Desktop environment : GNOME
    • Current theme: Default (Adwaita)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733@github.com>

VZ

unread,
Aug 27, 2025, 3:21:10 PMAug 27
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25733)

Please reproduce this in a sample. With GTK logical and physical pixels are the same so it shouldn't be necessary to relayout, but the layout should be correct (and same) in both cases.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229468889@github.com>

oneeyeman1

unread,
Aug 27, 2025, 3:50:10 PMAug 27
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@vadz ,
Reproduced.

Unmodified dialogs sample.

Build the sample
Set the Scale to 200.
Run the dialog and choose "Dialogs->Rich Message dialog"
Observe that the dialog will be cut short.
Change the scale to 100
Switch to the sample
Observe that the dialog is still displayed short.
Keeping the scale to 100, restart the dialog
Again choose "Dialogs->Rich Message dialog"
Observe that the dialog is displayed in full.

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229545972@github.com>

VZ

unread,
Aug 27, 2025, 3:52:22 PMAug 27
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25733)

I.e. the total size of the dialog changes? This could be due to imposing an upper limit on it to fit on the screen. Not sure if we can do anything about it if this is what it is.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229551826@github.com>

oneeyeman1

unread,
Aug 27, 2025, 3:58:48 PMAug 27
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@vadz ,
Not sure what you mean?

The size of the dialog didn't change. How can it change - it is the same.
But I totally expect the dialog to be displayed in full when I change the scale to 100%.

Do you want to see a screenshots?

Try the steps I outlined.

Disclaimer - I'm not using 2 monitor setup, just changing the scale factor on the fly.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229567192@github.com>

VZ

unread,
Aug 27, 2025, 4:00:38 PMAug 27
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25733)

Yes, please show screenshots.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229572000@github.com>

oneeyeman1

unread,
Aug 27, 2025, 4:04:21 PMAug 27
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)
image.png (view on web)

Start on 200%

image.png (view on web)

After changing to 100%

image.png (view on web)

Start on 100%


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229581180@github.com>

VZ

unread,
Aug 27, 2025, 4:07:09 PMAug 27
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25733)

Right, this is exactly what I wrote: dialog is limited to the display height (actually somewhat less) and when the resolution changes its size doesn't change.

To fix this we'd need to be notified about resolution change (I'm already not sure how to do it) and also store the initially computed best size in the TLW to check if we should expand to it if we have enough place now.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3229589312@github.com>

oneeyeman1

unread,
Aug 29, 2025, 7:52:04 PMAug 29
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@vadz ,

According to GTK maintainer here, we should be using GObject::notify in this case.

And then do the relayout in response to that change.

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3238725828@github.com>

RobertRoeb

unread,
Aug 30, 2025, 2:36:56 AMAug 30
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25733)

The current code in master listens to the "configure" event in gtk/toplevel.cpp and then compares old and new scale factors. Does this code get called when you change the scaling?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3239000565@github.com>

RobertRoeb

unread,
Aug 30, 2025, 3:04:29 AMAug 30
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25733)

And could you ask on that chat on the GTK list if that signal is called "notify:gtk-widget-scale" or something else? Unless someone knows the full name.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3239017029@github.com>

oneeyeman1

unread,
Aug 30, 2025, 8:39:26 PMAug 30
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@RobertRoeb ,
To answer you first question - yes, the code goes thru that signal, but:.

Changing th scale factor from 200 to 100 O get this:

oneeyeman1

unread,
Aug 30, 2025, 8:43:46 PMAug 30
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@RobertRoeb ,

And I just asked Emmanuelle for the proper name...

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3239636395@github.com>

paulcor

unread,
Aug 30, 2025, 9:01:58 PMAug 30
to wx-...@googlegroups.com, Subscribed
paulcor left a comment (wxWidgets/wxWidgets#25733)

And I just asked Emmanuelle for the proper name

JFC, it's scale-factor, it's RIGHT THERE.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3239642654@github.com>

RobertRoeb

unread,
Aug 31, 2025, 1:06:33 AMAug 31
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25733)

Is my understanding right that the scale factor eventually does get changed, but the configure event is not sent, so we have to catch "notify::scale-factor"


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3239769422@github.com>

RobertRoeb

unread,
Aug 31, 2025, 4:09:15 PMAug 31
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25733)

gtk_scale.patch

Try this patch, please


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3240381798@github.com>

oneeyeman1

unread,
Nov 16, 2025, 5:03:47 PM (6 days ago) Nov 16
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25733)

@vadz,

I don't know if you got my comment in the closed PR.

I just tried to add the Bind from it and I did get the event of DPI change. So presumably what is needed is to call Layout() when the DPI changed.

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25733/3539408243@github.com>

Reply all
Reply to author
Forward
0 new messages