aboutsummaryrefslogtreecommitdiff
path: root/src/MTools
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTools')
-rw-r--r--src/MTools/Comp/MMover.pm19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/MTools/Comp/MMover.pm b/src/MTools/Comp/MMover.pm
index 6b8c1c1..ae523d7 100644
--- a/src/MTools/Comp/MMover.pm
+++ b/src/MTools/Comp/MMover.pm
@@ -63,6 +63,9 @@ sub new {
$self -> recordEvent ('PRESSED');
$self -> recordEvent ('MOVED');
$self -> recordEvent ('RELEASED');
+ $self -> recordEvent ('PRESSED_OFF');
+ $self -> recordEvent ('MOVED_OFF');
+ $self -> recordEvent ('RELEASED_OFF');
$button = 1 if ! defined $button;
binding ($src, "<Button-$button>", [\&__pressed, $self, Ev('x'), Ev('y'), Ev('t')]);
@@ -100,7 +103,10 @@ sub setPos {
sub __pressed {
my ($self, $x, $y, $t) = @_;
- if(!$self -> mget('-visible')) {return;}
+ if(!$self -> mget('-visible')) {
+ $self -> notify ('PRESSED_OFF', $x, $y, $t);
+ return;
+ }
$self -> {__started} = 1;
$self -> {__last_mouse_x} = $x;
$self -> {__last_mouse_y} = $y;
@@ -109,8 +115,10 @@ sub __pressed {
sub __moved {
my ($self, $x, $y, $t) = @_;
- if (!$self -> {__started}) {return;}
- if(!$self -> mget('-visible')) {return;}
+ if (!$self -> {__started} || !$self -> mget('-visible')) {
+ $self -> notify ('MOVED_OFF', $x, $y, $t);
+ return;
+ }
my $dx = $x - $self -> {__last_mouse_x};
my $dy = $y - $self -> {__last_mouse_y};
@@ -177,7 +185,10 @@ sub __moved {
sub __released {
my ($self, $x, $y, $t) = @_;
$self -> {__started} = 0;
- if(!$self -> mget('-visible')) {return;}
+ if (!$self -> mget('-visible')) {
+ $self -> notify ('RELEASED_OFF', $x, $y, $t);
+ return;
+ }
$self -> notify ('RELEASED', $self -> {__last_mouse_x}, $self -> {__last_mouse_y}, $t);
}