Exemple #1
0
void gui_feedback()
{
    Manager* manager = Manager::getDefault();
    OverlayManager* overlays = OverlayManager::instance();

    ui::update_cursor_overlay();

    // Avoid updating a non-dirty screen over and over again.
#if 0                           // TODO It doesn't work yet
    if (!dirty_display_flag)
        return;
#endif

    // Draw overlays.
    overlays->captureOverlappedAreas();
    overlays->drawOverlays();

    if (!manager->getDisplay()->flip()) {
        // In case that the display was resized.
        gui_setup_screen(false);
        App::instance()->getMainWindow()->remapWindow();
        manager->invalidate();
    }
    else
        overlays->restoreOverlappedAreas();

    dirty_display_flag = false;
}
Exemple #2
0
bool GfxMode::setGfxMode() const
{
  // Try change the new graphics mode
  set_color_depth(m_depth);
  set_screen_scaling(m_scaling);

  // Set the mode
  if (set_gfx_mode(m_card, m_width, m_height, 0, 0) < 0) {
    // Error setting the new mode
    return false;
  }

  gui_setup_screen(true);

  // Set to a black palette
  set_black_palette();

  // Restore palette all screen stuff
  app_refresh_screen();

  // Redraw top window
  MainWindow* mainWindow = App::instance()->getMainWindow();
  if (mainWindow) {
    mainWindow->remapWindow();
    ui::Manager::getDefault()->invalidate();
  }

  return true;
}
Exemple #3
0
// Initializes GUI.
int init_module_gui()
{
    shortcuts = new std::vector<Shortcut*>;

    int w, h;
    bool maximized;
    load_gui_config(w, h, maximized);

    try {
        if (w > 0 && h > 0)
            main_display = she::instance()->createDisplay(w, h, screen_scaling);
    }
    catch (const she::DisplayCreationException&) {
        // Do nothing, the display wasn't created.
    }

    if (!main_display) {
        for (int c=0; try_resolutions[c].width; ++c) {
            try {
                main_display =
                    she::instance()->createDisplay(try_resolutions[c].width,
                                                   try_resolutions[c].height,
                                                   try_resolutions[c].scale);

                screen_scaling = try_resolutions[c].scale;
                break;
            }
            catch (const she::DisplayCreationException&) {
                // Ignore
            }
        }
    }

    if (!main_display) {
        she::error_message("Unable to create a user-interface display.\n");
        return -1;
    }

    main_clipboard = she::instance()->createClipboard();

    // Create the default-manager
    manager = new CustomizedGuiManager();
    manager->setDisplay(main_display);
    manager->setClipboard(main_clipboard);

    // Setup the GUI theme for all widgets
    CurrentTheme::set(ase_theme = new SkinTheme());

    if (maximized)
        main_display->maximize();

    gui_setup_screen(true);

    // Set graphics options for next time
    save_gui_config();

    return 0;
}