From f44ed725732dacb73b54d6d7cac4a04b83c85c15 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 25 Aug 2005 14:13:09 +0000 Subject: restrict mouse motion to image --- perl-install/standalone/draksplash | 11 +++++++++-- 1 file 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(); } -- cgit v1.2.1