update patches

This commit is contained in:
Matthias Clasen 2010-05-08 02:56:39 +00:00
parent 0da01c005e
commit 357511daa2
2 changed files with 42 additions and 50 deletions

View File

@ -1,7 +1,7 @@
diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.c diff -up gtk+-2.21.0/gtk/gtktooltip.c.fresh-tooltips gtk+-2.21.0/gtk/gtktooltip.c
--- gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips 2009-11-26 23:54:55.000000000 -0500 --- gtk+-2.21.0/gtk/gtktooltip.c.fresh-tooltips 2010-05-06 22:49:21.000000000 -0400
+++ gtk+-2.19.1/gtk/gtktooltip.c 2009-11-30 20:06:37.539580221 -0500 +++ gtk+-2.21.0/gtk/gtktooltip.c 2010-05-07 18:16:12.347311268 -0400
@@ -29,6 +29,10 @@ @@ -33,6 +33,10 @@
#include "gtkhbox.h" #include "gtkhbox.h"
#include "gtkalignment.h" #include "gtkalignment.h"
@ -11,8 +11,8 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
+ +
#include "gtkalias.h" #include "gtkalias.h"
#include <string.h> #undef DEBUG_TOOLTIP
@@ -95,6 +99,7 @@ static void gtk_tooltip_display_cl @@ -97,6 +101,7 @@ static void gtk_tooltip_display_cl
GtkTooltip *tooltip); GtkTooltip *tooltip);
static void gtk_tooltip_set_last_window (GtkTooltip *tooltip, static void gtk_tooltip_set_last_window (GtkTooltip *tooltip,
GdkWindow *window); GdkWindow *window);
@ -20,7 +20,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
G_DEFINE_TYPE (GtkTooltip, gtk_tooltip, G_TYPE_OBJECT); G_DEFINE_TYPE (GtkTooltip, gtk_tooltip, G_TYPE_OBJECT);
@@ -110,8 +115,43 @@ gtk_tooltip_class_init (GtkTooltipClass @@ -112,8 +117,43 @@ gtk_tooltip_class_init (GtkTooltipClass
} }
static void static void
@ -64,7 +64,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
tooltip->timeout_id = 0; tooltip->timeout_id = 0;
tooltip->browse_mode_timeout_id = 0; tooltip->browse_mode_timeout_id = 0;
@@ -127,8 +167,12 @@ gtk_tooltip_init (GtkTooltip *tooltip) @@ -129,8 +169,12 @@ gtk_tooltip_init (GtkTooltip *tooltip)
tooltip->last_window = NULL; tooltip->last_window = NULL;
tooltip->window = g_object_ref (gtk_window_new (GTK_WINDOW_POPUP)); tooltip->window = g_object_ref (gtk_window_new (GTK_WINDOW_POPUP));
@ -77,7 +77,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
gtk_widget_set_app_paintable (tooltip->window, TRUE); gtk_widget_set_app_paintable (tooltip->window, TRUE);
gtk_window_set_resizable (GTK_WINDOW (tooltip->window), FALSE); gtk_window_set_resizable (GTK_WINDOW (tooltip->window), FALSE);
gtk_widget_set_name (tooltip->window, "gtk-tooltip"); gtk_widget_set_name (tooltip->window, "gtk-tooltip");
@@ -145,7 +189,7 @@ gtk_tooltip_init (GtkTooltip *tooltip) @@ -147,7 +191,7 @@ gtk_tooltip_init (GtkTooltip *tooltip)
gtk_widget_show (tooltip->alignment); gtk_widget_show (tooltip->alignment);
g_signal_connect_swapped (tooltip->window, "style-set", g_signal_connect_swapped (tooltip->window, "style-set",
@ -86,7 +86,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
g_signal_connect_swapped (tooltip->window, "expose-event", g_signal_connect_swapped (tooltip->window, "expose-event",
G_CALLBACK (gtk_tooltip_paint_window), tooltip); G_CALLBACK (gtk_tooltip_paint_window), tooltip);
@@ -162,6 +206,13 @@ gtk_tooltip_init (GtkTooltip *tooltip) @@ -164,6 +208,13 @@ gtk_tooltip_init (GtkTooltip *tooltip)
gtk_box_pack_start (GTK_BOX (tooltip->box), tooltip->label, gtk_box_pack_start (GTK_BOX (tooltip->box), tooltip->label,
FALSE, FALSE, 0); FALSE, FALSE, 0);
@ -100,7 +100,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
tooltip->custom_widget = NULL; tooltip->custom_widget = NULL;
} }
@@ -508,19 +559,208 @@ gtk_tooltip_window_style_set (GtkTooltip @@ -510,19 +561,208 @@ gtk_tooltip_window_style_set (GtkTooltip
gtk_widget_queue_draw (tooltip->window); gtk_widget_queue_draw (tooltip->window);
} }
@ -319,7 +319,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
return FALSE; return FALSE;
} }
@@ -660,7 +900,7 @@ find_widget_under_pointer (GdkWindow *wi @@ -662,7 +902,7 @@ find_widget_under_pointer (GdkWindow *wi
#ifdef DEBUG_TOOLTIP #ifdef DEBUG_TOOLTIP
g_print ("event window %p (belonging to %p (%s)) (%d, %d)\n", g_print ("event window %p (belonging to %p (%s)) (%d, %d)\n",
@ -328,10 +328,10 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.
*x, *y); *x, *y);
#endif #endif
diff -up gtk+-2.19.1/gtk/gtkwidget.c.fresh-tooltips gtk+-2.19.1/gtk/gtkwidget.c diff -up gtk+-2.21.0/gtk/gtkwidget.c.fresh-tooltips gtk+-2.21.0/gtk/gtkwidget.c
--- gtk+-2.19.1/gtk/gtkwidget.c.fresh-tooltips 2009-11-27 20:59:42.000000000 -0500 --- gtk+-2.21.0/gtk/gtkwidget.c.fresh-tooltips 2010-05-07 13:34:31.000000000 -0400
+++ gtk+-2.19.1/gtk/gtkwidget.c 2009-11-30 20:00:23.425825787 -0500 +++ gtk+-2.21.0/gtk/gtkwidget.c 2010-05-07 18:14:28.348068707 -0400
@@ -2557,6 +2557,14 @@ gtk_widget_class_init (GtkWidgetClass *k @@ -2561,6 +2561,14 @@ gtk_widget_class_init (GtkWidgetClass *k
P_("The length of vertical scroll arrows"), P_("The length of vertical scroll arrows"),
1, G_MAXINT, 16, 1, G_MAXINT, 16,
GTK_PARAM_READABLE)); GTK_PARAM_READABLE));

