After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760509 - GdkWindow positions/sizes include css margins
GdkWindow positions/sizes include css margins
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-01-12 09:05 UTC by Timm Bäder
Modified: 2016-01-13 04:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use the content allocation for GtkButton/GtkCheckbutton (3.16 KB, patch)
2016-01-12 09:05 UTC, Timm Bäder
none Details | Review
switch: Fix input window and label positioning (2.37 KB, patch)
2016-01-12 18:35 UTC, Timm Bäder
none Details | Review
button: Don't include margin in input window size (3.40 KB, patch)
2016-01-12 19:20 UTC, Timm Bäder
accepted-commit_now Details | Review
modelbutton: Don't incliude margin in input window size (1.85 KB, patch)
2016-01-12 19:42 UTC, Timm Bäder
accepted-commit_now Details | Review
switch: Fix text positioning (1.22 KB, patch)
2016-01-12 20:43 UTC, Timm Bäder
accepted-commit_now Details | Review
switch: Don't include margins in input window size (1.81 KB, patch)
2016-01-12 20:45 UTC, Timm Bäder
accepted-commit_now Details | Review

Description Timm Bäder 2016-01-12 09:05:21 UTC
Created attachment 318845 [details] [review]
Use the content allocation for GtkButton/GtkCheckbutton

I'm not sure if this is also the case for the allocation in the gadget's allocate function, but at least for widgets that move_resize their windows in size_allocate, the allocation now includes the margins set in css, which is never really what is wanted(?).

One example are buttons in headerbars now, which get a 6px top/bottom margin set via css, see http://videobin.org/+b6p/em3.ogg
Comment 1 Timm Bäder 2016-01-12 09:12:27 UTC
Would also be nice to clarify where one is suposed to gdk_window_move_resize the GdkWindows, does it even matter wheter one does it size_allocate or the allocate function of the gadget? Even if it doesn't, it would be nice if all widgets did it in the same place.
Comment 2 Matthias Clasen 2016-01-12 12:34:17 UTC
Review of attachment 318845 [details] [review]:

looks right to me.

One consideration, though: people have actually asked for this kind of overflow for window buttons in maximized windows.
Comment 3 Timm Bäder 2016-01-12 12:42:16 UTC
Do you have a preference for where to do all the gdk_window_move_resize logic? the gadget allocate or size_allocate?

Also this seems to be broken in basically every widget -- switch, entry, spinbutton, ...
Comment 4 Timm Bäder 2016-01-12 18:35:34 UTC
Created attachment 318901 [details] [review]
switch: Fix input window and label positioning
Comment 5 Timm Bäder 2016-01-12 19:20:41 UTC
Created attachment 318908 [details] [review]
button: Don't include margin in input window size
Comment 6 Matthias Clasen 2016-01-12 19:30:38 UTC
Review of attachment 318908 [details] [review]:

looks right
Comment 7 Matthias Clasen 2016-01-12 19:32:23 UTC
Review of attachment 318901 [details] [review]:

note that the window gets a different size when it is initially created in realize. Maybe it doesn't matter.

::: gtk/gtkswitch.c
@@ +622,3 @@
 
+  label_x = x + ((width / 2) - rect.width) / 2;
+  label_y = y + (height - rect.height) / 2;

Is this an unrelated fix that should be in a separate commit ?
Comment 8 Timm Bäder 2016-01-12 19:42:32 UTC
Created attachment 318910 [details] [review]
modelbutton: Don't incliude margin in input window size
Comment 9 Timm Bäder 2016-01-12 19:42:59 UTC
(In reply to Matthias Clasen from comment #7)
> Review of attachment 318901 [details] [review] [review]:
> 
> note that the window gets a different size when it is initially created in
> realize. Maybe it doesn't matter.
> 
> ::: gtk/gtkswitch.c
> @@ +622,3 @@
>  
> +  label_x = x + ((width / 2) - rect.width) / 2;
> +  label_y = y + (height - rect.height) / 2;
> 
> Is this an unrelated fix that should be in a separate commit ?

yeah, probably. will make it 2.
Comment 10 Matthias Clasen 2016-01-12 19:46:02 UTC
Review of attachment 318910 [details] [review]:

looks good
Comment 11 Timm Bäder 2016-01-12 20:43:54 UTC
Created attachment 318918 [details] [review]
switch: Fix text positioning
Comment 12 Timm Bäder 2016-01-12 20:45:53 UTC
Created attachment 318919 [details] [review]
switch: Don't include margins in input window size
Comment 13 Matthias Clasen 2016-01-12 20:49:35 UTC
Review of attachment 318918 [details] [review]:

ok
Comment 14 Matthias Clasen 2016-01-12 20:50:04 UTC
Review of attachment 318919 [details] [review]:

ok