Example #1
0
    bool Display::readAndDispatch() {
      bool rv { true };

      int key;
      Shell *shell { getActiveShell() };
      WINDOW *window { reinterpret_cast<WINDOW *>(shell->window()) };

      shell->redraw();

      ::timeout(-1);
      ::raw();
      ::noecho();
      ::keypad(window, TRUE);

      Control *control { };
      shell->paint();

      if((control = shell->getFocusControl()) != nullptr) {
        Event event;

        if((key = ::wgetch(window)) != ERR) {
          event.keyCode = key;

          if(control->handleKeyEvent(key, event)) {

          }
        }
      }

      return(rv);
    }