--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/22 12:36:17 1.76
+++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/24 12:25:09 1.79
@@ -5,7 +5,9 @@
use List::Util qw(min max);
+use CFClient;
use CFClient::OpenGL;
+use CFClient::UI;
our @ISA = CFClient::UI::Base::;
@@ -32,7 +34,6 @@
$self->{completer} = new CFClient::MapWidget::Command::
command => $self->{command},
- can_focus => 1,
tooltip => "The Command Completer\n\n"
. "This is your central interface to send text commands to the server. "
. "To enter a verbatim command to send to the server, just type the command, "
@@ -116,6 +117,15 @@
: "Enable automatic pickup",
sub { $::PICKUP_ENABLE->toggle }
],
+ ["Quit",
+ sub {
+ if ($::CONN) {
+ &::open_quit_dialog;
+ } else {
+ exit;
+ }
+ }
+ ],
],
)->popup ($ev);
}
@@ -246,7 +256,7 @@
$::CONN->user_send ("$DIR{$sym}[1]");
}
} elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) {
- $self->{completer}->invoke_key_down ($ev);
+ $self->{completer}->inject_key_down ($ev);
$self->{completer}->show;
} else {
return 0;
@@ -528,7 +538,7 @@
if ($ev->{button} == 3) {
(new CFClient::UI::Menu
items => [
- ["bind " . (CFClient::UI::Label::escape $self->{select}) . " to a key"
+ ["bind " . (CFClient::asxml $self->{select}) . " to a key"
=> sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->grab_focus }) }]
],
)->popup ($ev);
@@ -627,10 +637,11 @@
$self->{entry}->set_text ("");
}
-sub invoke_key_down {
+sub inject_key_down {
my ($self, $ev) = @_;
- $self->{entry}->emit (key_down => $ev)
+ $self->{entry}->grab_focus;
+ $self->{entry}->emit (key_down => $ev);
}
sub update_labels {