diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-08-25 14:13:09 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-08-25 14:13:09 +0000 |
commit | f44ed725732dacb73b54d6d7cac4a04b83c85c15 (patch) | |
tree | a608e6ffc0e9fd7b451dc4500bcee2d157c53fe4 /perl-install | |
parent | f424fd90b063e53abfcca97d3544fcd590f00dd0 (diff) | |
download | drakx-f44ed725732dacb73b54d6d7cac4a04b83c85c15.tar drakx-f44ed725732dacb73b54d6d7cac4a04b83c85c15.tar.gz drakx-f44ed725732dacb73b54d6d7cac4a04b83c85c15.tar.bz2 drakx-f44ed725732dacb73b54d6d7cac4a04b83c85c15.tar.xz drakx-f44ed725732dacb73b54d6d7cac4a04b83c85c15.zip |
restrict mouse motion to image
Diffstat (limited to 'perl-install')
-rwxr-xr-x | perl-install/standalone/draksplash | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/perl-install/standalone/draksplash b/perl-install/standalone/draksplash index 558f6bfd1..ca2f6f790 100755 --- a/perl-install/standalone/draksplash +++ b/perl-install/standalone/draksplash @@ -295,10 +295,17 @@ sub image_button_pressed { update_theme_from_rect(); } +sub restrict_to_interval { + my ($x, $min, $max) = @_; + max($min, min($max, $x)); +} + sub image_motion_notify { my (undef, $event) = @_; member('button1-mask', @{$event->state}) or return; - my $point = { X => $event->x, Y => $event->y }; - $current_point and %$current_point = %$point; + %$current_point = ( + X => restrict_to_interval($event->x, 0, $theme{res_w}), + Y => restrict_to_interval($event->y, 0, $theme{res_h}), + ) if $current_point; update_theme_from_rect(); } |