[comp.windows.x] Help, I can't get input focus under olwm

dc@caveat.berkeley.edu (Dave Cottingham) (12/14/90)

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 true whether the client is running on the
Sparcstation or elsewhere (like the VAX downstairs), and the client
works fine when the window is on any other server I've tried.  Can
anyone give a hint what the problem is?  Anyone seen this before?
Could someone tell me how a window manager decides if a window should
be allowed to take input focus? (yes, I'm that clueless)

The machine:			SUN Sparcstation 1+
OS:				SUN OS 4.1
Brand of X:			Open Windows 2.0
Window manager:			olwm
Widget libs used by client:	NONE

Any clues most appreciated.

 - Dave Cottingham
   dc@caveat.berkeley.edu

boyter@bimbo.uucp (Maj Brian Boyter) (12/15/90)

dc@caveat.berkeley.edu (Dave Cottingham) writes:
>XCONQ, on my shiny new Sparcstation.  I can't direct the input focus

Dave...
Here's something to try...
In your .Xdefaults put a line like:
OpenwindowsFocusLenience: True

I'm working from memory since I'm at home and not at work....
This "feature" can be found in one of the man pages (try man xnews,
man olwm, man openwin, etc, and look for FocusLenience)....

Brian

-- 
---------------------------------------------------------------
   Maj. Brian A Boyter
   US Army Foreign Science & Technology Center
   Charlottesville, Va 22901                         __
   off: (804)980-7362                              (    )
   home:     973-9440                             {      }
                                                   (    )
   boyter@fstc-chville.army.mil                      ||
                                                     ||
   Just say glow......                       _______<  >_______

igl@ecs.soton.ac.uk (Ian Glendinning) (12/18/90)

In <1990Dec13.221949.583@agate.berkeley.edu> dc@caveat.berkeley.edu (Dave Cottingham) writes:

>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 true whether the client is running on the
>Sparcstation or elsewhere (like the VAX downstairs), and the client
>works fine when the window is on any other server I've tried.  Can
>anyone give a hint what the problem is?  Anyone seen this before?
>Could someone tell me how a window manager decides if a window should
>be allowed to take input focus? (yes, I'm that clueless)

Try putting the line:

OpenWindows.FocusLenience: true

in your .Xdefaults file.  I had a similar problem running a program on
my SPARC station under openwindows, which worked fine under other
versions of X.  Local experts informed me that the problem is most
likely to do with not enforcing the ICCCM requirement that windows
must have the input hint set in order to receive the focus.
Apparently, many X11R3 clients don't bother to set this hint.  Hope
this helps.
    Ian
--
I.Glendinning@ecs.soton.ac.uk        Ian Glendinning
Tel: +44 703 593081                  Electronics and Computer Science
Fax: +44 703 593045                  University of Southampton SO9 5NH England

smarks@eng.sun.COM (Stuart Marks) (12/18/90)

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 <X11/Xutil.h>
    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.

bill@polygen.uucp (Bill Poitras) (12/20/90)

In article <9012180213.AA13153@trantor.Eng.Sun.COM> smarks@eng.sun.COM (Stuart Marks) writes:
>
>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
[stuff deleted]

I have found this is not necessarily true.  I have an application that
does set the hint, and it does work under TWM, but when run under olwm on
a X11R4 server (my client is an X11R4 program), unless the user set the
'FocusLenience' hint, our windows cannot get input focus.  I have seen
many people post "I can't get input focus under olwm", and suspect it may
be an obscure problem with olwm.  I don't have olwm, so I can't do the
testing.

+-----------------+---------------------------+-----------------------------+
| Bill Poitras    | Polygen Corporation       | {princeton mit-eddie        |
|     (bill)      | Waltham, MA USA           |  bu sunne}!polygen!bill     |
|                 |                           | bill@polygen.com            |
+-----------------+---------------------------+-----------------------------+