ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.444 by root, Sat Dec 8 18:38:13 2007 UTC vs.
Revision 1.448 by root, Tue Dec 25 07:39:18 2007 UTC

139 my $grab = $GRAB; undef $GRAB; 139 my $grab = $GRAB; undef $GRAB;
140 $grab->update if $grab; 140 $grab->update if $grab;
141 $GRAB->update if $GRAB; 141 $GRAB->update if $GRAB;
142 142
143 check_hover $widget; 143 check_hover $widget;
144 $TOOLTIP_WATCHER->trigger; 144 $TOOLTIP_WATCHER->invoke;
145 } 145 }
146} 146}
147 147
148sub feed_sdl_motion_event { 148sub feed_sdl_motion_event {
149 my ($ev) = @_; 149 my ($ev) = @_;
309 delete $self->{root}; 309 delete $self->{root};
310 310
311 undef $GRAB if $GRAB == $self; 311 undef $GRAB if $GRAB == $self;
312 undef $HOVER if $HOVER == $self; 312 undef $HOVER if $HOVER == $self;
313 313
314 $CFPlus::UI::TOOLTIP_WATCHER->trigger 314 $CFPlus::UI::TOOLTIP_WATCHER->invoke
315 if $TOOLTIP->{owner} == $self; 315 if $TOOLTIP->{owner} == $self;
316 316
317 $self->emit ("focus_out"); 317 $self->emit ("focus_out");
318 $self->emit (visibility_change => 0); 318 $self->emit (visibility_change => 0);
319} 319}
440 440
441 $self->{tooltip} = $tooltip; 441 $self->{tooltip} = $tooltip;
442 442
443 if ($CFPlus::UI::TOOLTIP->{owner} == $self) { 443 if ($CFPlus::UI::TOOLTIP->{owner} == $self) {
444 delete $CFPlus::UI::TOOLTIP->{owner}; 444 delete $CFPlus::UI::TOOLTIP->{owner};
445 $CFPlus::UI::TOOLTIP_WATCHER->trigger; 445 $CFPlus::UI::TOOLTIP_WATCHER->invoke;
446 } 446 }
447} 447}
448 448
449# translate global coordinates to local coordinate system 449# translate global coordinates to local coordinate system
450sub coord2local { 450sub coord2local {
451 my ($self, $x, $y) = @_; 451 my ($self, $x, $y) = @_;
452 452
453 Carp::confess unless $self->{parent};#d# 453 return (undef, undef) unless $self->{parent};
454 454
455 $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y}) 455 $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y})
456} 456}
457 457
458# translate local coordinates to global coordinate system 458# translate local coordinates to global coordinate system
459sub coord2global { 459sub coord2global {
460 my ($self, $x, $y) = @_; 460 my ($self, $x, $y) = @_;
461 461
462 Carp::confess unless $self->{parent};#d# 462 return (undef, undef) unless $self->{parent};
463 463
464 $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y}) 464 $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y})
465} 465}
466 466
467sub invoke_focus_in { 467sub invoke_focus_in {
3673 ); 3673 );
3674 3674
3675 if ($self->{anim} && $self->{animspeed}) { 3675 if ($self->{anim} && $self->{animspeed}) {
3676 CFPlus::weaken (my $widget = $self); 3676 CFPlus::weaken (my $widget = $self);
3677 3677
3678 $widget->{animspeed} = List::Util::max 0.05, $widget->{animspeed}; 3678 $self->{animspeed} = List::Util::max 0.05, $self->{animspeed};
3679 $widget->{anim_start} = $self->{animspeed} * int EV::now / $self->{animspeed}; 3679 $self->{timer} = EV::periodic_ns 0, $self->{animspeed}, undef, sub {
3680 $self->{timer} = EV::timer_ns 0, 0, sub {
3681 return unless $::CONN; 3680 return unless $::CONN;
3682 3681
3683 my $w = $widget 3682 my $w = $widget
3684 or return; 3683 or return;
3685 3684
3702 my ($self) = @_; 3701 my ($self) = @_;
3703 3702
3704 return unless $self->{timer}; 3703 return unless $self->{timer};
3705 3704
3706 if ($self->{visible}) { 3705 if ($self->{visible}) {
3707 $self->{timer}->set (
3708 $self->{anim_start}
3709 + $self->{animspeed}
3710 * int 1.5 + (EV::now - $self->{anim_start}) / $self->{animspeed}
3711 );
3712 $self->{timer}->start; 3706 $self->{timer}->start;
3713 } else { 3707 } else {
3714 $self->{timer}->stop; 3708 $self->{timer}->stop;
3715 } 3709 }
3716} 3710}
4181 values %{ $self->{item} }; 4175 values %{ $self->{item} };
4182 4176
4183 while (my ($k, $v) = each %{ $self->{item} }) { 4177 while (my ($k, $v) = each %{ $self->{item} }) {
4184 delete $self->{item}{$k} if $v->{timeout} < $NOW; 4178 delete $self->{item}{$k} if $v->{timeout} < $NOW;
4185 } 4179 }
4186
4187 $self->{timer}->set (1, 1);
4188 4180
4189 my @widgets; 4181 my @widgets;
4190 4182
4191 my @items = sort { 4183 my @items = sort {
4192 $a->{pri} <=> $b->{pri} 4184 $a->{pri} <=> $b->{pri}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines