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

Comparing deliantra/Deliantra-Client/DC/BindingEditor.pm (file contents):
Revision 1.5 by root, Mon Aug 14 01:21:02 2006 UTC vs.
Revision 1.8 by elmex, Thu Oct 26 20:45:06 2006 UTC

27 CFPlus::KMOD_RSHIFT => "RSHIFT", 27 CFPlus::KMOD_RSHIFT => "RSHIFT",
28 CFPlus::KMOD_RCTRL => "RCTRL", 28 CFPlus::KMOD_RCTRL => "RCTRL",
29 CFPlus::KMOD_RALT => "RALT", 29 CFPlus::KMOD_RALT => "RALT",
30 CFPlus::KMOD_RMETA => "RMETA", 30 CFPlus::KMOD_RMETA => "RMETA",
31); 31);
32my $ALLOWED_MODIFIER_MASK = 0x0FC3; # this is the mask of the above ALLOWED_MODIFIERS or'ed together
32 33
33my %DIRECT_BIND_CHARS = map { $_ => 1 } qw/0 1 2 3 4 5 6 7 8 9/; 34my %DIRECT_BIND_CHARS = map { $_ => 1 } qw/0 1 2 3 4 5 6 7 8 9/;
34my @DIRECT_BIND_KEYS = ( 35my @DIRECT_BIND_KEYS = (
35 CFPlus::SDLK_F1, 36 CFPlus::SDLK_F1,
36 CFPlus::SDLK_F2, 37 CFPlus::SDLK_F2,
129 $self 130 $self
130} 131}
131 132
132sub cfg_bind { 133sub cfg_bind {
133 my ($self, $mod, $sym, $cmds) = @_; 134 my ($self, $mod, $sym, $cmds) = @_;
134 $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; 135 $::PROFILE->{bindings}{$mod}{$sym} = $cmds;
135 ::update_bindings (); 136 ::update_bindings ();
136} 137}
137 138
138sub cfg_unbind { 139sub cfg_unbind {
139 my ($self, $mod, $sym, $cmds) = @_; 140 my ($self, $mod, $sym, $cmds) = @_;
140 delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; 141 delete $::PROFILE->{bindings}{$mod}{$sym};
141 ::update_bindings (); 142 ::update_bindings ();
142} 143}
143 144
144sub commit { 145sub commit {
145 my ($self) = @_; 146 my ($self) = @_;
206 $vb->add (my $entry = new CFPlus::UI::Entry 207 $vb->add (my $entry = new CFPlus::UI::Entry
207 text => "", 208 text => "",
208 on_key_down => sub { 209 on_key_down => sub {
209 my ($entry, $ev) = @_; 210 my ($entry, $ev) = @_;
210 211
211 my $mod = $ev->{mod}; 212 my $mod = $ev->{mod} & $ALLOWED_MODIFIER_MASK;
212 my $sym = $ev->{sym}; 213 my $sym = $ev->{sym};
213 214
214 # XXX: This seems a little bit hackisch to me, but I have to ignore them 215 # XXX: This seems a little bit hackisch to me, but I have to ignore them
215 return if grep { $_ == $sym } @ALLOWED_MODIFIER_KEYS; 216 return if grep { $_ == $sym } @ALLOWED_MODIFIER_KEYS;
216 217
230 $self->{binding} = [$mod, $sym]; 231 $self->{binding} = [$mod, $sym];
231 $self->update_binding_widgets; 232 $self->update_binding_widgets;
232 $self->commit if $commit; 233 $self->commit if $commit;
233 $end_cb->() if $end_cb; 234 $end_cb->() if $end_cb;
234 235
236 if (my $binder = delete $self->{binder}) {
235 (delete $self->{binder})->destroy; 237 $binder->destroy;
238 }
236 1 239 1
237 }, 240 },
238 on_focus_out => sub { 241 on_focus_out => sub {
239 # segfaults and worse :() 242 # segfaults and worse :()
240 #(delete $self->{binder})->destroy if $self->{binder}; 243 #(delete $self->{binder})->destroy if $self->{binder};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines