You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Chris Bartlett (JIRA)" <ji...@apache.org> on 2011/07/20 14:17:57 UTC

[jira] [Commented] (PIVOT-720) Want keystrokes to go to the native OS window that has focus

    [ https://issues.apache.org/jira/browse/PIVOT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068312#comment-13068312 ] 

Chris Bartlett commented on PIVOT-720:
--------------------------------------

The thread in the description actually started out unrelated to this issue.  The relevant part of the discussion starts here.
http://apache-pivot-users.399431.n3.nabble.com/KeyListeners-on-ImageView-tp2600622p2622383.html


A quick (and hopefully accurate) summary of the current situation
Pivot currently tracks and exposes the focused org.apache.pivot.wtk.Component and active org.apache.pivot.wtk.Window via the following methods
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Component.html#getFocusedComponent()
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Window.html#getActiveWindow()
Pivot does not track or directly expose the state of any native OS windows that might house a org.apache.pivot.wtk.Display.

There can either be 0 or 1 focused Components at any given moment.
Likewise there can either be 0 or 1 active Windows at any given moment.
Both of these are independent of each other, and of which OS window might be 'active'.

This is the basic flow of Pivot's current keystroke dispatching
1) If there *is* a focused Component, the keystroke will be directed to it.
If this Component doesn't handle the keystroke, it will then directed to each of its ancestors until either the keystroke is handled or there are no more ancestors. (i.e. the org.apache.pivot.wtk.Display is the final Component to have its ComponentKeyListener called)
2) If there *isn't* a focused Component, the keystroke will be directed to application's Application.UnprocessedKeyHandler if it exists.


> Want keystrokes to go to the native OS window that has focus
> ------------------------------------------------------------
>
>                 Key: PIVOT-720
>                 URL: https://issues.apache.org/jira/browse/PIVOT-720
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>    Affects Versions: 2.0
>            Reporter: Bill van Melle
>             Fix For: 2.1
>
>
> If you use DesktopApplicationContext.createDisplay to create a new OS window, and you want to handle keystrokes sent to that window, the only way your key listener will get called is if there is a focused Pivot component in that window.  But not all interesting windows contain a focusable component, and even when they do, there are often good reasons not to focus a particular component by default.  Meanwhile, if Pivot's notion of the currently focused component is in a different OS window, keystrokes will go there, even though it's not the window that appears to the user to have focus (as judged by the native window system focus decoration), which is counterintuitive.
> There is extensive discussion at http://apache-pivot-users.399431.n3.nabble.com/KeyListeners-on-ImageView-td2600622.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira