aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Shared
diff options
context:
space:
mode:
authorMaarten Vanraes <alien@mageia.org>2016-01-12 20:44:49 +0100
committerMaarten Vanraes <alien@mageia.org>2016-01-12 20:47:13 +0100
commit65592e78ed5ef609a936b78b075114923b27aeaa (patch)
tree2b8b113f3e2a7e75d54d71b537e21ced5fe8b409 /lib/ManaTools/Shared
parent86b646ed963a75f6ed21b93fac0f9954dac0a787 (diff)
downloadmanatools-65592e78ed5ef609a936b78b075114923b27aeaa.tar
manatools-65592e78ed5ef609a936b78b075114923b27aeaa.tar.gz
manatools-65592e78ed5ef609a936b78b075114923b27aeaa.tar.bz2
manatools-65592e78ed5ef609a936b78b075114923b27aeaa.tar.xz
manatools-65592e78ed5ef609a936b78b075114923b27aeaa.zip
better handling of event return values
0 if need to exit positive if not handled yet and negative otherwise.
Diffstat (limited to 'lib/ManaTools/Shared')
-rw-r--r--lib/ManaTools/Shared/GUI/EventHandlerRole.pm4
-rw-r--r--lib/ManaTools/Shared/GUI/ExtTab.pm9
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm
index ba130bc7..852c97a1 100644
--- a/lib/ManaTools/Shared/GUI/EventHandlerRole.pm
+++ b/lib/ManaTools/Shared/GUI/EventHandlerRole.pm
@@ -522,7 +522,7 @@ sub findItem {
=head3 OUTPUT
- 0 if the loop should end, 1 otherwise
+ 0 if the loop should end, positive if handled, negative otherwise
=head3 DESCRIPTION
@@ -549,7 +549,7 @@ sub processEvents {
return $processed if $processed >= 0;
}
- return 1;
+ return -1;
}
#=============================================================
diff --git a/lib/ManaTools/Shared/GUI/ExtTab.pm b/lib/ManaTools/Shared/GUI/ExtTab.pm
index 0927b631..f7dd78b1 100644
--- a/lib/ManaTools/Shared/GUI/ExtTab.pm
+++ b/lib/ManaTools/Shared/GUI/ExtTab.pm
@@ -231,22 +231,23 @@ sub processEvent {
my $items = $self->items();
# call subevents
- return 0 if (!$replacepoint->processEvents($yevent));
+ my processed = $replacepoint->processEvents($yevent);
+ return $processed if $processed >= 0;
# only MenuEvents here...
- return 1 if ($yevent->eventType() != $yui::YEvent::MenuEvent);
+ return -1 if ($yevent->eventType() != $yui::YEvent::MenuEvent);
# only items from *this* tab
my $yitem = $yevent->item();
my $item = $self->findTabItem($yitem);
- return 1 if !defined($item);
+ return -1 if !defined($item);
# build the children
$self->buildTabItem($item);
# execute callback if needed
my $callback = $self->callback();
- my $result = 1;
+ my $result = -1;
$result = $callback->($self, $yevent, $item->backend()) if defined($callback);
# mark last item as this one