[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: X Event Capturing
Hello! I have attached the event capturer function. As I mentioned already, it works fine, without (XNextEvent) obstructing any application.
My problem is when I move the mouse pointer from the text area of a window (like kwrite) to the top of an icon (like "save" or "open") in that window, I get a "Focusout" event for kwrite, but no event to suggest the destination icon. How do I decode the destination?
Similarly, when I press any shortcut key (like Ctrl S to save), or any key for that matter (when within an editor), nothing gets recorded.
Waiting for a reply,
- Karthika
_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com
This function will be called for every window (w), passing a pointer to a data structure
that stores information about w & its related events.
evmon (Window w,struct winev **root)
{
int i;
XSetWindowAttributes attr;
XWindowAttributes wattr;
unsigned long mask = 0L;
int done, qlength;
XEvent event;
/* select for all events */
attr.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask |
Button1MotionMask |
Button2MotionMask | Button3MotionMask |
Button4MotionMask | Button5MotionMask |
ButtonMotionMask | KeymapStateMask |
ExposureMask | VisibilityChangeMask |
StructureNotifyMask | /* ResizeRedirectMask | */
SubstructureNotifyMask | SubstructureRedirectMask |
FocusChangeMask | PropertyChangeMask |
ColormapChangeMask | OwnerGrabButtonMask;
if (w)
{
XGetWindowAttributes(dpy, w, &wattr);
if (wattr.all_event_masks & ButtonPressMask)
attr.event_mask &= ~ButtonPressMask;
attr.event_mask &= ~SubstructureRedirectMask;
XSelectInput(dpy, w, attr.event_mask);
}
for (done = 0;done<1;done++)
{
/* tried for various final values of done */
node1=(struct winev *)malloc(sizeof(struct winev));
if (node1 == NULL)
perror("File singlea.c; function evmon:");
node1->next1=NULL;
qlength = QLength(dpy);
if (qlength == 0)
{
printf("queue length = 0\n");
sleep(1);
break;
}
/* If no event has occurred, quit for loop, as XNextevent *blocks*
until an event occurs. */
XNextEvent (dpy, &event); /* Should it be XPeekEvent ? */
switch (event.type)
{
case KeyPress:
...
} /* end of switch-case */
inserev(&(*root),&node1);
} /* end of for loop */
} /* end of function */