Community
Participate
Working Groups
Please execute the attached snippet on Linux. For me the set size of the checkbox is ignored - it is drawn as large as the text is.
Created attachment 282191 [details] Snippet
Created attachment 282192 [details] Screenshot illustrating the problem
Created attachment 282193 [details] Screenshot on Windows 10
I have studied GTK sources and it seems to be by design: 1) Every widget has two rectangles: allocation - this is the designated widget size clip - this is the area where widget is allowed to paint. It is often larger than allocation. 2) When a clip rectangle is changed for a widget, all parents that share the same GdkWindow have their clip rects adjusted to include the child's rect * see gtk_widget_set_clip() 3) GtkLabel includes entire text length in its clip rectangle. This seems to only be changed by enabling wrapping or ellipsis * see gtk_label_get_ink_rect() in gtk_label_size_allocate() 4) GtkLabel also calculates its minimum size as full text length, which is again modified by wrapping and ellipsis * see gtk_label_get_preferred_layout_size() 5) When GtkBox container performs layout, and there is not enough space to fit minimum sizes, it prints a warning and early returns. * see gtk_box_gadget_distribute() 6) Checkbox/radio/pushbuton all have a Label with text inside them. To summarize, when a Label doesn't fit, it still paints remaining text outside of bounds. SWT Label however is not affected because SWT wraps it in an intermediate GtkEventBox which creates its own GdkWindow. The simplest workaround is to wrap overflowing Button into a Composite. Just like Label, this will wrap the control in an intermediate GdkWindow, which stops clip rect propagation in gtk_widget_set_clip().