Project

General

Profile

2776_1.txt

Sergey Ivanovskiy, 10/25/2015 05:00 PM

Download (8.18 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
2
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-10-24 19:51:34 +0000
3
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-10-25 20:57:36 +0000
4
@@ -783,7 +783,8 @@
5
                      break;
6
                   case 0x98:
7
                      // enable/disable OS events
8
-                     p2j.screen.enableOsEvents(message[1] == 1);
9
+                     var wid = me.readInt32BinaryMessage(message, 1);
10
+                     p2j.screen.enableOsEvents(wid, message[5] == 1);
11
                      break;
12
                   case 0x99:
13
                      // set window iconification state
14

    
15
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java'
16
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-10-24 19:51:34 +0000
17
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebEmulatedWindow.java	2015-10-25 20:21:46 +0000
18
@@ -253,7 +253,7 @@
19
    @Override
20
    public void enableEvents(boolean capture)
21
    {
22
-      websock.enableOsEvents(capture);
23
+      websock.enableOsEvents(windowId, capture);
24
    }
25
 
26
    /**
27

    
28
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java'
29
--- src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2015-10-24 19:51:34 +0000
30
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/GuiWebSocket.java	2015-10-25 20:21:24 +0000
31
@@ -611,12 +611,19 @@
32
    /**
33
     * Enable or disable processing of OS events.
34
     *  
35
+    * @param    windowId
36
+    *           The window ID.
37
     * @param    state
38
     *           {@code true} to process OS events, {@code false} to ignore them.
39
     */
40
-   public void enableOsEvents(boolean state)
41
+   public void enableOsEvents(int windowId, boolean state)
42
    {
43
-      sendBinaryMessage(ENABLE_OS_EVENTS, (byte) (state ? 1 : 0));
44
+      byte[] message = new byte[6];
45
+      message[0] = ENABLE_OS_EVENTS;
46
+      
47
+      writeMessageInt32(message, 1, windowId);
48
+      message[5] = (byte) (state ? 1 : 0);
49
+      sendBinaryMessage(message);
50
    }
51
 
52
    /**
53

    
54
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js'
55
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js	2015-10-24 19:51:34 +0000
56
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js	2015-10-25 20:17:10 +0000
57
@@ -148,7 +148,7 @@
58
    {
59
       return function(evt)
60
       {
61
-         if (!p2j.screen.canProcessOsEvent(evt))
62
+         if (!p2j.screen.canProcessOsEvent(evt, win))
63
          {
64
             return;
65
          }
66
@@ -490,7 +490,7 @@
67
          }
68
          var mThis = win.mouseHandler;
69
          
70
-         if (mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt))
71
+         if (mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt, win))
72
          {
73
             return;
74
          }
75
@@ -657,7 +657,7 @@
76
          if (mThis.dragOwner != win.id ||
77
              !win.resizeable           ||
78
              !mThis.mouseDrag          ||
79
-             !p2j.screen.canProcessOsEvent(evt))
80
+             !p2j.screen.canProcessOsEvent(evt, win))
81
          {
82
             return;
83
          }
84
@@ -854,7 +854,7 @@
85
    {
86
       return function(evt)
87
       {
88
-         if (!mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt))
89
+         if (!mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt, win))
90
          {
91
             return;
92
          }
93
@@ -898,7 +898,7 @@
94
       {
95
          // only left button can trigger move
96
          if (evt.which != 1                     || 
97
-             !p2j.screen.canProcessOsEvent(evt) || 
98
+             !p2j.screen.canProcessOsEvent(evt, win) || 
99
              !win.canProcessWidget(wid, evt, mouseOp))
100
          {
101
             return;
102
@@ -935,7 +935,7 @@
103
    {
104
       return function(evt)
105
       {
106
-         if (mThis.dragOwner != wid || !mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt))
107
+         if (mThis.dragOwner != wid || !mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt, win))
108
          {
109
             return;
110
          }
111
@@ -994,7 +994,7 @@
112
 
113
       return function(evt)
114
       {
115
-         if (evt.which != 1 || !p2j.screen.canProcessOsEvent(evt))
116
+         if (evt.which != 1 || !p2j.screen.canProcessOsEvent(evt, win))
117
          {
118
             return;
119
          }
120
@@ -1194,7 +1194,7 @@
121
 
122
       return function(evt)
123
       {
124
-         if (evt.which != btnId || !p2j.screen.canProcessOsEvent(evt))
125
+         if (evt.which != btnId || !p2j.screen.canProcessOsEvent(evt, win))
126
          {
127
             return;
128
          }
129

    
130
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
131
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-10-24 19:51:34 +0000
132
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-10-25 20:59:20 +0000
133
@@ -48,9 +48,6 @@
134
    /** Flag indicating if the screen should send mouse events to the client-side. */
135
    me.processMouse = false;
136
 
137
-   /** Flag indicating if the screen should send OS events to the client-side. */
138
-   me.processOsEvents = false;
139
-   
140
    /** PaintPrimitives to ordinal mappings. Change this to match Java PaintPrimitives changes! */
141
    var ops = 
142
    {
143
@@ -202,6 +199,12 @@
144
       this.canvasRenderer = new CanvasRenderer(this.canvas, this.ctx, strokesManager,
145
              p2j.fonts, p2j.logger);
146
       
147
+      /** 
148
+        * Flag indicating if the window should send OS events to the client-side. The default value
149
+        * for new created window must be true due to modal windows application logic.
150
+        */
151
+      this.processOsEvents = true;
152
+
153
       /**
154
         * List of widgets which are aware of mouse events. They are in z-order, with the top-most
155
         * widgets having a having a lower index than the bottomost widgets.  This provides a 
156
@@ -372,7 +375,7 @@
157
             wThis.sendMouseEvent(evt, mousePos, wThis, opCode);
158
          }
159
          
160
-         if (!me.canProcessOsEvent(evt))
161
+         if (!me.canProcessOsEvent(evt, wThis))
162
          {
163
             return;
164
          }
165
@@ -629,6 +632,16 @@
166
    };
167
    
168
    /**
169
+    * Enables/disables the OS events for this window.
170
+    * 
171
+    * @param    {Boolean} capture
172
+    *           When <code>true</code>, it will process OS events like window close/iconify/etc.
173
+    */
174
+   Window.prototype.enableOsEvents = function(capture)
175
+   {
176
+      this.processOsEvents = capture;
177
+   };
178
+   /**
179
     * Draw the given list of operations in the canvas.
180
     *
181
     * @param    {byte[]} message
182
@@ -1461,14 +1474,16 @@
183
     * Determine if the specified event can be processed.  If the OS events or the mouse events are
184
     * disabled, return false.  Also, return false if the event is consumed.
185
     *
186
-    * @param   {MouseEvent} evt
187
-    *          The event details.
188
+    * @param    {MouseEvent} evt
189
+    *           The event details.
190
+    * @param    {Window} win
191
+    *           The window object.
192
     *
193
-    * @return  <code>true</code> if the event can be processed.
194
+    * @return   <code>true</code> if the event can be processed.
195
     */
196
-   me.canProcessOsEvent = function(evt)
197
+   me.canProcessOsEvent = function(evt, win)
198
    {
199
-      return me.processOsEvents && me.processMouse && !evt.defaultPrevented;
200
+      return win.processOsEvents && me.processMouse && !evt.defaultPrevented;
201
    }
202
    
203
    /**
204
@@ -1868,12 +1883,15 @@
205
    /**
206
     * Disable or enable OS event processing.
207
     *
208
-    * @param   {boolean} capture
209
-    *          When <code>true</code>, it will process OS events like window close/iconify/etc.
210
+    * @param    {Number} wid
211
+    *           The target window for which OS event processing should be enabled or disabled.
212
+    * @param    {Boolean} capture
213
+    *           When <code>true</code>, it will process OS events like window close/iconify/etc.
214
     */
215
-   me.enableOsEvents = function(capture)
216
+   me.enableOsEvents = function(wid, capture)
217
    {
218
-      me.processOsEvents = capture;
219
+      var win = getWindow(wid);
220
+      win.enableOsEvents(capture);
221
    }
222
    
223
    /**
224
@@ -1919,9 +1937,6 @@
225
       // disable mouse events
226
       me.captureMouseEvents(false);
227
       
228
-      // enable all OS events
229
-      me.enableOsEvents(true);
230
-      
231
       desktop = new VirtualDesktop(
232
             sendWindowStateActive,
233
             [174, 174, 174],
234