PDA

View Full Version : QCursor::setPos() fails with x server fatal error



Arnaldo Diniz
1st October 2009, 01:42
This is my first post as I am new to Qt and to the community (used to code in Delphi).

I am working on a very simple app which gets a key evt and triggers setPos just like: QCursor::setPos(QCursor::pos()+QPoint(0, 10));

Unfortunatelly, even if I trigger it just once, after 1 or 2 seconds my app crashes and I get a "<unknown>: Fatal IO error 0 (Success) on X server :0.0."

I'm running Ubuntu 9.04 Desktop on a Toshiba Celeron M/ATI notebook. w/ CompizFusion enabled.

Any clues?

Thanks in advance.

Arnaldo Diniz
1st October 2009, 12:30
I tested with Compiz disabled... It wsorked for the first 10 seconds... some mouse movement, but...

<unknown>: Fatal IO error 11 (resource temporarily unavailable) on X server :0.0.

Wes Pipez
2nd December 2010, 16:40
Same over here!

Even though what i am trying to do is the following. I want to continuously display the cursor coordinates relative to a widget. Herefore i start a QThread who gets the cursor and the widget as input and then should update the gui with the coordinates in a while-true-loop.

But i get the following error on startup:

---------------------
X Error: BadRequest (invalid request code or no such operation) 1
Major opcode: 0 ()
Resource id: 0x23
<unknown>: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.
---------------------

If i delay the call for the cursor position method with, e.g. time.sleep(1), The call works ok for around seven times and then crashes again.

How can avoid that? Or do you have a better idea for continuously displaying the cursor coordinates?

wysota
2nd December 2010, 23:45
Herefore i start a QThread who gets the cursor and the widget as input and then should update the gui with the coordinates in a while-true-loop.
... and you have your answer. Now read the docs about using multiple threads with gui.

By the way the word "continously" doesn't apply to computers. Think how often do you really need to know the position of the cursor.