Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!eng.sun.COM!smarks From: smarks@eng.sun.COM (Stuart Marks) Newsgroups: comp.windows.x Subject: Re: Help, I can't get input focus under olwm Message-ID: <9012180213.AA13153@trantor.Eng.Sun.COM> Date: 18 Dec 90 02:13:41 GMT References: <1990Dec13.221949.583@agate.berkeley.edu> Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 59 dc@caveat.berkeley.edu (Dave Cottingham) writes: Subject: Help, I can't get input focus under olwm I have run into a peculiar problem using my favorite X application, XCONQ, on my shiny new Sparcstation. I can't direct the input focus to XCONQ's window. This is the canonical problem where the client program has failed to set the "hints" on its window to tell the window manager that it is eligible to receive the input focus. There's a document called the ICCCM (Inter-Client Communication Conventions Manual) that is an X Consortium standard. (It's available on the X11R4 tape or via FTP from expo. It's also been reprinted in O'Reilly Volume 0 and in Scheifler/Gettys 2nd ed.) Among other things, this document explains that conforming programs must set certain properties on their top-level windows in order to inform the window manager about the program's resource requirements. One of these resources is the input focus. You've indicated that xconq is written entirely in Xlib. For Xlib programs, here's a way to set the proper hints to get the focus: #include XWMHints wmhints; /* ... */ wmhints.flags = InputHint; wmhints.input = True; XSetWMHints(dpy, win, &wmhints); /* ... */ XMapWindow(dpy, win); ... where "win" is a top-level window. You must do this for every top-level window, i.e. every non-override-redirect window that is a child of the root window. Could someone tell me how a window manager decides if a window should be allowed to take input focus? (yes, I'm that clueless) First, the window manager reads the hints the client has set on the window. These hints determine the way the focus is actually set to the window (e.g. the WM sets the focus to the window, or the WM asks the client to take the focus). This stuff is explained in the ICCCM. Now, the user interface for moving the focus around is part of window manager policy. Olwm, for instance, gives you a choice of two focus policies: "click-to-type" mode, where you must click in a window or its header to transfer the focus there, or "follow-mouse", where moving the pointer into a window transfers the focus there. Other window managers may have other user interfaces for moving the focus from window to window. s'marks Stuart W. Marks ARPA: smarks@eng.sun.com Windows & Graphics Software UUCP: sun!smarks Sun Microsystems, Inc.