SetMinSize() and SetSizeHints() platform differences with X11 and Wayland

40 views
Skip to first unread message

Hamish McIntyre-Bhatty

unread,
Nov 9, 2020, 12:31:44 PM11/9/20
to wx-users

Originally posted at
https://forums.wxwidgets.org/viewtopic.php?f=23&t=47598 but I have since been advised that I should post here and might get the attention of the
main GTK developer (Paul?).


As I first reported here: https://discuss.wxpython.org/t/setminsi ... nces/34914, I have noticed differences in the way SetMinSize() and SetSizeHints() work depending on whether the X11 or Wayland backend is used.

It seems that SetMinSize() and SetSizeHints() are ignoring the window decoration in the minimum size calculation on X11, but taking it into account on Wayland. The same does not seem to be the case for GetClientSize(), so I'm having trouble setting a minimum window size that is consistent across Linux distros that default to X11 (eg Ubuntu) and Wayland (eg Fedora). On Fedora, the windows can be shrunk a bit more, which I think is because:
  • Get/SetClientSize() work the same on both platforms and ignore the window decoration in the size calculation.
  • SetMinSize() and SetSizeHints() are taking the window decoration into account, but only on Wayland (everything is consistent on X11 AFAICT).
I have tried to do my due diligence and find a report here, on wxWidgets Trac, and on the users' mailing list, but have been unsuccessful - I do apologise if this is already reported/fixed in a newer version. Is there anything else I should investigate / any other information I should provide?

Probably best to look at the forum thread to catch up, because I successfully reproduced  with a custom build of both v3.0.4 and v3.1.4 on Fedora and there is a file attached there that demonstrates the issue.

If anyone has any advice/thoughts/suggestions for further things I should try or do to aid debugging, please let me know :)

Hamish

gunter.ko...@gmail.com

unread,
Nov 9, 2020, 1:28:38 PM11/9/20
to wx-users
Hey, thanks! That describes the problems I am currently trying to find the root of quite accurately.

Andy Robinson

unread,
Nov 10, 2020, 4:30:09 AM11/10/20
to wx-u...@googlegroups.com
On 09/11/2020 17:31, Hamish McIntyre-Bhatty wrote:
> As I first reported here: https://discuss.wxpython.org/t/setminsi ...
> nces/34914
> <https://discuss.wxpython.org/t/setminsize-and-setsizehints-platform-differences/34914>,
> I have noticed differences in the way SetMinSize() and SetSizeHints()
> work depending on whether the X11 or Wayland backend is used.
I use a different approach:

#ifdef __WXGTK__
setenv("GDK_BACKEND", "x11", 1 /* overwrite */);
#endif

Regards,
Andy Robinson, Seventh String Software, www.seventhstring.com

Hamish McIntyre-Bhatty

unread,
Mar 10, 2021, 2:21:24 PMMar 10
to wx-users
Bump, in case this is fixed or someone has some insights into how to fix it.

Igor Korot

unread,
Mar 10, 2021, 2:48:46 PMMar 10
to wx-u...@googlegroups.com
Hi,

On Wed, Mar 10, 2021 at 1:21 PM Hamish McIntyre-Bhatty
<hami...@gmail.com> wrote:
>
> Bump, in case this is fixed or someone has some insights into how to fix it.

So Andy's suggestion didn't work for you?

Thank you.

>
> On Tuesday, November 10, 2020 at 9:30:09 AM UTC an...@seventhstring.com wrote:
>>
>> On 09/11/2020 17:31, Hamish McIntyre-Bhatty wrote:
>> > As I first reported here: https://discuss.wxpython.org/t/setminsi ...
>> > nces/34914
>> > <https://discuss.wxpython.org/t/setminsize-and-setsizehints-platform-differences/34914>,
>> > I have noticed differences in the way SetMinSize() and SetSizeHints()
>> > work depending on whether the X11 or Wayland backend is used.
>> I use a different approach:
>>
>> #ifdef __WXGTK__
>> setenv("GDK_BACKEND", "x11", 1 /* overwrite */);
>> #endif
>>
>> Regards,
>> Andy Robinson, Seventh String Software, www.seventhstring.com
>
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+u...@googlegroups.com
> or visit http://groups.google.com/group/wx-users
> ---
> You received this message because you are subscribed to the Google Groups "wx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/6bc0f2cd-3ff2-47d1-aa49-9fc408b4e6fen%40googlegroups.com.

Hamish McIntyre-Bhatty

unread,
Mar 10, 2021, 2:59:35 PMMar 10
to wx-u...@googlegroups.com
Hi,

Not applicable to me as I'm using wxPython.

Also, using XWayland isn't a great solution going forwards so I'd rather
get it working without that.

Hamish

Vadim Zeitlin

unread,
Mar 10, 2021, 4:19:25 PMMar 10
to wx-u...@googlegroups.com
On Mon, 9 Nov 2020 09:31:44 -0800 (PST) Hamish McIntyre-Bhatty wrote:

HMB> Originally posted at
HMB> https://forums.wxwidgets.org/viewtopic.php?f=23&t=47598 but I have since
HMB> been advised that I should post here and might get the attention of the
HMB> main GTK developer (Paul?).
HMB>
HMB>
HMB> As I first reported here: https://discuss.wxpython.org/t/setminsi ...
HMB> nces/34914
HMB> <https://discuss.wxpython.org/t/setminsize-and-setsizehints-platform-differences/34914>,
HMB> I have noticed differences in the way SetMinSize() and SetSizeHints() work
HMB> depending on whether the X11 or Wayland backend is used.

Unfortunately I know very little about Wayland yet because I just can't
find time to really sit down and read/experiment with it, so I can't help
with this and couldn't reply anything really constructive to your message.
However I can say that it would be very useful for _us_ to have a simple
test case, in C++, showing the problem. If you could please create one as
described in https://trac.wxwidgets.org/wiki/HowToSubmitPatches and open a
ticket with it, it would be helpful.

HMB> It seems that SetMinSize() and SetSizeHints() are ignoring the window
HMB> decoration in the minimum size calculation on X11,

But wait, rereading this more carefully, I actually think it might not be
a Wayland problem at all because what you write is not the expected
behaviour under X11. Only SetClientSize() should ignore the window
decorations, SetMinSize() should take them into account. Unless we attach
different meanings to the word "ignore" so, just to be perfectly clear:
calling SetMinSize(100, 100) should prevent the window from being reduced
below 100 pixels in total size, which means that its client size will
become strictly less than 100 in both directions when it has its minimum
size. If this is not what you see with X11, please report the WM you use.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Hamish McIntyre-Bhatty

unread,
Mar 11, 2021, 2:24:17 PMMar 11
to wx-users

I've been advised to file a report in Trac to continue this discussion.

That report is here: https://trac.wxwidgets.org/ticket/19097

To answer your first query/verify it I'll have to test again - I'll get back to you.

I am using Cinnamon, so WM is Mutter. Also happens with GNOME on Fedora with Wayland and X11/xWayland.

Hamish
Reply all
Reply to author
Forward
0 new messages