WidgetInvoker: do not handle the clicked signal when there is no user interaction, part of SL #4307
There are cases where there is no user interaction but we do receive a clicked signal: in the clipboard we do have GtkRadioToolButton which are derived from the GtkToggleToolButton [1]. The 'clicked' signal is emitted when the 'active' property changes [2]. We use the 'active' property to indicate the current active clipping. In the Invoker we do check now if the event originated a user interaction or if it was generated due to a for example a property change. [1] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html [2] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html#GtkToggleToolButton--active Signed-off-by: Simon Schampijer <simon@laptop.org> Reviewed-by: Carlos Garnacho <carlos@lanedo.com> Acked-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
parent
1dd2aec650
commit
3859ff0022
@ -1155,6 +1155,18 @@ class WidgetInvoker(Invoker):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def __click_event_cb(self, button):
|
def __click_event_cb(self, button):
|
||||||
|
event = Gtk.get_current_event()
|
||||||
|
if not event:
|
||||||
|
# not an event from a user interaction, this can be when
|
||||||
|
# the clicked event is emitted on a 'active' property
|
||||||
|
# change of ToggleToolButton for example
|
||||||
|
return
|
||||||
|
if event and button != Gtk.get_event_widget(event):
|
||||||
|
# another special case for the ToggleToolButton: this handles
|
||||||
|
# the case where we select an item and the active property
|
||||||
|
# of the other one changes to 'False'
|
||||||
|
return
|
||||||
|
|
||||||
if self.props.lock_palette and not self.locked:
|
if self.props.lock_palette and not self.locked:
|
||||||
self.locked = True
|
self.locked = True
|
||||||
if hasattr(self.parent, 'set_expanded'):
|
if hasattr(self.parent, 'set_expanded'):
|
||||||
|
Loading…
Reference in New Issue
Block a user