Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#17336 closed defect (fixed)

SetSizeHints fails to set a minimum size that actually fits all controls under Wayland

Reported by: swt2c Owned by:
Priority: normal Milestone:
Component: wxGTK Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

Sizer method SetSizeHints(window) (Fit(window) is also affected) fails to set a minimum size that's large enough to fit all controls under Wayland. This can be reproduced with the attached simple wxPython program, but is also present, for example, the text sample which calls SetSizeHints().

This occurs with:
WX 3.0.2.0
GTK 3.18.6
on Fedora 23 when running under a Wayland session. Under an X11 session, it works as expected.

Is this a known issue? If not, I can try to debug further.

Attachments (3)

setsizehints.py download (316 bytes) - added by swt2c 4 years ago.
screenshot-setsizehints-wayland.png download (4.9 KB) - added by swt2c 4 years ago.
Screenshot of wxPython test on Wayland
screenshot-setsizehints-x11.png download (6.4 KB) - added by swt2c 4 years ago.
Screenshot of wxPython test on X11

Download all attachments as: .zip

Change History (14)

Changed 4 years ago by swt2c

Changed 4 years ago by swt2c

Screenshot of wxPython test on Wayland

Changed 4 years ago by swt2c

Screenshot of wxPython test on X11

comment:1 Changed 4 years ago by pcor

  • Status changed from new to confirmed

The problem is the client-side title bar, and possibly other decorations, which are not taken into account by our client size calculation.

comment:2 Changed 4 years ago by Paul Cornett <paulcor@…>

In 91ea4872813b90ff91702a11abbe644cb1e5044b/git-wxWidgets:

Adapt window decorations cache for client-side decorations

Fixes size calculations for TLWs created after the first one,
with Wayland, Mir and Broadway. See #17336

comment:3 Changed 4 years ago by Paul Cornett <paulcor@…>

In 41be4271e18a21acbcc30d1e61653190f8ef7a6d/git-wxWidgets:

Adapt window decorations cache for client-side decorations

Fixes size calculations for TLWs created after the first one,
with Wayland, Mir and Broadway. See #17336

(cherry picked from commit 91ea4872813b90ff91702a11abbe644cb1e5044b)

comment:4 Changed 4 years ago by pcor

  • Resolution set to fixed
  • Status changed from confirmed to closed

There are other problems with Wayland, but this particular one should be fixed.

comment:5 Changed 4 years ago by swt2c

Thanks again Paul for your work!

Is there a way to make this work for the first TLW? Or some workaround that can be used?

comment:6 Changed 4 years ago by pcor

I'm testing a change that would work for the first TLW, provided the size is (directly or indirectly) set using SetClientSize().

comment:7 Changed 4 years ago by Hanmac

  • Resolution fixed deleted
  • Status changed from closed to reopened

MIR is somehow broken on my system:

i got "undefined reference to `gdk_mir_display_get_type()'" i dont know why, because i added "libgdk-3" and

grep gdk_mir_display_get_type /usr/lib/x86_64-linux-gnu/libgdk-3.so
#=> Binary file /usr/lib/x86_64-linux-gnu/libgdk-3.so matches

Code:

#include <stdio.h>

#include "gdk/gdkmir.h"
/*top*/
extern int t(void);
int main(int argc, char **argv)
{
  if (argc > 1000000) {
  printf("%p", &t);
  }
return 0;
}

int t(void) { gdk_mir_display_get_type(); return 0; }
/* end */

Build test:
LANG=C g++ -o conftest `pkg-config --cflags --libs gtk+-mir-3.0` -x c++ conftest.c

comment:8 follow-up: Changed 4 years ago by awi

  • Version changed from 3.0.2 to dev-latest

I also faced this issue and reported it yesterday on GitHub:
91ea4872

comment:9 in reply to: ↑ 8 Changed 4 years ago by Hanmac

Replying to awi:

I also faced this issue and reported it yesterday on GitHub:
91ea4872

as my conftest (without wx) shows it doesn't look like a missing lib
i added `pkg-config --cflags --libs mirclient` too.

gdk is added to the building, `pkg-config --cflags --libs gtk+-mir-3.0` equals to:

-pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

your readelf shows that gdk has this function and seems to export it too (otherwise it wouldn't be visible)

as current i think it somehow a bug in gdk (or i am using it wrong), i will make a ticket on the gnome ticker and then add the link there.

EDIT:

there is the gtk bug link: https://bugzilla.gnome.org/show_bug.cgi?id=761829

Last edited 4 years ago by Hanmac (previous) (diff)

comment:10 follow-up: Changed 4 years ago by pcor

  • Resolution set to fixed
  • Status changed from reopened to closed

The problem is the GDK Mir functions are not being declared extern "C". Workaround committed in 1908c41.

comment:11 in reply to: ↑ 10 Changed 4 years ago by Hanmac

pcor:
The Problem was also fixed in gtk+ thanks to your solution. (See the issue link above)

Note: See TracTickets for help on using tickets.