rsence 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.2.4
@@ -373,7 +373,8 @@ HNumericTextControl = HTextControl.extend({
373
373
  defaultEvents: {
374
374
  mouseWheel: true,
375
375
  textEnter: true,
376
- contextMenu: true
376
+ contextMenu: true,
377
+ keyDown: true
377
378
  },
378
379
 
379
380
  /** Uses the mouseWheel event to step up/down the value.
@@ -384,6 +385,18 @@ HNumericTextControl = HTextControl.extend({
384
385
  this.setValue(Math.round(this.validateText(_value)));
385
386
  },
386
387
 
388
+ keyDown: function(_key){
389
+ if(_key===Event.KEY_UP){
390
+ this.mouseWheel(1);
391
+ return true;
392
+ }
393
+ else if(_key===Event.KEY_DOWN){
394
+ this.mouseWheel(-1);
395
+ return true;
396
+ }
397
+ return false;
398
+ },
399
+
387
400
  /** = Description
388
401
  * Extends the validateText method to ensure the
389
402
  * input is a number.
@@ -137,20 +137,55 @@ EVENT = {
137
137
  _this.hoverTimer = new Date().getTime();
138
138
  // Time since last hover event triggered
139
139
  },
140
+
141
+
142
+ // cleans up events that would be lost when browser window is blurred
143
+ _domWindowBlur: function(){
144
+ // console.log('window blurred');
145
+ var
146
+ _this = EVENT,
147
+ _status = _this.status;
148
+ // _status[_this.button1] = false;
149
+ // _status[_this.button2] = false;
150
+ // _status[_this.crsrX] = -1;
151
+ // _status[_this.crsrY] = -1;
152
+ _status[_this.keysDown] = [];
153
+ _status[_this.altKeyDown] = false;
154
+ _status[_this.ctrlKeyDown] = false;
155
+ _status[_this.shiftKeyDown] = false;
156
+ _status[_this.metaKeyDown] = false;
157
+ _status[_this.cmdKeyDown] = false;
158
+ _this.enableDroppableChecks = false;
159
+ if( HSystem.defaultInterval !== HSystem._blurredInterval ){
160
+ _this._sysDefaultInterval = HSystem.defaultInterval;
161
+ COMM.Queue.push( function(){
162
+ HSystem.defaultInterval = HSystem._blurredInterval;
163
+ } );
164
+ }
165
+ },
166
+ _domWindowFocus: function(){
167
+ var
168
+ _this = EVENT;
169
+ _this.enableDroppableChecks = _this._origDroppableChecks;
170
+ if( HSystem.defaultInterval === HSystem._blurredInterval && _this._sysDefaultInterval ){
171
+ COMM.Queue.push( function(){
172
+ HSystem.defaultInterval = _this._sysDefaultInterval;
173
+ } );
174
+ }
175
+ // console.log('window focused');
176
+ },
140
177
 
141
178
  /** Starts event listening.
142
179
  **/
143
180
  start: function() {
144
181
  var _globalEventTargetElement = (BROWSER_TYPE.ie && !BROWSER_TYPE.ie9)?document:window,
145
182
  _this = EVENT;
146
- // _eventMap = [
147
183
  Event.observe( _globalEventTargetElement, 'mousemove', _this.mouseMove );
148
184
  Event.observe( _globalEventTargetElement, 'mouseup', _this.mouseUp );
149
185
  Event.observe( _globalEventTargetElement, 'mousedown', _this.mouseDown );
150
186
  Event.observe( _globalEventTargetElement, 'click', _this.click );
151
187
  Event.observe( _globalEventTargetElement, 'keyup', _this.keyUp );
152
188
  Event.observe( _globalEventTargetElement, 'keydown', _this.keyDown );
153
- // IE and WebKit browsers don't need keyPress for repeat
154
189
  if( !BROWSER_TYPE.safari && !BROWSER_TYPE.ie){
155
190
  Event.observe( _globalEventTargetElement, 'keypress', _this.keyPress );
156
191
  }
@@ -158,16 +193,13 @@ EVENT = {
158
193
  Event.observe( _globalEventTargetElement, 'resize', _this.resize );
159
194
  Event.observe( _globalEventTargetElement, 'mousewheel', _this.mouseWheel );
160
195
  Event.observe( _globalEventTargetElement, 'dblclick', _this.doubleClick );
161
- // ],
162
- // i = 0;
163
- // for (; i !== _eventMap.length; i++) {
164
- // Event.observe(_globalEventTargetElement, _eventMap[i][0], _eventMap[i][1]);
165
- // }
166
196
  if (window.addEventListener) {
167
197
  window.addEventListener('DOMMouseScroll', EVENT.mouseWheel, false);
168
198
  window.addEventListener('resize', EVENT.resize, false);
169
199
  }
170
- //window.onmousewheel=document.onmousewheel=EVENT.mouseWheel;
200
+ _this._origDroppableChecks = _this.enableDroppableChecks;
201
+ Event.observe( window, 'blur', _this._domWindowBlur );
202
+ Event.observe( window, 'focus', _this._domWindowFocus );
171
203
  _this.listeners = [];
172
204
  // keep elemId buffer of all listeners
173
205
  _this.focused = [];
@@ -458,18 +490,37 @@ EVENT = {
458
490
  clearTimeout(_this._lastCoordFlushTimeout);
459
491
 
460
492
  // send drag event to all drag-interested ctrls
461
- for (; i !== _this.dragItems.length; i++) {
493
+ for (; i < _this.dragItems.length; i++) {
462
494
  _elemId = _this.dragItems[i];
463
495
  _this.focusOptions[_elemId].ctrl.drag(x, y);
464
496
  _this.coordCacheFlush(_elemId);
465
497
  _currentlyDragging = true;
466
498
  }
499
+ if(!_currentlyDragging){
500
+ if (new Date().getTime() > _this.hoverTimer + _this.hoverInterval) {
501
+ // sends mouseMove pseudo-events to ctrls interested
502
+ for (i = 0; i < _this.coordListeners.length; i++) {
503
+ _elemId = _this.coordListeners[i];
504
+ _ctrl = _this.focusOptions[_elemId].ctrl;
505
+ _ctrl.mouseMove(x, y);
506
+ }
507
+ _this.hoverTimer = new Date().getTime();
508
+ }
509
+ else {
510
+ _this._lastCoordFlushTimeout = setTimeout(
511
+ function(){
512
+ EVENT.flushMouseMove(x,y);
513
+ }, _this.hoverInterval
514
+ );
515
+ }
516
+ return false;
517
+ }
467
518
 
468
519
  if (_this.enableDroppableChecks) {
469
520
  // Check which items are under the mouse coordinates now.
470
521
  if (new Date().getTime() > _this.hoverTimer + _this.hoverInterval) {
471
522
  // sends mouseMove pseudo-events to ctrls interested
472
- for (i = 0; i !== _this.coordListeners.length; i++) {
523
+ for (i = 0; i < _this.coordListeners.length; i++) {
473
524
  _elemId = _this.coordListeners[i];
474
525
  _ctrl = _this.focusOptions[_elemId].ctrl;
475
526
  _ctrl.mouseMove(x, y);
@@ -479,7 +530,7 @@ EVENT = {
479
530
  }
480
531
  // sends drag&drop pseudo-events
481
532
  var _wasTopmostDroppable;
482
- for (i = 0; i !== _this.dragItems.length; i++) {
533
+ for (i = 0; i < _this.dragItems.length; i++) {
483
534
  // Find the current droppable while dragging.
484
535
  _wasTopmostDroppable = _this.topmostDroppable;
485
536
  _this.topmostDroppable = null;
@@ -529,7 +580,7 @@ EVENT = {
529
580
  );
530
581
  }
531
582
  }
532
- return _currentlyDragging;
583
+ return true;
533
584
  },
534
585
 
535
586
  // Loops through all registered items and store indices of elements
@@ -547,7 +598,7 @@ EVENT = {
547
598
  _size,
548
599
  _coords,
549
600
  _hovered = [];
550
- for (; i !== _this.listeners.length; i++) {
601
+ for (; i < _this.listeners.length; i++) {
551
602
  if (!_this.listeners[i] || !_this.focusOptions[i].ctrl) {
552
603
  continue;
553
604
  }
@@ -629,7 +680,7 @@ EVENT = {
629
680
  _this.status[_this.button2] = true;
630
681
  }
631
682
 
632
- for (; i !== _this.focused.length; i++) {
683
+ for (; i < _this.focused.length; i++) {
633
684
  if (_this.focused[i] === true) {
634
685
  // Set the active control to the currently focused item.
635
686
  if (_this.focusOptions[i].ctrl.enabled) {
@@ -648,14 +699,14 @@ EVENT = {
648
699
  _this.changeActiveControl(_newActiveControl);
649
700
  }
650
701
  // Call the mouseDown and startDrag events after the active control change has been handled.
651
- for (i = 0; i !== _startDragElementIds.length; i++) {
702
+ for (i = 0; i < _startDragElementIds.length; i++) {
652
703
  _this.dragItems.push(_startDragElementIds[i]);
653
704
  _this.focusOptions[_startDragElementIds[i]].ctrl.startDrag(x, y, _isLeftButton);
654
705
  _didStartDrag = true;
655
706
  }
656
707
 
657
708
  var _stopEvent = _mouseDownElementIds.length;
658
- for (i = 0; i !== _mouseDownElementIds.length; i++) {
709
+ for (i = 0; i < _mouseDownElementIds.length; i++) {
659
710
  if (_this.focusOptions[_mouseDownElementIds[i]].ctrl.mouseDown(x, y, _isLeftButton)) {
660
711
  _stopEvent--;
661
712
  }
@@ -721,7 +772,7 @@ EVENT = {
721
772
  if(!_isLeftButton){
722
773
  return true;
723
774
  }
724
- for (; i !== _this.focused.length; i++) {
775
+ for (; i < _this.focused.length; i++) {
725
776
  if (_this.focused[i] === true) {
726
777
  // Set the active control to the currently focused item.
727
778
  if (_this.focusOptions[i].ctrl.enabled) {
@@ -738,7 +789,7 @@ EVENT = {
738
789
  _this.changeActiveControl(_newActiveControl);
739
790
  }
740
791
  var _stopEvent = _clickElementIds.length;
741
- for (i = 0; i !== _clickElementIds.length; i++) {
792
+ for (i = 0; i < _clickElementIds.length; i++) {
742
793
  if (_this.focusOptions[_clickElementIds[i]].ctrl.click(x, y, _isLeftButton)) {
743
794
  _stopEvent--;
744
795
  }
@@ -827,7 +878,7 @@ EVENT = {
827
878
  i = 0;
828
879
  _this._modifiers(e);
829
880
  // Send endDrag for the currently dragged items even when they don't have focus, and clear the drag item array.
830
- for (; i !== _this.dragItems.length; i++) {
881
+ for (; i < _this.dragItems.length; i++) {
831
882
  _elemId = _this.dragItems[i];
832
883
  _ctrl = _this.focusOptions[_elemId].ctrl;
833
884
  _ctrl.endDrag(x, y, _isLeftButton);
@@ -888,10 +939,12 @@ EVENT = {
888
939
  i = 0;
889
940
  _this._modifiers(e);
890
941
  // Check for doubleClick listeners.
891
- for (i = 0; i !== _this.focused.length; i++) {
942
+ for (i = 0; i < _this.focused.length; i++) {
892
943
  if (_this.focused[i] === true) {
893
944
  if (_this.focusOptions[i].doubleClick === true) {
894
- _this.focusOptions[i].ctrl.doubleClick(x, y, true);
945
+ if ( _this.focusOptions[i].ctrl.doubleClick(x, y, true) ){
946
+ Event.stop(e);
947
+ }
895
948
  }
896
949
  }
897
950
  }
@@ -919,7 +972,7 @@ EVENT = {
919
972
  if (BROWSER_TYPE.opera || BROWSER_TYPE.safari || BROWSER_TYPE.ie) {
920
973
  _delta = 0 - _delta;
921
974
  }
922
- for (; i !== _this.focused.length; i++) {
975
+ for (; i < _this.focused.length; i++) {
923
976
  if (_this.focused[i] === true) {
924
977
  if (_this.focusOptions[i].mouseWheel === true) {
925
978
  Event.stop(e);
@@ -948,7 +1001,7 @@ EVENT = {
948
1001
  i = 0;
949
1002
  _this._modifiers(e);
950
1003
  // Check for contextMenu listeners.
951
- for (i = 0; i !== _this.focused.length; i++) {
1004
+ for (i = 0; i < _this.focused.length; i++) {
952
1005
  if (_this.focused[i] === true) {
953
1006
  if (_this.focusOptions[i].contextMenu === true) {
954
1007
  if( _this.focusOptions[i].ctrl.contextMenu() ){
@@ -989,7 +1042,7 @@ EVENT = {
989
1042
  }
990
1043
  }
991
1044
  // Insert key to the realtime array, remove in keyUp
992
- if (_this.isKeyDown(_keyCode)) {
1045
+ if(!_this.isKeyDown(_keyCode)) {
993
1046
  _this.status[_this.keysDown].push(_keyCode);
994
1047
  }
995
1048
  if (!_this.status[_this.cmdKeyDown] && _stopEvent){
@@ -1038,7 +1091,7 @@ EVENT = {
1038
1091
  _this.status[_this.cmdKeyDown] = false;
1039
1092
  }
1040
1093
  // Remove the key from the realtime array, inserted in keyDown
1041
- if(!_this.isKeyDown(_keyCode)){
1094
+ if(_this.isKeyDown(_keyCode)){
1042
1095
  _keyCodeIndex = _this.status[_this.keysDown].indexOf(_keyCode);
1043
1096
  _this.status[_this.keysDown].splice(_keyCodeIndex, 1);
1044
1097
  }
@@ -44,6 +44,9 @@ HSystem = {
44
44
 
45
45
  /** The default HSystem ticker interval. Unit is milliseconds. **/
46
46
  defaultInterval: 10,
47
+
48
+ // The ticker interval, when window has no focus.
49
+ _blurredInterval: 300,
47
50
 
48
51
  /** The default HApplication priority. Unit is "On the n:th tick: poll". **/
49
52
  defaultPriority: 20,
@@ -240,7 +240,9 @@ module RSence
240
240
  end
241
241
  puts "Storing sessions..." if RSence.args[:verbose]
242
242
  db_open
243
- @sessions.each do |ses_id,ses_data|
243
+ ses_ids = @sessions.keys
244
+ ses_ids.each do |ses_id|
245
+ ses_data = @sessions[ses_id]
244
246
  if @plugins
245
247
  @plugins.delegate( :dump_ses, ses_data )
246
248
  @plugins.delegate( :dump_ses_id, ses_id )
@@ -442,8 +442,8 @@ class ClientPkgBuild
442
442
  js_order.each do |js_pkg|
443
443
  pkg_part = @js[ js_pkg ]
444
444
  pkg_parts.push( pkg_part )
445
- pkg_size = ( @package_origsizes[ js_pkg ] or @destination_origsize[ js_pkg ] or 0 )
446
- warn "nil pkg size of: #{js_pkg}" if pkg_size.nil?
445
+ pkg_size = ( @package_origsizes[ js_pkg ] or @destination_origsize[ js_pkg ] or @compound_origsize[ js_pkg ] )
446
+ warn "nil pkg size of: #{js_pkg}" if pkg_size.nil? or pkg_size == 0
447
447
  js_size += pkg_size.nil? ? 0 : pkg_size
448
448
  end
449
449
  js_src = pkg_parts.join("\n")
@@ -459,6 +459,7 @@ class ClientPkgBuild
459
459
  else
460
460
  gz_size = gz_data.bytesize
461
461
  end
462
+ @compound_origsize[ pkg_name ] = js_size
462
463
  print_stat( pkg_name, js_size, jsc_size, gz_size )
463
464
  end
464
465
  end
@@ -496,6 +497,7 @@ class ClientPkgBuild
496
497
  def compose_destinations
497
498
  @destination_files = {} # rename to package_products
498
499
  @destination_origsize = {}
500
+ @compound_origsize = {}
499
501
  @package_names.each do |package_name|
500
502
  @packages[package_name].each do |bundle_name|
501
503
  if @bundles_found.has_key?( bundle_name )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-14 00:00:00.000000000 Z
13
+ date: 2012-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps