Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Problems with AWT input on Linux  (Read 941 times)
0 Members and 1 Guest are viewing this topic.
Offline Marvin Fröhlich

Senior Devvie




May the 4th, be with you...


« Posted 2006-08-23 23:26:24 »

hi

I've problems with repeated "keyPressed" and "keyReleased" events from the AWT event queue. When a key (all except modifyers) is held, the "keyPressed" event is not fired only once and the "keyReleased" event once with the physical key-releasement, but all three events pressed-typed-released-pressed-typed-released are continousely fired in that order.

I emailed with Will on this topic and want to make the discussion public. Here is the last message I sent to Will:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
Hi, Will

I searched the internet once more for this problem, and found some posts
telling this is a Java+Linux issue, which exists for a very long time
and has never been fixed :(

This is the output of a program printing out a line from keypressed and
keyreleased:

##################################
down: 70 (1156373986543)
up: 70 (1156373986796)
down: 70 (1156373986796)
up: 70 (1156373986832)
down: 70 (1156373986832)
up: 70 (1156373986865)
down: 70 (1156373986865)
up: 70 (1156373986900)
down: 70 (1156373986900)
up: 70 (1156373986936)
down: 70 (1156373986936)
up: 70 (1156373986972)
...
...
...
down: 70 (1156373986936)
up: 70 (1156373986972)
##################################

The value in brackets is the result of e.getWhen(), which is the timestamp
of the event. As you can see the timestamp of a "down" event following
an "up" event being produced by auto-repeat is always equal.


There're three workarounds for it. But none of them is perfect:

1. Delay the event dispatching and ignore two events being in a quantum.
--> This is the worst workaround and is absolutely useless in my opinion.

2. Check the platform type and in case of linux do a system call
   "xset r off", which disables auto-repeat (system-wide).
--> This is better but not usable, too, sice it acts system-wide and
    blocks the possibility to make use of auto-repeat.

3. Monitor the timestamps of the events and simply ignore events with equal
   timestamps.
--> This is the way I would prefer to go. But I don't have an idea how

    to accomplish this. If I waited for the next "down" event to check the
    timestamp, the up event could get missing.

Without a solution for this problem, keyboard input is not usable for games
on Linux. This is not an option, since one of the biggest xith's targets
are games.

Do you have an idea? I'
ll paste this into a new thread in the xith-forum.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (22 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (69 views)
2014-11-07 19:57:14
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!