[gtk+] GtkTooltip: take csd shadows into account for placement



commit 179d6a4c7b09721cdb885c7a0b8518504da1c9f8
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 6 17:15:18 2014 -0400

    GtkTooltip: take csd shadows into account for placement
    
    When placing tooltips, we don't want the shadow to influence
    our choice.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731187

 gtk/gtktooltip.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 0d284af..5aabf42 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -980,6 +980,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
   GdkRectangle monitor;
   guint cursor_size;
   GdkRectangle bounds;
+  GtkBorder border;
 
 #define MAX_DISTANCE 32
 
@@ -990,8 +991,10 @@ gtk_tooltip_position (GtkTooltip *tooltip,
 
   screen = gtk_widget_get_screen (new_tooltip_widget);
 
-  width = gtk_widget_get_allocated_width (GTK_WIDGET (tooltip->current_window));
-  height = gtk_widget_get_allocated_height (GTK_WIDGET (tooltip->current_window));
+  _gtk_window_get_shadow_width (GTK_WINDOW (tooltip->current_window), &border);
+
+  width = gtk_widget_get_allocated_width (GTK_WIDGET (tooltip->current_window)) - border.left - border.right;
+  height = gtk_widget_get_allocated_height (GTK_WIDGET (tooltip->current_window)) - border.top - 
border.bottom;
 
   monitor_num = gdk_screen_get_monitor_at_point (screen,
                                                  tooltip->last_x,
@@ -1133,6 +1136,9 @@ found:
         }
 #endif
 
+      x -= border.left;
+      y -= border.top;
+
       gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
       gtk_widget_show (GTK_WIDGET (tooltip->current_window));
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]