mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
Port to Mutter to Clutter 1.0 API
- Use float instead of ClutterUnit - clutter_actor_get_size/position() return floats (remove some stray usage of these functions in the default plugin as well.) - Adapt to cogl_texture_new_from_data() changes - Use blend strings to set up multitexturing - Remove CLUTTER_UNITS_TO_FLOAT() usage http://bugzilla.gnome.org/show_bug.cgi?id=585016
This commit is contained in:
parent
2ed1bf05d1
commit
fafb752827
@ -577,7 +577,7 @@ mutter_window_set_property (GObject *object,
|
||||
}
|
||||
else if (!newv && !priv->shadow && mutter_window_has_shadow (mw))
|
||||
{
|
||||
guint w, h;
|
||||
gfloat w, h;
|
||||
MetaDisplay *display = meta_screen_get_display (priv->screen);
|
||||
Mutter *compositor;
|
||||
|
||||
|
@ -227,7 +227,7 @@ mutter_shaped_texture_ensure_mask (MutterShapedTexture *stex)
|
||||
}
|
||||
else
|
||||
priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
|
||||
-1, FALSE,
|
||||
COGL_TEXTURE_NO_SLICING,
|
||||
COGL_PIXEL_FORMAT_A_8,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
tex_width,
|
||||
@ -282,30 +282,10 @@ mutter_shaped_texture_paint (ClutterActor *actor)
|
||||
{
|
||||
priv->material = cogl_material_new ();
|
||||
|
||||
/* Replace the RGB from layer 1 with the RGB from layer 0 */
|
||||
cogl_material_set_layer_combine_function
|
||||
(priv->material, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
|
||||
COGL_MATERIAL_LAYER_COMBINE_FUNC_REPLACE);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(priv->material, 1, 0,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
|
||||
|
||||
/* Modulate the alpha in layer 1 with the alpha from the
|
||||
previous layer */
|
||||
cogl_material_set_layer_combine_function
|
||||
(priv->material, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_FUNC_MODULATE);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(priv->material, 1, 0,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(priv->material, 1, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_TEXTURE);
|
||||
cogl_material_set_layer_combine (priv->material, 1,
|
||||
"RGB = REPLACE (PREVIOUS)"
|
||||
"A = MODULATE (PREVIOUS, TEXTURE)",
|
||||
NULL);
|
||||
}
|
||||
material = priv->material;
|
||||
|
||||
@ -325,30 +305,10 @@ mutter_shaped_texture_paint (ClutterActor *actor)
|
||||
{
|
||||
material = priv->material_workaround = cogl_material_new ();
|
||||
|
||||
/* Replace the RGB from layer 1 with the RGB from layer 0 */
|
||||
cogl_material_set_layer_combine_function
|
||||
(material, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
|
||||
COGL_MATERIAL_LAYER_COMBINE_FUNC_REPLACE);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(material, 1, 0,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
|
||||
|
||||
/* Use the alpha from layer 1 modulated with the alpha from
|
||||
the primary color */
|
||||
cogl_material_set_layer_combine_function
|
||||
(material, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_FUNC_MODULATE);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(material, 1, 0,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_PRIMARY_COLOR);
|
||||
cogl_material_set_layer_combine_arg_src
|
||||
(material, 1, 1,
|
||||
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
|
||||
COGL_MATERIAL_LAYER_COMBINE_SRC_TEXTURE);
|
||||
cogl_material_set_layer_combine (material, 1,
|
||||
"RGB = REPLACE (PREVIOUS)"
|
||||
"A = MODULATE (PRIMARY, TEXTURE)",
|
||||
NULL);
|
||||
}
|
||||
|
||||
material = priv->material_workaround;
|
||||
@ -369,8 +329,8 @@ mutter_shaped_texture_paint (ClutterActor *actor)
|
||||
|
||||
clutter_actor_get_allocation_box (actor, &alloc);
|
||||
cogl_rectangle (0, 0,
|
||||
CLUTTER_UNITS_TO_FLOAT (alloc.x2 - alloc.x1),
|
||||
CLUTTER_UNITS_TO_FLOAT (alloc.y2 - alloc.y1));
|
||||
alloc.x2 - alloc.x1,
|
||||
alloc.y2 - alloc.y1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -411,8 +371,8 @@ mutter_shaped_texture_pick (ClutterActor *actor,
|
||||
/* Paint the mask rectangle in the given color */
|
||||
cogl_set_source_texture (priv->mask_texture);
|
||||
cogl_rectangle_with_texture_coords (0, 0,
|
||||
CLUTTER_UNITS_TO_FLOAT (alloc.x2 - alloc.x1),
|
||||
CLUTTER_UNITS_TO_FLOAT (alloc.y2 - alloc.y1),
|
||||
alloc.x2 - alloc.x1,
|
||||
alloc.y2 - alloc.y1,
|
||||
0, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
|
@ -375,12 +375,6 @@ switch_workspace (MutterPlugin *plugin,
|
||||
|
||||
if (win_workspace == to || win_workspace == from)
|
||||
{
|
||||
gint x, y;
|
||||
guint w, h;
|
||||
|
||||
clutter_actor_get_position (window, &x, &y);
|
||||
clutter_actor_get_size (window, &w, &h);
|
||||
|
||||
apriv->orig_parent = clutter_actor_get_parent (window);
|
||||
|
||||
clutter_actor_reparent (window,
|
||||
@ -548,8 +542,8 @@ maximize (MutterPlugin *plugin,
|
||||
|
||||
gdouble scale_x = 1.0;
|
||||
gdouble scale_y = 1.0;
|
||||
gint anchor_x = 0;
|
||||
gint anchor_y = 0;
|
||||
gfloat anchor_x = 0;
|
||||
gfloat anchor_y = 0;
|
||||
|
||||
type = mutter_window_get_window_type (mc_window);
|
||||
|
||||
@ -558,8 +552,8 @@ maximize (MutterPlugin *plugin,
|
||||
ClutterAnimation *animation;
|
||||
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
|
||||
ActorPrivate *apriv = get_actor_private (mc_window);
|
||||
guint width, height;
|
||||
gint x, y;
|
||||
gfloat width, height;
|
||||
gfloat x, y;
|
||||
|
||||
apriv->is_maximized = TRUE;
|
||||
|
||||
|
@ -68,9 +68,9 @@ struct _TidyTextureFramePrivate
|
||||
|
||||
static void
|
||||
tidy_texture_frame_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv;
|
||||
|
||||
@ -101,9 +101,9 @@ tidy_texture_frame_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
tidy_texture_frame_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user