Do you use the same desktop environment/window manager under both?
Also, do you use X or Wayland under both or does it differ?
This could be a bug in window decoration size determination, but we need
to understand in which circumstances exactly does it happen and, of course,
having a minimal example reproducing it would be great, as usual.
On Sun, 26 Jun 2022 00:01:36 -0700 (PDT) utelle wrote:
u> > Do you use the same desktop environment/window manager under both?
u> > Also, do you use X or Wayland under both or does it differ?
u> Now I have checked whether using X or Wayland makes a difference. It does
u> I switched on both systems from X to Wayland, but the result was the same
u> as before. Under OpenSuSE (KDE) all is ok, under Ububtu (Gnome) the dialog
u> display is squeezed.
Sorry, I really have no idea what's going on here and it's very strange
that the behaviour is system- rather Wayland/X11-dependent.
Could it be due
to some quirk in determining the best sizes with the Ubuntu theme?
u> Is there a way to determine which environment is in use?
This is supposed to work, please check that libSM was detected by
configure. And if it was, please check what happens inside GetSM() in
But this shouldn't be necessary, of course...
u> What is method GetBestSize supposed to deliver? The total size of the
u> window including the titlebar?
u> What I don't understand is that method SetClientSize() resp
u> wxWindowGTK::DoSetClientSize() applies a correction to the width and
u> height, before passing the values on to method SetSize().
SetClientSize() doesn't do this for TLWs, why do you think it does it?
u> Finally, when and where the correction for the height of the titlebar is
This is complicated because we can have client-side decorations or not,
Wayland or X11, and with the latter we can't get the decorations size
immediately. There is a lot of code dealing with this in
u> The symbol wxUSE_DETECT_SM has the value 0. Therefore GetSM is not invoked.
You should be able to see why libSM wasn't detected in config.log, but the
most likely explanation is that the corresponding -dev package wasn't
u> AFAICT the method ComputeFittingClientSize works correctly. The height
u> correction I mentioned comes from the menu bar. And this is therefore also
u> correct. The point is that GetBestSize does not take the title bar into
u> account, or it can't determine its height.
Probably, yes, but I don't know why. It's supposed to, and this does work
in at least some circumstances.
u> Looking into setup.h for the created wx libraries the symbol has the value
u> I checked that the package libsm-dev is installed. I'm not sure how to
u> interpret config.log, therefore I attached the file config.log.
Something is wrong here as the attached config.log clearly shows that
libSM was successfully detected and contains
#define wxUSE_DETECT_SM 1
so you should have it on in your build.
u> For the time being I will live with the workaround I found:
u> 1) Retrieve GetBestSize
u> 2) Retrieve GetSize
u> 3) Retrieve GetClientSize
u> 4) Calculate clientSize = GetBestSize - (GetSize - GetClientSize)
u> 5) Use the calculated size for SetClientSize
u> (instead of using SetInitialSize).
I don't understand what is the advantage of doing this instead of just
using SetClientSize(GetBestClientSize()) directly?
u> I debugged the code and found out that GetSM() returns the value
u> "gnome-session", but that value is compared with "GnomeSM". Not equal,
u> therefore an empty string is returned.
Wow, it looks like "GnomeSM" was used with Gnome 2.0 (but I'm not even
sure about it), so we should definitely recognize "gnome-session" here
nowadays. I'll make a PR...
u> Sorry, there exists no method GetBestClientSize().
Oops, yes, you're right, sorry. But for a dialog you would typically use
wxSizer::ComputeFittingClientSize() with its top level size. And this is
also what wxSizer::Fit() does.
u> Maybe just checking whether the returned string starts with (or contains)
u> the substring "gnome", would be better than checking for a specific string.
Good idea, thanks, please check https://github.com/wxWidgets/wxWidgets/pull/22575
u> However, I have to call
u> SetInitialSize or SetClientSize, before the window is displayed. Otherwise
u> the wxFrame is not displayed with correct sizes.
This is very strange because SetSizerAndFit() really should result in
setting the client size to the correct value... Again, sorry for lack of
help but I just don't understand at all what's going on in your case.