Port gnome-shell to the Clutter-1.0 API

- clutter_actor_get_transformed_position()/size() return floats
- clutter_stage_get_actor_at_pos() takes a pick mode
- ClutterTimeline no longer has a concept of frames
- ClutterUnit is now replaced by float
- cogl_texture_new_from_data() signature changed

http://bugzilla.gnome.org/show_bug.cgi?id=585013
This commit is contained in:
Owen W. Taylor
2009-06-06 13:07:41 -04:00
parent 315da57c97
commit 2c7d33bad2
8 changed files with 37 additions and 38 deletions

View File

@ -289,6 +289,10 @@ Chrome.prototype = {
let [x, y] = actorData.actor.get_transformed_position();
let [w, h] = actorData.actor.get_transformed_size();
x = Math.round(x);
y = Math.round(y);
w = Math.round(w);
h = Math.round(h);
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h});
if (actorData.inputRegion && actorData.actor.get_paint_visibility())

View File

@ -122,7 +122,9 @@ _Draggable.prototype = {
// Because we want to find out what other actor is located at the current position of this._dragActor,
// we have to temporarily hide this._dragActor.
this._dragActor.hide();
let target = actor.get_stage().get_actor_at_pos(stageX + this._dragOffsetX, stageY + this._dragOffsetY);
let target = actor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
stageX + this._dragOffsetX,
stageY + this._dragOffsetY);
this._dragActor.show();
while (target) {
if (target._delegate && target._delegate.handleDragOver) {
@ -156,7 +158,8 @@ _Draggable.prototype = {
// Find a drop target
actor.hide();
let [dropX, dropY] = event.get_coords();
let target = actor.get_stage().get_actor_at_pos(dropX, dropY);
let target = actor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
dropX, dropY);
actor.show();
while (target) {
if (target._delegate && target._delegate.acceptDrop) {

View File

@ -648,7 +648,8 @@ GenericDisplay.prototype = {
// Check if the pointer is over one of the items and display the preview pop-up if it is.
let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
let global = Shell.Global.get();
let actor = global.stage.get_actor_at_pos(x, y);
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE,
x, y);
if (actor != null) {
let item = this._findDisplayedByActor(actor.get_parent());
if (item != null) {

View File

@ -204,10 +204,9 @@ ClutterFrameTicker.prototype = {
_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.FRAME_RATE,
duration: 1000*1000 });
this._currentTime = 0;
this._frame = 0;
this._timeline = new Clutter.Timeline({ duration: 1000*1000 });
this._startTime = -1;
this._currentTime = -1;
let me = this;
this._timeline.connect('new-frame',
@ -220,20 +219,13 @@ ClutterFrameTicker.prototype = {
// If there is a lot of setup to start the animation, then
// first frame number we get from clutter might be a long ways
// into the animation (or the animation might even be done).
// That looks bad, so we always start one frame into the
// That looks bad, so we always start at the first frame of the
// animation then only do frame dropping from there.
let delta;
if (this._frame == 0)
delta = 1;
else
delta = frame - this._frame;
if (delta == 0) // protect against divide-by-0 if we get a frame twice
delta = 1;
if (this._startTime < 0)
this._startTime = this._timeline.get_elapsed_time();
// currentTime is in milliseconds
this._currentTime += (1000 * delta) / this.FRAME_RATE;
this._frame = frame;
this._currentTime = this._timeline.get_elapsed_time() - this._startTime;
this.emit('prepare-frame');
},
@ -247,8 +239,8 @@ ClutterFrameTicker.prototype = {
stop : function() {
this._timeline.stop();
this._frame = 0;
this._currentTime = 0;
this._startTime = -1;
this._currentTime = -1;
}
};