… | |
… | |
22 | our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub { |
22 | our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub { |
23 | if (!$GRAB) { |
23 | if (!$GRAB) { |
24 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
24 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
25 | if (length $widget->{tooltip}) { |
25 | if (length $widget->{tooltip}) { |
26 | if ($TOOLTIP->{owner} != $widget) { |
26 | if ($TOOLTIP->{owner} != $widget) { |
|
|
27 | $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner}; |
27 | $TOOLTIP->hide; |
28 | $TOOLTIP->hide; |
28 | |
29 | |
29 | $TOOLTIP->{owner} = $widget; |
30 | $TOOLTIP->{owner} = $widget; |
|
|
31 | $TOOLTIP->{owner}->emit ("tooltip_show") if $TOOLTIP->{owner}; |
30 | |
32 | |
31 | return if $ENV{CFPLUS_DEBUG} & 8; |
33 | return if $ENV{CFPLUS_DEBUG} & 8; |
32 | |
34 | |
33 | my $tip = $widget->{tooltip}; |
35 | my $tip = $widget->{tooltip}; |
34 | |
36 | |
… | |
… | |
42 | } |
44 | } |
43 | } |
45 | } |
44 | } |
46 | } |
45 | |
47 | |
46 | $TOOLTIP->hide; |
48 | $TOOLTIP->hide; |
|
|
49 | $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner}; |
47 | delete $TOOLTIP->{owner}; |
50 | delete $TOOLTIP->{owner}; |
48 | }); |
51 | }); |
49 | |
52 | |
50 | sub get_layout { |
53 | sub get_layout { |
51 | my $layout; |
54 | my $layout; |
… | |
… | |
1966 | my $mod = $ev->{mod}; |
1969 | my $mod = $ev->{mod}; |
1967 | my $sym = $ev->{sym}; |
1970 | my $sym = $ev->{sym}; |
1968 | my $uni = $ev->{unicode}; |
1971 | my $uni = $ev->{unicode}; |
1969 | |
1972 | |
1970 | my $text = $self->get_text; |
1973 | my $text = $self->get_text; |
|
|
1974 | |
|
|
1975 | $self->{cursor} = List::Util::max 0, List::Util::min $self->{cursor}, length $text; |
1971 | |
1976 | |
1972 | if ($uni == 8) { |
1977 | if ($uni == 8) { |
1973 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1978 | substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; |
1974 | } elsif ($uni == 127) { |
1979 | } elsif ($uni == 127) { |
1975 | substr $text, $self->{cursor}, 1, ""; |
1980 | substr $text, $self->{cursor}, 1, ""; |