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:
parent
315da57c97
commit
2c7d33bad2
@ -289,6 +289,10 @@ Chrome.prototype = {
|
|||||||
|
|
||||||
let [x, y] = actorData.actor.get_transformed_position();
|
let [x, y] = actorData.actor.get_transformed_position();
|
||||||
let [w, h] = actorData.actor.get_transformed_size();
|
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});
|
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h});
|
||||||
|
|
||||||
if (actorData.inputRegion && actorData.actor.get_paint_visibility())
|
if (actorData.inputRegion && actorData.actor.get_paint_visibility())
|
||||||
|
@ -122,7 +122,9 @@ _Draggable.prototype = {
|
|||||||
// Because we want to find out what other actor is located at the current position of this._dragActor,
|
// 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.
|
// we have to temporarily hide this._dragActor.
|
||||||
this._dragActor.hide();
|
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();
|
this._dragActor.show();
|
||||||
while (target) {
|
while (target) {
|
||||||
if (target._delegate && target._delegate.handleDragOver) {
|
if (target._delegate && target._delegate.handleDragOver) {
|
||||||
@ -156,7 +158,8 @@ _Draggable.prototype = {
|
|||||||
// Find a drop target
|
// Find a drop target
|
||||||
actor.hide();
|
actor.hide();
|
||||||
let [dropX, dropY] = event.get_coords();
|
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();
|
actor.show();
|
||||||
while (target) {
|
while (target) {
|
||||||
if (target._delegate && target._delegate.acceptDrop) {
|
if (target._delegate && target._delegate.acceptDrop) {
|
||||||
|
@ -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.
|
// 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 [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
|
||||||
let global = Shell.Global.get();
|
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) {
|
if (actor != null) {
|
||||||
let item = this._findDisplayedByActor(actor.get_parent());
|
let item = this._findDisplayedByActor(actor.get_parent());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
@ -204,10 +204,9 @@ ClutterFrameTicker.prototype = {
|
|||||||
_init : function() {
|
_init : function() {
|
||||||
// We don't have a finite duration; tweener will tell us to stop
|
// We don't have a finite duration; tweener will tell us to stop
|
||||||
// when we need to stop, so use 1000 seconds as "infinity"
|
// when we need to stop, so use 1000 seconds as "infinity"
|
||||||
this._timeline = new Clutter.Timeline({ fps: this.FRAME_RATE,
|
this._timeline = new Clutter.Timeline({ duration: 1000*1000 });
|
||||||
duration: 1000*1000 });
|
this._startTime = -1;
|
||||||
this._currentTime = 0;
|
this._currentTime = -1;
|
||||||
this._frame = 0;
|
|
||||||
|
|
||||||
let me = this;
|
let me = this;
|
||||||
this._timeline.connect('new-frame',
|
this._timeline.connect('new-frame',
|
||||||
@ -220,20 +219,13 @@ ClutterFrameTicker.prototype = {
|
|||||||
// If there is a lot of setup to start the animation, then
|
// If there is a lot of setup to start the animation, then
|
||||||
// first frame number we get from clutter might be a long ways
|
// first frame number we get from clutter might be a long ways
|
||||||
// into the animation (or the animation might even be done).
|
// 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.
|
// animation then only do frame dropping from there.
|
||||||
let delta;
|
if (this._startTime < 0)
|
||||||
if (this._frame == 0)
|
this._startTime = this._timeline.get_elapsed_time();
|
||||||
delta = 1;
|
|
||||||
else
|
|
||||||
delta = frame - this._frame;
|
|
||||||
|
|
||||||
if (delta == 0) // protect against divide-by-0 if we get a frame twice
|
|
||||||
delta = 1;
|
|
||||||
|
|
||||||
// currentTime is in milliseconds
|
// currentTime is in milliseconds
|
||||||
this._currentTime += (1000 * delta) / this.FRAME_RATE;
|
this._currentTime = this._timeline.get_elapsed_time() - this._startTime;
|
||||||
this._frame = frame;
|
|
||||||
this.emit('prepare-frame');
|
this.emit('prepare-frame');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -247,8 +239,8 @@ ClutterFrameTicker.prototype = {
|
|||||||
|
|
||||||
stop : function() {
|
stop : function() {
|
||||||
this._timeline.stop();
|
this._timeline.stop();
|
||||||
this._frame = 0;
|
this._startTime = -1;
|
||||||
this._currentTime = 0;
|
this._currentTime = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -147,9 +147,9 @@ shell_gtk_embed_get_property (GObject *object,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
shell_gtk_embed_get_preferred_width (ClutterActor *actor,
|
shell_gtk_embed_get_preferred_width (ClutterActor *actor,
|
||||||
ClutterUnit for_height,
|
float for_height,
|
||||||
ClutterUnit *min_width_p,
|
float *min_width_p,
|
||||||
ClutterUnit *natural_width_p)
|
float *natural_width_p)
|
||||||
{
|
{
|
||||||
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
||||||
|
|
||||||
@ -166,9 +166,9 @@ shell_gtk_embed_get_preferred_width (ClutterActor *actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
shell_gtk_embed_get_preferred_height (ClutterActor *actor,
|
shell_gtk_embed_get_preferred_height (ClutterActor *actor,
|
||||||
ClutterUnit for_width,
|
float for_width,
|
||||||
ClutterUnit *min_height_p,
|
float *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
float *natural_height_p)
|
||||||
{
|
{
|
||||||
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
||||||
|
|
||||||
@ -186,13 +186,13 @@ shell_gtk_embed_get_preferred_height (ClutterActor *actor,
|
|||||||
static void
|
static void
|
||||||
shell_gtk_embed_allocate (ClutterActor *actor,
|
shell_gtk_embed_allocate (ClutterActor *actor,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gboolean absolute_origin_changed)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor);
|
||||||
int wx = 0, wy = 0, x, y, ax, ay;
|
float wx = 0.0, wy = 0.0, x, y, ax, ay;
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->
|
CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->
|
||||||
allocate (actor, box, absolute_origin_changed);
|
allocate (actor, box, flags);
|
||||||
|
|
||||||
/* Find the actor's new coordinates in terms of the stage (which is
|
/* Find the actor's new coordinates in terms of the stage (which is
|
||||||
* priv->window's parent window.
|
* priv->window's parent window.
|
||||||
@ -209,7 +209,7 @@ shell_gtk_embed_allocate (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_shell_embedded_window_allocate (embed->priv->window,
|
_shell_embedded_window_allocate (embed->priv->window,
|
||||||
wx, wy,
|
(int)(0.5 + wx), (int)(0.5 + wy),
|
||||||
box->x2 - box->x1,
|
box->x2 - box->x1,
|
||||||
box->y2 - box->y1);
|
box->y2 - box->y1);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ create_recording_icon (void)
|
|||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
texture = cogl_texture_new_from_data (32, 32, 63,
|
texture = cogl_texture_new_from_data (32, 32,
|
||||||
COGL_TEXTURE_NONE,
|
COGL_TEXTURE_NONE,
|
||||||
COGL_PIXEL_FORMAT_BGRA_8888,
|
COGL_PIXEL_FORMAT_BGRA_8888,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
@ -576,11 +576,11 @@ static void
|
|||||||
recorder_queue_redraw (ShellRecorder *recorder)
|
recorder_queue_redraw (ShellRecorder *recorder)
|
||||||
{
|
{
|
||||||
/* If we just queue a redraw on every mouse motion (for example), we
|
/* If we just queue a redraw on every mouse motion (for example), we
|
||||||
* starve ClutterTimeline, which operates at a very low priority. So
|
* starve Clutter, which operates at a very low priority. So
|
||||||
* we need to queue a "low priority redraw" after timeline updates
|
* we need to queue a "low priority redraw" after timeline updates
|
||||||
*/
|
*/
|
||||||
if (recorder->state == RECORDER_STATE_RECORDING && recorder->redraw_idle == 0)
|
if (recorder->state == RECORDER_STATE_RECORDING && recorder->redraw_idle == 0)
|
||||||
recorder->redraw_idle = g_idle_add_full (CLUTTER_PRIORITY_TIMELINE + 1,
|
recorder->redraw_idle = g_idle_add_full (CLUTTER_PRIORITY_REDRAW + 1,
|
||||||
recorder_idle_redraw, recorder, NULL);
|
recorder_idle_redraw, recorder, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,12 +598,12 @@ static void
|
|||||||
position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
|
position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
|
||||||
{
|
{
|
||||||
ShellStatusMenu *status = SHELL_STATUS_MENU (user_data);
|
ShellStatusMenu *status = SHELL_STATUS_MENU (user_data);
|
||||||
int src_x, src_y;
|
float src_x, src_y;
|
||||||
|
|
||||||
clutter_actor_get_transformed_position (CLUTTER_ACTOR (status), &src_x, &src_y);
|
clutter_actor_get_transformed_position (CLUTTER_ACTOR (status), &src_x, &src_y);
|
||||||
|
|
||||||
*x = src_x;
|
*x = (gint)(0.5 + src_x);
|
||||||
*y = src_y;
|
*y = (gint)(0.5 + src_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -434,8 +434,7 @@ pixbuf_to_cogl_handle (GdkPixbuf *pixbuf)
|
|||||||
{
|
{
|
||||||
return cogl_texture_new_from_data (gdk_pixbuf_get_width (pixbuf),
|
return cogl_texture_new_from_data (gdk_pixbuf_get_width (pixbuf),
|
||||||
gdk_pixbuf_get_height (pixbuf),
|
gdk_pixbuf_get_height (pixbuf),
|
||||||
63, /* taken from clutter-texture.c default */
|
COGL_TEXTURE_NONE,
|
||||||
COGL_TEXTURE_AUTO_MIPMAP,
|
|
||||||
gdk_pixbuf_get_has_alpha (pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
gdk_pixbuf_get_has_alpha (pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
gdk_pixbuf_get_rowstride (pixbuf),
|
gdk_pixbuf_get_rowstride (pixbuf),
|
||||||
|
Loading…
Reference in New Issue
Block a user