View File

@ -1,16 +1,16 @@
diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
--- gtk+-2.18.3/gtk/gtktooltip.c.positioning 2009-10-23 13:12:16.205437913 -0400 index 5cc2334..204a2b6 100644
+++ gtk+-2.18.3/gtk/gtktooltip.c 2009-10-23 13:52:15.922749329 -0400 --- a/gtk/gtktooltip.c
@@ -1023,57 +1023,134 @@ gtk_tooltip_position (GtkTooltip *toolti +++ b/gtk/gtktooltip.c
GtkWidget *new_tooltip_widget) @@ -903,53 +903,128 @@ gtk_tooltip_position (GtkTooltip *tooltip,
{ {
gint x, y; gint x, y;
+ gint wx, wy;
GdkScreen *screen; GdkScreen *screen;
+ gint monitor_num; + gint monitor_num;
+ GdkRectangle monitor; + GdkRectangle monitor;
+ GtkRequisition requisition; + GtkRequisition requisition;
+ guint cursor_size; + guint cursor_size;
+ GdkRectangle bounds;
+ +
+#define MAX_DISTANCE 32 +#define MAX_DISTANCE 32
@ -25,12 +25,7 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
+ tooltip->last_y); + tooltip->last_y);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+ +
+ gdk_window_get_origin (new_tooltip_widget->window, &wx, &wy); + get_bounding_box (new_tooltip_widget, &bounds);
+ if (!gtk_widget_get_has_window (new_tooltip_widget))
+ {
+ wx += new_tooltip_widget->allocation.x;
+ wy += new_tooltip_widget->allocation.y;
+ }
+ +
/* Position the tooltip */ /* Position the tooltip */
- /* FIXME: should we swap this when RTL is enabled? */ - /* FIXME: should we swap this when RTL is enabled? */
@ -39,21 +34,18 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
+ cursor_size = gdk_display_get_default_cursor_size (display); + cursor_size = gdk_display_get_default_cursor_size (display);
+ +
+ /* Try below */ + /* Try below */
+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; + x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = wy + new_tooltip_widget->allocation.height + 4; + y = bounds.y + bounds.height + 4;
+ +
+ if (y + requisition.height <= monitor.y + monitor.height) + if (y + requisition.height <= monitor.y + monitor.height)
{ {
- gdk_window_get_origin (new_tooltip_widget->window, &x, &y); - GdkRectangle bounds;
- if (!gtk_widget_get_has_window (new_tooltip_widget))
+ if (tooltip->keyboard_mode_enabled) + if (tooltip->keyboard_mode_enabled)
+ goto found; + goto found;
+
- get_bounding_box (new_tooltip_widget, &bounds);
+ if (y <= tooltip->last_y + cursor_size + MAX_DISTANCE) + if (y <= tooltip->last_y + cursor_size + MAX_DISTANCE)
{ + {
- x += new_tooltip_widget->allocation.x;
- y += new_tooltip_widget->allocation.y;
- }
+ if (tooltip->last_x + cursor_size + MAX_DISTANCE < x) + if (tooltip->last_x + cursor_size + MAX_DISTANCE < x)
+ x = tooltip->last_x + cursor_size + MAX_DISTANCE; + x = tooltip->last_x + cursor_size + MAX_DISTANCE;
+ else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE) + else if (x + requisition.width < tooltip->last_x - MAX_DISTANCE)
@ -62,15 +54,15 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
- /* For keyboard mode we position the tooltip below the widget, - /* For keyboard mode we position the tooltip below the widget,
- * right of the center of the widget. - * right of the center of the widget.
- */ - */
- x += new_tooltip_widget->allocation.width / 2; - x = bounds.x + bounds.width / 2;
- y += new_tooltip_widget->allocation.height + 4; - y = bounds.y + bounds.height + 4;
+ goto found; + goto found;
+ } + }
+ } + }
+ +
+ /* Try above */ + /* Try above */
+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; + x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = wy - requisition.height - 4; + y = bounds.y - requisition.height - 4;
+ +
+ if (y >= monitor.y) + if (y >= monitor.y)
+ { + {
@ -90,8 +82,8 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
- else - else
+ +
+ /* Try right FIXME: flip on rtl ? */ + /* Try right FIXME: flip on rtl ? */
+ x = wx + new_tooltip_widget->allocation.width + 4; + x = bounds.x + bounds.width + 4;
+ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; + y = bounds.y + bounds.height / 2 - requisition.height / 2;
+ +
+ if (x + requisition.width <= monitor.x + monitor.width) + if (x + requisition.width <= monitor.x + monitor.width)
{ {
@ -120,8 +112,8 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
- screen = gtk_widget_get_screen (new_tooltip_widget); - screen = gtk_widget_get_screen (new_tooltip_widget);
+ /* Try left FIXME: flip on rtl ? */ + /* Try left FIXME: flip on rtl ? */
+ x = wx - requisition.width - 4; + x = bounds.x - requisition.width - 4;
+ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; + y = bounds.y + bounds.height / 2 - requisition.height / 2;
- /* Show it */ - /* Show it */
- if (tooltip->current_window) - if (tooltip->current_window)
@ -148,11 +140,11 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
+ } + }
+ } + }
+ /* Fallback */ + /* Fallback */
+ if (tooltip->keyboard_mode_enabled) + if (tooltip->keyboard_mode_enabled)
+ { + {
+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; + x = bounds.x + bounds.width / 2 - requisition.width / 2;
+ y = wy + new_tooltip_widget->allocation.height + 4; + y = bounds.y + bounds.height + 4;
+ } + }
+ else + else
+ { + {
@ -168,7 +160,7 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
if (x + requisition.width > monitor.x + monitor.width) if (x + requisition.width > monitor.x + monitor.width)
x -= x - (monitor.x + monitor.width) + requisition.width; x -= x - (monitor.x + monitor.width) + requisition.width;
else if (x < monitor.x) else if (x < monitor.x)
@@ -1081,7 +1158,9 @@ gtk_tooltip_position (GtkTooltip *toolti @@ -957,7 +1032,9 @@ gtk_tooltip_position (GtkTooltip *tooltip,
if (y + requisition.height > monitor.y + monitor.height) if (y + requisition.height > monitor.y + monitor.height)
y -= y - (monitor.y + monitor.height) + requisition.height; y -= y - (monitor.y + monitor.height) + requisition.height;
@ -179,7 +171,7 @@ diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c
if (!tooltip->keyboard_mode_enabled) if (!tooltip->keyboard_mode_enabled)
{ {
/* don't pop up under the pointer */ /* don't pop up under the pointer */
@@ -1089,7 +1168,7 @@ gtk_tooltip_position (GtkTooltip *toolti @@ -965,7 +1042,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
y <= tooltip->last_y && tooltip->last_y < y + requisition.height) y <= tooltip->last_y && tooltip->last_y < y + requisition.height)
y = tooltip->last_y - requisition.height - 2; y = tooltip->last_y - requisition.height - 2;
} }