Catch change of monitor scaling under GTK+ (PR #25754)

27 views
Skip to first unread message

RobertRoeb

unread,
Sep 2, 2025, 11:06:35 AM (5 days ago) Sep 2
to wx-...@googlegroups.com, Subscribed

Allows to relayout controls when scaling is changed in large monitor Previous code assumed the configure event would be triggered by GTK+ Hopefully fixes #25733


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/25754

Commit Summary

  • 26312f5 Catch change of monitor scaling under GTK+

File Changes

(2 files)

Patch Links:


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/pull/25754@github.com>

paulcor

unread,
Sep 2, 2025, 4:31:13 PM (5 days ago) Sep 2
to wx-...@googlegroups.com, Subscribed
paulcor left a comment (wxWidgets/wxWidgets#25754)

The scale-factor notification is coming from "configure-event" handling anyway:
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkwindow.c?ref_type=heads#L7975
so I don't think this PR would make any difference.

The current code works fine for me changing the scale programmatically with gdk_x11_display_set_window_scale(), and we have no independent verification that it doesn't work, the details provided in #25733 being questionable.


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/pull/25754/c3246699854@github.com>

oneeyeman1

unread,
Sep 2, 2025, 5:14:48 PM (5 days ago) Sep 2
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25754)

@paulcor ,
Did you try what I described?

Build the library with --enable-debug --with-gtk
Build the dialog sample.
Change the monitor scale to 200%
Start the sample and run the Rich text dialog.
Change the monitor scale to 100 leaving the dialog open.
Observe the size of the dialog didnt change.

As said - im running only one monitor with different scales. Using X with GNOME non-classic interface (no menu bar at the top).

Can you run this and see the problem?

Thx.


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/pull/25754/c3246809887@github.com>

RobertRoeb

unread,
Sep 2, 2025, 5:18:51 PM (5 days ago) Sep 2
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25754)

Strange - I did test the code on my Ubuntu and choosing a different scale in the GNOME control centre did not cause a configure event, but new code was triggered.


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/pull/25754/c3246818205@github.com>

VZ

unread,
Sep 2, 2025, 5:24:32 PM (5 days ago) Sep 2
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25754)

FWIW this is not going to fix #25733 on its own anyhow, the problem is not the lack of event (if it's lacking) but that we don't change the TLW size when the DPI changes and it's not obvious whether we should do it and how.

Also, I do get DPI change events when dragging the window from one monitor (using 200% DPI) to the other (using 100%), this can be seen just by adding

    Bind(wxEVT_DPI_CHANGED, [](wxDPIChangedEvent& event) {
        wxLogDebug("DPI changed, new DPI: %d", event.GetNewDPI().x);
        event.Skip();
    });

to MyFrame ctor in the minimal sample.

I don't use GNOME, however, so I can't (easily) test changing the scale using its control center. Maybe it doesn't result to a reconfigure event?


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/pull/25754/c3246831497@github.com>

VZ

unread,
Sep 6, 2025, 3:01:36 PM (yesterday) Sep 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25754)

I'm not sure what to do about this one.

@RobertRoeb Can you please confirm that adding the snippet above to minimal sample doesn't show you "DPI changed" messages without this PR but does it with it?


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/pull/25754/c3263035929@github.com>

oneeyeman1

unread,
Sep 6, 2025, 4:44:00 PM (yesterday) Sep 6
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25754)

@vadz ,
I'd also ask Paul if he can reproduce it without this PR, and cant with it.

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/pull/25754/c3263193357@github.com>

RobertRoeb

unread,
9:31 AM (11 hours ago) 9:31 AM
to wx-...@googlegroups.com, Subscribed

Closed #25754.


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/pull/25754/issue_event/19550841039@github.com>

RobertRoeb

unread,
9:31 AM (11 hours ago) 9:31 AM
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25754)

I checked again with fresh rebuilds - and my observation was wrong. When changing the scaling using the GNOME control centre, the event get triggered in both arms, printing out the same numbers (new DPI 192) and when going back (new DPI 96). We can close this PR.


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/pull/25754/c3263780165@github.com>

oneeyeman1

unread,
9:47 AM (11 hours ago) 9:47 AM
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25754)

@RobertRoeb ,
Did you try the instructions I provided in the bug report for reproduce case?
Do you see the problem?

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/pull/25754/c3263789813@github.com>

RobertRoeb

unread,
11:28 AM (9 hours ago) 11:28 AM
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25754)

This PR attempted to correct catching a signal when the DPI changes, but it didn't change anything in my test case of using the GNOME control centre. I don't have multiple monitors to test anything and I didn't hear from you that the patch fixed anything


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/pull/25754/c3263850787@github.com>

oneeyeman1

unread,
12:14 PM (9 hours ago) 12:14 PM
to wx-...@googlegroups.com, Subscribed
oneeyeman1 left a comment (wxWidgets/wxWidgets#25754)

@RobertRoeb ,
I’m sorry I didn’t have time to look at it.

I’m getting ready to move as I lost my contract.

Can you run the instructions I provided in the ticket with and without this PR? I suspect that only frame windows are handled and not the dialogs.

BTW, as I wrote in the ticket, I also don’t have second monitor to test with and use GNOME Display Settings to change scale. I’m using mode GNOME UI with X. (Not classic one with the menu bar on top).

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/pull/25754/c3263881083@github.com>

Reply all
Reply to author
Forward
0 new messages