Bug 1205651 - GTK style padding for entry boxes is huge
Summary: GTK style padding for entry boxes is huge
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gtk3
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-25 12:10 UTC by Martin Stransky
Modified: 2015-11-18 10:07 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-18 10:07:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
an example (47.96 KB, image/png)
2015-03-25 12:10 UTC, Martin Stransky
no flags Details
GtkEntry in gtk3-widget-factory (12.70 KB, image/png)
2015-03-30 19:47 UTC, Martin Stransky
no flags Details

Description Martin Stransky 2015-03-25 12:10:58 UTC
Created attachment 1006304 [details]
an example

Description of problem:

GTK styles returns large padding values for GtkEntry box. It looks weird when it's rendered by Firefox in UI.

Version-Release number of selected component (if applicable):
gtk3-3.15.12-1.fc22.x86_64

Comment 1 Martin Stransky 2015-03-25 12:15:51 UTC
The code looks like:

gEntryWidget = gtk_entry_new();
style = gtk_widget_get_style_context(gEntryWidget);
gtk_style_context_get_border(style, 0, &border);
gtk_style_context_get_padding(style, 0, &padding);

and it returns:

(gdb) p	border
$1 = {left = 1,	right = 1, top = 1, bottom = 1}
(gdb) p padding
$2 = {left = 8,	right = 8, top = 5, bottom = 6}

Comment 2 Benjamin Otte 2015-03-26 03:51:38 UTC
It's specified like this in https://git.gnome.org/browse/gtk+/tree/gtk/theme/Adwaita/_common.scss?h=3.16.0#n221 so I guess this is by design. Adwaita uses a bunch of inset shadows to get the bevel effect on the border, maybe that's what takes up the pixels?

Comment 3 Martin Stransky 2015-03-30 19:47:06 UTC
Created attachment 1008659 [details]
GtkEntry in gtk3-widget-factory

As you can see on the attached example, gtk3-widget-factory renders GtkEntry widget with:
{left = 8,right = 8,top = 5,bottom = 6}

but GtkStyle returns sizes (border+padding):
{left = 9,right = 9,top = 6,bottom = 7}

Or is the widget size narrowed with any attribute?

Comment 4 Martin Stransky 2015-03-30 19:49:26 UTC
There's also a "bug" in Firefox when 2 extra pixels are added to the form size. That's defined in Firefox css styles. It can be fixed in FF but the values returned from GTK3 still don't match.

Comment 5 Martin Stransky 2015-03-30 19:50:54 UTC
NOTE: I don't count the shadows - it's measured from font border to element border (the blue focus line).

Comment 6 Martin Stransky 2015-11-18 10:07:51 UTC
Actually a Firefox bug when extra padding is added by Firefox css styles. Sorry for the confusion.


Note You need to log in before you can comment on or make changes to this bug.