… | |
… | |
22 | "f4" => "!toggle-spells", |
22 | "f4" => "!toggle-spells", |
23 | "f5" => "!toggle-inventory", |
23 | "f5" => "!toggle-inventory", |
24 | "f9" => "!toggle-setup", |
24 | "f9" => "!toggle-setup", |
25 | (map +("LAlt-$_" => "!switch-tab $_"), 0..9), |
25 | (map +("LAlt-$_" => "!switch-tab $_"), 0..9), |
26 | (map +("RAlt-$_" => "!switch-tab $_"), 0..9), |
26 | (map +("RAlt-$_" => "!switch-tab $_"), 0..9), |
|
|
27 | "LAlt-x" => "!close-current-tab", |
27 | "return" => "!activate-chat", |
28 | "return" => "!activate-chat", |
28 | "." => "!repeat-command", |
29 | "." => "!repeat-command", |
29 | |
30 | |
30 | "," => "take", |
31 | "," => "take", |
31 | "space" => "apply", |
32 | "space" => "apply", |
… | |
… | |
87 | "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) }, |
88 | "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) }, |
88 | "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) }, |
89 | "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) }, |
89 | "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, |
90 | "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, |
90 | "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, |
91 | "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, |
91 | "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) }, |
92 | "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) }, |
|
|
93 | "close-current-tab" => sub { $::MESSAGE_WINDOW->close_current_tab }, |
92 | "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current }, |
94 | "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current }, |
93 | "repeat-command" => sub { |
95 | "repeat-command" => sub { |
94 | $::CONN->user_send ($::COMPLETER->{last_command}) |
96 | $::CONN->user_send ($::COMPLETER->{last_command}) |
95 | if $::CONN && exists $::COMPLETER->{last_command}; |
97 | if $::CONN && exists $::COMPLETER->{last_command}; |
96 | }, |
98 | }, |
… | |
… | |
244 | } |
246 | } |
245 | |
247 | |
246 | sub find_default($) { |
248 | sub find_default($) { |
247 | my ($ev) = @_; |
249 | my ($ev) = @_; |
248 | |
250 | |
249 | if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) { |
|
|
250 | return $cmd; |
|
|
251 | } |
|
|
252 | |
|
|
253 | for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { |
251 | for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { |
254 | for (keys %$m) { |
252 | for (keys %$m) { |
255 | if ($_ == ($ev->{mod} & $_)) { |
253 | if ($_ == ($ev->{mod} & $_)) { |
256 | if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { |
254 | if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { |
257 | return $cmd; |
255 | return $cmd; |
258 | } |
256 | } |
259 | } |
257 | } |
260 | } |
258 | } |
|
|
259 | } |
|
|
260 | |
|
|
261 | if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) { |
|
|
262 | return $cmd; |
261 | } |
263 | } |
262 | |
264 | |
263 | () |
265 | () |
264 | } |
266 | } |
265 | |
267 | |