]> Pileus Git - ~andy/gtk/commitdiff
Use the same logic as GtkEntry when calculating border width. (#116368,
authorMatthias Clasen <maclas@gmx.de>
Thu, 11 Mar 2004 21:10:49 +0000 (21:10 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 11 Mar 2004 21:10:49 +0000 (21:10 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkspinbutton.c

index dbc97b4ef2355bbaa02a92d10549cf294f756a7f..804757fbc01266604b36469a65595b584d3ec738 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index dbc97b4ef2355bbaa02a92d10549cf294f756a7f..804757fbc01266604b36469a65595b584d3ec738 100644 (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>
 
index dbc97b4ef2355bbaa02a92d10549cf294f756a7f..804757fbc01266604b36469a65595b584d3ec738 100644 (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>
 
index dbc97b4ef2355bbaa02a92d10549cf294f756a7f..804757fbc01266604b36469a65595b584d3ec738 100644 (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>
 
index dbc97b4ef2355bbaa02a92d10549cf294f756a7f..804757fbc01266604b36469a65595b584d3ec738 100644 (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>
 
index 7a65b5b028f113526634d2cdd5d05c431196f20f..1c4c30924b6d1fcf442d8cc6dd4e9418633a9245 100644 (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;