Redo tabs => spaces indentation change to not lose manual indentation
Revert most JS changes in commit: Fri Nov 28 20:12:20 2008 +0000 Convert all JS style to be uniform, add Eclipse settings bits Instead, just add 'indent-tabs-mode: nil' to the mode lines and convert tabs to spaces. The indentation no longer exactly matches the Eclipse settings, since they differ in some ways from the style we are trying to achieve. svn path=/trunk/; revision=97
This commit is contained in:
106
js/ui/main.js
106
js/ui/main.js
@ -1,4 +1,4 @@
|
||||
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */
|
||||
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Shell = imports.gi.Shell;
|
||||
@ -18,67 +18,67 @@ let overlay = null;
|
||||
let run_dialog = null;
|
||||
let wm = null;
|
||||
|
||||
//The "FrameTicker" object is an object used to feed new frames to Tweener
|
||||
//so it can update values and redraw. The default frame ticker for
|
||||
//Tweener just uses a simple timeout at a fixed frame rate and has no idea
|
||||
//of "catching up" by dropping frames.
|
||||
|
||||
//We substitute it with custom frame ticker here that connects Tweener to
|
||||
//a Clutter.TimeLine. Now, Clutter.Timeline itself isn't a whole lot more
|
||||
//sophisticated than a simple timeout at a fixed frame rate, but at least
|
||||
//it knows how to drop frames. (See HippoAnimationManager for a more
|
||||
//sophisticated view of continous time updates; even better is to pay
|
||||
//attention to the vertical vblank and sync to that when possible.)
|
||||
|
||||
// The "FrameTicker" object is an object used to feed new frames to Tweener
|
||||
// so it can update values and redraw. The default frame ticker for
|
||||
// Tweener just uses a simple timeout at a fixed frame rate and has no idea
|
||||
// of "catching up" by dropping frames.
|
||||
//
|
||||
// We substitute it with custom frame ticker here that connects Tweener to
|
||||
// a Clutter.TimeLine. Now, Clutter.Timeline itself isn't a whole lot more
|
||||
// sophisticated than a simple timeout at a fixed frame rate, but at least
|
||||
// it knows how to drop frames. (See HippoAnimationManager for a more
|
||||
// sophisticated view of continous time updates; even better is to pay
|
||||
// attention to the vertical vblank and sync to that when possible.)
|
||||
//
|
||||
function ClutterFrameTicker() {
|
||||
this._init();
|
||||
}
|
||||
|
||||
ClutterFrameTicker.prototype = {
|
||||
TARGET_FRAME_RATE : 60,
|
||||
TARGET_FRAME_RATE : 60,
|
||||
|
||||
_init : function() {
|
||||
// We don't have a finite duration; tweener will tell us to stop
|
||||
// when we need to stop, so use 1000 seconds as "infinity"
|
||||
this._timeline = new Clutter.Timeline({ fps: this.TARGET_FRAME_RATE,
|
||||
duration: 1000*1000 });
|
||||
this._frame = 0;
|
||||
_init : function() {
|
||||
// We don't have a finite duration; tweener will tell us to stop
|
||||
// when we need to stop, so use 1000 seconds as "infinity"
|
||||
this._timeline = new Clutter.Timeline({ fps: this.TARGET_FRAME_RATE,
|
||||
duration: 1000*1000 });
|
||||
this._frame = 0;
|
||||
|
||||
let me = this;
|
||||
this._timeline.connect('new-frame',
|
||||
let me = this;
|
||||
this._timeline.connect('new-frame',
|
||||
function(timeline, frame) {
|
||||
me._onNewFrame(frame);
|
||||
});
|
||||
},
|
||||
me._onNewFrame(frame);
|
||||
});
|
||||
},
|
||||
|
||||
_onNewFrame : function(frame) {
|
||||
// Unfortunately the interface to to send a new frame to tweener
|
||||
// is a simple "next frame" and there is no provision for signaling
|
||||
// that frames have been skipped or just telling it the new time.
|
||||
// But what it actually does internally is just:
|
||||
//
|
||||
// _currentTime += 1000/_ticker.FRAME_RATE;
|
||||
//
|
||||
// So by dynamically adjusting the value of FRAME_RATE we can trick
|
||||
// it into dealing with dropped frames.
|
||||
_onNewFrame : function(frame) {
|
||||
// Unfortunately the interface to to send a new frame to tweener
|
||||
// is a simple "next frame" and there is no provision for signaling
|
||||
// that frames have been skipped or just telling it the new time.
|
||||
// But what it actually does internally is just:
|
||||
//
|
||||
// _currentTime += 1000/_ticker.FRAME_RATE;
|
||||
//
|
||||
// So by dynamically adjusting the value of FRAME_RATE we can trick
|
||||
// it into dealing with dropped frames.
|
||||
|
||||
let delta = frame - this._frame;
|
||||
if (delta == 0)
|
||||
this.FRAME_RATE = this.TARGET_FRAME_RATE;
|
||||
else
|
||||
this.FRAME_RATE = this.TARGET_FRAME_RATE / delta;
|
||||
this._frame = frame;
|
||||
this.emit('prepare-frame');
|
||||
},
|
||||
let delta = frame - this._frame;
|
||||
if (delta == 0)
|
||||
this.FRAME_RATE = this.TARGET_FRAME_RATE;
|
||||
else
|
||||
this.FRAME_RATE = this.TARGET_FRAME_RATE / delta;
|
||||
this._frame = frame;
|
||||
this.emit('prepare-frame');
|
||||
},
|
||||
|
||||
start : function() {
|
||||
this._timeline.start();
|
||||
},
|
||||
start : function() {
|
||||
this._timeline.start();
|
||||
},
|
||||
|
||||
stop : function() {
|
||||
this._timeline.stop();
|
||||
this._frame = 0;
|
||||
}
|
||||
stop : function() {
|
||||
this._timeline.stop();
|
||||
this._frame = 0;
|
||||
}
|
||||
};
|
||||
|
||||
Signals.addSignalMethods(ClutterFrameTicker.prototype);
|
||||
@ -121,9 +121,9 @@ function start() {
|
||||
wm = new WindowManager.WindowManager();
|
||||
}
|
||||
|
||||
//Used to go into a mode where all keyboard and mouse input goes to
|
||||
//the stage. Returns true if we successfully grabbed the keyboard and
|
||||
//went modal, false otherwise
|
||||
// Used to go into a mode where all keyboard and mouse input goes to
|
||||
// the stage. Returns true if we successfully grabbed the keyboard and
|
||||
// went modal, false otherwise
|
||||
function startModal() {
|
||||
let global = Shell.Global.get();
|
||||
|
||||
|
Reference in New Issue
Block a user