[shotwell: 1/2] Check hover position as widget-relative not layout-relative



commit b24a2b43b43a04031355979ce3a148b57d1f0101
Author: IBBoard <dev ibboard co uk>
Date:   Sat Nov 3 15:54:31 2018 +0000

    Check hover position as widget-relative not layout-relative
    
    Without this, the mouse "position" will never be within the
    allocation rectangle of the title/subtitle/comment text widgets!

 src/CheckerboardLayout.vala | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index c2d1a521..bf6c9151 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -2025,7 +2025,14 @@ public class CheckerboardLayout : Gtk.DrawingArea {
     public override bool query_tooltip(int x, int y, bool keyboard_mode, Gtk.Tooltip tooltip) {
         CheckerboardItem? item = get_item_at_pixel(x, y);
         
-        return (item != null) ? item.query_tooltip(x, y, tooltip) : false;
+        // Note: X & Y allocations are relative to parents, so we need to query the item's tooltip
+        // relative to its INTERNAL coordinates, otherwise tooltips don't work
+        if (item != null) {
+            item.translate_coordinates(ref x, ref y);
+            return item.query_tooltip(x, y, tooltip);
+        } else {
+            return false;
+        }
     }
     
     private void on_colors_changed() {


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