summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-10-18 19:26:43 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-10-18 19:26:43 +0000
commit30faa38aec228c0b20c665f409b09447f801bcdd (patch)
tree6f6ebb34500f74a103e8b7ab0d79eb9c90791d31 /gtk
parentd0c4e085357c46991ac4b83a5a0b0a58bc3583c9 (diff)
downloadgdk-pixbuf-30faa38aec228c0b20c665f409b09447f801bcdd.tar.gz
Fix use of uninitialized variable.
Thu Oct 17 17:17:05 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkcheckbutton.c (gtk_check_button_size_request): Fix use of uninitialized variable. Thu Oct 17 14:38:37 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c (gtk_accel_label_expose_event): Align the baseline of the accelerator label with the first baseline of the main label of the menu item. (#76593) Wed Oct 16 18:25:24 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkevents-x11.c (translate_key_event): Use gdk_keymap_translate_keyboard_state() rather than XLookupString() to get the keysymbol, since XLookupString can confuse the input method handling. (#93575) * gdk/x11/gdkkeys-x11.c: Rewrite the handling of key translation for the non-XKB case to properly handle Shift_Lock, Caps_Lock, Num_Lock according to the Xlib spec. (#67066)
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkaccellabel.c39
-rw-r--r--gtk/gtkcheckbutton.c6
2 files changed, 30 insertions, 15 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index d05376247..4190d3fca 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -293,13 +293,25 @@ gtk_accel_label_size_request (GtkWidget *widget,
g_object_unref (layout);
}
+static gint
+get_first_baseline (PangoLayout *layout)
+{
+ PangoLayoutIter *iter;
+ gint result;
+
+ iter = pango_layout_get_iter (layout);
+ result = pango_layout_iter_get_baseline (iter);
+ pango_layout_iter_free (iter);
+
+ return PANGO_PIXELS (result);
+}
+
static gboolean
gtk_accel_label_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget);
GtkMisc *misc = GTK_MISC (accel_label);
- PangoLayout *layout;
if (GTK_WIDGET_DRAWABLE (accel_label))
{
@@ -309,8 +321,11 @@ gtk_accel_label_expose_event (GtkWidget *widget,
if (widget->allocation.width >= widget->requisition.width + ac_width)
{
- guint x;
- guint y;
+ PangoLayout *label_layout;
+ PangoLayout *accel_layout;
+
+ gint x;
+ gint y;
widget->allocation.width -= ac_width;
if (GTK_WIDGET_CLASS (parent_class)->expose_event)
@@ -318,13 +333,13 @@ gtk_accel_label_expose_event (GtkWidget *widget,
widget->allocation.width += ac_width;
x = widget->allocation.x + widget->allocation.width - misc->xpad - ac_width;
-
- y = (widget->allocation.y * (1.0 - misc->yalign) +
- (widget->allocation.y + widget->allocation.height -
- (widget->requisition.height - misc->ypad * 2)) *
- misc->yalign) + 1.5;
-
- layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
+
+ label_layout = gtk_label_get_layout (GTK_LABEL (accel_label));
+ gtk_label_get_layout_offsets (GTK_LABEL (accel_label), NULL, &y);
+
+ accel_layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
+
+ y += get_first_baseline (label_layout) - get_first_baseline (accel_layout);
gtk_paint_layout (widget->style,
widget->window,
@@ -334,9 +349,9 @@ gtk_accel_label_expose_event (GtkWidget *widget,
widget,
"accellabel",
x, y,
- layout);
+ accel_layout);
- g_object_unref (layout);
+ g_object_unref (accel_layout);
}
else
{
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 963cb6ea9..d0667c4bc 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -235,6 +235,9 @@ gtk_check_button_size_request (GtkWidget *widget,
requisition->width = border_width * 2;
requisition->height = border_width * 2;
+ _gtk_check_button_get_props (GTK_CHECK_BUTTON (widget),
+ &indicator_size, &indicator_spacing);
+
child = GTK_BIN (widget)->child;
if (child && GTK_WIDGET_VISIBLE (child))
{
@@ -246,9 +249,6 @@ gtk_check_button_size_request (GtkWidget *widget,
requisition->height += child_requisition.height;
}
- _gtk_check_button_get_props (GTK_CHECK_BUTTON (widget),
- &indicator_size, &indicator_spacing);
-
requisition->width += (indicator_size + indicator_spacing * 2 + 2 * (focus_width + focus_pad));
temp = indicator_size + indicator_spacing * 2;