Ticket #4224: 0001-CanvasIcon-do-not-keep-it-ACTIVE-when-right-click-tw.patch

File 0001-CanvasIcon-do-not-keep-it-ACTIVE-when-right-click-tw.patch, 1.7 KB (added by humitos, 8 years ago)
  • src/sugar3/graphics/icon.py

    From a8877a5cbcbf7075b5e273adf987a3d941b1bc2f Mon Sep 17 00:00:00 2001
    From: Manuel Kaufmann <humitos@gmail.com>
    Date: Thu, 29 Nov 2012 12:32:04 -0300
    Subject: [PATCH sugar-toolkit-gtk3] CanvasIcon: do not keep it ACTIVE when
     right-click twice SL #4224
    
    When a CanvasIcon is right-clicked __button_press_event_cb and
    __palette_popup_cb are called but not __button_release_event_cb. So,
    ACTIVE flag is set but immediately removed by __palette_popup_cb and
    PRELIGHT is set.
    
    Now, if the user right-click it again while the palette is popped up,
    __button_press_event_cb is called and it sets ACTIVE flag but
    __palette_popup_cb is not called again because the palette is already
    shown and that makes the icon to keep in ACTIVE state.
    
    This patch checks if the palette is popped up when
    __button_press_event_cb is called and if the palette is not popped up
    the ACTIVE flag is set.
    
    Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
    ---
     src/sugar3/graphics/icon.py | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
    index 507db41..5bdb3b8 100644
    a b class CanvasIcon(EventIcon): 
    727727        self.unset_state_flags(Gtk.StateFlags.PRELIGHT)
    728728
    729729    def __button_press_event_cb(self, icon, event):
    730         self.set_state_flags(self.get_state_flags() | Gtk.StateFlags.ACTIVE,
    731                              clear=True)
     730        if not self.palette.is_up():
     731            self.set_state_flags(self.get_state_flags() | Gtk.StateFlags.ACTIVE,
     732                                 clear=True)
    732733
    733734    def __button_release_event_cb(self, icon, event):
    734735        self.unset_state_flags(Gtk.StateFlags.ACTIVE)