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 646882 - Theming fixes for GtkButton and GtkCombobox
Theming fixes for GtkButton and GtkCombobox
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
[theme]
Depends on:
Blocks: 645824
 
 
Reported: 2011-04-06 03:48 UTC by Cosimo Cecchi
Modified: 2011-04-12 21:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
button: make gtk_button_get_props() return the padding too (1.27 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
button: don't use the border values for padding (4.74 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
combobox: don't add the button style class to the whole widget (1.22 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
combobox: don't use the border as a padding (6.69 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
combobox: rename border->padding for code clarity (14.83 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
combobox: allocate the right border to the arrow and not to the label (1.48 KB, patch)
2011-04-06 03:48 UTC, Cosimo Cecchi
committed Details | Review
combobox: always give the full allocation to the button in menu mode (1.34 KB, patch)
2011-04-12 18:27 UTC, Cosimo Cecchi
committed Details | Review

Description Cosimo Cecchi 2011-04-06 03:48:11 UTC
Here's a patchset that fixes some holes in GtkButton and GtkCombobox themability, as for bug 645824.
Comment 1 Cosimo Cecchi 2011-04-06 03:48:13 UTC
Created attachment 185251 [details] [review]
button: make gtk_button_get_props() return the padding too
Comment 2 Cosimo Cecchi 2011-04-06 03:48:16 UTC
Created attachment 185252 [details] [review]
button: don't use the border values for padding

It's wrong, and makes it impossible to theme the button properly.
Comment 3 Cosimo Cecchi 2011-04-06 03:48:19 UTC
Created attachment 185253 [details] [review]
combobox: don't add the button style class to the whole widget

It already has a toggle button inside, and this way we cannot theme them
separately.
Comment 4 Cosimo Cecchi 2011-04-06 03:48:22 UTC
Created attachment 185254 [details] [review]
combobox: don't use the border as a padding

This causes the combobox to behave badly from the theme.
Comment 5 Cosimo Cecchi 2011-04-06 03:48:25 UTC
Created attachment 185255 [details] [review]
combobox: rename border->padding for code clarity
Comment 6 Cosimo Cecchi 2011-04-06 03:48:28 UTC
Created attachment 185256 [details] [review]
combobox: allocate the right border to the arrow and not to the label

When the combobox is in menu mode, the right padding of the togglebutton
inside, should be allocated to its rightmost children, which is the
arrow.
Comment 7 Matthias Clasen 2011-04-11 21:51:38 UTC
Review of attachment 185251 [details] [review]:

Looks fine, apart from the minor coding style thing.

::: gtk/gtkbutton.c
@@ +1464,3 @@
+    {
+      gtk_style_context_get_padding (context, state, padding);
+    }

GTK+ coding style calls for no braces here.
Comment 8 Matthias Clasen 2011-04-11 22:04:20 UTC
Review of attachment 185252 [details] [review]:

Not 100% sure I understand why it is wrong, but I'll trust your insight into the css machinery.
Comment 9 Matthias Clasen 2011-04-11 22:05:06 UTC
Review of attachment 185253 [details] [review]:

Ok
Comment 10 Matthias Clasen 2011-04-11 22:06:01 UTC
Review of attachment 185254 [details] [review]:

Again I'll have to defer to your understanding of css parameter interactions.
Comment 11 Matthias Clasen 2011-04-11 22:07:34 UTC
Review of attachment 185255 [details] [review]:

No problems with the renaming

::: gtk/gtkcombobox.c
@@ +2425,3 @@
+          allocation->y += padding.top;
+          allocation->width -= padding.left + padding.right;
+          allocation->height -= padding.top + padding.bottom;

This looks like it is not just a renaming, but an actual behaviour change. 
Should be explained and committed separately.
Comment 12 Matthias Clasen 2011-04-11 22:08:37 UTC
Review of attachment 185256 [details] [review]:

ok
Comment 13 Cosimo Cecchi 2011-04-12 18:27:03 UTC
Created attachment 185820 [details] [review]
combobox: always give the full allocation to the button in menu mode

The button is what draws the background/frame outline of the combobox,
and padding is defined as the spacing *inside* the widget between the
border and the content.
Comment 14 Cosimo Cecchi 2011-04-12 18:28:02 UTC
(In reply to comment #11)

> This looks like it is not just a renaming, but an actual behaviour change. 
> Should be explained and committed separately.

I splitted it into the last patch attached here.
Comment 15 Matthias Clasen 2011-04-12 20:40:40 UTC
Review of attachment 185820 [details] [review]:

Makes sense.
Comment 16 Cosimo Cecchi 2011-04-12 21:09:07 UTC
Thanks for the review, pushed to master with the code style fixed for the first patch.

Attachment 185251 [details] pushed as 29e45c4 - button: make gtk_button_get_props() return the padding too
Attachment 185252 [details] pushed as 2c29311 - button: don't use the border values for padding
Attachment 185253 [details] pushed as 9f4183c - combobox: don't add the button style class to the whole widget
Attachment 185254 [details] pushed as 22eb1f5 - combobox: don't use the border as a padding
Attachment 185255 [details] pushed as 503466c - combobox: rename border->padding for code clarity
Attachment 185256 [details] pushed as e94b311 - combobox: allocate the right border to the arrow and not to the label
Attachment 185820 [details] pushed as 713488e - combobox: always give the full allocation to the button in menu mode