GTK has an internal call path for "get the window under the cursor". This gets called rather more than you might expect, for things like tooltip selection and positioning. It's implemented with a server grab around a chain of XQueryPointer calls; details, for the curious:
http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkwindow-x11.c#n3216 Now the server grab here is a little misguided, since it will not in fact hold the cursor still. It _will_ keep the window hierarchy stable, but that's not the same thing. Regardless, what the toolkit is actually looking for here is a single request to give a snapshot of cursor containment. If we had that, we wouldn't need the grab, and we'd be robust in the face of cursor motion. And the grab is really quite impolite when the client is remote. X has this information already, trivially. The sprite trace already contains the cursor window and its parentage. This even works naïvely for XI2, PickPointer() will do the same thing for FixesQueryPointer as for the core request. It might be worth extending this to arbitrary pointers? Feedback appreciated. While we're at it, we could extend this to QueryTree, so you can get the complete ancestry of any window. There _was_ a codepath in GTK that could make use of this feature, but it seems to have been obviated by the client-side windows change. It'd be trivial, so I went ahead and spec'd it, but I'm just as happy to leave it out on grounds of parsimony. I'm not aware of any other queries in X where we could eliminate grabs like this, but I didn't look especially hard. There are still a few cases in GTK and Qt where server grabs are required, but they seem to all be around XEMBED and XDND. It's not clear to me that the server could provide any additional atomicity to help with that, but, again, maybe there's something I'm not thinking of. - ajax _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
