Issue 32853 - Order of "queued" css.awt.KeyEvents not FIFO
Summary: Order of "queued" css.awt.KeyEvents not FIFO
Status: CLOSED IRREPRODUCIBLE
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P4 Trivial
Target Milestone: ---
Assignee: stephan.wunderlich
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-11 15:57 UTC by f_specker
Modified: 2013-02-24 21:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Java Class implementing XKeyHandler (5.87 KB, text/plain)
2004-08-13 12:48 UTC, f_specker
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description f_specker 2004-08-11 15:57:57 UTC
Implementing a css.awt.XKeyHandler, if keyPressed() takes long enough,
succeeding KeyEvents are "queued" until the implementation is ready to process
them. However, this "queue" seems to be implemented as a stack or something
similar, as the KeyEvents don't get processed in their input order.

Situation: Java-App implementing XKeyHandler, with keyPressed() fast enough to
just allow for slow typing with processing of KeyEvents in order. Type faster in
OOo (slide finger across keyboard to be fast enough): 1234567890

Resulting order in Java-App:
Try 1: 1276543098
Try 2: 1876543209
Try 3: 1098765432

As a workaround in the Java-App, one could write the KeyEvents into a queue, and
process them in another thread. Would be nice though to receive the KeyEvents in
order from the beginning :-)

Tested with OOo 1.1.2 on WinXP SP2, with J2SDK 1.4.2_03.
Comment 1 stephan.wunderlich 2004-08-13 11:35:33 UTC
SW->f_specker: I just tried the following:
Dim returnValue as String

sub main
	toolkit = createUnoService("com.sun.star.awt.Toolkit")
	keyhandler = createUnoListener("CB_", "com.sun.star.awt.XKeyHandler")
	returnValue=""
	toolkit.addKeyHandler(keyhandler)
	wait 2000
	toolkit.removeKeyHandler(keyhandler)
	msgbox returnValue	
end sub

sub CB_keyPressed(event as Object)
	returnValue = returnValue + event.keychar
end sub

sub CB_keyReleased(event as Object)

end sub

and it works as expected. Can you provide a java-application which demonstrates
the behaviour you describe ?
Comment 2 f_specker 2004-08-13 12:48:02 UTC
Created attachment 17126 [details]
Java Class implementing XKeyHandler
Comment 3 f_specker 2004-08-13 12:48:19 UTC
SW, I have to apologize, the order of the KeyEvents is correct. I thought it
wasn't because I constructed the String out of the KeyEvents based on the
position where the KeyEvents occurred (relative to the document beginning; s.
attached java file).
But the position is only correct if there are no more KeyEvents waiting to be
processed. Also, the typed Characters only get displayed after all waiting
KeyEvents have been processed. So i _guess_ that is the actual problem, since I
calculate the position out of the information the XTextViewCursor supplies (I
know, the way I calculate the position is an ugly hack, but it's the only way I
could get it working... alternatives are welcome :-).

Sorry again I filed the issue before tracing the root of the problem.
Comment 4 stephan.wunderlich 2004-08-16 13:23:46 UTC
SW->f_specker : I just ran you java-program and it also delivers me the pressed
keys in the right sequence ... well so far I can't reproduce the described
behaviour :-( ... I wonder why you catch every key event from the client side.
Since the OOo-files are xml-files and with that "pure-text" why don't you
implement a 'send' button and use a cvs-like server-side backend to do the merge ?
Comment 5 f_specker 2004-08-16 13:38:02 UTC
I need to do it that way for a proof-of-concept for using OOo as a client for a
(real-time) collaborative editing system (-> issue 32784). I filed this issue
because it makes fast typing impossible in my case; for my proof-of-concept,
this is acceptable, but I thought there might be others having the same problem.
If it is not reproducable on other configurations, then forget about it.
Comment 6 stephan.wunderlich 2004-08-17 10:58:26 UTC
works for me
Comment 7 stephan.wunderlich 2004-08-17 10:59:16 UTC
not reproducible => closed