Commit b3079c0d authored by Havoc Pennington's avatar Havoc Pennington
Browse files

Use gint16 for GtkBorder

32K of border ought to be enough for any pixel dimensions. At least
until screens are so huge we start using doubles.

This saves a nice 64 bits of space when we have a GtkBorder
stored somewhere.

Signed integers are used to avoid surprising unsigned math
issues. Just search GTK's whole git log from inception
for "unsigned" if you want to find any number of commits
fixing signed/unsigned bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=629387
parent 7e520d90
...@@ -1941,6 +1941,7 @@ gtk_rc_property_parse_border (const GParamSpec *pspec, ...@@ -1941,6 +1941,7 @@ gtk_rc_property_parse_border (const GParamSpec *pspec,
GtkBorder border; GtkBorder border;
GScanner *scanner; GScanner *scanner;
gboolean success = FALSE; gboolean success = FALSE;
int left, right, top, bottom;
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE); g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE); g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
...@@ -1948,11 +1949,15 @@ gtk_rc_property_parse_border (const GParamSpec *pspec, ...@@ -1948,11 +1949,15 @@ gtk_rc_property_parse_border (const GParamSpec *pspec,
scanner = gtk_rc_scanner_new (); scanner = gtk_rc_scanner_new ();
g_scanner_input_text (scanner, gstring->str, gstring->len); g_scanner_input_text (scanner, gstring->str, gstring->len);
if (get_braced_int (scanner, TRUE, FALSE, &border.left) && if (get_braced_int (scanner, TRUE, FALSE, &left) &&
get_braced_int (scanner, FALSE, FALSE, &border.right) && get_braced_int (scanner, FALSE, FALSE, &right) &&
get_braced_int (scanner, FALSE, FALSE, &border.top) && get_braced_int (scanner, FALSE, FALSE, &top) &&
get_braced_int (scanner, FALSE, TRUE, &border.bottom)) get_braced_int (scanner, FALSE, TRUE, &bottom))
{ {
border.left = left;
border.right = right;
border.top = top;
border.bottom = bottom;
g_value_set_boxed (property_value, &border); g_value_set_boxed (property_value, &border);
success = TRUE; success = TRUE;
} }
......
...@@ -416,10 +416,10 @@ struct _GtkStyleClass ...@@ -416,10 +416,10 @@ struct _GtkStyleClass
*/ */
struct _GtkBorder struct _GtkBorder
{ {
gint left; gint16 left;
gint right; gint16 right;
gint top; gint16 top;
gint bottom; gint16 bottom;
}; };
GType gtk_style_get_type (void) G_GNUC_CONST; GType gtk_style_get_type (void) G_GNUC_CONST;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment