Discussion:
Xlib question
(too old to reply)
Julian Bradfield
2011-09-20 09:01:05 UTC
Permalink
user to click on a window which my program will then identify. I know
I can used XQueryTree to get the list of windows then call XGetWindowAttributes
on each of them to see which one the mouse pointer is in, but what I can't
figure out is how to tell if a window is occluded by another window. The
Isn't the window in the button event?

Have a look at the code in xkill !
b***@boltar.world
2011-09-20 09:46:55 UTC
Permalink
On Tue, 20 Sep 2011 09:01:05 +0000 (UTC)
user to click on a window which my program will then identify. I know
I can used XQueryTree to get the list of windows then call
XGetWindowAttributes
on each of them to see which one the mouse pointer is in, but what I can't
figure out is how to tell if a window is occluded by another window. The
Isn't the window in the button event?
No, it just gives you the root window id. Using KDE anyway.
Have a look at the code in xkill !
I can't find it. Got a URL?

Cheers

B2003
Julian Bradfield
2011-09-20 10:01:42 UTC
Permalink
Post by b***@boltar.world
Post by Julian Bradfield
Have a look at the code in xkill !
I can't find it. Got a URL?
Google xkill source
and take the first hit.
Single Stage to Orbit
2011-09-20 10:03:04 UTC
Permalink
Post by b***@boltar.world
On Tue, 20 Sep 2011 09:01:05 +0000 (UTC)
user to click on a window which my program will then identify. I know
I can used XQueryTree to get the list of windows then call
XGetWindowAttributes
on each of them to see which one the mouse pointer is in, but what I can't
figure out is how to tell if a window is occluded by another window. The
Isn't the window in the button event?
No, it just gives you the root window id. Using KDE anyway.
Have a look at the code in xkill !
I can't find it. Got a URL?
Look for xkill:
http://xorg.freedesktop.org/
--
Tactical Nuclear Kittens
Nobody
2011-09-20 13:35:33 UTC
Permalink
Post by b***@boltar.world
user to click on a window which my program will then identify. I know
I can used XQueryTree to get the list of windows then call
XGetWindowAttributes
on each of them to see which one the mouse pointer is in, but what I can't
figure out is how to tell if a window is occluded by another window. The
Isn't the window in the button event?
No, it just gives you the root window id. Using KDE anyway.
Which field are you looking at? It should be in event.xbutton.subwindow.
Post by b***@boltar.world
Have a look at the code in xkill !
I can't find it. Got a URL?
Here is the "meat" of the code from xkill-1.0.3:

if (XGrabPointer (dpy, root, False, MASK, GrabModeSync, GrabModeAsync,
None, cursor, CurrentTime) != GrabSuccess) {
fprintf (stderr, "%s: unable to grab cursor\n", ProgramName);
Exit (1);
}

/* from dsimple.c in xwininfo */
while (retwin == None || pressed != 0) {
XEvent event;

XAllowEvents (dpy, SyncPointer, CurrentTime);
XWindowEvent (dpy, root, MASK, &event);
switch (event.type) {
case ButtonPress:
if (retwin == None) {
retbutton = event.xbutton.button;
retwin = ((event.xbutton.subwindow != None) ?
event.xbutton.subwindow : root);
}
pressed++;
continue;
case ButtonRelease:
if (pressed > 0) pressed--;
continue;
} /* end switch */
} /* end for */
William Ahern
2011-09-20 22:00:42 UTC
Permalink
Post by b***@boltar.world
On Tue, 20 Sep 2011 09:01:05 +0000 (UTC)
user to click on a window which my program will then identify. I know
I can used XQueryTree to get the list of windows then call
XGetWindowAttributes
on each of them to see which one the mouse pointer is in, but what I can't
figure out is how to tell if a window is occluded by another window. The
Isn't the window in the button event?
No, it just gives you the root window id. Using KDE anyway.
Have a look at the code in xkill !
I can't find it. Got a URL?
http://google.com/codesearch#search/&q=xkill&type=cs

Loading...