1
|
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js'
|
2
|
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2015-10-14 16:32:09 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js 2015-10-15 15:05:27 +0000
|
4
|
@@ -253,6 +253,10 @@
|
5
|
inputText.value = encodeURIComponent(text); // to escape "\n"
|
6
|
inputText.focus();
|
7
|
inputText.select();
|
8
|
+ var keyObj = p2j.keys_queue.pop();
|
9
|
+ var completed = (Date.now() - keyObj.startTime);
|
10
|
+ console.log("[" + keyObj.seq + "] " + String.fromCodePoint(keyObj.key) + " takes "
|
11
|
+ + (completed));
|
12
|
}
|
13
|
/**
|
14
|
* Check if a string is empty.
|
15
|
|
16
|
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js'
|
17
|
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js 2015-10-14 16:32:09 +0000
|
18
|
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js 2015-10-15 14:31:53 +0000
|
19
|
@@ -88,6 +88,9 @@
|
20
|
document.addEventListener('keydown', keyboardReader.onkeydown, true);
|
21
|
document.addEventListener('keypress', keyboardReader.onkeypress, true);
|
22
|
document.addEventListener('keyup', keyboardReader.onkeyup, true);
|
23
|
+ var sequence = 0;
|
24
|
+ p2j.keys_queue = [];
|
25
|
+ p2j.keys_sequence = function() { return ++sequence;};
|
26
|
};
|
27
|
|
28
|
/**
|
29
|
@@ -209,6 +212,12 @@
|
30
|
return;
|
31
|
}
|
32
|
}
|
33
|
+ p2j.keys_queue.push(
|
34
|
+ {
|
35
|
+ key : key,
|
36
|
+ startTime : Date.now(),
|
37
|
+ seq : p2j.keys_sequence()
|
38
|
+ });
|
39
|
sendKeyCode(key);
|
40
|
|
41
|
evt.preventDefault();
|
42
|
|
43
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java'
|
44
|
--- src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2015-10-14 16:32:09 +0000
|
45
|
+++ src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java 2015-10-15 14:38:37 +0000
|
46
|
@@ -198,7 +198,7 @@
|
47
|
public void processKeyEvent(KeyInput ke)
|
48
|
{
|
49
|
int key = ke.actionCode();
|
50
|
-
|
51
|
+ gd.setCurrentSelection(String.valueOf(ke.keyChar()));
|
52
|
boolean invalidateSelection = true;
|
53
|
NativePoint prevCaret = new NativePoint(absoluteX(), absoluteY());
|
54
|
boolean setSelEnd = false;
|
55
|
|
56
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java'
|
57
|
--- src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java 2015-09-29 14:43:06 +0000
|
58
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/EmulatedWindowState.java 2015-10-15 15:42:35 +0000
|
59
|
@@ -429,7 +429,7 @@
|
60
|
{
|
61
|
int waitForBatch = 0;
|
62
|
|
63
|
- System.err.println("START DRAWING CYCLE FOR WINDOW " + windowId);
|
64
|
+ //System.err.println("START DRAWING CYCLE FOR WINDOW " + windowId);
|
65
|
|
66
|
while (!graphicPool.isEmpty() || waitForBatch != 0)
|
67
|
{
|
68
|
@@ -555,7 +555,7 @@
|
69
|
break;
|
70
|
}
|
71
|
|
72
|
- System.err.printf("PaintPrimitives.%s %s\n", ps.id.toString(), extra);
|
73
|
+ //System.err.printf("PaintPrimitives.%s %s\n", ps.id.toString(), extra);
|
74
|
|
75
|
switch (ps.id)
|
76
|
{
|
77
|
@@ -580,7 +580,7 @@
|
78
|
|
79
|
flush();
|
80
|
|
81
|
- System.err.println("END DRAWING CYCLE FOR WINDOW " + windowId);
|
82
|
+ //System.err.println("END DRAWING CYCLE FOR WINDOW " + windowId);
|
83
|
}
|
84
|
}
|
85
|
}
|
86
|
|
87
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java'
|
88
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2015-10-14 16:32:09 +0000
|
89
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java 2015-10-15 15:37:20 +0000
|
90
|
@@ -36,7 +36,8 @@
|
91
|
import java.awt.Component;
|
92
|
import java.awt.event.MouseEvent;
|
93
|
import java.awt.event.MouseWheelEvent;
|
94
|
-
|
95
|
+import java.util.concurrent.ConcurrentLinkedQueue;
|
96
|
+import java.util.concurrent.atomic.AtomicInteger;
|
97
|
// don't import the entire logging package as it has naming conflicts with jetty
|
98
|
import java.util.logging.Level;
|
99
|
import java.util.logging.Logger;
|
100
|
@@ -139,6 +140,24 @@
|
101
|
*/
|
102
|
private LinkedList<GuiWebEmulatedWindow> repaints = new LinkedList<>();
|
103
|
|
104
|
+ private static final AtomicInteger KEYS_SEQ = new AtomicInteger(0);
|
105
|
+ static class KeyWrapper
|
106
|
+ {
|
107
|
+ int key;
|
108
|
+ long start;
|
109
|
+ int seq;
|
110
|
+ /**
|
111
|
+ * @param key
|
112
|
+ */
|
113
|
+ public KeyWrapper(int key)
|
114
|
+ {
|
115
|
+ this.key = key;
|
116
|
+ this.start = System.currentTimeMillis();
|
117
|
+ this.seq = KEYS_SEQ.incrementAndGet();
|
118
|
+ }
|
119
|
+
|
120
|
+ }
|
121
|
+ private static final Queue<KeyWrapper> keys_queue = new ConcurrentLinkedQueue<KeyWrapper>();
|
122
|
/**
|
123
|
* Constructor.
|
124
|
*
|
125
|
@@ -395,7 +414,9 @@
|
126
|
@Override
|
127
|
public int readKey()
|
128
|
{
|
129
|
- return websock.readKey();
|
130
|
+ int key = websock.readKey();
|
131
|
+ keys_queue.add(new KeyWrapper(key));
|
132
|
+ return key;
|
133
|
}
|
134
|
|
135
|
/**
|
136
|
@@ -1216,6 +1237,12 @@
|
137
|
@Override
|
138
|
public void setCurrentSelection(String txt)
|
139
|
{
|
140
|
+ KeyWrapper keyObj = keys_queue.poll();
|
141
|
+ if (keyObj != null)
|
142
|
+ {
|
143
|
+ long completed = System.currentTimeMillis() - keyObj.start;
|
144
|
+ System.err.println("[" + keyObj.seq + "] " + keyObj.key + " takes " + completed);
|
145
|
+ }
|
146
|
websock.setSelection(txt);
|
147
|
}
|
148
|
}
|
149
|
|