corbet@STOUT.ATD.UCAR.EDU (Jonathan Corbet) (09/14/90)
I have an interesting problem here. We have implemented our own "graphics widget" for the presentation of real time meteorological data. This widget is actually subclassed from "composite", since we want to be able to put other widgets inside it -- active objects on the screen, and so on. It's really simple, with the most permissive geometry manager possible. It works great, until... You see, some of these managed child widgets are Xaw menuButton widgets. And they work great. But, it is also desirable to have the mouse buttons do things in the basic graphics window, such as pop up a simpleMenu. I managed to create an action which will do that, once I've registered it with XtRegisterGrabAction. BUT, as soon as I do that, the menuButtons cease to work. The pointer events go right through them to the graphics widget. A little research found the problem: apparently it is not possible to put a passive pointer grab on a window if an ancester window has done such a grab. Thus, as soon as I ask for popup menus in my graphics widget, the menu buttons can't do their grabs any more, and thus break. My questions: 1) Why is this the case? What would be wrong with allowing passive grabs in children of other windows which have already established grabs? 2) Any suggestions as to how I could get around this one? Many thanks, Jonathan Corbet National Center for Atmospheric Research, Atmospheric Technology Division corbet@stout.atd.ucar.edu
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (09/14/90)
apparently it is not possible to put a passive pointer grab on a window if an ancester window has done such a grab. Incorrect. It is possible to put a passive grab there, but it is rather difficult to get it to activate. Because, passive grabs are processed top-down from the root, not bottom up. (I do not have the time to explain why this was done, or why it is an insufficiently general solution.) Any suggestions as to how I could get around this one? I don't really understand what effect you want, so it's hard to say. If the translations being used are disjoint (the graphics widget and the menu button can't both trigger off exactly the same button/modifier combination), Xt ought to "do the right thing" and there shouldn't be a problem. Of course, Xt has been known to have bugs... (Please don't mail directly back to me. :-)