Project

General

Profile

10984.txt

Sergey Ivanovskiy, 01/14/2016 01:39 PM

Download (1.71 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/driver/swing/WinKeyboardReader.java'
2
--- src/com/goldencode/p2j/ui/client/driver/swing/WinKeyboardReader.java	2015-10-14 13:31:31 +0000
3
+++ src/com/goldencode/p2j/ui/client/driver/swing/WinKeyboardReader.java	2016-01-14 18:27:15 +0000
4
@@ -32,11 +32,17 @@
5
 ** 009 VIG 20150818 Added ALT key support for menus keys navigation mode.
6
 ** 010 SBI 20151008 Improvements to support better GUI key processing compatibility.
7
 ** 011 SBI 20151014 Auto-repeats are fixed.
8
+** 012 SBI 20160114 Fixed the internal keyboard state to be consistent that happens due to this
9
+**                  keys combination ALT + TAB is intercepted by the operating system.
10
 */
11
 
12
 package com.goldencode.p2j.ui.client.driver.swing;
13
 
14
+import java.awt.AWTEvent;
15
+import java.awt.Toolkit;
16
+import java.awt.event.AWTEventListener;
17
 import java.awt.event.KeyEvent;
18
+import java.awt.event.WindowEvent;
19
 
20
 import com.goldencode.p2j.ui.*;
21
 import com.goldencode.p2j.ui.client.event.*;
22
@@ -56,7 +62,23 @@
23
       xlate.put(KeyEvent.VK_ESCAPE, Key.VK_ESCAPE);
24
       
25
       // ALT is not processed by 4GL... => Processed as menubar activation key.
26
-      xlate.put(KeyEvent.VK_ALT, 1024); 
27
+      xlate.put(KeyEvent.VK_ALT, 1024);
28
+      // added to process OS intercepted keys
29
+      Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener()
30
+      {
31
+         @Override
32
+         public void eventDispatched(AWTEvent event)
33
+         {
34
+            if (event.getID() == WindowEvent.WINDOW_DEACTIVATED)
35
+            {
36
+               if (!keyDownEvents.isEmpty())
37
+               {
38
+                  keyDownEvents.clear();
39
+               }
40
+            }
41
+         }
42
+      }, AWTEvent.WINDOW_EVENT_MASK);
43
+
44
    }
45
 
46
    /**
47