]>
Commit | Line | Data |
---|---|---|
802fe47e DM |
1 | Sources found at http://dogfeathers.com/mark/java7issue.html |
2 | ||
3 | Index: tigervnc.new/java/src/com/tigervnc/vncviewer/VncViewer.java | |
4 | =================================================================== | |
5 | --- tigervnc.new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2012-08-21 09:05:04.000000000 +0200 | |
6 | +++ tigervnc.new/java/src/com/tigervnc/vncviewer/VncViewer.java 2012-08-21 09:10:27.000000000 +0200 | |
7 | @@ -110,6 +110,28 @@ | |
8 | ||
9 | public void init() { | |
10 | ||
11 | + // fix focus traversal | |
12 | + Container topParent = null; | |
13 | + Container parent = this; | |
14 | + // The natural thing would be to call getParent() until it returns | |
15 | + // null, but then you would be looping for a long time, since | |
16 | + // PluginEmbeddedFrame's getParent() returns itself. | |
17 | + for (int k=0; k < 10; k++) { | |
18 | + topParent = parent; | |
19 | + parent = parent.getParent(); | |
20 | + if (parent == null) break; | |
21 | + } | |
22 | + | |
23 | + // If topParent isn't a KeyEventDispatcher then we must be in some | |
24 | + // Plugin version that doesn't need the workaround. | |
25 | + try { | |
26 | + KeyEventDispatcher ked = (KeyEventDispatcher)topParent; | |
27 | + KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); | |
28 | + // You have to remove it twice, otherwise the problem isn't fixed | |
29 | + kfm.removeKeyEventDispatcher(ked); | |
30 | + kfm.removeKeyEventDispatcher(ked); | |
31 | + } catch (ClassCastException e) {} | |
32 | + | |
33 | readParameters(); | |
34 | ||
35 | refApplet = this; |