Reputation: 123
So, I develop a small screenshot utility called Lookit, and I'm wanting to have the user be able to screenshot an entire window (currently entire screen and dragged rectangle capture are supported).
What I'm wondering is how to get the Window that the user clicks on so that I can find it's geometry and grab that section of the screen.
Any help is appreciated.
Thanks!
Upvotes: 2
Views: 1496
Reputation: 4292
Those windows belong to other processes, so you have to go through the windowing system. This is different for each platform, and AFAIK not abstracted by GDK.
On X11 you could use the python bindings to libwnck:
import wnck
screen = wnck.screen_get_default()
for window in reversed(screen.get_windows_stacked()):
if window.get_geometry() <matches your click coordinates>
Upvotes: 4