Important: Please read the Qt Code of Conduct -

[Solved] Send generated MouseEvents to Kernel event / DirectFB linux_input event

  • Hi

    I am trying to generate mouse events.
    It basically works, but I am still missing some part.

    I use this to set the position:

    QCursor *cur = new QCursor; cur->setPos(pXY); 

    and this to post the event:

    QApplication::postEvent(this, new QMouseEvent(MB_Event, pXY, MB_Button, 0, 0));

    This positions and executes a click at the given location. Using postEvent alone does the click but always at position 0,0.
    However, the mouse cursor always stays at the same location (middle of screen).
    This seems to be because the mouse cursor is displayed by DirectFB and the above MouseEvents obviously never make it to DirectFB. I am not sure this is completely true because I can override the look of the cursor in Qt, but I could not find to set it's position.

    Instead of doing the above, I am now trying to send an event to the Kernel or to the linux_input of DFB. This would then position the cursor and the event would automatically be propagated to Qt.

    Any idea how this can be done?

  • Nobody a hint on this ... or maybe a hint where to ask.

  • I think on Linux, easiest way is using uinput (

  • @tomma

    Thanks a lot! That was great input.
    While reading about uinput the idea of writing to the event itself instead crossed me.
    I implemented a function that generates the various (basic) events of a touch screen and writing it directly to event0.
    It works perfect so far.