diff --git a/fresh-tooltips.patch b/fresh-tooltips.patch index a809c50..e4acfe1 100644 --- a/fresh-tooltips.patch +++ b/fresh-tooltips.patch @@ -1,7 +1,7 @@ -diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip.c ---- gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips 2009-11-26 23:54:55.000000000 -0500 -+++ gtk+-2.19.1/gtk/gtktooltip.c 2009-11-30 20:06:37.539580221 -0500 -@@ -29,6 +29,10 @@ +diff -up gtk+-2.21.0/gtk/gtktooltip.c.fresh-tooltips gtk+-2.21.0/gtk/gtktooltip.c +--- gtk+-2.21.0/gtk/gtktooltip.c.fresh-tooltips 2010-05-06 22:49:21.000000000 -0400 ++++ gtk+-2.21.0/gtk/gtktooltip.c 2010-05-07 18:16:12.347311268 -0400 +@@ -33,6 +33,10 @@ #include "gtkhbox.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 -@@ -95,6 +99,7 @@ static void gtk_tooltip_display_cl + #undef DEBUG_TOOLTIP +@@ -97,6 +101,7 @@ static void gtk_tooltip_display_cl GtkTooltip *tooltip); static void gtk_tooltip_set_last_window (GtkTooltip *tooltip, 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); -@@ -110,8 +115,43 @@ gtk_tooltip_class_init (GtkTooltipClass +@@ -112,8 +117,43 @@ gtk_tooltip_class_init (GtkTooltipClass } 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->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->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_window_set_resizable (GTK_WINDOW (tooltip->window), FALSE); 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); 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_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, 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; } -@@ -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); } @@ -319,7 +319,7 @@ diff -up gtk+-2.19.1/gtk/gtktooltip.c.fresh-tooltips gtk+-2.19.1/gtk/gtktooltip. 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 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); #endif -diff -up gtk+-2.19.1/gtk/gtkwidget.c.fresh-tooltips gtk+-2.19.1/gtk/gtkwidget.c ---- gtk+-2.19.1/gtk/gtkwidget.c.fresh-tooltips 2009-11-27 20:59:42.000000000 -0500 -+++ gtk+-2.19.1/gtk/gtkwidget.c 2009-11-30 20:00:23.425825787 -0500 -@@ -2557,6 +2557,14 @@ gtk_widget_class_init (GtkWidgetClass *k +diff -up gtk+-2.21.0/gtk/gtkwidget.c.fresh-tooltips gtk+-2.21.0/gtk/gtkwidget.c +--- gtk+-2.21.0/gtk/gtkwidget.c.fresh-tooltips 2010-05-07 13:34:31.000000000 -0400 ++++ gtk+-2.21.0/gtk/gtkwidget.c 2010-05-07 18:14:28.348068707 -0400 +@@ -2561,6 +2561,14 @@ gtk_widget_class_init (GtkWidgetClass *k P_("The length of vertical scroll arrows"), 1, G_MAXINT, 16, GTK_PARAM_READABLE)); diff --git a/tooltip-positioning.patch b/tooltip-positioning.patch index 8634189..49b72c2 100644 --- a/tooltip-positioning.patch +++ b/tooltip-positioning.patch @@ -1,16 +1,16 @@ -diff -up gtk+-2.18.3/gtk/gtktooltip.c.positioning gtk+-2.18.3/gtk/gtktooltip.c ---- gtk+-2.18.3/gtk/gtktooltip.c.positioning 2009-10-23 13:12:16.205437913 -0400 -+++ gtk+-2.18.3/gtk/gtktooltip.c 2009-10-23 13:52:15.922749329 -0400 -@@ -1023,57 +1023,134 @@ gtk_tooltip_position (GtkTooltip *toolti - GtkWidget *new_tooltip_widget) +diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c +index 5cc2334..204a2b6 100644 +--- a/gtk/gtktooltip.c ++++ b/gtk/gtktooltip.c +@@ -903,53 +903,128 @@ gtk_tooltip_position (GtkTooltip *tooltip, { gint x, y; -+ gint wx, wy; GdkScreen *screen; + gint monitor_num; + GdkRectangle monitor; + GtkRequisition requisition; + guint cursor_size; ++ GdkRectangle bounds; + +#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); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + -+ gdk_window_get_origin (new_tooltip_widget->window, &wx, &wy); -+ if (!gtk_widget_get_has_window (new_tooltip_widget)) -+ { -+ wx += new_tooltip_widget->allocation.x; -+ wy += new_tooltip_widget->allocation.y; -+ } ++ get_bounding_box (new_tooltip_widget, &bounds); + /* Position the tooltip */ - /* 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); + + /* Try below */ -+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; -+ y = wy + new_tooltip_widget->allocation.height + 4; ++ x = bounds.x + bounds.width / 2 - requisition.width / 2; ++ y = bounds.y + bounds.height + 4; + + if (y + requisition.height <= monitor.y + monitor.height) { -- gdk_window_get_origin (new_tooltip_widget->window, &x, &y); -- if (!gtk_widget_get_has_window (new_tooltip_widget)) +- GdkRectangle bounds; + if (tooltip->keyboard_mode_enabled) + goto found; -+ + +- get_bounding_box (new_tooltip_widget, &bounds); + 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) + x = tooltip->last_x + cursor_size + 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, - * right of the center of the widget. - */ -- x += new_tooltip_widget->allocation.width / 2; -- y += new_tooltip_widget->allocation.height + 4; +- x = bounds.x + bounds.width / 2; +- y = bounds.y + bounds.height + 4; + goto found; + } + } + + /* Try above */ -+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; -+ y = wy - requisition.height - 4; ++ x = bounds.x + bounds.width / 2 - requisition.width / 2; ++ y = bounds.y - requisition.height - 4; + + 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 + + /* Try right FIXME: flip on rtl ? */ -+ x = wx + new_tooltip_widget->allocation.width + 4; -+ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; ++ x = bounds.x + bounds.width + 4; ++ y = bounds.y + bounds.height / 2 - requisition.height / 2; + + 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); + /* Try left FIXME: flip on rtl ? */ -+ x = wx - requisition.width - 4; -+ y = wy + new_tooltip_widget->allocation.height / 2 - requisition.height / 2; ++ x = bounds.x - requisition.width - 4; ++ y = bounds.y + bounds.height / 2 - requisition.height / 2; - /* Show it */ - 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) + { -+ x = wx + new_tooltip_widget->allocation.width / 2 - requisition.width / 2; -+ y = wy + new_tooltip_widget->allocation.height + 4; ++ x = bounds.x + bounds.width / 2 - requisition.width / 2; ++ y = bounds.y + bounds.height + 4; + } + 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) x -= x - (monitor.x + monitor.width) + requisition.width; 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) 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) { /* 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 - requisition.height - 2; }