Project

General

Profile

2956_window_events_3.txt

Sergey Ivanovskiy, 02/02/2016 01:05 AM

Download (8.46 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebSimulator.java'
2
--- src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebSimulator.java	2015-12-09 06:42:45 +0000
3
+++ src/com/goldencode/p2j/ui/client/chui/driver/web/ChuiWebSimulator.java	2016-02-01 15:21:19 +0000
4
@@ -222,13 +222,16 @@
5
    }
6
    
7
    /**
8
-    * Raise an event as the window was activated.  This is a no-op in ChUI.
9
+    * Raise an event indicating that the target window has been activated or deactivated. This is
10
+    * a no-op in ChUI.
11
     * 
12
     * @param    windowId
13
     *           The window ID.
14
+    * @param    state
15
+    *           True if the window has been activated, otherwise false.
16
     */
17
    @Override
18
-   public void windowActivated(int windowId)
19
+   public void windowActivated(int windowId, boolean state)
20
    {
21
       // no-op
22
    }
23

    
24
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/ClientProtocolHooks.java'
25
--- src/com/goldencode/p2j/ui/client/driver/web/ClientProtocolHooks.java	2015-12-09 06:42:45 +0000
26
+++ src/com/goldencode/p2j/ui/client/driver/web/ClientProtocolHooks.java	2016-02-01 15:21:19 +0000
27
@@ -100,12 +100,14 @@
28
    public void setWindowDimension(int windowId, int width, int height);
29
 
30
    /**
31
-    * Raise an event as the window was activated.
32
+    * Raise an event indicating that the target window has been activated or deactivated.
33
     * 
34
     * @param    windowId
35
     *           The window ID.
36
+    * @param    state
37
+    *           The boolean flag indicating that the target window has been activated or inactive.
38
     */
39
-   public void windowActivated(int windowId);
40
+   public void windowActivated(int windowId, boolean state);
41
 
42
    /**
43
     * Raise an event as the window was (de)iconified.
44

    
45
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
46
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2016-01-31 17:04:52 +0000
47
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2016-02-02 05:43:00 +0000
48
@@ -101,11 +101,13 @@
49
     * 
50
     * @param    {Number} wid
51
     *           The target window id
52
+    * @param    {Boolean} active
53
+    *           The flag indicating that the target window should be active or not.
54
     */
55
-   me.sendWindowActive = function(wid)
56
+   me.sendWindowActive = function(wid, active)
57
    {
58
       // send the window activation to the java side
59
-      var msg = new Uint8Array(5);
60
+      var msg = new Uint8Array(6);
61
       
62
       // message type
63
       msg[0] = 0x0f;
64
@@ -113,6 +115,8 @@
65
       // 1. the window ID
66
       me.writeInt32BinaryMessage(msg, 1, wid);
67
       
68
+      msg[5] = active ? 1 : 0;
69
+      
70
       // send the window active event
71
       me.send(msg);
72
    }
73

    
74
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java'
75
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java	2016-01-10 13:19:14 +0000
76
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebDriver.java	2016-02-02 05:28:40 +0000
77
@@ -587,7 +587,7 @@
78
       if (focus)
79
       {
80
          // activate the window and notify the upper layers
81
-         windowActivated(windowId);
82
+         windowActivated(windowId, true);
83
       }
84
    }
85
    
86
@@ -889,9 +889,11 @@
87
     * 
88
     * @param    windowId
89
     *           The window ID.
90
+    * @param    state
91
+    *           True if the window has been activated, otherwise false.
92
     */
93
    @Override
94
-   public void windowActivated(int windowId)
95
+   public void windowActivated(int windowId, boolean state)
96
    {
97
       // resolve window object
98
       TopLevelWindow<?> window = (TopLevelWindow<?>) WindowManager.findWindow(windowId);
99
@@ -915,10 +917,8 @@
100
       {
101
          ThinClient.getInstance().postOSEvent(new WindowActivated(ow, false, false));
102
       }
103
-      else
104
-      {
105
-         ThinClient.getInstance().postOSEvent(new WindowActivated(window, true, false));
106
-      }
107
+      
108
+      ThinClient.getInstance().postOSEvent(new WindowActivated(window, state, false));
109
    }
110
 
