Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!trwind!venice!baur From: baur@venice.SEDD.TRW.COM (Steven L. Baur) Newsgroups: comp.windows.x Subject: Re: ICCCM and colormaps---simple question Message-ID: <306@venice.SEDD.TRW.COM> Date: 14 Feb 90 00:01:36 GMT References: <9002130408.AA13069@ATHENA.MIT.EDU> Organization: TRW Systems Engineering & Development Division, Redondo Beach, CA Lines: 39 From article <9002130408.AA13069@ATHENA.MIT.EDU>, by kochhar@HARVARD.HARVARD.EDU: > ... I was also wondering; instead of having > the user specify that no window manager is running, is there a > way for the application to automatically detect that? For example, > twm seems to be able to detect that another window manager is > already running; Twm detects another window manager when calling XSelectInput on the root window. If this call fails, it assumes that another wm is there. (Only one client is allowed to select button press events on a window). Olwm does this too. Here is the code: (twm) RedirectError = FALSE; XSetErrorHandler(CatchRedirectError); XSelectInput(dpy, RootWindow (dpy, scrnum), ColormapChangeMask | EnterWindowMask | PropertyChangeMask | SubstructureRedirectMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); XSync(dpy, 0); XSetErrorHandler(TwmErrorHandler); (olwm) ErrorSensitive("Perhaps there is another window manager running?"); XSelectInput( DefDpy, RootWindow(DefDpy, DefScreen), KeyPressMask | SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | EnterWindowMask ); XSync(DefDpy, False); ErrorInsensitive(DefDpy); -- steve baur@venice.SEDD.TRW.COM A computer which cannot run GNU emacs is not worth using.