Exemplo n.º 1
0
void QHIMEInputContext::setComposePosition(int x, int y)
{
//    printf("setComposePosition %d %d\n", x, y);
    if (hime_ch) {
      hime_im_client_set_cursor_location(hime_ch, x, y);
    }
}
Exemplo n.º 2
0
// return TRUE if the key is accepted
int hime_im_client_forward_key_press(HIME_client_handle *handle,
                                          KeySym key, u_int state,
                                          char **rstr)
{
  int flag;
  if (!handle)
    return 0;
  // in case client didn't send focus in event
  if (!BITON(handle->flag, FLAG_HIME_client_handle_has_focus)) {
    hime_im_client_focus_in(handle);
    handle->flag |= FLAG_HIME_client_handle_has_focus;
    hime_im_client_set_cursor_location(handle, handle->spot_location.x,
       handle->spot_location.y);
  }

//  dbg("hime_im_client_forward_key_press\n");
  flag = hime_im_client_forward_key_event(
             handle, HIME_req_key_press, key, state, rstr);

  return ((flag & HIME_reply_key_processed) !=0);
}
Exemplo n.º 3
0
void hime_im_client_focus_in(HIME_client_handle *handle)
{
  if (!handle)
    return;
  if (is_special_user)
    return;

  HIME_req req;
//  dbg("hime_im_client_focus_in\n");
  handle->flag |= FLAG_HIME_client_handle_has_focus;

  if (!gen_req(handle, HIME_req_focus_in, &req))
    return;

  if (handle_write(handle, &req, sizeof(req)) <=0) {
    error_proc(handle,"hime_im_client_focus_in error");
  }

  hime_im_client_set_cursor_location(handle, handle->spot_location.x,
     handle->spot_location.y);
}
Exemplo n.º 4
0
void QHimePlatformInputContext::cursorMoved()
{
    dbg(" QHimePlatformInputContext::cursorMoved()\n");

    QWindow *inputWindow = qApp->focusWindow();
    if (!inputWindow)
        return;

    QRect r = qApp->inputMethod()->cursorRectangle().toRect();
    if(!r.isValid())
        return;

    // hime server will clear the string if the cursor is moved, make sure the x,y is valid
    int x = r.left(),  y = r.bottom();
    if (x > inputWindow->width() || y > inputWindow->height() || x < 0 || y < 0)
        return;

    if (hime_ch && (x !=  last_x || y != last_y)) {
        last_x = x; last_y = y;
        dbg("move cursor %d, %d\n", x, y);
        hime_im_client_set_cursor_location(hime_ch, x,  y);
    }
}