Get an X window ID

eberrocal at laurel.datsi.fi.upm.es eberrocal at laurel.datsi.fi.upm.es
Fri May 18 05:20:28 PDT 2007


Hi all.

First, Thanks for your requests.

Second, I am going to put a code where you can see what I am pretending.

----------------------------
pid = fork();

switch(pid)
{
	case 0:
		if (execl("./myXapplication","./myXapplication","param",NULL) < 0)
			perror("execl");
		break;
	case -1:
		fprintf(stderr,"Error during the process of fork()\n");
		break;
	default:
	// I am going to listen for the event number 16 (CreateNotify)

		while (!XCheckTypedEvent(display,16,&event));

		anyevent = event.xany;
		win_id = anyevent.window;
		fprintf(stdout, "The window have this ID: %x\n",win_id);

		// wait for the son
		while (pid != wait(NULL));
		fprintf(stdout, "Execution finished\n");
}

----------------------------

The problem is that XCheckTypedEvent() can not capture the event
CreateNotify for the window that create myXapplication.

Really, XCheckTypedEvent() can not capture any CreateNotify event. When
this program is running I open windows but the function do not capture
nothing.

Any Idea?.

Thanks.

Edu.




More information about the xorg mailing list