diff options
author | Angelo Naselli <anaselli@linux.it> | 2016-01-01 20:03:36 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2016-01-01 20:03:36 +0100 |
commit | 3c0aaf37d6c56708293b493524a7465668b0b0a6 (patch) | |
tree | 207c55063d132f910b36d1d59d2c528e6a0a3f8e /lib | |
parent | 49faf2fbe6ca4c17314e41b89f15288dcd1e970c (diff) | |
download | manatools-3c0aaf37d6c56708293b493524a7465668b0b0a6.tar manatools-3c0aaf37d6c56708293b493524a7465668b0b0a6.tar.gz manatools-3c0aaf37d6c56708293b493524a7465668b0b0a6.tar.bz2 manatools-3c0aaf37d6c56708293b493524a7465668b0b0a6.tar.xz manatools-3c0aaf37d6c56708293b493524a7465668b0b0a6.zip |
delWidget needs event name not event
changed processEvents to manage event deletion during event managing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ManaTools/Shared/GUI/Event.pm | 8 | ||||
-rw-r--r-- | lib/ManaTools/Shared/GUI/EventHandlerRole.pm | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/ManaTools/Shared/GUI/Event.pm b/lib/ManaTools/Shared/GUI/Event.pm index f9793a7f..655adffb 100644 --- a/lib/ManaTools/Shared/GUI/Event.pm +++ b/lib/ManaTools/Shared/GUI/Event.pm @@ -133,12 +133,12 @@ has 'backend' => ( sub processEvent { my $self = shift; my $yevent = shift; - return 1 if ($yevent->eventType != $self->eventType); - return 1 if ($yevent->eventType == $yui::YEvent::WidgetEvent && !$self->equalsWidget($yevent->widget)); - return 1 if ($yevent->eventType == $yui::YEvent::MenuEvent && !$self->equalsItem($yevent->item)); + return -1 if ($yevent->eventType != $self->eventType); + return -1 if ($yevent->eventType == $yui::YEvent::WidgetEvent && !$self->equalsWidget($yevent->widget)); + return -1 if ($yevent->eventType == $yui::YEvent::MenuEvent && !$self->equalsItem($yevent->item)); my $event = $self->event(); return $event->($self, $yevent, $self->backend()) if defined($event); - return 1; + return -1; } sub equalsWidget { diff --git a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm index 83db71b3..fd785cba 100644 --- a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm +++ b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm @@ -278,7 +278,7 @@ sub delWidget { my $self = shift; my $widget = shift; my $event = $self->findWidget($widget); - $self->delEvent($event) if (defined $event); + $self->delEvent($event->name()) if (defined $event); } #============================================================= @@ -361,7 +361,8 @@ sub processEvents { my $events = $self->events(); # loop all the items for my $event (values %{$events}) { - return 0 if(!$event->processEvent($yevent)); + my $processed = $event->processEvent($yevent); + return $processed if $processed >= 0; } return 1; } |