Re: Send signal?



Hi,

> >  I want send a click signal to a widget,
> >  is it possible?
> 
> 
> It is difficult to make synthetic events which work reliably, and you 
> are not allowed to emit other widget's signals, so I think this is 
> probably impossible.

Well you can use the X11 X-Test extension to generate synthetic mouse
events. If you want to give it a try:

---snip---

#include <stdio.h>
#include <X11/extensions/XTest.h>

int main (void) {
	Display *display;
	int BtnNr = 2; // middle mouse button

	if( !(display = XOpenDisplay(NULL)) ) {
		fprintf(stderr, "unable to open display\n");
		exit (1);
	}

	XTestFakeButtonEvent(display, BtnNr, False, 0);
	XTestFakeButtonEvent(display, BtnNr, True, 0);

	XFlush(display);
	XCloseDisplay(display);
	exit (0);
}

---snap---

gcc source.c -o source -L/usr/X11R6/lib -lX11 -lXtst
 
> Why do you want to do this? Maybe there is another way to accomplish 
> what you want.

I think using the XTest extension should be your second
thought too ;)

cu
Marcus
-- 
 Public Key available
 --------------------------------------------------------
 Marcus Schäfer (Res. & Dev.)  SuSE Linux AG
 Tel:  +49-911-740530          Schanzäckerstr. 10
 Fax:  +49-911-3206727         D-90443 Nuernberg
 WWW:  http://www.suse.de      Germany
 --------------------------------------------------------



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