main_loop (Raggle::Interfaces::NcursesInterface)

    # File raggle, line 4281
          def NcursesInterface::main_loop
            meth = 'NcursesInterface::main_loop'
            timeout = $config['input_select_timeout']
            $done = false

            until $done
              # handle keyboard input
              r = select [$stdin], nil, nil, timeout
              if r && r.size > 0
                c = Ncurses::getch
                case c
                when Ncurses::KEY_MOUSE
                  mev = Ncurses::MEVENT.new
                  Ncurses.getmouse(mev)

                  # build event string
                  ev_str = Ncurses.constants.grep(/^BUTTON._/).find_all { |c_str|
                    mev.bstate & Ncurses.const_get(c_str)
                  }.map { |str| str.downcase }.join(',') || ''

                  $log.warn(meth) { "mouse event: #{mev.x}x#{mev.y}: #{ev_str}" }
                else
                  $config['keys'][c].call($wins[$a_win],c) \
                    if c != Ncurses::KEY_RESIZE && $config['keys'].has_key?(c)
                end
              end

              # refresh window contents if there's been a feed update
              if $update_wins
                $update_wins = false
                Raggle::Interfaces::NcursesInterface::populate_feed_win
                # wins.each { |win| win.draw_items }
              end

              NcursesInterface::set_status $new_status if $new_status != $status
            end
          end