--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/06/11 20:09:12 1.55 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/06/14 16:20:22 1.59 @@ -63,6 +63,8 @@ sub button_down { my ($self, $ev, $x, $y) = @_; + return unless $::CONN; + $self->focus_in; if ($ev->{button} == 1) { @@ -78,7 +80,7 @@ $x += 1; $y += 1; - $::CONN->send ("lookat $x $y") + $::CONN->lookat ($x, $y) if $::CONN; } elsif ($ev->{button} == 2) { @@ -183,7 +185,10 @@ } elsif (exists $DIR{$sym}) { if ($mod & CFClient::KMOD_SHIFT) { $self->{shft}++; - $::CONN->user_send ("fire $DIR{$sym}[0]"); + if ($DIR{$sym}[0] != $self->{fire_dir}) { + $::CONN->user_send ("fire $DIR{$sym}[0]"); + } + $self->{fire_dir} = $DIR{$sym}[0]; } elsif ($mod & CFClient::KMOD_CTRL) { $self->{ctrl}++; $::CONN->user_send ("run $DIR{$sym}[0]"); @@ -221,9 +226,22 @@ my $mod = $ev->{mod}; my $sym = $ev->{sym}; - if (!($mod & CFClient::KMOD_SHIFT) && delete $self->{shft}) { - $::CONN->user_send ("fire_stop"); - $res = 1; + if ($::CFG->{shift_fire_stop}) { + if (!($mod & CFClient::KMOD_SHIFT) && delete $self->{shft}) { + $::CONN->user_send ("fire_stop"); + delete $self->{fire_dir}; + $res = 1; + } + } else { + if (exists $DIR{$sym} && delete $self->{shft}) { + $::CONN->user_send ("fire_stop"); + delete $self->{fire_dir}; + $res = 1; + } elsif (($sym == CFClient::SDLK_LSHIFT || $sym == CFClient::SDLK_RSHIFT) && delete $self->{shft}) { # XXX: is RSHIFT ok? + $::CONN->user_send ("fire_stop"); + delete $self->{fire_dir}; + $res = 1; + } } if (!($mod & CFClient::KMOD_CTRL ) && delete $self->{ctrl}) { @@ -241,9 +259,11 @@ || $CFClient::UI::FOCUS == $self->{completer}{entry}; return - unless $focused || !$::FAST; + unless $::CONN && ($focused || !$::FAST); if (delete $self->{need_update}) { + $self->{fow_texture} ||= glGenTexture; + glNewList $self->{list}; if ($::MAP) { @@ -465,6 +485,19 @@ on_changed => sub { $self->update_labels; }, + on_button_down => sub { + my ($entry, $ev, $x, $y) = @_; + + if ($ev->{button} == 3) { + (new CFClient::UI::Menu + items => [ + ["bind to a key" => sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->focus_in }) }] + ], + )->popup ($ev); + return 1; + } + 0 + }, on_key_down => sub { my ($entry, $ev) = @_;