Results 1 to 4 of 4
i wrote a program,it is an xlib program..
i want to catch the event regarding to a window like firefox that is running on the server and i got this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-16-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 14
problem in xlib programming
i wrote a program,it is an xlib program..
i want to catch the event regarding to a window like firefox that is running on the server and i got this error:
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Serial number of failed request: 11
Current serial number in output stream: 13
when i add this line to the code ,error occured:
this is a part of code:XSelectInput (display, w, ExposureMask | KeyPressMask | ButtonPressMask);
Window rt,pr;
Window *children_return;
unsigned int nofch;
int f=XQueryTree(display, DefaultRootWindow(display), &rt, &pr, &children_return, &nofch);
uint *array=(uint*)children_return;
uint k;
for (k = 0; k < nofch; k++)
{
//GET THE STATUS OF WINDOW
XWindowAttributes a;
XGetWindowAttributes(display, children_return[k], &a);
//printf("status:%d",a.map_state);
//GET THE WINDOW ID:
Window w = (Window) array[k];
char * name='\0';
int status =XFetchName(display,w,&name);
if (status>=Success&&a.map_state==2)
{
printf("Found %u: %u %s -- statuse=%d\n",k, w, name,a.map_state);
XSelectInput (display, w, ExposureMask | KeyPressMask | ButtonPressMask);
}
}
- 09-17-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,140
Are you running the xlib program in the same user account as Firefox? On the same machine where Firefox is being run (client machine), or (if they are different) on the X display server machine? You may need to make sure that your X display is the same as Firefox, and it is possible that you may need to run the xlib application as root in order to overcome the privacy/permissions issue that you have run into.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-17-2010 #3Just Joined!
- Join Date
- Sep 2010
- Posts
- 14
- 09-20-2010 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,140
The display is either set via the DISPLAY environment variable, or a command-line option to the program which in turn sets the DISPLAY environment inside the application. Normall this would be :0.0
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote

