CellRendererIcon: improve calculation in do_render

Use a more efficient method to check if the pointer is inside the cell,
because we have the cell_area in the do_render method.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
master
Gonzalo Odiard 10 years ago
parent a56282991f
commit 3a6427cdc6

@ -983,7 +983,14 @@ class CellRendererIcon(Gtk.CellRenderer):
context.save()
context.add_class("sugar-icon-cell")
pointer_inside = self._point_in_cell_renderer(widget)
def is_pointer_inside():
# widget is the treeview
x, y = widget.get_pointer()
x, y = widget.convert_widget_to_bin_window_coords(x, y)
return ((cell_area.x <= x <= cell_area.x + cell_area.width)
and (cell_area.y <= y <= cell_area.y + cell_area.height))
pointer_inside = is_pointer_inside()
# The context will have prelight state if the mouse pointer is
# in the entire row, but we want that state if the pointer is

Loading…
Cancel
Save