Unix Programming - Programmatically move the mouse?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Programmatically move the mouse?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Programmatically move the mouse?
J. Patrick Brandt

2004-01-23, 5:33 pm

Does anyone even know if it is possible programmatically to reposition the
mouse cursor [using Qt under Linux]?

Any hints appreciated. I am trying to "trap" the mouse cursor to the visible
area of a framebuffer (e.g. TV out - the visible part of the screen is less
than the full x-y resolution, depending on the monitor...)

I can catch mouseMoveEvents and send my own (which I receive) but the cursor
doesn't move, so all I am doing is sending "extra" events, not affecting the
mouse.

What I would like to do is something like "if x<100 then move mouse to
(100,y)", etc.

Sorry - I can't seem to find a "Qt" related group.
Thanks!


Michael B Allen

2004-01-23, 5:33 pm

On Wed, 24 Dec 2003 00:00:24 -0500, J. Patrick Brandt wrote:
quote:

> Does anyone even know if it is possible programmatically to reposition
> the mouse cursor [using Qt under Linux]?
>
> Any hints appreciated. I am trying to "trap" the mouse cursor to the
> visible area of a framebuffer (e.g. TV out - the visible part of the
> screen is less than the full x-y resolution, depending on the
> monitor...)
>
> I can catch mouseMoveEvents and send my own (which I receive) but the
> cursor doesn't move, so all I am doing is sending "extra" events, not
> affecting the mouse.
>
> What I would like to do is something like "if x<100 then move mouse to
> (100,y)", etc.
>
> Sorry - I can't seem to find a "Qt" related group. Thanks!



This doesn't have anything to do with Qt really. You want to look at the
X windows documentation. I don't know if there is a standard way to do
this sort of thing but it's very likely possible to do such a thing. You
might need to inject some custom mouse events or other trickery.

Mike
Torgny Lyon

2004-01-23, 5:33 pm

J. Patrick Brandt wrote:
quote:

> Does anyone even know if it is possible programmatically to reposition the
> mouse cursor [using Qt under Linux]?
>
> Any hints appreciated. I am trying to "trap" the mouse cursor to the visible
> area of a framebuffer (e.g. TV out - the visible part of the screen is less
> than the full x-y resolution, depending on the monitor...)
>
> I can catch mouseMoveEvents and send my own (which I receive) but the cursor
> doesn't move, so all I am doing is sending "extra" events, not affecting the
> mouse.
>
> What I would like to do is something like "if x<100 then move mouse to
> (100,y)", etc.
>
> Sorry - I can't seem to find a "Qt" related group.
> Thanks!
>
>



Perhaps XWarpPointer() is what you are looking for.

--
Torgny Lyon <torgny@enterprise.hb.se>
PGP Public Key: http://enterprise.hb.se/~torgny/pgpkey.asc

Jerry Feldman

2004-01-23, 5:33 pm

On Tue, 23 Dec 2003 21:00:24 -0800
"J. Patrick Brandt" <spambait@null.com> wrote:
quote:

> Does anyone even know if it is possible programmatically to reposition
> the mouse cursor [using Qt under Linux]?
>
> Any hints appreciated. I am trying to "trap" the mouse cursor to the
> visible area of a framebuffer (e.g. TV out - the visible part of the
> screen is less than the full x-y resolution, depending on the
> monitor...)
>
> I can catch mouseMoveEvents and send my own (which I receive) but the
> cursor doesn't move, so all I am doing is sending "extra" events, not
> affecting the mouse.
>
> What I would like to do is something like "if x<100 then move mouse to
> (100,y)", etc.
>
> Sorry - I can't seem to find a "Qt" related group.
> Thanks!


There are several listservs dedicated to QT.
http://lists.trolltech.com/

I suggest you visit the trolltech website for tutorials and
documentation. I think that you might want to look at QMouseEvent and
related properties.
--
Jerry Feldman <gaf-nospam-at-blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
J. Patrick Brandt

2004-01-23, 5:33 pm

Follow-up:

I am actually using Qt/embedded, so I am able to use
QWSServer::sendMouseEvent(qpoint, buttonstate)...

I trap the MouseMove events in an eventFilter and (as needed) do a
sendMouseEvent of my own.

This makes the mouse cursor *look* ok on the screen (e.g. it moves where I
want) but the "real" position seems to be remembered by something deeper.

I haven't tried it on the target system so I have hope it will work [and
that the position is confused in my emulation by the underlying X11 system].

I think I am getting close.

Thanks for the replies.

"J. Patrick Brandt" <spambait@null.com> wrote in message
news:939Gb.55987$pY.34251@fed1read04...
quote:

> Does anyone even know if it is possible programmatically to reposition the
> mouse cursor [using Qt under Linux]?
>
> Any hints appreciated. I am trying to "trap" the mouse cursor to the


visible
quote:

> area of a framebuffer (e.g. TV out - the visible part of the screen is


less
quote:

> than the full x-y resolution, depending on the monitor...)
>
> I can catch mouseMoveEvents and send my own (which I receive) but the


cursor
quote:

> doesn't move, so all I am doing is sending "extra" events, not affecting


the
quote:

> mouse.
>
> What I would like to do is something like "if x<100 then move mouse to
> (100,y)", etc.
>
> Sorry - I can't seem to find a "Qt" related group.
> Thanks!
>
>




Bak

2004-01-23, 5:33 pm

"J. Patrick Brandt" <spambait@null.com> wrote in message news:<tJoGb.61932$pY.34942@fed1read04>...[QUOTE][color=darkred]
> Follow-up:
>
> I am actually using Qt/embedded, so I am able to use
> QWSServer::sendMouseEvent(qpoint, buttonstate)...
>
> I trap the MouseMove events in an eventFilter and (as needed) do a
> sendMouseEvent of my own.
>
> This makes the mouse cursor *look* ok on the screen (e.g. it moves where I
> want) but the "real" position seems to be remembered by something deeper.
>
> I haven't tried it on the target system so I have hope it will work [and
> that the position is confused in my emulation by the underlying X11 system].
>
> I think I am getting close.
>
> Thanks for the replies.
>
> "J. Patrick Brandt" <spambait@null.com> wrote in message
> news:939Gb.55987$pY.34251@fed1read04...
> visible
> less
> cursor
> the

Hello
Your counsel is helpful.
but i don't work.

I'd like to generate mouse event(mouse left button down, up, move).
I am using Qt 3.2.3.
I don't find QWSServer class.
"qwindowsystem_qws.h"
this file do not exist in my linux system.

Why?
How do i use QWSServer?.
thanks!!.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com