From 966b869ad8b036d985d8a91291af32b4e8002385 Mon Sep 17 00:00:00 2001 From: Nemo Date: Mon, 15 Jun 2020 18:03:51 +0530 Subject: [PATCH] Fixes hover boundaries Closes #33 This removes the hover boundaries entirely, so you must click elsewhere to close the menu now, which I think is better behaviour --- hackertray/appindicator_replacement.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/hackertray/appindicator_replacement.py b/hackertray/appindicator_replacement.py index c9b5cd7..b5096d5 100644 --- a/hackertray/appindicator_replacement.py +++ b/hackertray/appindicator_replacement.py @@ -82,30 +82,5 @@ class Indicator: # Show the menu self.menu.popup(None, None, None, 0, 0, Gtk.get_current_event_time()) - # Get the location and size of the window - mouse_rect = self.menu.get_window().get_frame_extents() - - self.x = mouse_rect.x - self.y = mouse_rect.y - self.right = self.x + mouse_rect.width - self.bottom = self.y + mouse_rect.height - - # Set a timer to poll the menu - self.timer = GLib.timeout_add(100, self.check_mouse) - - def check_mouse(self): - if not self.menu.get_window().is_visible(): - return - - # Now check the global mouse coords - root = self.menu.get_screen().get_root_window() - - _,x,y,_ = root.get_pointer() - - if (x < (self.x-10)) or (x > self.right) or (y < (self.y+10)) or (y > self.bottom): - self.hide_menu() - else: - return True - def hide_menu(self): self.menu.popdown()