def response_to(types = :all, state = :both, opts = nil, &block)
      logger.debug "setting response to #{types.inspect} for state #{state.inspect} with #{opts.inspect}"
      types = Array(types)
      opts ||= {}
      no_response_to(types, state) if opts[:exclusive] == true
      Array(state == :both ? %w(down up) : state).each do |state|
        types.each do |type|
          combined_types(type, opts).each do |combined_type|
            responses[combined_type][state.to_sym] << block
          end
        end
      end
      nil
    end
def response_to(types = :all, state = :both, opts = nil, &block)
      logger.debug "setting response to #{types.inspect} for state #{state.inspect} with #{opts.inspect}"
      types = Array(types)
      opts ||= {}
      no_response_to(types, state) if opts[:exclusive] == true
      Array(state == :both ? %w(down up) : state).each do |state|
        types.each do |type|
          combined_types(type, opts).each do |combined_type|
            responses[combined_type][state.to_sym] << block
          end
        end
      end
      nil
    end
Registers a response to one or more actions.

 Parameters (see Launchpad for values):

 [+types+] one or an array of button types to respond to,
           additional value <tt>:all</tt> for all buttons
 [+state+] button state to respond to,
           additional value <tt>:both</tt>

 Optional options hash:

 [<tt>:exclusive</tt>] <tt>true/false</tt>,
                       whether to deregister all other responses to the specified actions,
                       optional, defaults to +false+
 [<tt>:x</tt>]         x coordinate(s), can contain arrays and ranges, when specified
                       without y coordinate, it's interpreted as a whole column
 [<tt>:y</tt>]         y coordinate(s), can contain arrays and ranges, when specified
                       without x coordinate, it's interpreted as a whole row

 Takes a block which will be called when an action matching the parameters occurs.

 Block parameters:

 [+interaction+] the interaction object that received the action
 [+action+]      the action received from Launchpad::Device.read_pending_actions