… | |
… | |
470 | } |
470 | } |
471 | |
471 | |
472 | sub emit { |
472 | sub emit { |
473 | my ($self, $signal, @args) = @_; |
473 | my ($self, $signal, @args) = @_; |
474 | |
474 | |
|
|
475 | #d##TODO# stop propagating at first true, do not use sum |
475 | (List::Util::sum +(map $_->($self, @args), @{$self->{signal_cb}{$signal} || []}), # before |
476 | (List::Util::sum map $_->($self, @args), @{$self->{signal_cb}{$signal} || []}) # before |
476 | ($self->can ("invoke_$signal") || sub { 1 })->($self, @args)) # closure |
477 | || ($self->can ("invoke_$signal") || sub { 1 })->($self, @args) # closure |
477 | || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent |
478 | || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent |
478 | } |
479 | } |
479 | |
480 | |
480 | sub find_widget { |
481 | sub find_widget { |
481 | my ($self, $x, $y) = @_; |
482 | my ($self, $x, $y) = @_; |
482 | |
483 | |
… | |
… | |
3471 | $self->update_binding_widgets; |
3472 | $self->update_binding_widgets; |
3472 | |
3473 | |
3473 | $self |
3474 | $self |
3474 | } |
3475 | } |
3475 | |
3476 | |
|
|
3477 | sub cfg_bind { |
|
|
3478 | my ($self, $mod, $sym, $cmds) = @_; |
|
|
3479 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
|
|
3480 | ::update_bindings (); |
|
|
3481 | } |
|
|
3482 | |
|
|
3483 | sub cfg_unbind { |
|
|
3484 | my ($self, $mod, $sym, $cmds) = @_; |
|
|
3485 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
|
|
3486 | ::update_bindings (); |
|
|
3487 | } |
|
|
3488 | |
3476 | sub commit { |
3489 | sub commit { |
3477 | my ($self) = @_; |
3490 | my ($self) = @_; |
3478 | my ($mod, $sym, $cmds) = $self->get_binding; |
3491 | my ($mod, $sym, $cmds) = $self->get_binding; |
3479 | if ($sym != 0 && @$cmds > 0) { |
3492 | if ($sym != 0 && @$cmds > 0) { |
3480 | $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) |
3493 | $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) |
… | |
… | |
3550 | |
3563 | |
3551 | # this is a shortcut method that asks for a binding |
3564 | # this is a shortcut method that asks for a binding |
3552 | # and then just binds it. |
3565 | # and then just binds it. |
3553 | sub do_quick_binding { |
3566 | sub do_quick_binding { |
3554 | my ($self, $cmds, $end_cb) = @_; |
3567 | my ($self, $cmds, $end_cb) = @_; |
3555 | $self->set_binding (undef, undef, $cmds, sub { |
3568 | $self->set_binding (undef, undef, $cmds, sub { $self->cfg_bind (@_) }); |
3556 | $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2]; |
|
|
3557 | }); |
|
|
3558 | $self->ask_for_bind (1, $end_cb); |
3569 | $self->ask_for_bind (1, $end_cb); |
3559 | } |
3570 | } |
3560 | |
3571 | |
3561 | sub update_binding_widgets { |
3572 | sub update_binding_widgets { |
3562 | my ($self) = @_; |
3573 | my ($self) = @_; |