jalred.ElSegundo@XEROX.COM (02/28/90)
I have a widget for which I would like to receive VisibilityNotify events. However, I seem to be unable to select those events. I retrieve the current event mask of the window using XtBuildEventMask, OR in VisibilityChangeMask, and then set the event mask using XSelectInput. This doesn't seem to work. If I get the new event mask after I XSelectInput, it is set to the original event mask (the mask which was being used before I attempted to change it). So what's the scoop? Am I attempting to misuse XSelectInput? My configuration is SunSS1, SunOS4.0.3, X11R4, no fixes applied. My code is below: windowData.topLevel is a widget, created (before the XSelectInput call) by: windowData.topLevel = XtInitialize("top", "Tool", NULL, 0, &argc, argv); EventMask eventMask, newEventMask; Display *myDisplay; Window myWindow; myDisplay = XtDisplay(windowData.topLevel); myWindow = XtWindow(windowData.topLevel); eventMask = XtBuildEventMask(windowData.topLevel); printf("eventMask of topLevel = %x\n",eventMask); newEventMask = eventMask | VisibilityChangeMask; printf("newEventMask = %x\n", newEventMask); XSelectInput(myDisplay, myWindow, newEventMask); eventMask = XtBuildEventMask(windowData.topLevel); printf("eventMask of topLevel = %x\n",eventMask); This is the output of the printf's: eventMask of topLevel = 220030 newEventMask = 230030 eventMask of topLevel = 220030 Looks like newEventMask is getting assigned correctly (eventMask | (1L<<16)), but not sticking. I'd appreciate any hints/solutions, Jim Alred <jalred.elsegundo@xerox.com>
klee@wsl.dec.com (Ken Lee) (03/02/90)
In article <900227-154552-595@Xerox>, jalred.ElSegundo@XEROX.COM writes: > I have a widget for which I would like to receive VisibilityNotify events. > However, I seem to be unable to select those events. I retrieve the current > event mask of the window using XtBuildEventMask, OR in VisibilityChangeMask, > and then set the event mask using XSelectInput. Because of the heirarchy of windows in your typical widget, XSelectInput is unlikely to generate useful results. You should use XtAddEventHandler or the translation manager instead. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@wsl.dec.com uucp: uunet!decwrl!klee
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (03/02/90)
> XSelectInput(myDisplay, myWindow, newEventMask);
Don't do that. Use XtAddEventHandler(). This function will select for
the event, and call the routine specified whenever that event is received.
Don't mix X Event handling with Xt Event handling, you will just get into
trouble.
Chris D. Peterson
MIT X Consortium
Net: kit@expo.lcs.mit.edu
Phone: (617) 253 - 9608
Address: MIT - Room NE43-213
chan@hpfcmgw.HP.COM (Chan Benson) (03/03/90)
I don't know. Looks like a job for XtAddEventHandler.