Пример #1
0
UISystem::~UISystem()
{
  OverlayManager::destroyInstance();

  // finish theme
  CurrentTheme::set(NULL);

  details::exitWidgets();

  _internal_set_mouse_display(NULL);
  update_mouse_overlay(NULL);
}
Пример #2
0
UISystem::~UISystem()
{
  OverlayManager::destroyInstance();

  // finish theme
  set_theme(nullptr, guiscale());

  details::exitWidgets();

  _internal_set_mouse_display(nullptr);
  if (!update_custom_native_cursor(nullptr))
    update_mouse_overlay(nullptr);

  ASSERT(g_instance == this);
  g_instance = nullptr;
}
Пример #3
0
void _internal_no_mouse_position()
{
  if (!update_custom_native_cursor(nullptr))
    update_mouse_overlay(nullptr);
}
Пример #4
0
static void update_mouse_cursor()
{
  os::NativeCursor nativeCursor = os::kNoCursor;
  const Cursor* cursor = nullptr;

  if (use_native_mouse_cursor ||
      mouse_cursor_type == kOutsideDisplay) {
    switch (mouse_cursor_type) {
      case ui::kOutsideDisplay:
        nativeCursor = os::kArrowCursor;
        break;
      case ui::kNoCursor: break;
      case ui::kArrowCursor:
      case ui::kArrowPlusCursor:
        nativeCursor = os::kArrowCursor;
        break;
      case ui::kCrosshairCursor:
        nativeCursor = os::kCrosshairCursor;
        break;
      case ui::kForbiddenCursor:
        nativeCursor = os::kForbiddenCursor;
        break;
      case ui::kHandCursor:
        nativeCursor = os::kLinkCursor;
        break;
      case ui::kScrollCursor:
      case ui::kMoveCursor:
        nativeCursor = os::kMoveCursor;
        break;
      case ui::kSizeNSCursor: nativeCursor = os::kSizeNSCursor; break;
      case ui::kSizeWECursor: nativeCursor = os::kSizeWECursor; break;
      case ui::kSizeNCursor: nativeCursor = os::kSizeNCursor; break;
      case ui::kSizeNECursor: nativeCursor = os::kSizeNECursor; break;
      case ui::kSizeECursor: nativeCursor = os::kSizeECursor; break;
      case ui::kSizeSECursor: nativeCursor = os::kSizeSECursor; break;
      case ui::kSizeSCursor: nativeCursor = os::kSizeSCursor; break;
      case ui::kSizeSWCursor: nativeCursor = os::kSizeSWCursor; break;
      case ui::kSizeWCursor: nativeCursor = os::kSizeWCursor; break;
      case ui::kSizeNWCursor: nativeCursor = os::kSizeNWCursor; break;
    }
  }

  // Set native cursor
  if (mouse_display) {
    bool ok = mouse_display->setNativeMouseCursor(nativeCursor);

    // It looks like the specific native cursor is not supported,
    // so we can should use the internal overlay (even when we
    // have use_native_mouse_cursor flag enabled).
    if (!ok)
      nativeCursor = os::kNoCursor;
  }

  // Use a custom cursor
  if (nativeCursor == os::kNoCursor &&
      mouse_cursor_type != ui::kOutsideDisplay) {
    if (get_theme() && mouse_cursor_type != ui::kCustomCursor)
      cursor = get_theme()->getStandardCursor(mouse_cursor_type);
    else
      cursor = mouse_cursor_custom;
  }

  // Try to use a custom native cursor if it's possible
  if (nativeCursor == os::kNoCursor &&
      !update_custom_native_cursor(cursor)) {
    // Or an overlay as last resource
    update_mouse_overlay(cursor);
  }
}
Пример #5
0
static void update_mouse_cursor()
{
  // Use native cursor when it's possible/available/configured to do so.

  she::NativeCursor nativeCursor = she::kNoCursor;
  Cursor* cursor = nullptr;

  if (use_native_mouse_cursor ||
      mouse_cursor_type == kOutsideDisplay) {
    switch (mouse_cursor_type) {
      case ui::kOutsideDisplay:
        nativeCursor = she::kArrowCursor;
        break;
      case ui::kNoCursor: break;
      case ui::kArrowCursor:
      case ui::kArrowPlusCursor:
        nativeCursor = she::kArrowCursor;
        break;
      case ui::kForbiddenCursor:
        nativeCursor = she::kForbiddenCursor;
        break;
      case ui::kHandCursor:
        nativeCursor = she::kLinkCursor;
        break;
      case ui::kScrollCursor:
      case ui::kMoveCursor:
        nativeCursor = she::kMoveCursor;
        break;
      case ui::kSizeNSCursor: nativeCursor = she::kSizeNSCursor; break;
      case ui::kSizeWECursor: nativeCursor = she::kSizeWECursor; break;
      case ui::kSizeNCursor: nativeCursor = she::kSizeNCursor; break;
      case ui::kSizeNECursor: nativeCursor = she::kSizeNECursor; break;
      case ui::kSizeECursor: nativeCursor = she::kSizeECursor; break;
      case ui::kSizeSECursor: nativeCursor = she::kSizeSECursor; break;
      case ui::kSizeSCursor: nativeCursor = she::kSizeSCursor; break;
      case ui::kSizeSWCursor: nativeCursor = she::kSizeSWCursor; break;
      case ui::kSizeWCursor: nativeCursor = she::kSizeWCursor; break;
      case ui::kSizeNWCursor: nativeCursor = she::kSizeNWCursor; break;
    }
  }

  // Set native cursor
  if (mouse_display) {
    bool ok = mouse_display->setNativeMouseCursor(nativeCursor);

    // It looks like the specific native cursor is not supported,
    // so we can should use the internal overlay (even when we
    // have use_native_mouse_cursor flag enabled).
    if (!ok)
      nativeCursor = she::kNoCursor;
  }

  // Use a software cursor with the overlay.
  if (nativeCursor == she::kNoCursor &&
      mouse_cursor_type != ui::kOutsideDisplay &&
      CurrentTheme::get()) {
    cursor = CurrentTheme::get()->getCursor(mouse_cursor_type);
  }

  // Set internal overlay
  update_mouse_overlay(cursor);
}
Пример #6
0
void _internal_no_mouse_position()
{
  update_mouse_overlay(NULL);
}
Пример #7
0
static void update_mouse_cursor()
{
  // Use native cursor when it's possible/available/configured to do so.

  bool native_cursor_available = false;
  if (use_native_mouse_cursor || mouse_cursor_type == kOutsideDisplay) {
    she::NativeCursor nativeCursor = she::kNoCursor;

    native_cursor_available = true;
    switch (mouse_cursor_type) {
      case ui::kOutsideDisplay:
        nativeCursor = she::kArrowCursor;
        break;
      case ui::kNoCursor: break;
      case ui::kArrowCursor:
      case ui::kArrowPlusCursor:
        nativeCursor = she::kArrowCursor;
        break;
      case ui::kForbiddenCursor:
        nativeCursor = she::kForbiddenCursor;
        break;
      case ui::kHandCursor:
        nativeCursor = she::kLinkCursor;
        break;
      case ui::kScrollCursor:
      case ui::kMoveCursor:
        nativeCursor = she::kMoveCursor;
        break;
      case ui::kSizeNSCursor: nativeCursor = she::kSizeNSCursor; break;
      case ui::kSizeWECursor: nativeCursor = she::kSizeWECursor; break;
      case ui::kSizeNCursor: nativeCursor = she::kSizeNCursor; break;
      case ui::kSizeNECursor: nativeCursor = she::kSizeNECursor; break;
      case ui::kSizeECursor: nativeCursor = she::kSizeECursor; break;
      case ui::kSizeSECursor: nativeCursor = she::kSizeSECursor; break;
      case ui::kSizeSCursor: nativeCursor = she::kSizeSCursor; break;
      case ui::kSizeSWCursor: nativeCursor = she::kSizeSWCursor; break;
      case ui::kSizeWCursor: nativeCursor = she::kSizeWCursor; break;
      case ui::kSizeNWCursor: nativeCursor = she::kSizeNWCursor; break;
      default:
        native_cursor_available = false;
        break;
    }

    if (native_cursor_available) {
      native_cursor_available =
        mouse_display->setNativeMouseCursor(nativeCursor);
      native_cursor_set = (nativeCursor != she::kNoCursor);
    }
  }

  // Hide native cursor if it is visible but the current cursor type
  // is not supported natively.

  if (!native_cursor_available && native_cursor_set) {
    mouse_display->setNativeMouseCursor(she::kNoCursor);
    native_cursor_set = false;
  }

  // Use a software cursor with the overlay.

  if (!native_cursor_set) {
    if (mouse_cursor_type == ui::kNoCursor) {
      update_mouse_overlay(NULL);
    }
    else {
      update_mouse_overlay(CurrentTheme::get()->getCursor(mouse_cursor_type));
    }
  }
  else {
    // Hide the overlay if we are using a native cursor.
    update_mouse_overlay(NULL);
  }

  dirty_display_flag = true;
}
Пример #8
0
void _ji_system_exit()
{
  set_display(NULL);
  update_mouse_overlay(NULL);
}