[comp.windows.news] psterm problems in OW2

laukee@canon.co.uk (David Lau-Kee) (08/15/90)

Any idea why psterm fails to grab and release focus properly in OW2?  

If you move into a psterm from the rootcanvas everything works ok.  
When you move back out again keyboard input is still grabbed by the psterm.
Moving into a shelltool resets things.

If you move into a psterm from a shelltool too quickly then the psterm grabs
input focus then releases it immediately.  A right-button press over the
psterm cures things.

Is someone doing something strange with enter/exit events?

David

ronin@ronin.Eng.Sun.COM (Brian Raymor - NeWS Toolkit) (08/17/90)

(David Lau-Kee) writes:

> Any idea why psterm fails to grab and release focus properly in OW2?  

The window manager (X11) and ClassFocus (PostScript) are fighting over
who gets to assign the input focus.  These two mechanisms use slightly
different notions of when to change focus.  In addition, sometimes a 
race condition occurs between the two.

This problem is new to OpenWindows Version 2 since Version 1 used pswm
rather than olwm.

>If you move into a psterm from the rootcanvas everything works ok.
> When you move back out again keyboard input is still grabbed by the psterm.
> Moving into a shelltool resets things.

The PostScript-based focus manager assigns focus *only* on ENTRY to a canvas.
The OpenLook Window Manager (olwm) assigns focus on ENTRY or EXIT from an
X11 window.  When you move out of an X11 window into the rootcanvas, olwm
considers only the EXIT event.  It does not observe the entry to the 
rootcanvas.  This works fine in a X11-only world; the focus is removed
from the X11 client due to the EXIT and ends up assigned to the root.

Now consider what happens when you move from a psterm canvas onto the root.
In OW1, pswm saw this as "entering the root" and reassigned focus to the root.
In OW2, the PostScript-based focus manager sees only the EXIT from psterm, and 
ignores it, and the X11 focus manager doesn't see any enter/exit for an X11
window, so it doesn't do anything either.  Result: Focus stays with psterm.

>If you move into a psterm from a shelltool too quickly then the psterm grabs
>input focus then releases it immediately.  A right-button press over the
>psterm cures things.

This is the aforementioned race condition.  X11 sees the exit from shelltool,
but since it can't "see" non-X11 canvases such as psterm, it thinks the mouse
moved into the root.  So it assigns the focus to the root.  Meanwhile, the 
PostScript-based focus manager sees the entry to psterm and assigns focus to 
psterm.  Even though the events are generated in that order, the X11 stuff 
tends to take longer to respond since it's in a different UNIX(TM) process, 
so the focus often gets reassigned to root AFTER it was assigned to psterm.

Both of these problems are a result of having two managers fighting over what
should be a single global resource (the focus).  Similar problems arise with
colormap focus etc.  The NeWS Toolkit and XView developers are working toward a
resolution of these problems for V3.


"as told to" :-)

Brian Raymor