Re: Simulating a mouse click



On Wednesday 21 May 2003 08:56, Bosko Andjelkovic wrote:
> Well, I am trying to make a GNOME version of this win32 program:
> http://home.planet.nl/~andje000/ac.html
>
> I need to send a mouse click signal to the window beneath the cursor. In
> the win32 API there is a function called mouse_event which does exactly
> this, but I can't seem to find such a function in X so I need to do this
> 'manually' (i.e. detect the window under the cursor and then send a
> mouse click signal to it). I hope that this answers your question about
> what I am doing.

I'm sorry - but my next question, is why?  What good is it?

What it really appears you want to do is intercept as well as send events for 
the X11 server.  This may, or may not be, within the scope of GTK - I cannot 
say because I would never have cause for doing this since use GTK purely to 
produce front ends to my programs.

I know X11 can do what you want, but programming in X is seriously not fun 
which is why we have GTK, QT, KDE, Motiff, and a few dozen more API's - so 
you don't have to deal with the nightmare of X11.
> Bosko

-Rich

P.S. if anybody writes back to tell me how dead wrong I am about X11, please 
do it by writing the shortest program you can that prints "hello world" on 
the screen with a seperate button to exit the program.

> > On Monday 19 May 2003 10:08, Bosko Andjelkovic wrote:
> > > Well, I need to send a mouse signal to a specific location on the
> > > screen (the position of the cursor) so that the user doesnt have to
> > > click. Can someone tell me how that is done?
> >
> > Under X, you can detect mouse moment.  Keep in mind that X11 is an event
> > driven system - if you chose to use this signal, you'll get LOTS of
> > events.
> >
> > I think the GDK equivalent is GDK_MOTION_NOTIFY.  I believe you can also
> > query the mouse position too any time you like.  I know you can in X, and
> > I'm sure you can in GDK/GTK.
> >
> > Can you tell me more about what you are doing and WHY you need this? 
> > That would help me a lot in helping me to get a solution to your problem.
> >
> > -Rich
> >
> > > Bosko
> > >
> > > > Why do you need to simulate a mouse click?  You can detect when a
> > > > pointer enters and leaves a window - perhaps you'd rather use that
> > > > signal instead?
> > > >
> > > > I don't know the string equivlanets, but here are the values for
> > > > that:
> > > >
> > > > GDK_ENTER_NOTIFY
> > > > GDK_LEAVE_NOTIFY
> > > >
> > > > -Rich
> > > >
> > > > On Tuesday 13 May 2003 09:29, Bosko Andjelkovic wrote:
> > > > > I am creating an application that uses gtk+ and creating the
> > > > > interface was easy, but what I need to code now is 'simulating' n
> > > > > mouse click at the cursors current position (e.g. if the cursor
> > > > > happens to be hovering over a menu and my applications fakes a
> > > > > mouse click, the menu would open). I know that I can send mouse
> > > > > signals to widgets inside my application's interface, but I need
> > > > > this for the whole screen (i.e. detect the cursors position and
> > > > > then send a mouse signal to the object on that position).
> > > > > Someone told me that GDK can do this, so I took a look at the GDK
> > > > > API, but I still don't know how to do this. I did find a function
> > > > > called gdk_display_get_pointer(), which may be what I need to
> > > > > detect the cursors position, but I am not sure since I can't get it
> > > > > to work. Can anyone help me further with this?
> > > > > Thanks in advance.
> > > > >
> > > > > _______________________________________________
> > > > > gtk-list mailing list
> > > > > gtk-list gnome org
> > > > > http://mail.gnome.org/mailman/listinfo/gtk-list
> > > >
> > > > _______________________________________________
> > > > gtk-list mailing list
> > > > gtk-list gnome org
> > > > http://mail.gnome.org/mailman/listinfo/gtk-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]