Project

General

Profile

workaround_20151102.txt

Sergey Ivanovskiy, 11/03/2015 03:17 AM

Download (1.77 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java'
2
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java	2015-10-24 19:51:34 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingEmulatedWindow.java	2015-11-03 08:10:37 +0000
4
@@ -267,7 +267,11 @@
5
                if (toOS)
6
                {
7
                   // if focus is lost to a non-4GL window, the titlebar needs to be aware of this
8
-                  ThinClient.getInstance().postOSEvent(new WindowActivated(window, false, toOS));
9
+                  ThinClient tc = ThinClient.getInstance();
10
+                  if (tc != null)
11
+                  {
12
+                     ThinClient.getInstance().postOSEvent(new WindowActivated(window, false, toOS));
13
+                  }
14
                }
15
             }
16
          }
17

    
18
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java'
19
--- src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java	2015-10-22 23:14:19 +0000
20
+++ src/com/goldencode/p2j/ui/client/gui/driver/swing/SwingGuiDriver.java	2015-11-03 07:41:59 +0000
21
@@ -78,6 +78,8 @@
22
 
23
 import javax.swing.*;
24
 
25
+import sun.awt.AppContext;
26
+
27
 import java.lang.reflect.*;
28
 import java.io.*;
29
 import java.util.*;
30
@@ -102,7 +104,14 @@
31
    {
32
       protected SwingKeyboardReader initialValue()
33
       {
34
-         return new WinKeyboardReader();
35
+         AppContext appContext = AppContext.getAppContext();
36
+         Object keyboardReader = appContext.get(WinKeyboardReader.class);
37
+         if (keyboardReader == null)
38
+         {
39
+            keyboardReader = new WinKeyboardReader();
40
+            appContext.put(WinKeyboardReader.class, keyboardReader);
41
+         }
42
+         return (WinKeyboardReader) keyboardReader;
43
       };
44
    };
45
 
46