[gtk+/gtk-3-0] widget: Add hack to make label mnemonics work again
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-0] widget: Add hack to make label mnemonics work again
- Date: Tue, 26 Apr 2011 12:15:02 +0000 (UTC)
commit f85feed1136a1e8dcf60b79cf000d723c22378f3
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 26 14:07:27 2011 +0200
widget: Add hack to make label mnemonics work again
Mnemonics for characters that go beyond the baseline (q, y, g) were not
being shown, because they are drawn outside of the label's allocated
size.
This patch just disables the clip-to-size for labels, so that the label
can draw outsize of its allocation. In most cases, that works around
this bug.
https://bugzilla.gnome.org/show_bug.cgi?id=648570
gtk/gtkwidget.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4d7df85..ae83564 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5659,6 +5659,20 @@ gtk_cairo_should_draw_window (cairo_t *cr,
event->window == window;
}
+static gboolean
+gtk_widget_get_clip_draw (GtkWidget *widget)
+{
+ /* labels are not clipped, because clipping them would cause
+ * mnemonics to not appear on characters that go beyond the
+ * baseline.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=648570
+ */
+ if (GTK_IS_LABEL (widget))
+ return FALSE;
+
+ return TRUE;
+}
+
/* code shared by gtk_container_propagate_draw() and
* gtk_widget_draw()
*/
@@ -5672,6 +5686,8 @@ _gtk_widget_draw_internal (GtkWidget *widget,
if (!gtk_widget_is_drawable (widget))
return;
+ clip_to_size &= gtk_widget_get_clip_draw (widget);
+
if (clip_to_size)
{
cairo_rectangle (cr,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]