Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: 1 [2]

Author Topic: KeyPress stops being detected after 15-30 seconds  (Read 2021 times)

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #15 on: October 19, 2011, 01:19:09 AM »

Yes, of course. Without losing focus it works fine. But non-exclusive input is essential for me.

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #16 on: October 19, 2011, 06:12:22 PM »

Well, I have one possible test you can make to see if it fixes your issue (not a fix, but a quick test). Modify:
inline bool _isKeyRepeat(XEvent &event) in LinuxKeyboard.h to always return false. ie comment out everything and just return.

I'm thinking that maybe the XNextEvent is getting confused and removing the key press event. Though, doesn't seem possible. It would probably also be good to add logging in LinuxKeybaord.cpp, in capture(). Add:

printf("Key: %i Type: %i", event.xkey, event.type);

right after XNextEvent(display, &event);.


Hopefully, this will gather more insight... with the is repeat removed, you will get multiple pressed/released calls for auto repeat... though, I don't think you will see that anyway, as you are not holding keys down for this test. And if we still do not see the pressed event coming, that would indicate X11 is not giving s that anymore for some odd reason.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #17 on: October 22, 2011, 05:47:08 AM »

I get the following output: http://pastie.org/pastes/2740423/text
For the first 30 seconds, the Type stays constant, then it starts to change. I wonder what it means.

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #18 on: October 23, 2011, 04:40:59 PM »

I think the printf statement I gave you produces some odd events (acts oddly here). You should be seeing 2 and 3 for pressed and released. Try using:
printf("KeyEvent %i\n", event.type);

Instead. To just printout the event type. If it is changing from something other then 2 or 3, it will help to know what it is. The numbers can be found in /usr/include/XLL/X.h
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #19 on: October 25, 2011, 04:04:42 AM »

Erm. I didn't really get what I should do. Just print event.type? It's already printed in the output I gave, so nothing changes after excluding excessive key output.
As for X.h, there's no mentioning of 42561760 and 42553600.
What should I do?

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #20 on: October 25, 2011, 07:05:19 PM »

If you notice, it is printing out less. Those numbers are not right, and it has something to do with printing out the other value. So just printout one and you should get better results.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #21 on: October 26, 2011, 03:54:22 AM »

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #22 on: October 26, 2011, 07:04:06 PM »

Cool, that output looks much better (the 2 right before a press and 3 right before release). But I don't see any of the missing keypresses in this one. I'm really curious to see what is coming in when it is messed up.

Also, make sure you have removed the code I mention as well about auto repeat checking. If you can get it to miss keypresses again like this, we should see exactly why.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #23 on: October 28, 2011, 04:09:03 AM »

Sorry, what should I do exactly?

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #24 on: October 28, 2011, 07:14:08 AM »

With this logging you need to reproduce the issue. I didn't see it happen in the last dump you posted.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #25 on: October 29, 2011, 01:22:13 AM »

You mean I should uncomment what I've commented?

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #26 on: November 01, 2011, 05:55:04 AM »

What you need to do is:
* Have the logging you currently have there
* Remove or keep removed the key repeat function I listed earlier
* Reproduce the issue and post the relevant section of log that shows the event code where you are only seeing keyreleases.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #27 on: November 01, 2011, 08:04:27 AM »

I've rerun my example with the commented code, and there's no problem.
I've uncommented it and rerun my example, here's the output: http://pastie.org/pastes/2794065/text
So it is this function that causes some sort of wrong behaviour.

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: KeyPress stops being detected after 15-30 seconds
« Reply #28 on: November 05, 2011, 05:50:16 PM »

Hmm, I'm not sure why that function is gobbling up all the keypresses after some point (and how alt-tab seems to be at play), but that is definitely what appears to be happening. I'll try to examine that piece of code more (it was a patch created from someone else) and look for some fix.
Logged

kornerr

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 37
    • View Profile
    • Opensource Game Studio
Re: KeyPress stops being detected after 15-30 seconds
« Reply #29 on: November 05, 2011, 08:59:33 PM »

Thanks. I can only assure that the 1.2 version behaviour worked for me fine.
Pages: 1 [2]