Compare commits
11 Commits
wip/carlos
...
wip/gcampa
Author | SHA1 | Date | |
---|---|---|---|
4f56cfb1e6 | |||
db7fa793b0 | |||
f254879226 | |||
94ac7ff02c | |||
7332eb3db2 | |||
b61e221e8f | |||
f278fd92d5 | |||
0a1ee4aa54 | |||
5a83ef71c9 | |||
3e723caabd | |||
dbc9303efd |
@ -48,6 +48,7 @@ libmutter_la_SOURCES = \
|
||||
compositor/compositor-private.h \
|
||||
compositor/meta-background-actor.c \
|
||||
compositor/meta-background-actor-private.h \
|
||||
compositor/meta-background.c \
|
||||
compositor/meta-module.c \
|
||||
compositor/meta-module.h \
|
||||
compositor/meta-plugin.c \
|
||||
@ -226,7 +227,7 @@ typelib_DATA = Meta-$(api_version).typelib
|
||||
INTROSPECTION_GIRS = Meta-$(api_version).gir
|
||||
|
||||
Meta-$(api_version).gir: libmutter.la
|
||||
@META_GIR@_INCLUDES = GObject-2.0 GDesktopEnums-3.0 Gdk-3.0 Gtk-3.0 Clutter-1.0 xlib-2.0 xfixes-4.0 Cogl-1.0
|
||||
@META_GIR@_INCLUDES = GObject-2.0 GDesktopEnums-3.0 Gdk-3.0 Gtk-3.0 Clutter-1.0 xlib-2.0 xfixes-4.0 Cogl-1.0 GnomeDesktop-3.0
|
||||
@META_GIR@_EXPORT_PACKAGES = libmutter
|
||||
@META_GIR@_CFLAGS = $(INCLUDES)
|
||||
@META_GIR@_LIBS = libmutter.la
|
||||
|
@ -23,47 +23,8 @@
|
||||
|
||||
#include "cogl-utils.h"
|
||||
|
||||
/**
|
||||
* meta_create_color_texture_4ub:
|
||||
* @red:
|
||||
* @green:
|
||||
* @blue:
|
||||
* @alpha:
|
||||
* @flags: Optional flags for the texture, or %COGL_TEXTURE_NONE;
|
||||
* %COGL_TEXTURE_NO_SLICING is useful if the texture will be
|
||||
* repeated to create a constant color fill, since hardware
|
||||
* repeat can't be used for a sliced texture.
|
||||
*
|
||||
* Creates a texture that is a single pixel with the specified
|
||||
* unpremultiplied color components.
|
||||
*
|
||||
* Return value: (transfer full): a newly created Cogl texture
|
||||
*/
|
||||
CoglHandle
|
||||
meta_create_color_texture_4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha,
|
||||
CoglTextureFlags flags)
|
||||
{
|
||||
CoglColor color;
|
||||
guint8 pixel[4];
|
||||
|
||||
cogl_color_set_from_4ub (&color, red, green, blue, alpha);
|
||||
cogl_color_premultiply (&color);
|
||||
|
||||
pixel[0] = cogl_color_get_red_byte (&color);
|
||||
pixel[1] = cogl_color_get_green_byte (&color);
|
||||
pixel[2] = cogl_color_get_blue_byte (&color);
|
||||
pixel[3] = cogl_color_get_alpha_byte (&color);
|
||||
|
||||
return cogl_texture_new_from_data (1, 1,
|
||||
flags,
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
4, pixel);
|
||||
}
|
||||
|
||||
#define CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
/* Based on gnome-shell/src/st/st-private.c:_st_create_texture_material.c */
|
||||
|
||||
@ -79,32 +40,69 @@ meta_create_color_texture_4ub (guint8 red,
|
||||
*
|
||||
* Return value: (transfer full): a newly created Cogl material
|
||||
*/
|
||||
CoglHandle
|
||||
CoglPipeline *
|
||||
meta_create_texture_material (CoglHandle src_texture)
|
||||
{
|
||||
static CoglHandle texture_material_template = COGL_INVALID_HANDLE;
|
||||
CoglHandle material;
|
||||
static CoglPipeline *texture_material_template = NULL;
|
||||
CoglPipeline *material;
|
||||
|
||||
/* We use a material that has a dummy texture as a base for all
|
||||
texture materials. The idea is that only the Cogl texture object
|
||||
would be different in the children so it is likely that Cogl will
|
||||
be able to share GL programs between all the textures. */
|
||||
if (G_UNLIKELY (texture_material_template == COGL_INVALID_HANDLE))
|
||||
if (G_UNLIKELY (texture_material_template == NULL))
|
||||
{
|
||||
CoglHandle dummy_texture;
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
CoglContext *context = clutter_backend_get_cogl_context (backend);
|
||||
|
||||
dummy_texture = meta_create_color_texture_4ub (0xff, 0xff, 0xff, 0xff,
|
||||
COGL_TEXTURE_NONE);
|
||||
|
||||
texture_material_template = cogl_material_new ();
|
||||
cogl_material_set_layer (texture_material_template, 0, dummy_texture);
|
||||
cogl_handle_unref (dummy_texture);
|
||||
texture_material_template = cogl_pipeline_new (context);
|
||||
cogl_pipeline_set_layer_null_texture (texture_material_template,
|
||||
0, COGL_TEXTURE_TYPE_2D);
|
||||
}
|
||||
|
||||
material = cogl_material_copy (texture_material_template);
|
||||
material = cogl_pipeline_copy (texture_material_template);
|
||||
|
||||
if (src_texture != COGL_INVALID_HANDLE)
|
||||
cogl_material_set_layer (material, 0, src_texture);
|
||||
cogl_pipeline_set_layer_texture (material, 0, src_texture);
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_create_crossfade_material:
|
||||
* @src_texture_0: (allow-none): the texture to crossfade from
|
||||
* @src_texture_1: (allow-none): the texture to crossfade to
|
||||
*
|
||||
* Creates a material with two layers, using a combine constant to
|
||||
* crossfade between them.
|
||||
*
|
||||
* Return value: (transfer full): a newly created Cogl material
|
||||
*/
|
||||
CoglPipeline *
|
||||
meta_create_crossfade_material (CoglHandle src_texture_0,
|
||||
CoglHandle src_texture_1)
|
||||
{
|
||||
static CoglPipeline *texture_material_template = NULL;
|
||||
CoglPipeline *material;
|
||||
|
||||
if (G_UNLIKELY (texture_material_template == NULL))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
CoglContext *context = clutter_backend_get_cogl_context (backend);
|
||||
|
||||
texture_material_template = cogl_pipeline_new (context);
|
||||
|
||||
cogl_pipeline_set_layer_null_texture (texture_material_template,
|
||||
0, COGL_TEXTURE_TYPE_2D);
|
||||
cogl_pipeline_set_layer_null_texture (texture_material_template,
|
||||
1, COGL_TEXTURE_TYPE_2D);
|
||||
cogl_pipeline_set_layer_combine (texture_material_template,
|
||||
1, "RGBA = INTERPOLATE (TEXTURE, PREVIOUS, CONSTANT[A])",
|
||||
NULL);
|
||||
}
|
||||
|
||||
material = cogl_pipeline_copy (texture_material_template);
|
||||
|
||||
if (src_texture_0 != COGL_INVALID_HANDLE)
|
||||
cogl_pipeline_set_layer_texture (material, 0, src_texture_0);
|
||||
if (src_texture_1 != COGL_INVALID_HANDLE)
|
||||
cogl_pipeline_set_layer_texture (material, 1, src_texture_1);
|
||||
|
||||
return material;
|
||||
}
|
||||
|
@ -23,13 +23,11 @@
|
||||
#ifndef __META_COGL_UTILS_H__
|
||||
#define __META_COGL_UTILS_H__
|
||||
|
||||
#define COGL_ENABLE_EXPERIMENTAL_API
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
CoglHandle meta_create_color_texture_4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha,
|
||||
CoglTextureFlags flags);
|
||||
CoglHandle meta_create_texture_material (CoglHandle src_texture);
|
||||
CoglPipeline *meta_create_texture_material (CoglHandle src_texture);
|
||||
CoglPipeline *meta_create_crossfade_material (CoglHandle src_texture_0,
|
||||
CoglHandle src_texture_1);
|
||||
|
||||
#endif /* __META_COGL_UTILS_H__ */
|
||||
|
@ -40,7 +40,6 @@ struct _MetaCompScreen
|
||||
|
||||
ClutterActor *stage, *window_group, *overlay_group;
|
||||
ClutterActor *background_actor;
|
||||
ClutterActor *hidden_group;
|
||||
GList *windows;
|
||||
GHashTable *windows_by_xid;
|
||||
Window output;
|
||||
|
@ -117,21 +117,6 @@ process_property_notify (MetaCompositor *compositor,
|
||||
{
|
||||
MetaWindowActor *window_actor;
|
||||
|
||||
if (event->atom == compositor->atom_x_root_pixmap)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
for (l = meta_display_get_screens (compositor->display); l; l = l->next)
|
||||
{
|
||||
MetaScreen *screen = l->data;
|
||||
if (event->window == meta_screen_get_xroot (screen))
|
||||
{
|
||||
meta_background_actor_update (screen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
@ -588,22 +573,17 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
}
|
||||
|
||||
info->window_group = meta_window_group_new (screen);
|
||||
info->background_actor = meta_background_actor_new_for_screen (screen);
|
||||
info->background_actor = meta_background_actor_new (screen, NULL);
|
||||
info->overlay_group = clutter_group_new ();
|
||||
info->hidden_group = clutter_group_new ();
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (info->window_group),
|
||||
info->background_actor,
|
||||
NULL);
|
||||
meta_window_group_set_background (META_WINDOW_GROUP (info->window_group),
|
||||
META_BACKGROUND_ACTOR (info->background_actor));
|
||||
|
||||
clutter_container_add (CLUTTER_CONTAINER (info->stage),
|
||||
info->window_group,
|
||||
info->overlay_group,
|
||||
info->hidden_group,
|
||||
NULL);
|
||||
|
||||
clutter_actor_hide (info->hidden_group);
|
||||
|
||||
info->plugin_mgr = meta_plugin_manager_new (screen);
|
||||
|
||||
/*
|
||||
@ -1202,8 +1182,6 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
||||
|
||||
XResizeWindow (xdisplay, xwin, width, height);
|
||||
|
||||
meta_background_actor_screen_size_changed (screen);
|
||||
|
||||
meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
|
||||
meta_screen_get_screen_number (screen),
|
||||
width, height);
|
||||
|
@ -9,7 +9,39 @@
|
||||
void meta_background_actor_set_visible_region (MetaBackgroundActor *self,
|
||||
cairo_region_t *visible_region);
|
||||
|
||||
void meta_background_actor_update (MetaScreen *screen);
|
||||
void meta_background_actor_screen_size_changed (MetaScreen *screen);
|
||||
/**
|
||||
* MetaBackgroundSlideshow:
|
||||
*
|
||||
* A class for handling animated backgrounds.
|
||||
*/
|
||||
|
||||
#define META_TYPE_BACKGROUND_SLIDESHOW (meta_background_slideshow_get_type ())
|
||||
#define META_BACKGROUND_SLIDESHOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_SLIDESHOW, MetaBackgroundSlideshow))
|
||||
#define META_BACKGROUND_SLIDESHOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_SLIDESHOW, MetaBackgroundSlideshowClass))
|
||||
#define META_IS_BACKGROUND_SLIDESHOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_SLIDESHOW))
|
||||
#define META_IS_BACKGROUND_SLIDESHOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_SLIDESHOW))
|
||||
#define META_BACKGROUND_SLIDESHOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_SLIDESHOW, MetaBackgroundSlideshowClass))
|
||||
|
||||
typedef struct _MetaBackgroundSlideshow MetaBackgroundSlideshow;
|
||||
typedef struct _MetaBackgroundSlideshowClass MetaBackgroundSlideshowClass;
|
||||
|
||||
GType meta_background_slideshow_get_type (void) G_GNUC_CONST;
|
||||
|
||||
MetaBackgroundSlideshow *meta_background_slideshow_new (MetaScreen *screen,
|
||||
const char *picture_uri);
|
||||
|
||||
const char *meta_background_slideshow_get_uri (MetaBackgroundSlideshow *slideshow);
|
||||
|
||||
GTask *meta_background_slideshow_draw_async (MetaBackgroundSlideshow *slideshow,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
CoglHandle meta_background_slideshow_draw_finish (MetaBackgroundSlideshow *slideshow,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
int meta_background_slideshow_get_next_timeout (MetaBackgroundSlideshow *slideshow);
|
||||
|
||||
|
||||
|
||||
#endif /* META_BACKGROUND_ACTOR_PRIVATE_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
1005
src/compositor/meta-background.c
Normal file
1005
src/compositor/meta-background.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,13 @@ struct _MetaWindowGroup
|
||||
ClutterGroup parent;
|
||||
|
||||
MetaScreen *screen;
|
||||
MetaBackgroundActor *background;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_BACKGROUND,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_GROUP);
|
||||
@ -270,7 +277,8 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
if (clutter_actor_has_effects (l->data))
|
||||
continue;
|
||||
|
||||
if (META_IS_WINDOW_ACTOR (l->data))
|
||||
if (l->data != window_group->background &&
|
||||
META_IS_WINDOW_ACTOR (l->data))
|
||||
{
|
||||
MetaWindowActor *window_actor = l->data;
|
||||
int x, y;
|
||||
@ -296,7 +304,7 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
meta_window_actor_set_visible_region_beneath (window_actor, visible_region);
|
||||
cairo_region_translate (visible_region, x, y);
|
||||
}
|
||||
else if (META_IS_BACKGROUND_ACTOR (l->data))
|
||||
else if (l->data == window_group->background)
|
||||
{
|
||||
MetaBackgroundActor *background_actor = l->data;
|
||||
int x, y;
|
||||
@ -322,12 +330,13 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
*/
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
if (META_IS_WINDOW_ACTOR (l->data))
|
||||
if (l->data != window_group->background &&
|
||||
META_IS_WINDOW_ACTOR (l->data))
|
||||
{
|
||||
MetaWindowActor *window_actor = l->data;
|
||||
meta_window_actor_reset_visible_regions (window_actor);
|
||||
}
|
||||
else if (META_IS_BACKGROUND_ACTOR (l->data))
|
||||
else if (l->data == window_group->background)
|
||||
{
|
||||
MetaBackgroundActor *background_actor = l->data;
|
||||
meta_background_actor_set_visible_region (background_actor, NULL);
|
||||
@ -337,12 +346,70 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_group_set_background (MetaWindowGroup *self,
|
||||
MetaBackgroundActor *actor)
|
||||
{
|
||||
self->background = actor;
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (self),
|
||||
CLUTTER_ACTOR (actor));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaWindowGroup *self = META_WINDOW_GROUP (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKGROUND:
|
||||
g_value_set_object (value, self->background);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaWindowGroup *self = META_WINDOW_GROUP (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BACKGROUND:
|
||||
meta_window_group_set_background (self, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_class_init (MetaWindowGroupClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
object_class->get_property = meta_window_group_get_property;
|
||||
object_class->set_property = meta_window_group_set_property;
|
||||
|
||||
actor_class->paint = meta_window_group_paint;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_BACKGROUND,
|
||||
g_param_spec_object ("background",
|
||||
"Background actor",
|
||||
"The primary background actor",
|
||||
META_TYPE_BACKGROUND_ACTOR,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <meta/screen.h>
|
||||
#include <meta/meta-background-actor.h>
|
||||
|
||||
/**
|
||||
* MetaWindowGroup:
|
||||
@ -49,4 +50,7 @@ GType meta_window_group_get_type (void);
|
||||
|
||||
ClutterActor *meta_window_group_new (MetaScreen *screen);
|
||||
|
||||
void meta_window_group_set_background (MetaWindowGroup *group,
|
||||
MetaBackgroundActor *background);
|
||||
|
||||
#endif /* META_WINDOW_GROUP_H */
|
||||
|
@ -239,7 +239,7 @@ meta_screen_class_init (MetaScreenClass *klass)
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (MetaScreenClass, monitors_changed),
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
|
@ -60,7 +60,8 @@ struct _MetaBackgroundActor
|
||||
|
||||
GType meta_background_actor_get_type (void);
|
||||
|
||||
ClutterActor *meta_background_actor_new_for_screen (MetaScreen *screen);
|
||||
ClutterActor *meta_background_actor_new (MetaScreen *screen,
|
||||
GSettings *settings);
|
||||
|
||||
/**
|
||||
* MetaSnippetHook:
|
||||
@ -83,18 +84,4 @@ typedef enum {
|
||||
META_SNIPPET_HOOK_TEXTURE_LOOKUP
|
||||
} MetaSnippetHook;
|
||||
|
||||
|
||||
void meta_background_actor_add_glsl_snippet (MetaBackgroundActor *actor,
|
||||
MetaSnippetHook hook,
|
||||
const char *declarations,
|
||||
const char *code,
|
||||
gboolean is_replace);
|
||||
|
||||
void meta_background_actor_set_uniform_float (MetaBackgroundActor *actor,
|
||||
const char *uniform_name,
|
||||
int n_components,
|
||||
int count,
|
||||
const float *uniform,
|
||||
int uniform_length);
|
||||
|
||||
#endif /* META_BACKGROUND_ACTOR_H */
|
||||
|
Reference in New Issue
Block a user