From 0f4309a32457385bd6266cd8f3ac63e4d5c39515 Mon Sep 17 00:00:00 2001 From: Sam Parkinson Date: Wed, 15 Jun 2016 08:01:11 +1000 Subject: [PATCH 1/2] Don't activate EventIcons after touch long press Steps to reproduce: 1. Long press activity icon on homeview Expcected: Palette invokes, icon not activated Actual: Palette invokes, icon also activated, activity launched This was because the "activate" signal was emitted before the palette invoker got it's signal, meaning the palette invoker couldn't scilence the event. --- src/sugar3/graphics/icon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py index c9d278be..52916c1f 100644 --- a/src/sugar3/graphics/icon.py +++ b/src/sugar3/graphics/icon.py @@ -575,7 +575,10 @@ class EventIcon(Gtk.EventBox): self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.TOUCH_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK) - self.connect('button-release-event', self.__button_release_event_cb) + # Connect after the default so that the palette can silence events + # for example, after a touch palette invocation + self.connect_after('button-release-event', + self.__button_release_event_cb) for key, value in kwargs.iteritems(): self.set_property(key, value) From 2971749b83219beb0e144eeda8c73407ede248af Mon Sep 17 00:00:00 2001 From: Sam Parkinson Date: Thu, 16 Jun 2016 09:58:55 +1000 Subject: [PATCH 2/2] Fix CursorInvoker wrongly positioning EventIcon palettes Steps to reproduce: 1. Long press on home view favorite icon (an event icon) Expected: Palette invoker where finger is Actuall: Palette invokes in top left corner This is because the long press controller emits coords relative to the widget's window, and EventIcons sometimes have their own windows. We can't change the long press controller, as it is a public api. But we fix this by translating the coords to the root window coords in the CursorInvoker. Using root coords is consistent with the right click handleing in the cursor invoker. --- src/sugar3/graphics/palettewindow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index b2cafd87..9a5b8e2a 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -1381,6 +1381,7 @@ class CursorInvoker(Invoker): def __long_pressed_event_cb(self, controller, x, y, widget): self._long_pressed_recognized = True + x, y = widget.get_window().get_root_coords(x, y) self.notify_right_click(x, y) def get_toplevel(self):