Merge branch 'master' into my-overlay-design
This commit is contained in:
commit
a9fedcce76
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -290,6 +290,23 @@ big_box_real_foreach (ClutterContainer *container,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
big_box_real_foreach_with_internals (ClutterContainer *container,
|
||||||
|
ClutterCallback callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
BigBox *group = BIG_BOX (container);
|
||||||
|
BigBoxPrivate *priv = group->priv;
|
||||||
|
|
||||||
|
big_box_real_foreach (container, callback, user_data);
|
||||||
|
|
||||||
|
if (priv->background_texture)
|
||||||
|
(* callback) (priv->background_texture, user_data);
|
||||||
|
|
||||||
|
if (priv->background_rectangle)
|
||||||
|
(* callback) (priv->background_rectangle, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_real_raise (ClutterContainer *container,
|
big_box_real_raise (ClutterContainer *container,
|
||||||
ClutterActor *child,
|
ClutterActor *child,
|
||||||
@ -439,6 +456,7 @@ clutter_container_iface_init (ClutterContainerIface *iface)
|
|||||||
iface->add = big_box_real_add;
|
iface->add = big_box_real_add;
|
||||||
iface->remove = big_box_real_remove;
|
iface->remove = big_box_real_remove;
|
||||||
iface->foreach = big_box_real_foreach;
|
iface->foreach = big_box_real_foreach;
|
||||||
|
iface->foreach_with_internals = big_box_real_foreach_with_internals;
|
||||||
iface->raise = big_box_real_raise;
|
iface->raise = big_box_real_raise;
|
||||||
iface->lower = big_box_real_lower;
|
iface->lower = big_box_real_lower;
|
||||||
iface->sort_depth_order = big_box_real_sort_depth_order;
|
iface->sort_depth_order = big_box_real_sort_depth_order;
|
||||||
@ -1086,8 +1104,8 @@ big_box_get_content_width_request (ClutterActor *self,
|
|||||||
for (c = priv->children; c != NULL; c = c->next)
|
for (c = priv->children; c != NULL; c = c->next)
|
||||||
{
|
{
|
||||||
BigBoxChild *child = (BigBoxChild *) c->data;
|
BigBoxChild *child = (BigBoxChild *) c->data;
|
||||||
ClutterUnit min_width;
|
float min_width;
|
||||||
ClutterUnit natural_width;
|
float natural_width;
|
||||||
|
|
||||||
if (!BOX_CHILD_IN_LAYOUT (child))
|
if (!BOX_CHILD_IN_LAYOUT (child))
|
||||||
continue;
|
continue;
|
||||||
@ -1308,7 +1326,7 @@ big_box_get_content_area_vertical (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
static BigBoxAdjustInfo *
|
static BigBoxAdjustInfo *
|
||||||
big_box_adjust_infos_new (BigBox *box,
|
big_box_adjust_infos_new (BigBox *box,
|
||||||
ClutterUnit for_content_width)
|
float for_content_width)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv = box->priv;
|
BigBoxPrivate *priv = box->priv;
|
||||||
BigBoxAdjustInfo *adjusts = g_new0 (BigBoxAdjustInfo, g_list_length (priv->children));
|
BigBoxAdjustInfo *adjusts = g_new0 (BigBoxAdjustInfo, g_list_length (priv->children));
|
||||||
@ -1402,7 +1420,7 @@ big_box_adjust_up_to_natural_size (GList *children,
|
|||||||
((!child->if_fits && !if_fits) ||
|
((!child->if_fits && !if_fits) ||
|
||||||
(child->if_fits && if_fits && !adjusts[i].does_not_fit)))
|
(child->if_fits && if_fits && !adjusts[i].does_not_fit)))
|
||||||
{
|
{
|
||||||
ClutterUnit needed_increase;
|
float needed_increase;
|
||||||
|
|
||||||
g_assert (adjusts[i].adjustment >= 0);
|
g_assert (adjusts[i].adjustment >= 0);
|
||||||
|
|
||||||
@ -1446,7 +1464,7 @@ big_box_adjust_up_to_natural_size (GList *children,
|
|||||||
((!child->if_fits && !if_fits) ||
|
((!child->if_fits && !if_fits) ||
|
||||||
(child->if_fits && if_fits && !adjusts[i].does_not_fit)))
|
(child->if_fits && if_fits && !adjusts[i].does_not_fit)))
|
||||||
{
|
{
|
||||||
ClutterUnit needed_increase;
|
float needed_increase;
|
||||||
|
|
||||||
g_assert (adjusts[i].adjustment >= 0);
|
g_assert (adjusts[i].adjustment >= 0);
|
||||||
|
|
||||||
@ -1459,7 +1477,7 @@ big_box_adjust_up_to_natural_size (GList *children,
|
|||||||
|
|
||||||
if (needed_increase > 0)
|
if (needed_increase > 0)
|
||||||
{
|
{
|
||||||
ClutterUnit extra;
|
float extra;
|
||||||
|
|
||||||
extra = (space_to_distribute / n_needing_increase);
|
extra = (space_to_distribute / n_needing_increase);
|
||||||
|
|
||||||
@ -1605,7 +1623,7 @@ big_box_adjust_for_expandable (GList *children,
|
|||||||
if (box_child_is_expandable (child, &(adjusts[i])) &&
|
if (box_child_is_expandable (child, &(adjusts[i])) &&
|
||||||
!adjusts[i].does_not_fit)
|
!adjusts[i].does_not_fit)
|
||||||
{
|
{
|
||||||
ClutterUnit extra;
|
float extra;
|
||||||
|
|
||||||
extra = (expand_space / expand_count);
|
extra = (expand_space / expand_count);
|
||||||
|
|
||||||
@ -1719,7 +1737,7 @@ big_box_get_hbox_height_request (ClutterActor *self,
|
|||||||
for (c = priv->children; c != NULL; c = c->next)
|
for (c = priv->children; c != NULL; c = c->next)
|
||||||
{
|
{
|
||||||
BigBoxChild *child = c->data;
|
BigBoxChild *child = c->data;
|
||||||
ClutterUnit min_height, natural_height;
|
float min_height, natural_height;
|
||||||
int req = 0;
|
int req = 0;
|
||||||
|
|
||||||
if (!BOX_CHILD_IN_LAYOUT (child))
|
if (!BOX_CHILD_IN_LAYOUT (child))
|
||||||
@ -1734,10 +1752,8 @@ big_box_get_hbox_height_request (ClutterActor *self,
|
|||||||
&min_height, &natural_height);
|
&min_height, &natural_height);
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("H - Child %p min height %d natural %d",
|
g_debug ("H - Child %p min height %g natural %g",
|
||||||
child->actor,
|
child->actor, min_height, natural_height);
|
||||||
CLUTTER_UNITS_TO_DEVICE (min_height),
|
|
||||||
CLUTTER_UNITS_TO_DEVICE (natural_height));
|
|
||||||
|
|
||||||
total_min = MAX (total_min, min_height);
|
total_min = MAX (total_min, min_height);
|
||||||
total_natural = MAX (total_natural, natural_height);
|
total_natural = MAX (total_natural, natural_height);
|
||||||
@ -1786,10 +1802,8 @@ big_box_get_vbox_height_request (ClutterActor *self,
|
|||||||
&min_height, &natural_height);
|
&min_height, &natural_height);
|
||||||
|
|
||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
g_debug ("V - Child %p min height %d natural %d",
|
g_debug ("V - Child %p min height %g natural %g",
|
||||||
child->actor,
|
child->actor, min_height, natural_height);
|
||||||
CLUTTER_UNITS_TO_DEVICE (min_height),
|
|
||||||
CLUTTER_UNITS_TO_DEVICE (natural_height));
|
|
||||||
|
|
||||||
n_children_in_natural += 1;
|
n_children_in_natural += 1;
|
||||||
total_natural += natural_height;
|
total_natural += natural_height;
|
||||||
@ -1868,30 +1882,30 @@ big_box_get_preferred_height (ClutterActor *self,
|
|||||||
if (priv->debug)
|
if (priv->debug)
|
||||||
{
|
{
|
||||||
if (min_height_p)
|
if (min_height_p)
|
||||||
g_debug ("Computed minimum height for width=%d as %d",
|
g_debug ("Computed minimum height for width=%g as %g",
|
||||||
CLUTTER_UNITS_TO_DEVICE (for_width), CLUTTER_UNITS_TO_DEVICE (*min_height_p));
|
for_width, *min_height_p);
|
||||||
if (natural_height_p)
|
if (natural_height_p)
|
||||||
g_debug ("Computed natural height for width=%d as %d",
|
g_debug ("Computed natural height for width=%g as %g",
|
||||||
CLUTTER_UNITS_TO_DEVICE (for_width), CLUTTER_UNITS_TO_DEVICE (*natural_height_p));
|
for_width, *natural_height_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
big_box_layout (ClutterActor *self,
|
big_box_layout (ClutterActor *self,
|
||||||
ClutterUnit content_x,
|
float content_x,
|
||||||
ClutterUnit content_y,
|
float content_y,
|
||||||
ClutterUnit allocated_content_width,
|
float allocated_content_width,
|
||||||
ClutterUnit allocated_content_height,
|
float allocated_content_height,
|
||||||
ClutterUnit requested_content_width,
|
float requested_content_width,
|
||||||
ClutterUnit requested_content_height,
|
float requested_content_height,
|
||||||
gboolean absolute_origin_changed)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
BigBoxAdjustInfo *adjusts;
|
BigBoxAdjustInfo *adjusts;
|
||||||
ClutterActorBox child_box;
|
ClutterActorBox child_box;
|
||||||
ClutterUnit allocated_size, requested_size;
|
float allocated_size, requested_size;
|
||||||
ClutterUnit start;
|
float start;
|
||||||
ClutterUnit end;
|
float end;
|
||||||
GList *c;
|
GList *c;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
@ -1924,7 +1938,7 @@ big_box_layout (ClutterActor *self,
|
|||||||
for (c = priv->children; c != NULL; c = c->next)
|
for (c = priv->children; c != NULL; c = c->next)
|
||||||
{
|
{
|
||||||
BigBoxChild *child = (BigBoxChild *) c->data;
|
BigBoxChild *child = (BigBoxChild *) c->data;
|
||||||
ClutterUnit req;
|
float req;
|
||||||
|
|
||||||
if (!BOX_CHILD_IN_LAYOUT (child))
|
if (!BOX_CHILD_IN_LAYOUT (child))
|
||||||
{
|
{
|
||||||
@ -1953,7 +1967,7 @@ big_box_layout (ClutterActor *self,
|
|||||||
child_box.y2 - child_box.y1);
|
child_box.y2 - child_box.y1);
|
||||||
|
|
||||||
clutter_actor_allocate (child->actor, &child_box,
|
clutter_actor_allocate (child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1976,7 +1990,7 @@ big_box_layout (ClutterActor *self,
|
|||||||
child_box.y2 - child_box.y1);
|
child_box.y2 - child_box.y1);
|
||||||
|
|
||||||
clutter_actor_allocate (child->actor, &child_box,
|
clutter_actor_allocate (child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req <= 0)
|
if (req <= 0)
|
||||||
@ -1990,7 +2004,7 @@ big_box_layout (ClutterActor *self,
|
|||||||
child_box.y2 = 0;
|
child_box.y2 = 0;
|
||||||
|
|
||||||
clutter_actor_allocate (child->actor, &child_box,
|
clutter_actor_allocate (child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Children with req == 0 still get spacing unless they are IF_FITS.
|
/* Children with req == 0 still get spacing unless they are IF_FITS.
|
||||||
@ -2015,7 +2029,7 @@ big_box_layout (ClutterActor *self,
|
|||||||
static void
|
static void
|
||||||
big_box_allocate (ClutterActor *self,
|
big_box_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gboolean absolute_origin_changed)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
BigBoxPrivate *priv;
|
BigBoxPrivate *priv;
|
||||||
int requested_content_width;
|
int requested_content_width;
|
||||||
@ -2037,7 +2051,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
box->x2,
|
box->x2,
|
||||||
box->y2);
|
box->y2);
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (big_box_parent_class)->allocate (self, box, absolute_origin_changed);
|
CLUTTER_ACTOR_CLASS (big_box_parent_class)->allocate (self, box, flags);
|
||||||
|
|
||||||
big_box_get_content_width_request (self,
|
big_box_get_content_width_request (self,
|
||||||
&requested_content_width,
|
&requested_content_width,
|
||||||
@ -2088,7 +2102,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
clutter_actor_allocate (priv->background_texture, &bg_box,
|
clutter_actor_allocate (priv->background_texture, &bg_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->background_rectangle)
|
if (priv->background_rectangle)
|
||||||
@ -2102,7 +2116,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
clutter_actor_allocate (priv->background_rectangle,
|
clutter_actor_allocate (priv->background_rectangle,
|
||||||
&rectangle_box,
|
&rectangle_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = priv->children; c != NULL; c = c->next)
|
for (c = priv->children; c != NULL; c = c->next)
|
||||||
@ -2123,7 +2137,7 @@ big_box_allocate (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
float x, y, width, height;
|
float x, y, width, height;
|
||||||
|
|
||||||
clutter_actor_get_positionu (child->actor, &x, &y);
|
clutter_actor_get_position (child->actor, &x, &y);
|
||||||
clutter_actor_get_preferred_width(child->actor, -1, NULL, &width);
|
clutter_actor_get_preferred_width(child->actor, -1, NULL, &width);
|
||||||
clutter_actor_get_preferred_height(child->actor, width, NULL, &height);
|
clutter_actor_get_preferred_height(child->actor, width, NULL, &height);
|
||||||
|
|
||||||
@ -2185,14 +2199,14 @@ big_box_allocate (ClutterActor *self,
|
|||||||
child_box.y2);
|
child_box.y2);
|
||||||
|
|
||||||
clutter_actor_allocate(child->actor, &child_box,
|
clutter_actor_allocate(child->actor, &child_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
big_box_layout (self, content_x, content_y,
|
big_box_layout (self, content_x, content_y,
|
||||||
allocated_content_width, allocated_content_height,
|
allocated_content_width, allocated_content_height,
|
||||||
requested_content_width, requested_content_height,
|
requested_content_width, requested_content_height,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -43,7 +43,7 @@ typedef struct {
|
|||||||
|
|
||||||
struct BigRectangle {
|
struct BigRectangle {
|
||||||
ClutterRectangle parent_instance;
|
ClutterRectangle parent_instance;
|
||||||
ClutterUnit radius;
|
float radius;
|
||||||
Corner *corner;
|
Corner *corner;
|
||||||
CoglHandle corner_material;
|
CoglHandle corner_material;
|
||||||
CoglHandle border_material;
|
CoglHandle border_material;
|
||||||
@ -210,8 +210,7 @@ create_corner_texture(Corner *src)
|
|||||||
g_free(data);
|
g_free(data);
|
||||||
|
|
||||||
texture = cogl_texture_new_from_data(size, size,
|
texture = cogl_texture_new_from_data(size, size,
|
||||||
0,
|
COGL_TEXTURE_NONE,
|
||||||
FALSE,
|
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888,
|
COGL_PIXEL_FORMAT_RGBA_8888,
|
||||||
COGL_PIXEL_FORMAT_ANY,
|
COGL_PIXEL_FORMAT_ANY,
|
||||||
rowstride,
|
rowstride,
|
||||||
@ -287,7 +286,7 @@ big_rectangle_update_corners(BigRectangle *rectangle)
|
|||||||
"color", &color,
|
"color", &color,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
corner = corner_get(CLUTTER_UNITS_TO_DEVICE(rectangle->radius),
|
corner = corner_get(rectangle->radius,
|
||||||
color,
|
color,
|
||||||
border_width,
|
border_width,
|
||||||
border_color);
|
border_color);
|
||||||
@ -485,7 +484,7 @@ big_rectangle_set_property(GObject *object,
|
|||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CORNER_RADIUS:
|
case PROP_CORNER_RADIUS:
|
||||||
rectangle->radius = CLUTTER_UNITS_FROM_DEVICE(g_value_get_uint(value));
|
rectangle->radius = g_value_get_uint(value);
|
||||||
rectangle->corners_dirty = TRUE;
|
rectangle->corners_dirty = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -508,7 +507,7 @@ big_rectangle_get_property(GObject *object,
|
|||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CORNER_RADIUS:
|
case PROP_CORNER_RADIUS:
|
||||||
g_value_set_uint(value, CLUTTER_UNITS_TO_DEVICE(rectangle->radius));
|
g_value_set_uint(value, rectangle->radius);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -279,7 +279,7 @@ big_theme_image_paint(ClutterActor *actor)
|
|||||||
static void
|
static void
|
||||||
big_theme_image_allocate(ClutterActor *actor,
|
big_theme_image_allocate(ClutterActor *actor,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gboolean absolute_origin_changed)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
BigThemeImage *image;
|
BigThemeImage *image;
|
||||||
guint old_width;
|
guint old_width;
|
||||||
@ -289,8 +289,8 @@ big_theme_image_allocate(ClutterActor *actor,
|
|||||||
|
|
||||||
image = BIG_THEME_IMAGE(actor);
|
image = BIG_THEME_IMAGE(actor);
|
||||||
|
|
||||||
width = ABS(CLUTTER_UNITS_TO_DEVICE(box->x2 - box->x1));
|
width = ABS(box->x2 - box->x1);
|
||||||
height = ABS(CLUTTER_UNITS_TO_DEVICE(box->y2 - box->y1));
|
height = ABS(box->y2 - box->y1);
|
||||||
|
|
||||||
g_object_get(actor,
|
g_object_get(actor,
|
||||||
"surface-width", &old_width,
|
"surface-width", &old_width,
|
||||||
@ -307,14 +307,14 @@ big_theme_image_allocate(ClutterActor *actor,
|
|||||||
if (CLUTTER_ACTOR_CLASS(big_theme_image_parent_class))
|
if (CLUTTER_ACTOR_CLASS(big_theme_image_parent_class))
|
||||||
CLUTTER_ACTOR_CLASS(big_theme_image_parent_class)->allocate(actor,
|
CLUTTER_ACTOR_CLASS(big_theme_image_parent_class)->allocate(actor,
|
||||||
box,
|
box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
big_theme_image_get_preferred_height(ClutterActor *actor,
|
big_theme_image_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)
|
||||||
{
|
{
|
||||||
BigThemeImage *image;
|
BigThemeImage *image;
|
||||||
|
|
||||||
@ -333,8 +333,7 @@ big_theme_image_get_preferred_height(ClutterActor *actor,
|
|||||||
if (!image->u.surface)
|
if (!image->u.surface)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*natural_height_p = CLUTTER_UNITS_FROM_DEVICE(
|
*natural_height_p = cairo_image_surface_get_height(image->u.surface);
|
||||||
cairo_image_surface_get_height(image->u.surface));
|
|
||||||
break;
|
break;
|
||||||
case BIG_THEME_IMAGE_SVG:
|
case BIG_THEME_IMAGE_SVG:
|
||||||
{
|
{
|
||||||
@ -344,8 +343,7 @@ big_theme_image_get_preferred_height(ClutterActor *actor,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
rsvg_handle_get_dimensions(image->u.svg_handle, &dimensions);
|
rsvg_handle_get_dimensions(image->u.svg_handle, &dimensions);
|
||||||
*natural_height_p =
|
*natural_height_p = dimensions.height;
|
||||||
CLUTTER_UNITS_FROM_DEVICE(dimensions.height);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -355,9 +353,9 @@ big_theme_image_get_preferred_height(ClutterActor *actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
big_theme_image_get_preferred_width(ClutterActor *actor,
|
big_theme_image_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)
|
||||||
{
|
{
|
||||||
BigThemeImage *image;
|
BigThemeImage *image;
|
||||||
|
|
||||||
@ -376,7 +374,7 @@ big_theme_image_get_preferred_width(ClutterActor *actor,
|
|||||||
if (!image->u.surface)
|
if (!image->u.surface)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE(cairo_image_surface_get_width(image->u.surface));
|
*natural_width_p = cairo_image_surface_get_width(image->u.surface);
|
||||||
break;
|
break;
|
||||||
case BIG_THEME_IMAGE_SVG:
|
case BIG_THEME_IMAGE_SVG:
|
||||||
{
|
{
|
||||||
@ -386,7 +384,7 @@ big_theme_image_get_preferred_width(ClutterActor *actor,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
rsvg_handle_get_dimensions(image->u.svg_handle, &dimensions);
|
rsvg_handle_get_dimensions(image->u.svg_handle, &dimensions);
|
||||||
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE(dimensions.width);
|
*natural_width_p = dimensions.width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -693,6 +693,8 @@ static void
|
|||||||
save_to_file (ShellAppMonitor *monitor)
|
save_to_file (ShellAppMonitor *monitor)
|
||||||
{
|
{
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
|
gpointer key;
|
||||||
|
gpointer value;
|
||||||
int activity;
|
int activity;
|
||||||
GSList *popularity;
|
GSList *popularity;
|
||||||
AppPopularity *app_popularity;
|
AppPopularity *app_popularity;
|
||||||
@ -721,9 +723,11 @@ save_to_file (ShellAppMonitor *monitor)
|
|||||||
g_object_unref (output);
|
g_object_unref (output);
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, monitor->popularities);
|
g_hash_table_iter_init (&iter, monitor->popularities);
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer *) &activity, (gpointer *) &popularity)
|
while (g_hash_table_iter_next (&iter, &key, &value) && value)
|
||||||
&& popularity)
|
|
||||||
{
|
{
|
||||||
|
activity = GPOINTER_TO_INT (key);
|
||||||
|
popularity = value;
|
||||||
|
|
||||||
line = g_strdup_printf ("%i\n", activity);
|
line = g_strdup_printf ("%i\n", activity);
|
||||||
g_data_output_stream_put_string (data_output, "--\n", NULL, NULL);
|
g_data_output_stream_put_string (data_output, "--\n", NULL, NULL);
|
||||||
g_data_output_stream_put_string (data_output, line, NULL, NULL);
|
g_data_output_stream_put_string (data_output, line, NULL, NULL);
|
||||||
|
@ -44,7 +44,7 @@ struct _ShellGlobal {
|
|||||||
const char *configdir;
|
const char *configdir;
|
||||||
|
|
||||||
/* Displays the root window; see shell_global_create_root_pixmap_actor() */
|
/* Displays the root window; see shell_global_create_root_pixmap_actor() */
|
||||||
ClutterGLXTexturePixmap *root_pixmap;
|
ClutterActor *root_pixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -1002,23 +1002,27 @@ ClutterActor *
|
|||||||
shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
||||||
{
|
{
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
gboolean created_new_pixmap = FALSE;
|
ClutterActor *stage;
|
||||||
ClutterActor *clone;
|
|
||||||
|
|
||||||
/* The actor created is actually a ClutterClone of global->root_pixmap. */
|
/* The actor created is actually a ClutterClone of global->root_pixmap. */
|
||||||
|
|
||||||
if (global->root_pixmap == NULL)
|
if (global->root_pixmap == NULL)
|
||||||
{
|
{
|
||||||
global->root_pixmap = CLUTTER_GLX_TEXTURE_PIXMAP (clutter_glx_texture_pixmap_new ());
|
global->root_pixmap = clutter_glx_texture_pixmap_new ();
|
||||||
|
|
||||||
/* The low and medium quality filters give nearest-neighbor resizing. */
|
/* The low and medium quality filters give nearest-neighbor resizing. */
|
||||||
clutter_texture_set_filter_quality (CLUTTER_TEXTURE (global->root_pixmap),
|
clutter_texture_set_filter_quality (CLUTTER_TEXTURE (global->root_pixmap),
|
||||||
CLUTTER_TEXTURE_QUALITY_HIGH);
|
CLUTTER_TEXTURE_QUALITY_HIGH);
|
||||||
|
|
||||||
/* The pixmap actor is only referenced by its clones. */
|
/* We can only clone an actor within a stage, so we hide the source
|
||||||
g_object_ref_sink (global->root_pixmap);
|
* texture then add it to the stage */
|
||||||
|
clutter_actor_hide (global->root_pixmap);
|
||||||
|
stage = mutter_plugin_get_stage (global->plugin);
|
||||||
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
|
||||||
|
global->root_pixmap);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (global->root_pixmap), "destroy",
|
/* This really should never happen; but just in case... */
|
||||||
|
g_signal_connect (global->root_pixmap, "destroy",
|
||||||
G_CALLBACK (root_pixmap_destroy), global);
|
G_CALLBACK (root_pixmap_destroy), global);
|
||||||
|
|
||||||
/* Metacity handles changes to some root window properties in its global
|
/* Metacity handles changes to some root window properties in its global
|
||||||
@ -1034,16 +1038,9 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
|||||||
gdk_window_add_filter (window, root_window_filter, global);
|
gdk_window_add_filter (window, root_window_filter, global);
|
||||||
|
|
||||||
update_root_window_pixmap (global);
|
update_root_window_pixmap (global);
|
||||||
|
|
||||||
created_new_pixmap = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clone = clutter_clone_new (CLUTTER_ACTOR (global->root_pixmap));
|
return clutter_clone_new (global->root_pixmap);
|
||||||
|
|
||||||
if (created_new_pixmap)
|
|
||||||
g_object_unref(global->root_pixmap);
|
|
||||||
|
|
||||||
return clone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -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),
|
||||||
|
@ -76,19 +76,19 @@ static void tidy_grid_pick (ClutterActor *actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
tidy_grid_get_preferred_width (ClutterActor *self,
|
tidy_grid_get_preferred_width (ClutterActor *self,
|
||||||
ClutterUnit for_height,
|
gfloat for_height,
|
||||||
ClutterUnit *min_width_p,
|
gfloat *min_width_p,
|
||||||
ClutterUnit *natural_width_p);
|
gfloat *natural_width_p);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tidy_grid_get_preferred_height (ClutterActor *self,
|
tidy_grid_get_preferred_height (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
gfloat for_width,
|
||||||
ClutterUnit *min_height_p,
|
gfloat *min_height_p,
|
||||||
ClutterUnit *natural_height_p);
|
gfloat *natural_height_p);
|
||||||
|
|
||||||
static void tidy_grid_allocate (ClutterActor *self,
|
static void tidy_grid_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gboolean absolute_origin_changed);
|
ClutterAllocationFlags flags);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (TidyGrid, tidy_grid,
|
G_DEFINE_TYPE_WITH_CODE (TidyGrid, tidy_grid,
|
||||||
CLUTTER_TYPE_ACTOR,
|
CLUTTER_TYPE_ACTOR,
|
||||||
@ -101,26 +101,25 @@ G_DEFINE_TYPE_WITH_CODE (TidyGrid, tidy_grid,
|
|||||||
|
|
||||||
struct _TidyGridPrivate
|
struct _TidyGridPrivate
|
||||||
{
|
{
|
||||||
ClutterUnit for_height, for_width;
|
gfloat for_height, for_width;
|
||||||
ClutterUnit pref_width, pref_height;
|
gfloat pref_width, pref_height;
|
||||||
ClutterUnit alloc_width, alloc_height;
|
gfloat alloc_width, alloc_height;
|
||||||
|
|
||||||
gboolean absolute_origin_changed;
|
|
||||||
GHashTable *hash_table;
|
GHashTable *hash_table;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
gboolean homogenous_rows;
|
gboolean homogenous_rows;
|
||||||
gboolean homogenous_columns;
|
gboolean homogenous_columns;
|
||||||
gboolean end_align;
|
gboolean end_align;
|
||||||
ClutterUnit column_gap, row_gap;
|
gfloat column_gap, row_gap;
|
||||||
gdouble valign, halign;
|
gdouble valign, halign;
|
||||||
|
|
||||||
gboolean column_major;
|
gboolean column_major;
|
||||||
|
|
||||||
gboolean first_of_batch;
|
gboolean first_of_batch;
|
||||||
ClutterUnit a_current_sum, a_wrap;
|
gfloat a_current_sum, a_wrap;
|
||||||
ClutterUnit max_extent_a;
|
gfloat max_extent_a;
|
||||||
ClutterUnit max_extent_b;
|
gfloat max_extent_b;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -139,8 +138,8 @@ enum
|
|||||||
struct _TidyGridActorData
|
struct _TidyGridActorData
|
||||||
{
|
{
|
||||||
gboolean xpos_set, ypos_set;
|
gboolean xpos_set, ypos_set;
|
||||||
ClutterUnit xpos, ypos;
|
gfloat xpos, ypos;
|
||||||
ClutterUnit pref_width, pref_height;
|
gfloat pref_width, pref_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -167,22 +166,22 @@ tidy_grid_class_init (TidyGridClass *klass)
|
|||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class,
|
(gobject_class,
|
||||||
PROP_ROW_GAP,
|
PROP_ROW_GAP,
|
||||||
clutter_param_spec_unit ("row-gap",
|
g_param_spec_float ("row-gap",
|
||||||
"Row gap",
|
"Row gap",
|
||||||
"gap between rows in the layout",
|
"gap between rows in the layout",
|
||||||
0, CLUTTER_MAXUNIT,
|
0.0, G_MAXFLOAT,
|
||||||
0,
|
0.0,
|
||||||
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class,
|
(gobject_class,
|
||||||
PROP_COLUMN_GAP,
|
PROP_COLUMN_GAP,
|
||||||
clutter_param_spec_unit ("column-gap",
|
g_param_spec_float ("column-gap",
|
||||||
"Column gap",
|
"Column gap",
|
||||||
"gap between columns in the layout",
|
"gap between columns in the layout",
|
||||||
0, CLUTTER_MAXUNIT,
|
0.0, G_MAXFLOAT,
|
||||||
0,
|
0.0,
|
||||||
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
|
G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
|
||||||
|
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
@ -367,14 +366,14 @@ tidy_grid_get_column_major (TidyGrid *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
tidy_grid_set_column_gap (TidyGrid *self,
|
tidy_grid_set_column_gap (TidyGrid *self,
|
||||||
ClutterUnit value)
|
gfloat value)
|
||||||
{
|
{
|
||||||
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
||||||
priv->column_gap = value;
|
priv->column_gap = value;
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterUnit
|
gfloat
|
||||||
tidy_grid_get_column_gap (TidyGrid *self)
|
tidy_grid_get_column_gap (TidyGrid *self)
|
||||||
{
|
{
|
||||||
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
||||||
@ -385,14 +384,14 @@ tidy_grid_get_column_gap (TidyGrid *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
tidy_grid_set_row_gap (TidyGrid *self,
|
tidy_grid_set_row_gap (TidyGrid *self,
|
||||||
ClutterUnit value)
|
gfloat value)
|
||||||
{
|
{
|
||||||
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
||||||
priv->row_gap = value;
|
priv->row_gap = value;
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterUnit
|
gfloat
|
||||||
tidy_grid_get_row_gap (TidyGrid *self)
|
tidy_grid_get_row_gap (TidyGrid *self)
|
||||||
{
|
{
|
||||||
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
TidyGridPrivate *priv = TIDY_GRID_GET_PRIVATE (self);
|
||||||
@ -463,10 +462,10 @@ tidy_grid_set_property (GObject *object,
|
|||||||
tidy_grid_set_column_major (grid, g_value_get_boolean (value));
|
tidy_grid_set_column_major (grid, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
case PROP_COLUMN_GAP:
|
case PROP_COLUMN_GAP:
|
||||||
tidy_grid_set_column_gap (grid, clutter_value_get_unit (value));
|
tidy_grid_set_column_gap (grid, g_value_get_float (value));
|
||||||
break;
|
break;
|
||||||
case PROP_ROW_GAP:
|
case PROP_ROW_GAP:
|
||||||
tidy_grid_set_row_gap (grid, clutter_value_get_unit (value));
|
tidy_grid_set_row_gap (grid, g_value_get_float (value));
|
||||||
break;
|
break;
|
||||||
case PROP_VALIGN:
|
case PROP_VALIGN:
|
||||||
tidy_grid_set_valign (grid, g_value_get_double (value));
|
tidy_grid_set_valign (grid, g_value_get_double (value));
|
||||||
@ -507,10 +506,10 @@ tidy_grid_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, tidy_grid_get_column_major (grid));
|
g_value_set_boolean (value, tidy_grid_get_column_major (grid));
|
||||||
break;
|
break;
|
||||||
case PROP_COLUMN_GAP:
|
case PROP_COLUMN_GAP:
|
||||||
clutter_value_set_unit (value, tidy_grid_get_column_gap (grid));
|
g_value_set_float (value, tidy_grid_get_column_gap (grid));
|
||||||
break;
|
break;
|
||||||
case PROP_ROW_GAP:
|
case PROP_ROW_GAP:
|
||||||
clutter_value_set_unit (value, tidy_grid_get_row_gap (grid));
|
g_value_set_float (value, tidy_grid_get_row_gap (grid));
|
||||||
break;
|
break;
|
||||||
case PROP_VALIGN:
|
case PROP_VALIGN:
|
||||||
g_value_set_double (value, tidy_grid_get_valign (grid));
|
g_value_set_double (value, tidy_grid_get_valign (grid));
|
||||||
@ -661,15 +660,15 @@ tidy_grid_pick (ClutterActor *actor,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
tidy_grid_get_preferred_width (ClutterActor *self,
|
tidy_grid_get_preferred_width (ClutterActor *self,
|
||||||
ClutterUnit for_height,
|
gfloat for_height,
|
||||||
ClutterUnit *min_width_p,
|
gfloat *min_width_p,
|
||||||
ClutterUnit *natural_width_p)
|
gfloat *natural_width_p)
|
||||||
{
|
{
|
||||||
TidyGrid *layout = (TidyGrid *) self;
|
TidyGrid *layout = (TidyGrid *) self;
|
||||||
TidyGridPrivate *priv = layout->priv;
|
TidyGridPrivate *priv = layout->priv;
|
||||||
ClutterUnit natural_width;
|
gfloat natural_width;
|
||||||
|
|
||||||
natural_width = CLUTTER_UNITS_FROM_INT (200);
|
natural_width = 200.0;
|
||||||
if (min_width_p)
|
if (min_width_p)
|
||||||
*min_width_p = natural_width;
|
*min_width_p = natural_width;
|
||||||
if (natural_width_p)
|
if (natural_width_p)
|
||||||
@ -680,15 +679,15 @@ tidy_grid_get_preferred_width (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
tidy_grid_get_preferred_height (ClutterActor *self,
|
tidy_grid_get_preferred_height (ClutterActor *self,
|
||||||
ClutterUnit for_width,
|
gfloat for_width,
|
||||||
ClutterUnit *min_height_p,
|
gfloat *min_height_p,
|
||||||
ClutterUnit *natural_height_p)
|
gfloat *natural_height_p)
|
||||||
{
|
{
|
||||||
TidyGrid *layout = (TidyGrid *) self;
|
TidyGrid *layout = (TidyGrid *) self;
|
||||||
TidyGridPrivate *priv = layout->priv;
|
TidyGridPrivate *priv = layout->priv;
|
||||||
ClutterUnit natural_height;
|
gfloat natural_height;
|
||||||
|
|
||||||
natural_height = CLUTTER_UNITS_FROM_INT (200);
|
natural_height = 200.0;
|
||||||
|
|
||||||
priv->for_width = for_width;
|
priv->for_width = for_width;
|
||||||
priv->pref_height = natural_height;
|
priv->pref_height = natural_height;
|
||||||
@ -699,17 +698,17 @@ tidy_grid_get_preferred_height (ClutterActor *self,
|
|||||||
*natural_height_p = natural_height;
|
*natural_height_p = natural_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterUnit
|
static gfloat
|
||||||
compute_row_height (GList *siblings,
|
compute_row_height (GList *siblings,
|
||||||
ClutterUnit best_yet,
|
gfloat best_yet,
|
||||||
ClutterUnit current_a,
|
gfloat current_a,
|
||||||
TidyGridPrivate *priv)
|
TidyGridPrivate *priv)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
gboolean homogenous_a;
|
gboolean homogenous_a;
|
||||||
gboolean homogenous_b;
|
gboolean homogenous_b;
|
||||||
ClutterUnit gap;
|
gfloat gap;
|
||||||
|
|
||||||
if (priv->column_major)
|
if (priv->column_major)
|
||||||
{
|
{
|
||||||
@ -727,7 +726,7 @@ compute_row_height (GList *siblings,
|
|||||||
for (l = siblings; l != NULL; l = l->next)
|
for (l = siblings; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
ClutterActor *child = l->data;
|
ClutterActor *child = l->data;
|
||||||
ClutterUnit natural_width, natural_height;
|
gfloat natural_width, natural_height;
|
||||||
|
|
||||||
/* each child will get as much space as they require */
|
/* each child will get as much space as they require */
|
||||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
||||||
@ -736,7 +735,7 @@ compute_row_height (GList *siblings,
|
|||||||
|
|
||||||
if (priv->column_major)
|
if (priv->column_major)
|
||||||
{
|
{
|
||||||
ClutterUnit temp = natural_height;
|
gfloat temp = natural_height;
|
||||||
natural_height = natural_width;
|
natural_height = natural_width;
|
||||||
natural_width = temp;
|
natural_width = temp;
|
||||||
}
|
}
|
||||||
@ -762,17 +761,17 @@ compute_row_height (GList *siblings,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ClutterUnit
|
static gfloat
|
||||||
compute_row_start (GList *siblings,
|
compute_row_start (GList *siblings,
|
||||||
ClutterUnit start_x,
|
gfloat start_x,
|
||||||
TidyGridPrivate *priv)
|
TidyGridPrivate *priv)
|
||||||
{
|
{
|
||||||
ClutterUnit current_a = start_x;
|
gfloat current_a = start_x;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
gboolean homogenous_a;
|
gboolean homogenous_a;
|
||||||
gboolean homogenous_b;
|
gboolean homogenous_b;
|
||||||
ClutterUnit gap;
|
gfloat gap;
|
||||||
|
|
||||||
if (priv->column_major)
|
if (priv->column_major)
|
||||||
{
|
{
|
||||||
@ -790,7 +789,7 @@ compute_row_start (GList *siblings,
|
|||||||
for (l = siblings; l != NULL; l = l->next)
|
for (l = siblings; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
ClutterActor *child = l->data;
|
ClutterActor *child = l->data;
|
||||||
ClutterUnit natural_width, natural_height;
|
gfloat natural_width, natural_height;
|
||||||
|
|
||||||
/* each child will get as much space as they require */
|
/* each child will get as much space as they require */
|
||||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
||||||
@ -819,17 +818,17 @@ compute_row_start (GList *siblings,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
tidy_grid_allocate (ClutterActor *self,
|
tidy_grid_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gboolean absolute_origin_changed)
|
ClutterAllocationFlags flags)
|
||||||
{
|
{
|
||||||
TidyGrid *layout = (TidyGrid *) self;
|
TidyGrid *layout = (TidyGrid *) self;
|
||||||
TidyGridPrivate *priv = layout->priv;
|
TidyGridPrivate *priv = layout->priv;
|
||||||
|
|
||||||
ClutterUnit current_a;
|
gfloat current_a;
|
||||||
ClutterUnit current_b;
|
gfloat current_b;
|
||||||
ClutterUnit next_b;
|
gfloat next_b;
|
||||||
ClutterUnit agap;
|
gfloat agap;
|
||||||
ClutterUnit bgap;
|
gfloat bgap;
|
||||||
|
|
||||||
gboolean homogenous_a;
|
gboolean homogenous_a;
|
||||||
gboolean homogenous_b;
|
gboolean homogenous_b;
|
||||||
@ -842,11 +841,10 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
/* chain up to set actor->allocation */
|
/* chain up to set actor->allocation */
|
||||||
CLUTTER_ACTOR_CLASS (tidy_grid_parent_class)
|
CLUTTER_ACTOR_CLASS (tidy_grid_parent_class)
|
||||||
->allocate (self, box, absolute_origin_changed);
|
->allocate (self, box, flags);
|
||||||
|
|
||||||
priv->alloc_width = box->x2 - box->x1;
|
priv->alloc_width = box->x2 - box->x1;
|
||||||
priv->alloc_height = box->y2 - box->y1;
|
priv->alloc_height = box->y2 - box->y1;
|
||||||
priv->absolute_origin_changed = absolute_origin_changed;
|
|
||||||
|
|
||||||
/* Make sure we have calculated the preferred size */
|
/* Make sure we have calculated the preferred size */
|
||||||
/* what does this do? */
|
/* what does this do? */
|
||||||
@ -885,8 +883,8 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
for (iter = priv->list; iter; iter = iter->next)
|
for (iter = priv->list; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
ClutterActor *child = iter->data;
|
ClutterActor *child = iter->data;
|
||||||
ClutterUnit natural_width;
|
gfloat natural_width;
|
||||||
ClutterUnit natural_height;
|
gfloat natural_height;
|
||||||
|
|
||||||
/* each child will get as much space as they require */
|
/* each child will get as much space as they require */
|
||||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
||||||
@ -901,7 +899,7 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
if (priv->column_major)
|
if (priv->column_major)
|
||||||
{
|
{
|
||||||
ClutterUnit temp = priv->max_extent_a;
|
gfloat temp = priv->max_extent_a;
|
||||||
priv->max_extent_a = priv->max_extent_b;
|
priv->max_extent_a = priv->max_extent_b;
|
||||||
priv->max_extent_b = temp;
|
priv->max_extent_b = temp;
|
||||||
}
|
}
|
||||||
@ -909,8 +907,8 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
for (iter = priv->list; iter; iter=iter->next)
|
for (iter = priv->list; iter; iter=iter->next)
|
||||||
{
|
{
|
||||||
ClutterActor *child = iter->data;
|
ClutterActor *child = iter->data;
|
||||||
ClutterUnit natural_a;
|
gfloat natural_a;
|
||||||
ClutterUnit natural_b;
|
gfloat natural_b;
|
||||||
|
|
||||||
/* each child will get as much space as they require */
|
/* each child will get as much space as they require */
|
||||||
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
clutter_actor_get_preferred_size (CLUTTER_ACTOR (child),
|
||||||
@ -919,7 +917,7 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
if (priv->column_major) /* swap axes around if column is major */
|
if (priv->column_major) /* swap axes around if column is major */
|
||||||
{
|
{
|
||||||
ClutterUnit temp = natural_a;
|
gfloat temp = natural_a;
|
||||||
natural_a = natural_b;
|
natural_a = natural_b;
|
||||||
natural_b = temp;
|
natural_b = temp;
|
||||||
}
|
}
|
||||||
@ -945,7 +943,7 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
next_b = current_b + natural_b;
|
next_b = current_b + natural_b;
|
||||||
|
|
||||||
{
|
{
|
||||||
ClutterUnit row_height;
|
gfloat row_height;
|
||||||
ClutterActorBox child_box;
|
ClutterActorBox child_box;
|
||||||
|
|
||||||
if (homogenous_b)
|
if (homogenous_b)
|
||||||
@ -976,7 +974,7 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
|
|
||||||
if (priv->column_major)
|
if (priv->column_major)
|
||||||
{
|
{
|
||||||
ClutterUnit temp = child_box.x1;
|
gfloat temp = child_box.x1;
|
||||||
child_box.x1 = child_box.y1;
|
child_box.x1 = child_box.y1;
|
||||||
child_box.y1 = temp;
|
child_box.y1 = temp;
|
||||||
|
|
||||||
@ -988,7 +986,7 @@ tidy_grid_allocate (ClutterActor *self,
|
|||||||
/* update the allocation */
|
/* update the allocation */
|
||||||
clutter_actor_allocate (CLUTTER_ACTOR (child),
|
clutter_actor_allocate (CLUTTER_ACTOR (child),
|
||||||
&child_box,
|
&child_box,
|
||||||
absolute_origin_changed);
|
flags);
|
||||||
|
|
||||||
if (homogenous_a)
|
if (homogenous_a)
|
||||||
{
|
{
|
||||||
|
@ -82,11 +82,11 @@ void tidy_grid_set_column_major (TidyGrid *self,
|
|||||||
gboolean value);
|
gboolean value);
|
||||||
gboolean tidy_grid_get_column_major (TidyGrid *self);
|
gboolean tidy_grid_get_column_major (TidyGrid *self);
|
||||||
void tidy_grid_set_row_gap (TidyGrid *self,
|
void tidy_grid_set_row_gap (TidyGrid *self,
|
||||||
ClutterUnit value);
|
gfloat value);
|
||||||
ClutterUnit tidy_grid_get_row_gap (TidyGrid *self);
|
gfloat tidy_grid_get_row_gap (TidyGrid *self);
|
||||||
void tidy_grid_set_column_gap (TidyGrid *self,
|
void tidy_grid_set_column_gap (TidyGrid *self,
|
||||||
ClutterUnit value);
|
gfloat value);
|
||||||
ClutterUnit tidy_grid_get_column_gap (TidyGrid *self);
|
gfloat tidy_grid_get_column_gap (TidyGrid *self);
|
||||||
void tidy_grid_set_valign (TidyGrid *self,
|
void tidy_grid_set_valign (TidyGrid *self,
|
||||||
gdouble value);
|
gdouble value);
|
||||||
gdouble tidy_grid_get_valign (TidyGrid *self);
|
gdouble tidy_grid_get_valign (TidyGrid *self);
|
||||||
|
Loading…
Reference in New Issue
Block a user