Example #1
0
bool
InfoBoxWindow::OnTimer(WindowTimer &timer)
{
  if (timer == focus_timer) {
    focus_timer.Cancel();
    FocusParent();
    return true;
  } else if (timer == dialog_timer) {
    dragging = pressed = false;
    Invalidate();
    ReleaseCapture();

    dialog_timer.Cancel();
    ShowDialog();
    return true;
  } else
    return PaintWindow::OnTimer(timer);
}
Example #2
0
JNIEXPORT void JNICALL Java_org_cef_browser_CefBrowser_1N_N_1SetFocus
  (JNIEnv *env, jobject obj, jboolean enable) {
  CefRefPtr<CefBrowser> browser = JNI_GET_BROWSER_OR_RETURN(env, obj);
  if (browser->GetHost()->IsWindowRenderingDisabled()) {
    browser->GetHost()->SendFocusEvent(enable != JNI_FALSE);
  } else {
    browser->GetHost()->SetFocus(enable != JNI_FALSE);
  }

#if defined(OS_WIN)
  if (enable == JNI_FALSE) {
    HWND browserHandle = browser->GetHost()->GetWindowHandle();
    if (CefCurrentlyOn(TID_UI))
      FocusParent(browserHandle);
    else
      CefPostTask(TID_UI, NewCefRunnableFunction(&FocusParent, browserHandle));
  }
#endif
}
Example #3
0
bool
InfoBoxWindow::OnKeyDown(unsigned key_code)
{
  /* handle local hot key */

  switch (key_code) {
  case KEY_UP:
    focus_timer.Schedule(FOCUS_TIMEOUT_MAX);
    return HandleKey(InfoBoxContent::ibkUp);

  case KEY_DOWN:
    focus_timer.Schedule(FOCUS_TIMEOUT_MAX);
    return HandleKey(InfoBoxContent::ibkDown);

  case KEY_LEFT:
    focus_timer.Schedule(FOCUS_TIMEOUT_MAX);
    return HandleKey(InfoBoxContent::ibkLeft);

  case KEY_RIGHT:
    focus_timer.Schedule(FOCUS_TIMEOUT_MAX);
    return HandleKey(InfoBoxContent::ibkRight);

  case KEY_RETURN:
    ShowDialog();
    return true;

  case KEY_ESCAPE:
    focus_timer.Cancel();
    FocusParent();
    return true;
  }

  /* handle global hot key */

  if (InputEvents::ProcessKey(InputEvents::MODE_INFOBOX, key_code))
    return true;

  /* call super class */

  return PaintWindow::OnKeyDown(key_code);
}