示例#1
0
JNIEXPORT void JNICALL
Java_com_showtimemediacenter_showtime_STCore_glwMotion(JNIEnv *env,
                                                       jobject obj,
                                                       jint id,
                                                       jint action,
                                                       jint x,
                                                       jint y)
{
  android_glw_root_t *agr = (android_glw_root_t *)id;
  glw_root_t *gr = &agr->gr;
  glw_pointer_event_t gpe = {0};

  switch(action) {
  case 0: gpe.type = GLW_POINTER_LEFT_PRESS;    break;
  case 1: gpe.type = GLW_POINTER_LEFT_RELEASE;  break;
  case 2: gpe.type = GLW_POINTER_MOTION_UPDATE; break;
  default: return;
  }

  glw_lock(gr);
  gpe.x =  (2.0f * x / gr->gr_width ) - 1.0f;
  gpe.y = -(2.0f * y / gr->gr_height) + 1.0f;
  glw_pointer_event(gr, &gpe);
  glw_unlock(gr);
}
示例#2
0
static void
hide_cursor(glw_x11_t *gx11)
{
  glw_pointer_event_t gpe = {0};

  if(gx11->cursor_hidden)
    return;

  gx11->cursor_hidden = 1;
  XDefineCursor(gx11->display, gx11->win, gx11->blank_cursor);
 
  gpe.type = GLW_POINTER_GONE;
  glw_lock(&gx11->gr);
  glw_pointer_event(&gx11->gr, &gpe);
  glw_unlock(&gx11->gr);
}