diamant@hpfclp.SDE.HP.COM (John Diamant) (05/05/88)
I would like to set up an event handler for an event on a window that is not associated with a widget. I know I could replace XtMainLoop with my own loop including a handler for that event, but that is ugly. Also, I am trying to hide this code in a library, so requiring all users of the library to call something other than XtMainLoop is less than satisfying. From reading both the Toolkit code and the documentation on this subject, it appears that the only cases in which the Toolkit will dispatch on an event not tied to a widget is either an input or timer event or a grab to be sent to a modal cascade of spring_loaded widgets. None of these sound like they will do what I want. Specifically, what I want to do is pay attention to changes in the RESOURCE_MANAGER property on the root window in order to update my resources and state variables when it changes, though this is just an example of the type of thing I'm talking about. I would like to register an event handler on PropertyChangeMask, but can't because there is no widget associated with the root window. It seems to me that Toolkit based window managers would run into similar problems. Is there some way to do this with the current Toolkit? Would adding support for this type of callback be reasonable? This would require storing the list of callbacks in some global place since they are normally looked up on the widget associated with the window that got the event. By the way, I'm using X11R2 on an HP 9000/350. It appears that there are several types of Event Handler / Callbacks in the Toolkit, and what I'm interested in would require even another one. It occurs to me that maybe the approach here is wrong and that it would be possible to generalize this back down to one or two types of handlers, though I don't have a specific proposal to do that. The types of handlers/callbacks I have found are: 1) Event Handlers 2) Callbacks 3) Input Handlers 4) Timer Handlers 5) Event handlers on non-widgets (my addition) 6) Application specific handlers built into other handlers (such as a dispatcher built into an Input Handler to dispatch on different functions depending on the type of input). Thanks in advance, John Diamant Software Development Environments Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant