diff options
author | Simon Schampijer <simon@laptop.org> | 2012-09-12 09:21:42 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-09-12 13:40:26 (GMT) |
commit | 9b391fa3cfb034e56bd4dd9d9378899b07c041e4 (patch) | |
tree | 39fc78c987b6b59733417a06de543c7cd6fdd6dd /src | |
parent | c6c2220f0ded037dfcaab7343a74b4ff5f5790d0 (diff) |
CellRendererInvoker: various fixups
- the GtkCellRenderer (which our CellRenderer derives from) is not a
GtkWidget and therefor the 'get_display' method does not exist, we
fallback to the default display in that case [1]
- the get_rect method should return a Gdk.Rectangle now, see other
invokers
- check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse
leave see 289787e8c6cfca7781046b77b8d60a84821219ed for a similar
case
- todo: the Palette does not go away when the mouse leaves the
widget
[1] http://developer.gnome.org/gtk3/3.4/GtkCellRenderer.html
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/sugar3/graphics/palettewindow.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index 45ff543..ab7e2f2 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -400,7 +400,10 @@ class MouseSpeedDetector(GObject.GObject): self._state = None def _get_mouse_position(self): - display = self.parent.get_display() + if hasattr(self.parent, 'get_display'): + display = self.parent.get_display() + else: + display = Gdk.Display.get_default() manager = display.get_device_manager() pointer_device = manager.get_client_pointer() screen, x, y = pointer_device.get_position() @@ -745,7 +748,10 @@ class Invoker(GObject.GObject): invoker_valign = alignment[3] if self._cursor_x == -1 or self._cursor_y == -1: - display = self.parent.get_display() + if hasattr(self.parent, 'get_display'): + display = self.parent.get_display() + else: + display = Gdk.Display.get_default() manager = display.get_device_manager() pointer_device = manager.get_client_pointer() screen, x, y = pointer_device.get_position() @@ -1167,7 +1173,7 @@ class CellRendererInvoker(Invoker): self._release_hid = tree_view.connect('button-release-event', self.__button_release_event_cb) - self.attach(cell_renderer) + Invoker.attach(self, cell_renderer) def detach(self): Invoker.detach(self) @@ -1186,13 +1192,14 @@ class CellRendererInvoker(Invoker): x = 0 y = 0 - x += allocation.x - y += allocation.y + rect = Gdk.Rectangle() + rect.x = x + allocation.x + rect.y = y + allocation.y - width = allocation.width - height = allocation.height + rect.width = allocation.width + rect.height = allocation.height - return (x, y, width, height) + return rect def __motion_notify_event_cb(self, widget, event): if event.window != widget.get_bin_window(): @@ -1231,7 +1238,9 @@ class CellRendererInvoker(Invoker): self._tree_view.queue_draw_area(x, y, area.width, area.height) def __leave_notify_event_cb(self, widget, event): - self.notify_mouse_leave() + if event.mode == Gdk.CrossingMode.NORMAL: + self.notify_mouse_leave() + return False def __button_release_event_cb(self, widget, event): if event.button == 1 and self._point_in_cell_renderer(event.x, |