Use the same logic as GtkEntry when calculating border width. (#116368,

Thu Mar 11 22:12:14 2004  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
	logic as GtkEntry when calculating border width.  (#116368, reported
	by Morten Welinder)
This commit is contained in:
Matthias Clasen 2004-03-11 21:10:49 +00:00 committed by Matthias Clasen
parent 3e69627146
commit c20280810a
6 changed files with 90 additions and 23 deletions

View File

@ -1,3 +1,9 @@
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
logic as GtkEntry when calculating border width. (#116368, reported
by Morten Welinder)
Thu Mar 11 15:59:05 2004 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c (create_spins): Use gtk_entry_set_width_chars()
@ -110,10 +116,10 @@ Thu Mar 11 01:08:25 2004 Jonathan Blandford <jrb@gnome.org>
Wed Mar 10 23:40:15 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the background
on the action view cell renderer here, not in init, so that a) we catch
style changes, and b) we get the real style, not the default one.
Partial fix for #127648, reported by Dave Bordoley.
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the
background on the action view cell renderer here, not in init, so
that a) we catch style changes, and b) we get the real style, not
the default one. Partial fix for #127648, reported by Dave Bordoley.
2004-03-10 Tor Lillqvist <tml@iki.fi>

View File

@ -1,3 +1,9 @@
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
logic as GtkEntry when calculating border width. (#116368, reported
by Morten Welinder)
Thu Mar 11 15:59:05 2004 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c (create_spins): Use gtk_entry_set_width_chars()
@ -110,10 +116,10 @@ Thu Mar 11 01:08:25 2004 Jonathan Blandford <jrb@gnome.org>
Wed Mar 10 23:40:15 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the background
on the action view cell renderer here, not in init, so that a) we catch
style changes, and b) we get the real style, not the default one.
Partial fix for #127648, reported by Dave Bordoley.
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the
background on the action view cell renderer here, not in init, so
that a) we catch style changes, and b) we get the real style, not
the default one. Partial fix for #127648, reported by Dave Bordoley.
2004-03-10 Tor Lillqvist <tml@iki.fi>

View File

@ -1,3 +1,9 @@
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
logic as GtkEntry when calculating border width. (#116368, reported
by Morten Welinder)
Thu Mar 11 15:59:05 2004 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c (create_spins): Use gtk_entry_set_width_chars()
@ -110,10 +116,10 @@ Thu Mar 11 01:08:25 2004 Jonathan Blandford <jrb@gnome.org>
Wed Mar 10 23:40:15 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the background
on the action view cell renderer here, not in init, so that a) we catch
style changes, and b) we get the real style, not the default one.
Partial fix for #127648, reported by Dave Bordoley.
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the
background on the action view cell renderer here, not in init, so
that a) we catch style changes, and b) we get the real style, not
the default one. Partial fix for #127648, reported by Dave Bordoley.
2004-03-10 Tor Lillqvist <tml@iki.fi>

View File

@ -1,3 +1,9 @@
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
logic as GtkEntry when calculating border width. (#116368, reported
by Morten Welinder)
Thu Mar 11 15:59:05 2004 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c (create_spins): Use gtk_entry_set_width_chars()
@ -110,10 +116,10 @@ Thu Mar 11 01:08:25 2004 Jonathan Blandford <jrb@gnome.org>
Wed Mar 10 23:40:15 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the background
on the action view cell renderer here, not in init, so that a) we catch
style changes, and b) we get the real style, not the default one.
Partial fix for #127648, reported by Dave Bordoley.
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the
background on the action view cell renderer here, not in init, so
that a) we catch style changes, and b) we get the real style, not
the default one. Partial fix for #127648, reported by Dave Bordoley.
2004-03-10 Tor Lillqvist <tml@iki.fi>

View File

@ -1,3 +1,9 @@
Thu Mar 11 22:12:14 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkspinbutton.c (gtk_spin_button_size_request): Use the same
logic as GtkEntry when calculating border width. (#116368, reported
by Morten Welinder)
Thu Mar 11 15:59:05 2004 Owen Taylor <otaylor@redhat.com>
* tests/testgtk.c (create_spins): Use gtk_entry_set_width_chars()
@ -110,10 +116,10 @@ Thu Mar 11 01:08:25 2004 Jonathan Blandford <jrb@gnome.org>
Wed Mar 10 23:40:15 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the background
on the action view cell renderer here, not in init, so that a) we catch
style changes, and b) we get the real style, not the default one.
Partial fix for #127648, reported by Dave Bordoley.
* gtk/gtkentrycompletion.c (_gtk_entry_completion_popup): Set the
background on the action view cell renderer here, not in init, so
that a) we catch style changes, and b) we get the real style, not
the default one. Partial fix for #127648, reported by Dave Bordoley.
2004-03-10 Tor Lillqvist <tml@iki.fi>

View File

@ -616,6 +616,40 @@ compute_double_length (double val, int digits)
return a + digits + extra;
}
/* Keep in sync with gtkentry.c !
*/
static void
get_borders (GtkEntry *entry,
gint *xborder,
gint *yborder)
{
GtkWidget *widget = GTK_WIDGET (entry);
gint focus_width;
gboolean interior_focus;
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
NULL);
if (entry->has_frame)
{
*xborder = widget->style->xthickness;
*yborder = widget->style->ythickness;
}
else
{
*xborder = 0;
*yborder = 0;
}
if (!interior_focus)
{
*xborder += focus_width;
*yborder += focus_width;
}
}
static void
gtk_spin_button_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@ -641,6 +675,7 @@ gtk_spin_button_size_request (GtkWidget *widget,
gint digit_width;
gboolean interior_focus;
gint focus_width;
gint xborder, yborder;
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
@ -673,9 +708,11 @@ gtk_spin_button_size_request (GtkWidget *widget,
w = PANGO_PIXELS (MIN (string_len, max_string_len) * digit_width);
width = MAX (width, w);
requisition->width = width + /* INNER_BORDER */ 2 * 2;
if (!interior_focus)
requisition->width += 2 * focus_width;
get_borders (entry, &xborder, &yborder);
xborder += 2; /* INNER_BORDER */
requisition->width = width + xborder * 2;
}
requisition->width += arrow_size + 2 * widget->style->xthickness;