You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Erik Innocent <ei...@gmail.com> on 2013/08/28 01:46:53 UTC

Re: How to make UnprocessedKeyHandler function in fullscreen mode?

Update: I'm now using 2.0.3, and I'm still encountering this issue with the
Mac. But on both Raspian and Windows 8, the key presses are captured.

Cheers,
--E



On Fri, Jul 19, 2013 at 6:48 PM, Erik Innocent <ei...@gmail.com> wrote:

> Yeah, I've got the source in Eclipse (w00t Maven). I just ran a debug
> session with fullscreen activated and deactivated, and when deactivated the
> debug cursor makes it to my breakpoint at line 1306 (which for me is the
> line "if (dragDescendant == null) {" from your example in your last
> email), but with fullscreen the cursor never makes it there. I do however
> get the sound of the basic error bell upon each key press when in
> fullscreen mode -- the same bell as you might hear in a terminal window
> when pressing an invalid key.
>
> Note also that I cannot do an alt-tab to verify that the application is
> indeed in the foreground, but I clicked on it with the mouse to help make
> sure. I suppose I could try adding a mouse-click listener if you think that
> route (the application not having true focus) bears investigation.
>
> Thanks again for the prompt replies, I truly appreciate it.
>
> HTH,
> --E
>
>
> On Fri, Jul 19, 2013 at 6:30 PM, Roger L. Whitcomb <
> Roger.Whitcomb@actian.com> wrote:
>
>> Okay, then I have a couple more questions:****
>>
>> **·         **Do you have the capability to debug Pivot code itself?
>> (that is, do you have the source downloaded, and setup in Eclipse or
>> whatever IDE you are using?)****
>>
>> **·         **Or can you build the Pivot source with some debugging
>> print statements?  ****
>>
>> ** **
>>
>> Because if either one, it would be good to see if the key events even
>> make it into this code in ApplicationContext.java: 1291 and following, and
>> if so, what is preventing the UnprocessedKeyHandler from being called.
>> Basically this is the logic (for all three events):****
>>
>>             if (dragDescendant == null) {****
>>
>>                 // Process the event****
>>
>>                 Component focusedComponentLocal =
>> Component.getFocusedComponent();****
>>
>> ** **
>>
>> . . .****
>>
>>                         try {****
>>
>>                             if (focusedComponentLocal == null) {****
>>
>>                                 for (Application application :
>> applications) {****
>>
>>                                     if (application instanceof
>> Application.UnprocessedKeyHandler) {****
>>
>>                                         Application.UnprocessedKeyHandler
>> unprocessedKeyHandler =****
>>
>>
>> (Application.UnprocessedKeyHandler)application;****
>>
>>
>> unprocessedKeyHandler.keyPressed(keyCode, keyLocation);****
>>
>>                                     }****
>>
>>                                 }****
>>
>> ** **
>>
>> So, basically the “dragDescendant” could be non-null (doubtful), or the
>> “focusedComponentLocal” could be non-null (possible that fullscreen mode
>> puts focus somewhere we don’t expect).  But, I’m thinking it is more likely
>> more fundamental in that the key events are never even getting into this
>> code.****
>>
>> ** **
>>
>> (I’m like the teacher giving you the homework assignment ;) … I’m a
>> little busy right now, or I’d do these same tests myself.)****
>>
>> ** **
>>
>> Thanks,****
>>
>> ~Roger Whitcomb****
>>
>> ** **
>>
>> *From:* Erik Innocent [mailto:einnocent@gmail.com]
>> *Sent:* Friday, July 19, 2013 4:13 PM
>> *To:* user
>> *Subject:* Re: How to make UnprocessedKeyHandler function in fullscreen
>> mode?****
>>
>> ** **
>>
>> I just tried it again with output statements in keyPressed() and
>> keyReleased() and the problem still exists. Thank you so much for the
>> prompt reply! And you're welcome for the test case, I'm happy to provide
>> anything that makes it easier for us to get to the bottom of this =)****
>>
>> ** **
>>
>> Cheers,****
>>
>> --E****
>>
>> ** **
>>
>> On Fri, Jul 19, 2013 at 6:04 PM, Roger and Beth Whitcomb <
>> RogerandBeth@rbwhitcomb.com> wrote:****
>>
>> Hi Erik,
>>     I haven't tried your code yet, but I wonder if you get anything from
>> the "keyPressed" or "keyReleased" methods either?  I could imagine a
>> scenario in which the keystrokes were intercepted, but not translated to
>> keys....  Also, I will look at the ApplicationContext code where it
>> dispatches things to see if there is anything strange related to fullscreen
>> mode that might be going on.  Thanks for the test case.
>>
>> ~Roger Whitcomb****
>>
>> ** **
>>
>> On 7/19/13 3:58 PM, Erik Innocent wrote:****
>>
>> How can I make UnprocessedKeyHandler function in fullscreen mode? Which
>> is to say, unprocessed keys seem not to be detected in fullscreen mode. I
>> posted a simple example here: ****
>>
>> ** **
>>
>> https://gist.github.com/einnocent/6042931****
>>
>> ** **
>>
>> Uncomment the line w/ setFullScreen(true) to toggle back and forth
>> between starting in a window and fullscreen. When it works, you should be
>> able to press (pretty much) any key and see a log line printed to console.
>> Am I doing something wrong, or is this a bug?****
>>
>> ** **
>>
>> My versions: JRE 1.7.0_21; Mac OS X 10.6.8; Apache Pivot 2.0.2****
>>
>> ** **
>>
>> Thanks!****
>>
>> --E****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>
>

Re: How to make UnprocessedKeyHandler function in fullscreen mode?

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
Sounds like Mac has has some differences.  I remember seeing some 
Mac-specific flag setting, related to event processing, but I don't have 
the knowledge of what might be going wrong there.

But, that's where I'd start to look is in the way that flags are set for 
fullscreen mode and see if there might be something obvious there.

~Roger

On 8/27/13 4:46 PM, Erik Innocent wrote:
> Update: I'm now using 2.0.3, and I'm still encountering this issue 
> with the Mac. But on both Raspian and Windows 8, the key presses are 
> captured.
>
> Cheers,
> --E
>
>
>
> On Fri, Jul 19, 2013 at 6:48 PM, Erik Innocent <einnocent@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Yeah, I've got the source in Eclipse (w00t Maven). I just ran a
>     debug session with fullscreen activated and deactivated, and when
>     deactivated the debug cursor makes it to my breakpoint at line
>     1306 (which for me is the line "if(dragDescendant== null) {" from
>     your example in your last email), but with fullscreen the cursor
>     never makes it there. I do however get the sound of the basic
>     error bell upon each key press when in fullscreen mode -- the same
>     bell as you might hear in a terminal window when pressing an
>     invalid key.
>
>     Note also that I cannot do an alt-tab to verify that the
>     application is indeed in the foreground, but I clicked on it with
>     the mouse to help make sure. I suppose I could try adding a
>     mouse-click listener if you think that route (the application not
>     having true focus) bears investigation.
>
>     Thanks again for the prompt replies, I truly appreciate it.
>
>     HTH,
>     --E
>
>
>     On Fri, Jul 19, 2013 at 6:30 PM, Roger L. Whitcomb
>     <Roger.Whitcomb@actian.com <ma...@actian.com>> wrote:
>
>         Okay, then I have a couple more questions:
>
>         ·Do you have the capability to debug Pivot code itself? (that
>         is, do you have the source downloaded, and setup in Eclipse or
>         whatever IDE you are using?)
>
>         ·Or can you build the Pivot source with some debugging print
>         statements?
>
>         Because if either one, it would be good to see if the key
>         events even make it into this code in ApplicationContext.java:
>         1291 and following, and if so, what is preventing the
>         UnprocessedKeyHandler from being called.  Basically this is
>         the logic (for all three events):
>
>         if (dragDescendant == null) {
>
>         // Process the event
>
>         Component focusedComponentLocal = Component.getFocusedComponent();
>
>         . . .
>
>         try {
>
>         if (focusedComponentLocal == null) {
>
>         for (Application application : applications) {
>
>         if (application instanceof Application.UnprocessedKeyHandler) {
>
>         Application.UnprocessedKeyHandler unprocessedKeyHandler =
>
>         (Application.UnprocessedKeyHandler)application;
>
>         unprocessedKeyHandler.keyPressed(keyCode, keyLocation);
>
>                               }
>
>         }
>
>         So, basically the “dragDescendant” could be non-null
>         (doubtful), or the “focusedComponentLocal” could be non-null
>         (possible that fullscreen mode puts focus somewhere we don’t
>         expect).  But, I’m thinking it is more likely more fundamental
>         in that the key events are never even getting into this code.
>
>         (I’m like the teacher giving you the homework assignment ;) …
>         I’m a little busy right now, or I’d do these same tests myself.)
>
>         Thanks,
>
>         ~Roger Whitcomb
>
>         *From:*Erik Innocent [mailto:einnocent@gmail.com
>         <ma...@gmail.com>]
>         *Sent:* Friday, July 19, 2013 4:13 PM
>         *To:* user
>         *Subject:* Re: How to make UnprocessedKeyHandler function in
>         fullscreen mode?
>
>         I just tried it again with output statements in keyPressed()
>         and keyReleased() and the problem still exists. Thank you so
>         much for the prompt reply! And you're welcome for the test
>         case, I'm happy to provide anything that makes it easier for
>         us to get to the bottom of this =)
>
>         Cheers,
>
>         --E
>
>         On Fri, Jul 19, 2013 at 6:04 PM, Roger and Beth Whitcomb
>         <RogerandBeth@rbwhitcomb.com
>         <ma...@rbwhitcomb.com>> wrote:
>
>         Hi Erik,
>             I haven't tried your code yet, but I wonder if you get
>         anything from the "keyPressed" or "keyReleased" methods
>         either?  I could imagine a scenario in which the keystrokes
>         were intercepted, but not translated to keys.... Also, I will
>         look at the ApplicationContext code where it dispatches things
>         to see if there is anything strange related to fullscreen mode
>         that might be going on.  Thanks for the test case.
>
>         ~Roger Whitcomb
>
>         On 7/19/13 3:58 PM, Erik Innocent wrote:
>
>             How can I make UnprocessedKeyHandler function in
>             fullscreen mode? Which is to say, unprocessed keys seem
>             not to be detected in fullscreen mode. I posted a simple
>             example here:
>
>             https://gist.github.com/einnocent/6042931
>
>             Uncomment the line w/ setFullScreen(true) to toggle back
>             and forth between starting in a window and fullscreen.
>             When it works, you should be able to press (pretty much)
>             any key and see a log line printed to console. Am I doing
>             something wrong, or is this a bug?
>
>             My versions: JRE 1.7.0_21; Mac OS X 10.6.8; Apache Pivot 2.0.2
>
>             Thanks!
>
>             --E
>
>
>