wxDisplay().GetClientArea(); return different results depending on how appl launched (Issue #25932)

21 views
Skip to first unread message

Sergey Khalyutn

unread,
Oct 27, 2025, 10:24:35 AM (5 days ago) Oct 27
to wx-...@googlegroups.com, Subscribed
Khalyutin created an issue (wxWidgets/wxWidgets#25932)

Please help me determine the cause

wxWigget 3.2.8 amd64 Gnome Ubuntu 24.04.01 under Oracle VirtualBox
Dispaly 4k with 200% scale

wxDisplay().GetGeometry(); and wxDisplay().GetClientArea(); return different results depending on how application launched.

run under VSCode IDE: wxDisplay().GetClientArea() W=1982 H=1048 - as expected

build/RESULT/nm-erp-studio.run nm-core-library.so::debug.p:452412.t:452412 DISPLAY=[:0] XAUTHORITY=[/run/user/1000/.mutter-Xwaylandauth.3L8GE3]. nm-core-library.so::debug.p:452412.t:452412 wxDisplay(this->handle()).GetClientArea() W=1982 H=1048, scale=2.000000 . nm-core-library.so::debug.p:452412.t:452412 ~application() .... nm-core-library.so::debug.p:452412.t:452412 ~application() ok..

run under gnome terminal or gnome "Files" : wxDisplay().GetClientArea() W=4096 H=2160 - NOT expected

/build/RESULT/nm-erp-studio.run nm-core-library.so::debug.p:452691.t:452691 DISPLAY=[:0] XAUTHORITY=[/run/user/1000/.mutter-Xwaylandauth.3L8GE3]. nm-core-library.so::debug.p:452691.t:452691 wxDisplay(this->handle()).GetClientArea() W=4096 H=2160, scale=2.000000 . nm-core-library.so::debug.p:452691.t:452691 ~application() .... nm-core-library.so::debug.p:452691.t:452691 ~application() ok..

run under gnome terminal as root : wxDisplay().GetClientArea() W=1982 H=1048 - as expected

sudo build/RESULT/nm-erp-studio.run nm-core-library.so::debug.p:452726.t:452726 DISPLAY=[:0] XAUTHORITY=[/run/user/1000/.mutter-Xwaylandauth.3L8GE3]. nm-core-library.so::debug.p:452726.t:452726 wxDisplay(this->handle()).GetClientArea() W=1982 H=1048, scale=2.000000 . nm-core-library.so::debug.p:452726.t:452726 ~application() .... nm-core-library.so::debug.p:452726.t:452726 ~application() ok..

on amd64 KDE leap under Oracle VirtualBox - ok as expected.


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

VZ

unread,
Oct 27, 2025, 11:10:19 AM (4 days ago) Oct 27
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25932)

Compare environment variables set in the different cases.

Also please try actually debugging this by stepping into the code and checking what's going on there, this shouldn't be difficult to do.

P.S. I've edited your submission to make it more readable, you need to use triple backticks around blocks of literal text.


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/25932/3451776664@github.com>

Sergey Khalyutn

unread,
Oct 28, 2025, 5:52:04 AM (4 days ago) Oct 28
to wx-...@googlegroups.com, Subscribed

Closed #25932 as completed.


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/issue/25932/issue_event/20548680423@github.com>

Sergey Khalyutn

unread,
Oct 28, 2025, 5:52:09 AM (4 days ago) Oct 28
to wx-...@googlegroups.com, Subscribed
Khalyutin left a comment (wxWidgets/wxWidgets#25932)

Probably it`s gtk3 <-> Wayland backend problem. (Monitor scaling is not taken into account when returning "application pixel" size of monitor). And gnome desktop (root has GDK_BACKEND=x11" bat user no) :(

Workaround is use X11 backend :

bool nm::wxw::appl::Runer::Initialize(int& argc, wxChar **argv) // override wxApp::Initialize
{
    setenv("GDK_BACKEND", "x11", 1);
    return wxApp::Initialize(argc, argv);
}


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/25932/3455534550@github.com>

VZ

unread,
Oct 28, 2025, 9:08:19 AM (4 days ago) Oct 28
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25932)

If you really want to always use X11, it's probably better to call gdk_set_allowed_backends("x11"), but wxDisplay().GetClientArea() should work with Wayland too — and it does on my system with the display sample, which correctly shows the size of the display using 2x scaling in logical pixels.


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/25932/3456387659@github.com>

Sergey Khalyutn

unread,
Oct 28, 2025, 10:27:43 AM (4 days ago) Oct 28
to wx-...@googlegroups.com, Subscribed
Khalyutin left a comment (wxWidgets/wxWidgets#25932)

on my openSUSE LEAP-16.0 under KDE decktop wxDisplay().GetClientArea() work corret without setenv("GDK_BACKEND", "x11", 1);

gdk_set_allowed_backends("x11") is better, of course, I`m try... , but it need include...

#ifdef LINUX
#   include <gtk/gtk.h>
#   include <gdk/gdk.h>
#endif

and something like:

        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/atk-1.0")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/lib64/graphene-1.0/include")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/graphene-1.0")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/gdk-pixbuf-2.0")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/harfbuzz")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/pango-1.0")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/cairo")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/glib-2.0")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/lib64/glib-2.0/include")
        # target_include_directories(${notecoreTARGET_ID} PUBLIC "/usr/include/gtk-3.0")    

map to X11 workaround decision...

And, of course, thanks for the advice :)


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/25932/3456741001@github.com>

Reply all
Reply to author
Forward
0 new messages