nanogui: Support for on-screen keyboard
Subject:
Re: Support for on-screen keyboard
From:
Vidar Hokstad ####@####.####
Date:
15 May 1999 18:40:54 -0000
Message-Id: <Pine.LNX.4.10.9905152021440.2715-100000@a.ncg.net>
On Sat, 15 May 1999, Warner Losh wrote:
> In message ####@####.#### Vidar Hokstad writes:
> : With Alex' suggestion, it would be something like:
> :
> : windowid = GetLastFocusedWindow()
> : SendKeyEvent(...)
> :
> : I think Alex' suggestion is cleaner than mine, as it would work with any
> : widget set without modification.
>
> There is a race condition here. If the keyboard focus changes between
> the GetLastFocusedWindow and SendKeyEvent, then you can have
> problems.
>
> Why not just SendKeyEvent(...)? Maybe with a WindowID of 0 to mean
> current focus. That way there can be no race condition.
That complicates the server side implementation quite a bit, because you'd
have to make sure that nothing that happens in the on-screen keyboard
window changes focus - after all you wouldn't want the on-screen keyboard
to get the events. That was the entire point of splitting it into two
calls.
Besides, I don't think this would be a race condition:
- GetLastFocusedWindow() would be called on _each_ mouse-enter event
to the window.
- Events that would generate a SendKeyEvent() (button clicks in the
on-screen keyboard) can only happen between the mouse-enter and
the mouse-leave event, and any focus changes that happens then is
an internal matter for the on-screen keyboard. Those focuse changes
_should_ be ignored, which is why we do the GetLastFocusedWindow()
on mouse-enter, and not not right before SendKeyEvent()
- Other focus changes can only happen _after_ a mouse-leave, and then
they will be reflected by the GetLastFocusedWindow() that happens
when the pointer reenters the on-screen keyboard window.
Vidar Hokstad ####@####.####
Director of R&D, Screen Media AS