I need to simulate the "drag" event in N900 to control other applications.
 
When my application is in background, I would like to sent drag event to the 
foreground application, for example, sending a "drag from left to right" event 
to control image browsing application to show the previous image. Currently I 
implement it using following code.Sometimes, it worked. However, sometimes, the 
drag event will not be responsed.For example, sometimes, when I simulate a drag 
event to the image browser, the image switching does not happen. But I can felt 
that a vibration has been triggered. It seems that the device has received a 
press event (XTestFakeButtonEvent), but the motion (XTestFakeMotionEvent) is 
ignored.
 
So does anyone know how to solved this problem? Thanks.
 

voidNokiaTouchX11EventHandler::dragLeft()

{

   qDebug()<<"DragLeft";

  Display*dpy=NULL;

  XEventevent;

  inti;

  dpy=XOpenDisplay(NULL);

  XQueryPointer(dpy,RootWindow(dpy,0),

                  &event.xbutton.root,&event.xbutton.window,

                  &event.xbutton.x_root,&event.xbutton.y_root,

                  &event.xbutton.x,&event.xbutton.y,

                  &event.xbutton.state);

  XTestFakeButtonEvent(dpy,1,True,CurrentTime);

  for(i=400;i>=300;i-=50)

  {

          XTestFakeMotionEvent(dpy,-1,i,

                  250,CurrentTime);

          usleep(10000);

          XSync(dpy,0);

  }

  usleep(10000);

  XTestFakeButtonEvent(dpy,1,False,CurrentTime);

  XCloseDisplay(dpy);

}
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to