1
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js'
|
2
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js 2016-04-19 20:02:45 +0000
|
3
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.mouse.js 2016-04-20 18:13:33 +0000
|
4
|
@@ -793,6 +793,11 @@
|
5
|
this.defaultPtr = defaultPtr;
|
6
|
this.forceDefault = forceDefault;
|
7
|
this.active = false;
|
8
|
+ // define a widget's region
|
9
|
+ this.x = x;
|
10
|
+ this.y = y;
|
11
|
+ this.width = width;
|
12
|
+ this.height = height;
|
13
|
|
14
|
this.mouseExit = function(evt)
|
15
|
{
|
16
|
@@ -874,6 +879,7 @@
|
17
|
this.handle = function(mouseOp, evt)
|
18
|
{
|
19
|
// no ops
|
20
|
+ return false;
|
21
|
};
|
22
|
|
23
|
};
|
24
|
@@ -915,6 +921,12 @@
|
25
|
|
26
|
addListeners(handlers, mops, listeners);
|
27
|
|
28
|
+ // define a widget's region
|
29
|
+ this.x = x;
|
30
|
+ this.y = y;
|
31
|
+ this.width = width;
|
32
|
+ this.height = height;
|
33
|
+
|
34
|
this.deregisterListeners = function()
|
35
|
{
|
36
|
removeListeners(handlers, mops, listeners);
|
37
|
@@ -923,12 +935,9 @@
|
38
|
this.getEvents = function()
|
39
|
{
|
40
|
var events = {};
|
41
|
- for (var prop in mops)
|
42
|
+ for (var i = 0; i < mops.length; i++)
|
43
|
{
|
44
|
- if (mops.hasOwnProperty(prop))
|
45
|
- {
|
46
|
- events[prop] = true;
|
47
|
- }
|
48
|
+ events[mops[i]] = true;
|
49
|
}
|
50
|
|
51
|
return events;
|
52
|
@@ -947,17 +956,20 @@
|
53
|
var listener = handlers[mouseOp];
|
54
|
if (listener !== undefined)
|
55
|
{
|
56
|
- listener(evt);
|
57
|
+ return listener(evt);
|
58
|
}
|
59
|
+
|
60
|
+ return false;
|
61
|
};
|
62
|
|
63
|
function processMouseDragStop(mThis, mouseOp)
|
64
|
{
|
65
|
return function(evt)
|
66
|
{
|
67
|
+ console.debug("drag stop " + mouseOp);
|
68
|
if (!mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt, win))
|
69
|
{
|
70
|
- return;
|
71
|
+ return false;
|
72
|
}
|
73
|
|
74
|
// send the window location
|
75
|
@@ -969,7 +981,7 @@
|
76
|
mThis.dragOwner = undefined;
|
77
|
|
78
|
// event was processed, cancel other listeners
|
79
|
- evt.preventDefault();
|
80
|
+ return true;
|
81
|
};
|
82
|
};
|
83
|
|
84
|
@@ -977,18 +989,18 @@
|
85
|
{
|
86
|
return function(evt)
|
87
|
{
|
88
|
+ console.debug("drag start " + mouseOp);
|
89
|
// only left button can trigger move
|
90
|
if (evt.which != 1 ||
|
91
|
- !p2j.screen.canProcessOsEvent(evt, win) ||
|
92
|
- !win.canProcessWidget(wid, evt, mouseOp))
|
93
|
+ !p2j.screen.canProcessOsEvent(evt, win) )
|
94
|
{
|
95
|
- return;
|
96
|
+ return false;
|
97
|
}
|
98
|
|
99
|
if (mThis.mouseDrag)
|
100
|
{
|
101
|
- evt.preventDefault();
|
102
|
- return;
|
103
|
+// evt.preventDefault();
|
104
|
+ return false;
|
105
|
}
|
106
|
|
107
|
var mousePos = win.getMousePos(evt);
|
108
|
@@ -1007,7 +1019,7 @@
|
109
|
mThis.dragOwner = wid;
|
110
|
|
111
|
// event was processed, cancel other listeners
|
112
|
- evt.preventDefault();
|
113
|
+ return true;
|
114
|
}
|
115
|
};
|
116
|
};
|
117
|
@@ -1016,9 +1028,10 @@
|
118
|
{
|
119
|
return function(evt)
|
120
|
{
|
121
|
+ console.debug("drag " + mouseOp);
|
122
|
if (mThis.dragOwner != wid || !mThis.mouseDrag || !p2j.screen.canProcessOsEvent(evt, win))
|
123
|
{
|
124
|
- return;
|
125
|
+ return false;
|
126
|
}
|
127
|
var mousePos = win.getMousePos(evt);
|
128
|
|
129
|
@@ -1039,7 +1052,7 @@
|
130
|
mThis.lastMouseEvent = evt;
|
131
|
|
132
|
// event was processed, cancel other listeners
|
133
|
- evt.preventDefault();
|
134
|
+ return true;
|
135
|
};
|
136
|
};
|
137
|
};
|
138
|
@@ -1081,7 +1094,7 @@
|
139
|
{
|
140
|
if (evt.which != 1 || !p2j.screen.canProcessOsEvent(evt, win))
|
141
|
{
|
142
|
- return;
|
143
|
+ return false;
|
144
|
}
|
145
|
|
146
|
var mousePos = win.getMousePos(evt);
|
147
|
@@ -1092,8 +1105,10 @@
|
148
|
mousePos.y <= ma.y + ma.height)
|
149
|
{
|
150
|
stateChangedCallback(win, evt, mousePos, opCode);
|
151
|
- evt.preventDefault();
|
152
|
+ return true;
|
153
|
}
|
154
|
+
|
155
|
+ return false;
|
156
|
};
|
157
|
};
|
158
|
|
159
|
@@ -1128,6 +1143,11 @@
|
160
|
{
|
161
|
/** Placeholder for the required mouse events listeners */
|
162
|
var handlers = {};
|
163
|
+ // define a widget's region
|
164
|
+ this.x = x;
|
165
|
+ this.y = y;
|
166
|
+ this.width = width;
|
167
|
+ this.height = height;
|
168
|
|
169
|
this.wsc = new WindowStateChangedWorker(win, wid, x, y, width, height, windowCloseCallback, handlers);
|
170
|
|
171
|
@@ -1162,8 +1182,10 @@
|
172
|
var listener = handlers[mouseOp];
|
173
|
if (listener !== undefined)
|
174
|
{
|
175
|
- listener(evt);
|
176
|
+ return listener(evt);
|
177
|
}
|
178
|
+
|
179
|
+ return false;
|
180
|
};
|
181
|
};
|
182
|
|
183
|
@@ -1187,6 +1209,11 @@
|
184
|
{
|
185
|
/** Placeholder for the required mouse events listeners */
|
186
|
var handlers = {};
|
187
|
+ // define a widget's region
|
188
|
+ this.x = x;
|
189
|
+ this.y = y;
|
190
|
+ this.width = width;
|
191
|
+ this.height = height;
|
192
|
|
193
|
this.wsc = new WindowStateChangedWorker(win, wid, x, y, width, height, windowIconifyCallback, handlers);
|
194
|
|
195
|
@@ -1219,8 +1246,10 @@
|
196
|
var listener = handlers[mouseOp];
|
197
|
if (listener !== undefined)
|
198
|
{
|
199
|
- listener(evt);
|
200
|
+ return listener(evt);
|
201
|
}
|
202
|
+
|
203
|
+ return false;
|
204
|
};
|
205
|
};
|
206
|
|
207
|
@@ -1245,6 +1274,11 @@
|
208
|
/** Placeholder for the required mouse events listeners */
|
209
|
var handlers = {};
|
210
|
|
211
|
+ // define a widget's region
|
212
|
+ this.x = x;
|
213
|
+ this.y = y;
|
214
|
+ this.width = width;
|
215
|
+ this.height = height;
|
216
|
this.wsc = new WindowStateChangedWorker(win, wid, x, y, width, height, windowMaximizeCallback, handlers);
|
217
|
|
218
|
function windowMaximizeCallback(win, evt, mousePos, opCode)
|
219
|
@@ -1278,8 +1312,10 @@
|
220
|
var listener = handlers[mouseOp];
|
221
|
if (listener !== undefined)
|
222
|
{
|
223
|
- listener(evt);
|
224
|
+ return listener(evt);
|
225
|
}
|
226
|
+
|
227
|
+ return false;
|
228
|
};
|
229
|
};
|
230
|
|
231
|
@@ -1312,6 +1348,11 @@
|
232
|
var mops = ["click", "mousedown"];
|
233
|
var listeners = [processPopup(this, "click"), processPopup(this, "mousedown")];
|
234
|
addListeners(handlers, mops, listeners);
|
235
|
+ // define a widget's region
|
236
|
+ this.x = x;
|
237
|
+ this.y = y;
|
238
|
+ this.width = width;
|
239
|
+ this.height = height;
|
240
|
|
241
|
function processPopup(mThis, mouseOp)
|
242
|
{
|
243
|
@@ -1319,9 +1360,9 @@
|
244
|
|
245
|
return function(evt)
|
246
|
{
|
247
|
- if (evt.which != btnId || !p2j.screen.canProcessOsEvent(evt, win))
|
248
|
+ if (evt.which != btnId /*|| !p2j.screen.canProcessOsEvent(evt, win)*/)
|
249
|
{
|
250
|
- return;
|
251
|
+ return false;
|
252
|
}
|
253
|
|
254
|
var mousePos = win.getMousePos(evt);
|
255
|
@@ -1331,12 +1372,14 @@
|
256
|
mousePos.y >= ma.y &&
|
257
|
mousePos.y <= ma.y + ma.height)
|
258
|
{
|
259
|
- // send the event and consume it
|
260
|
+ // send the event mousedown only
|
261
|
+ // click event is not prevented and it follows mousedown
|
262
|
win.sendMouseEvent(evt, mousePos, win, opCode, wid);
|
263
|
-
|
264
|
- evt.preventDefault();
|
265
|
+
|
266
|
+ return true;
|
267
|
}
|
268
|
|
269
|
+ return false;
|
270
|
// let the event be processed by other widgets
|
271
|
};
|
272
|
};
|
273
|
@@ -1348,7 +1391,7 @@
|
274
|
|
275
|
this.getEvents = function()
|
276
|
{
|
277
|
- return { "click" : true, "mouseDown" : true };
|
278
|
+ return { "click" : true, "mousedown" : true };
|
279
|
};
|
280
|
|
281
|
/**
|
282
|
@@ -1364,8 +1407,10 @@
|
283
|
var listener = handlers[mouseOp];
|
284
|
if (listener !== undefined)
|
285
|
{
|
286
|
- listener(evt);
|
287
|
+ return listener(evt);
|
288
|
}
|
289
|
+
|
290
|
+ return false;
|
291
|
};
|
292
|
};
|
293
|
|
294
|
|
295
|
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
|
296
|
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2016-04-19 20:02:45 +0000
|
297
|
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2016-04-20 17:57:45 +0000
|
298
|
@@ -270,18 +270,17 @@
|
299
|
function commonHandler(evt)
|
300
|
{
|
301
|
var mouseOp = evt.type;
|
302
|
-
|
303
|
+ console.debug("commonHandler " + mouseOp);
|
304
|
if (!down && !up)
|
305
|
{
|
306
|
targetWindow = p2j.screen.getEventTarget(evt);
|
307
|
- }
|
308
|
-
|
309
|
- if (targetWindow === undefined)
|
310
|
- {
|
311
|
- return;
|
312
|
- }
|
313
|
-
|
314
|
- dispatchEventToOSMouseWidgets(mouseOp, evt);
|
315
|
+ if (targetWindow !== undefined)
|
316
|
+ {
|
317
|
+ targetWidget = targetWindow.findMouseSource(evt, targetWindow.mouseAwareWidgets[mouseOp]);
|
318
|
+ }
|
319
|
+ }
|
320
|
+
|
321
|
+ dispatchEvent(mouseOp, evt)
|
322
|
}
|
323
|
|
324
|
/**
|
325
|
@@ -295,14 +294,16 @@
|
326
|
down = true;
|
327
|
up = false;
|
328
|
|
329
|
+ var mouseOp = evt.type;
|
330
|
+
|
331
|
targetWindow = p2j.screen.getEventTarget(evt);
|
332
|
|
333
|
if (targetWindow !== undefined)
|
334
|
{
|
335
|
- targetWidget = targetWindow.findMouseSource(evt, targetWindow.mouseAwareWidgets["mousedown"]);
|
336
|
+ targetWidget = targetWindow.findMouseSource(evt, targetWindow.mouseAwareWidgets[mouseOp]);
|
337
|
}
|
338
|
-
|
339
|
- dispatchEvent("mousedown", evt);
|
340
|
+
|
341
|
+ dispatchEvent(mouseOp, evt);
|
342
|
}
|
343
|
|
344
|
/**
|
345
|
@@ -344,18 +345,18 @@
|
346
|
}
|
347
|
var mouseOp = evt.type;
|
348
|
|
349
|
- dispatchEventToOSMouseWidgets(mouseOp, evt);
|
350
|
+ dispatchEvent("mousemove", evt);
|
351
|
|
352
|
- if (!dragTimeout)
|
353
|
- {
|
354
|
- //Sends drag notifications with the frequency that doesn't exceed one event per 100 ms.
|
355
|
- dragTimeout = setTimeout(
|
356
|
- function()
|
357
|
- {
|
358
|
- dragTimeout = null;
|
359
|
- dispatchEvent("drag", evt);
|
360
|
- }, 100);
|
361
|
- }
|
362
|
+// if (!dragTimeout)
|
363
|
+// {
|
364
|
+// //Sends drag notifications with the frequency that doesn't exceed one event per 100 ms.
|
365
|
+// dragTimeout = setTimeout(
|
366
|
+// function()
|
367
|
+// {
|
368
|
+// dragTimeout = null;
|
369
|
+// dispatchEvent("drag", evt);
|
370
|
+// }, 100);
|
371
|
+// }
|
372
|
}
|
373
|
|
374
|
/**
|
375
|
@@ -373,35 +374,67 @@
|
376
|
return;
|
377
|
}
|
378
|
|
379
|
- dispatchEventToOSMouseWidgets(mouseOp, evt);
|
380
|
+
|
381
|
+ var mousePos = targetWindow.getMousePos(evt);
|
382
|
|
383
|
if (targetWidget === undefined)
|
384
|
{
|
385
|
+ console.debug("targetWidget === undefined");
|
386
|
+ dispatchEventToAnyMouseWidgets(mouseOp, evt, mousePos);
|
387
|
return;
|
388
|
}
|
389
|
|
390
|
- var mousePos = targetWindow.getMousePos(evt);
|
391
|
-
|
392
|
// check if targetWidget belongs to "any mouse" widgets (listen all events)
|
393
|
// than sending mouseOp message is send to targetWidget
|
394
|
if (!targetWindow.anyMouseAwareWidgets.hasOwnProperty(targetWidget))
|
395
|
{
|
396
|
dispatchEventToAnyMouseWidgets(mouseOp, evt, mousePos);
|
397
|
}
|
398
|
-
|
399
|
+ else
|
400
|
+ {
|
401
|
+ console.debug("!!!any mouse widgets are ignored due to wid " + targetWidget + " for " + mouseOp);
|
402
|
+ }
|
403
|
|
404
|
if (!targetWindow.processOsEvents || !p2j.screen.processMouse)
|
405
|
{
|
406
|
return;
|
407
|
}
|
408
|
-
|
409
|
- if (p2j.screen.hasOsEvent(evt, targetWindow, mouseOp, targetWidget))
|
410
|
+
|
411
|
+ var widgetList = targetWindow.mouseAwareWidgets[evt.type];
|
412
|
+
|
413
|
+ // go through the widgets via the z-order
|
414
|
+ for (var idx = 0; idx < targetWindow.zOrder.length; idx++)
|
415
|
{
|
416
|
- // high-level event, do not process here
|
417
|
- return;
|
418
|
+ var wid = targetWindow.zOrder[idx];
|
419
|
+
|
420
|
+ if (targetWindow.isInside(mousePos, wid, widgetList))
|
421
|
+ {
|
422
|
+ var osWidget = p2j.screen.getOsEvent(evt, targetWindow, mouseOp, wid);
|
423
|
+ if (osWidget)
|
424
|
+ {
|
425
|
+ if (osWidget.handle(mouseOp, evt))
|
426
|
+ {
|
427
|
+ return;
|
428
|
+ }
|
429
|
+ }
|
430
|
+ }
|
431
|
}
|
432
|
+//
|
433
|
+// var osWidget = p2j.screen.getOsEvent(evt, targetWindow, mouseOp, targetWidget);
|
434
|
+// if (osWidget === undefined)
|
435
|
+// {
|
436
|
+// osWidget = targetWindow.findTargetOSWidget(evt);
|
437
|
+// }
|
438
|
+// if (osWidget)
|
439
|
+// {
|
440
|
+// osWidget.handle(mouseOp, evt);
|
441
|
+// //dispatchEventToOSMouseWidgets(mouseOp, evt);
|
442
|
+// // high-level event, do not process here
|
443
|
+// return;
|
444
|
+// }
|
445
|
|
446
|
targetWindow.sendMouseEvent(evt, mousePos, targetWindow, p2j.screen.mouseOps[mouseOp], targetWidget);
|
447
|
+ console.debug("sendMouseEvent: " + targetWindow.id + " -> " + mouseOp + " to wid " + targetWidget);
|
448
|
}
|
449
|
|
450
|
/**
|
451
|
@@ -416,7 +449,7 @@
|
452
|
{
|
453
|
if (targetWindow === undefined)
|
454
|
{
|
455
|
- return;
|
456
|
+ return false;
|
457
|
}
|
458
|
|
459
|
for (var osOp in targetWindow.osAwareWidgets)
|
460
|
@@ -429,15 +462,17 @@
|
461
|
if (osWidgets.hasOwnProperty(wid))
|
462
|
{
|
463
|
var osWidget = osWidgets[wid];
|
464
|
- if (evt.defaultPrevented)
|
465
|
+ if (osWidget.handle(mouseOp, evt))
|
466
|
{
|
467
|
- return;
|
468
|
+ console.debug("!!! dispatchEventToOSMouseWidgets('" + mouseOp + "', evt) to wid = " + wid + " " + osOp);
|
469
|
+ return true;
|
470
|
}
|
471
|
- osWidget.handle(mouseOp, evt);
|
472
|
}
|
473
|
}
|
474
|
}
|
475
|
}
|
476
|
+
|
477
|
+ return false;
|
478
|
}
|
479
|
|
480
|
/**
|
481
|
@@ -464,9 +499,10 @@
|
482
|
{
|
483
|
// check if a given widget is a registered widget for mouseOp
|
484
|
// to prevent sending the same event twice
|
485
|
- if (!targetWindow.mouseAwareWidgets[mouseOp].hasOwnProperty(wid))
|
486
|
+ if ((targetWidget === undefined) || !targetWindow.mouseAwareWidgets[mouseOp].hasOwnProperty(wid))
|
487
|
{
|
488
|
targetWindow.sendMouseEvent(evt, mousePos, targetWindow, p2j.screen.mouseOps[mouseOp], wid);
|
489
|
+ console.debug("dispatchEventToAnyMouseWidgets('" + mouseOp + "', evt) to wid = " + wid + ", " + JSON.stringify(mousePos));
|
490
|
}
|
491
|
}
|
492
|
}
|
493
|
@@ -573,10 +609,10 @@
|
494
|
{
|
495
|
// cannot use an array here because some indexes are negative numbers
|
496
|
this.mouseAwareWidgets[mouseOp] = {};
|
497
|
- if (mouseOp !== "drag" && mouseOp !== "click" && mouseOp !== "mouseup" && mouseOp !== "mousedown")
|
498
|
- {
|
499
|
- this.canvas.addEventListener(mouseOp, this.raiseMouseEvent(this, mouseOp));
|
500
|
- }
|
501
|
+// if (mouseOp !== "drag" && mouseOp !== "click" && mouseOp !== "mouseup" && mouseOp !== "mousedown")
|
502
|
+// {
|
503
|
+// this.canvas.addEventListener(mouseOp, this.raiseMouseEvent(this, mouseOp));
|
504
|
+// }
|
505
|
}
|
506
|
}
|
507
|
|
508
|
@@ -665,6 +701,32 @@
|
509
|
}
|
510
|
return undefined;
|
511
|
};
|
512
|
+
|
513
|
+ Window.prototype.findTargetOSWidget = function(evt)
|
514
|
+ {
|
515
|
+ var mouseOp = evt.type;
|
516
|
+
|
517
|
+ var mousePos = this.getMousePos(evt);
|
518
|
+
|
519
|
+ var widgetList = this.mouseAwareWidgets[evt.type];
|
520
|
+
|
521
|
+ // go through the widgets via the z-order
|
522
|
+ for (var idx = 0; idx < this.zOrder.length; idx++)
|
523
|
+ {
|
524
|
+ var wid = this.zOrder[idx];
|
525
|
+
|
526
|
+ if (this.isInside(mousePos, wid, widgetList))
|
527
|
+ {
|
528
|
+ var osWidget = p2j.screen.getOsEvent(evt, this, mouseOp, wid);
|
529
|
+ if (osWidget)
|
530
|
+ {
|
531
|
+ return osWidget;
|
532
|
+ }
|
533
|
+ }
|
534
|
+ }
|
535
|
+
|
536
|
+ return undefined;
|
537
|
+ };
|
538
|
|
539
|
/**
|
540
|
* Check if the widgets is in the list and mouse position is within its bounds
|
541
|
@@ -820,7 +882,7 @@
|
542
|
*/
|
543
|
Window.prototype.setWidgetZOrder = function(zOrder)
|
544
|
{
|
545
|
- //console.debug(JSON.stringify(zOrder));
|
546
|
+ console.debug(JSON.stringify(zOrder));
|
547
|
this.zOrder = zOrder;
|
548
|
}
|
549
|
|
550
|
@@ -909,29 +971,29 @@
|
551
|
*/
|
552
|
Window.prototype.registerMouseWidget = function(wid, x, y, width, height, actions)
|
553
|
{
|
554
|
-// var widActions = "";
|
555
|
-// for (var opName in mouseOps)
|
556
|
-// {
|
557
|
-// if (mouseOps.hasOwnProperty(opName))
|
558
|
-// {
|
559
|
-// if ((actions & (1 << mouseOps[opName])) == (1 << mouseOps[opName]))
|
560
|
-// {
|
561
|
-// widActions = widActions + " " + opName;
|
562
|
-// }
|
563
|
-// }
|
564
|
-// }
|
565
|
-// for (var opName in osOps)
|
566
|
-// {
|
567
|
-// if (osOps.hasOwnProperty(opName))
|
568
|
-// {
|
569
|
-// if ((actions & (1 << osOps[opName])) == (1 << osOps[opName]))
|
570
|
-// {
|
571
|
-// widActions = widActions + " " + opName;
|
572
|
-// }
|
573
|
-// }
|
574
|
-// }
|
575
|
-// console.debug("registerMouseWidget( " + wid + ", x=" + x + ", y=" + y + ", width=" + width
|
576
|
-// + ", height=" + height + ", actions=" + widActions + ")");
|
577
|
+ var widActions = "";
|
578
|
+ for (var opName in mouseOps)
|
579
|
+ {
|
580
|
+ if (mouseOps.hasOwnProperty(opName))
|
581
|
+ {
|
582
|
+ if ((actions & (1 << mouseOps[opName])) == (1 << mouseOps[opName]))
|
583
|
+ {
|
584
|
+ widActions = widActions + " " + opName;
|
585
|
+ }
|
586
|
+ }
|
587
|
+ }
|
588
|
+ for (var opName in osOps)
|
589
|
+ {
|
590
|
+ if (osOps.hasOwnProperty(opName))
|
591
|
+ {
|
592
|
+ if ((actions & (1 << osOps[opName])) == (1 << osOps[opName]))
|
593
|
+ {
|
594
|
+ widActions = widActions + " " + opName;
|
595
|
+ }
|
596
|
+ }
|
597
|
+ }
|
598
|
+ console.debug("registerMouseWidget( " + wid + ", x=" + x + ", y=" + y + ", width=" + width
|
599
|
+ + ", height=" + height + ", actions=" + widActions + ")");
|
600
|
// // register the widget aware of mouse (existing entry will be overwritten)
|
601
|
for (var opName in mouseOps)
|
602
|
{
|
603
|
@@ -956,41 +1018,74 @@
|
604
|
|
605
|
if ((actions & (1 << opCode)) == (1 << opCode))
|
606
|
{
|
607
|
- var mactions = this.osAwareWidgets[opName];
|
608
|
+ var mactions = this.osAwareWidgets[opName];
|
609
|
+ var osWidget = createOSWidget(this, opName, wid, x, y, width, height);
|
610
|
+ if (osWidget)
|
611
|
+ {
|
612
|
+ mactions[wid] = osWidget;
|
613
|
+ addOSWidgetToMouseWidgets(this, wid, osWidget);
|
614
|
+ }
|
615
|
|
616
|
- if (opName == "movable")
|
617
|
- {
|
618
|
- mactions[wid] = new MouseMovable(this, wid, x, y, width, height);
|
619
|
- }
|
620
|
- else if (opName == "editable")
|
621
|
- {
|
622
|
-// mactions[wid] = new MouseEditable(this, wid, x, y, width, height);
|
623
|
- }
|
624
|
- else if (opName == "window_closed")
|
625
|
- {
|
626
|
- mactions[wid] = new WindowClose(this, wid, x, y, width, height);
|
627
|
- }
|
628
|
- else if (opName == "window_iconified")
|
629
|
- {
|
630
|
- mactions[wid] = new WindowIconify(this, wid, x, y, width, height);
|
631
|
- }
|
632
|
- else if (opName == "window_maximized")
|
633
|
- {
|
634
|
- mactions[wid] = new WindowMaximize(this, wid, x, y, width, height);
|
635
|
- }
|
636
|
- else if (opName == "popupable_left")
|
637
|
- {
|
638
|
- mactions[wid] = new MousePopupable(this, wid, x, y, width, height, 1);
|
639
|
- }
|
640
|
- else if (opName == "popupable_right")
|
641
|
- {
|
642
|
- mactions[wid] = new MousePopupable(this, wid, x, y, width, height, 3);
|
643
|
- }
|
644
|
}
|
645
|
}
|
646
|
}
|
647
|
};
|
648
|
|
649
|
+ function addOSWidgetToMouseWidgets(container, wid, osWidget)
|
650
|
+ {
|
651
|
+ var mouseEvents = osWidget.getEvents();
|
652
|
+ for (var evt in mouseEvents)
|
653
|
+ {
|
654
|
+ if (mouseEvents.hasOwnProperty(evt))
|
655
|
+ {
|
656
|
+ var mouseWidgets = container.mouseAwareWidgets[evt];
|
657
|
+ if (mouseWidgets)
|
658
|
+ {
|
659
|
+ mouseWidgets[wid] = osWidget;
|
660
|
+ }
|
661
|
+ else
|
662
|
+ {
|
663
|
+ console.debug("[" + evt + "] !!!!!!!!!!!!!!!");
|
664
|
+ }
|
665
|
+ }
|
666
|
+ }
|
667
|
+ }
|
668
|
+
|
669
|
+ function createOSWidget(container, opName, wid, x, y, width, height)
|
670
|
+ {
|
671
|
+ var osWidget;
|
672
|
+ if (opName == "movable")
|
673
|
+ {
|
674
|
+ osWidget = new MouseMovable(container, wid, x, y, width, height);
|
675
|
+ }
|
676
|
+ else if (opName == "editable")
|
677
|
+ {
|
678
|
+// osWidget = new MouseEditable(container, wid, x, y, width, height);
|
679
|
+ }
|
680
|
+ else if (opName == "window_closed")
|
681
|
+ {
|
682
|
+ osWidget = new WindowClose(container, wid, x, y, width, height);
|
683
|
+ }
|
684
|
+ else if (opName == "window_iconified")
|
685
|
+ {
|
686
|
+ osWidget = new WindowIconify(container, wid, x, y, width, height);
|
687
|
+ }
|
688
|
+ else if (opName == "window_maximized")
|
689
|
+ {
|
690
|
+ osWidget = new WindowMaximize(container, wid, x, y, width, height);
|
691
|
+ }
|
692
|
+ else if (opName == "popupable_left")
|
693
|
+ {
|
694
|
+ osWidget = new MousePopupable(container, wid, x, y, width, height, 1);
|
695
|
+ }
|
696
|
+ else if (opName == "popupable_right")
|
697
|
+ {
|
698
|
+ osWidget = new MousePopupable(container, wid, x, y, width, height, 3);
|
699
|
+ }
|
700
|
+
|
701
|
+ return osWidget;
|
702
|
+ }
|
703
|
+
|
704
|
/**
|
705
|
* Deregister the specified widget for mouse events.
|
706
|
*
|
707
|
@@ -1930,7 +2025,7 @@
|
708
|
|
709
|
// send the mouse event
|
710
|
p2j.socket.sendMouseEvent(mouseEvent);
|
711
|
-
|
712
|
+ console.debug("sendMouseEvent " + JSON.stringify(mouseEvent));
|
713
|
// events are generated for the first widget which should respond for this mouse
|
714
|
// action; it's the P2J runtimes responsibility to determine which actual widget
|
715
|
// should interpret the event (i.e. z-order, etc)
|
716
|
@@ -2527,22 +2622,20 @@
|
717
|
*/
|
718
|
me.getOsEvent = function(evt, wThis, mouseOp, id)
|
719
|
{
|
720
|
- var mousePos = wThis.getMousePos(evt);
|
721
|
-
|
722
|
for (var osOp in wThis.osAwareWidgets)
|
723
|
{
|
724
|
- var ma = wThis.osAwareWidgets[osOp][id];
|
725
|
-
|
726
|
- if (ma == undefined)
|
727
|
- {
|
728
|
- continue;
|
729
|
- }
|
730
|
-
|
731
|
- var osEvents = ma.getEvents();
|
732
|
-
|
733
|
- if (osEvents[mouseOp] != undefined)
|
734
|
- {
|
735
|
- return wThis.osAwareWidgets[osOp][id];
|
736
|
+ if (wThis.osAwareWidgets.hasOwnProperty(osOp))
|
737
|
+ {
|
738
|
+ var osWidgets = wThis.osAwareWidgets[osOp];
|
739
|
+ if (osWidgets.hasOwnProperty(id))
|
740
|
+ {
|
741
|
+ var osWidget = osWidgets[id];
|
742
|
+ var osEvents = osWidget.getEvents();
|
743
|
+ if (osEvents.hasOwnProperty(mouseOp))
|
744
|
+ {
|
745
|
+ return osWidget;
|
746
|
+ }
|
747
|
+ }
|
748
|
}
|
749
|
}
|
750
|
|
751
|
|