def handle_focused
      ch = nil

      focused.dispatch :focused
      update_focus

      if focused.activate_focus?
        focused.activate!

      elsif focused.kind_of?(Layout)
        ch = focused.handle_input(true)

      elsif !deactivate? && !nav_select
        ch = sync_getch
      end

      if self.ch_select
        ch = self.ch_select
        self.ch_select = nil
      end

      ch
    end
def handle_focused
      ch = nil

      focused.dispatch :focused
      update_focus

      if focused.activate_focus?
        focused.activate!

      elsif focused.kind_of?(Layout)
        ch = focused.handle_input(true)

      elsif !deactivate? && !nav_select
        ch = sync_getch
      end

      if self.ch_select
        ch = self.ch_select
        self.ch_select = nil
      end

      ch
    end
Internal helper, logic invoked when a component gains focus