111
    /**
112

    
113
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java'
114
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2016-01-08 16:20:03 +0000
115
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2016-02-01 18:17:11 +0000
116
@@ -423,7 +423,7 @@
117
             }
118
             break;
119
          case SET_WINDOW_BOUNDS:
120
-            if (x != ps.x || y != ps.y || width != ps.width || height != ps.height)
121
+            if (x != ps.x || y != ps.y || width != ps.width || height != ps.height || initLocation)
122
             {
123
                x = ps.x;
124
                y = ps.y;
125

    
126
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java'
127
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2016-01-29 15:50:34 +0000
128
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2016-02-01 15:21:19 +0000
129
@@ -1245,14 +1245,16 @@
130
          
131
          handled = true;
132
       }
133
-      else if (length == 5 && message[offset] == MSG_WINDOW_ACTIVATED)
134
+      else if (length == 6 && message[offset] == MSG_WINDOW_ACTIVATED)
135
       {
136
          int idx = offset + 1;
137
          
138
          int windowId = readMessageInt32(message, idx);
139
          idx = idx + 4;
140
          
141
-         this.callbacks.windowActivated(windowId);
142
+         boolean state = message[idx] == 1;
143
+         
144
+         this.callbacks.windowActivated(windowId, state);
145
       }
146
       else if (length == 6 && message[offset] == MSG_WINDOW_ICONIFY)
147
       {
148

    
149
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js'
150
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js	2016-01-31 17:04:52 +0000
151
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js	2016-02-01 15:21:19 +0000
152
@@ -108,16 +108,21 @@
153
 
154
          // to request the input focus to this window
155
          win.canvas.focus();
156
-
157
-         if (p2j.screen.topWindowId() == win.id)
158
+         
159
+         var topWindowId = p2j.screen.topWindowId();
160
+         if (topWindowId == win.id)
161
          {
162
             return;
163
          }
164
          
165
+         if (topWindowId)
166
+         {
167
+            p2j.socket.sendWindowActive(topWindowId, false);
168
+         }
169
          // move the window to top
170
          win.moveToTop();
171
          
172
-         p2j.socket.sendWindowActive(win.id);
173
+         p2j.socket.sendWindowActive(win.id, true);
174
          
175
          // consume the event
176
          evt.preventDefault();
177

    
178
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
179
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2016-01-31 17:04:52 +0000
180
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2016-02-02 05:49:46 +0000
181
@@ -1588,11 +1588,12 @@
182
     */
183
    function activateTopVisibleWindow(id)
184
    {
185
+      //p2j.socket.sendWindowActive(id, false);
186
       var topWindow = findTopVisibleWindow(id);
187
       if (topWindow)
188
       {
189
          topWindow.moveToTop();
190
-         p2j.socket.sendWindowActive(topWindow.id);
191
+         p2j.socket.sendWindowActive(topWindow.id, true);
192
       }
193
    }
194
 
195
@@ -1670,7 +1671,6 @@
196
 
197
       // the z-order is based on the array index
198
       var zidx = zlist.length * 10;
199
-      
200
       // assign the z-order
201
       win.canvas.style.zIndex = zidx;
202
    };
203
@@ -2178,7 +2178,11 @@
204
     */
205
    me.moveToTop = function(wid)
206
    {
207
-      moveZOrderEntryToTop(wid);
208
+      var win = getWindow(wid);
209
+      if (win)
210
+      {
211
+         win.moveToTop();
212
+      }
213
    }
214
    
215
    /**
216
@@ -2263,7 +2267,6 @@
217
          
218
          addZOrderEntry(newZlist[i].id, newZlist[i].win);
219
       }
220
-      
221
       taskBar.setTaskIconActive(zlist[zlist.length - 1].id, true);
222
       
223
       console.log("restack");
224
@@ -2356,7 +2359,11 @@
225
     */
226
    function sendWindowStateActive(windowId)
227
    {
228
-      p2j.socket.sendWindowActive(windowId);
229
+      var topWindowId = p2j.screen.topWindowId();
230
+      if (topWindowId)
231
+      {
232
+         p2j.socket.sendWindowActive(topWindowId, false);
233
+      }
234
       var win = getWindow(windowId);
235
       if (!win.isVisible())
236
       {
237
@@ -2366,19 +2373,7 @@
238
       win.deiconify();
239
       
240
       // send the window activation to the java side
241
-      message = new Uint8Array(5);
242
-      var offset = 0;
243
-      
244
-      // message type
245
-      message[0] = 0x0f;
246
-      offset = offset + 1;
247
-      
248
-      // 1. the window ID
249
-      p2j.socket.writeInt32BinaryMessage(message, offset, win.id);
250
-      offset = offset + 4;
251
-
252
-      // send the message
253
-      p2j.socket.send(message);
254
+      p2j.socket.sendWindowActive(windowId, true);
255
    }
256
 
257
    /**
258