[baobab/issue_14_pie_chart_gone_further_cleanup: 3/5] Only call highlight_item_at_point when moving or when clicking.




commit d36a40f68a5c7e79d01db60d246cbed2f525ed96
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Sat Jan 9 16:48:10 2021 +0000

    Only call highlight_item_at_point when moving or when clicking.

 src/baobab-chart.vala | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala
index a5a5b47..2e53174 100644
--- a/src/baobab-chart.vala
+++ b/src/baobab-chart.vala
@@ -200,7 +200,7 @@ namespace Baobab {
         };
 
         construct {
-            add_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.ENTER_NOTIFY_MASK | 
Gdk.EventMask.LEAVE_NOTIFY_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK | 
Gdk.EventMask.SCROLL_MASK);
+            add_events (Gdk.EventMask.EXPOSURE_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | 
Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.SCROLL_MASK);
 
             action_group = new SimpleActionGroup ();
             action_group.add_action_entries (action_entries, this);
@@ -463,6 +463,8 @@ namespace Baobab {
 
         protected override bool button_press_event (Gdk.EventButton event) {
             if (event.type == Gdk.EventType.BUTTON_PRESS) {
+                highlight_item_at_point (event.x, event.y);
+
                 if (event.triggers_context_menu ()) {
                     show_popup_menu (event);
                     return true;
@@ -470,7 +472,7 @@ namespace Baobab {
 
                 switch (event.button) {
                 case Gdk.BUTTON_PRIMARY:
-                    if (highlight_item_at_point (event.x, event.y)) {
+                    if (highlighted_item != null) {
                         var path = model.get_path (highlighted_item.iter);
                         if (root.compare (path) == 0) {
                             move_up_root ();
@@ -594,7 +596,7 @@ namespace Baobab {
         }
 
         protected override bool query_tooltip (int x, int y, bool keyboard_tooltip, Gtk.Tooltip tooltip) {
-            if (keyboard_tooltip || !highlight_item_at_point(x,y)) {
+            if (keyboard_tooltip || highlighted_item == null) {
                 return false;
             }
 


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