Use G_DECLARE_DERIVABLE/FINAL_TYPE on some types

This is only for types in the `Meta` namespace.

* Clears up a lot of boilerplate
* We get `g_autoptr` support for free
This commit is contained in:
Niels De Graef 2018-10-31 11:47:17 +01:00 committed by Georges Basile Stavracas Neto
parent 7759adf8e9
commit d539fe28d5
33 changed files with 919 additions and 1397 deletions

View File

@ -31,20 +31,11 @@
G_BEGIN_DECLS
#define META_TYPE_BARRIER_IMPL (meta_barrier_impl_get_type ())
#define META_BARRIER_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BARRIER_IMPL, MetaBarrierImpl))
#define META_BARRIER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL, MetaBarrierImplClass))
#define META_IS_BARRIER_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL))
#define META_IS_BARRIER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL))
#define META_BARRIER_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BARRIER_IMPL, MetaBarrierImplClass))
typedef struct _MetaBarrierImpl MetaBarrierImpl;
typedef struct _MetaBarrierImplClass MetaBarrierImplClass;
struct _MetaBarrierImpl
{
GObject parent;
};
#define META_TYPE_BARRIER_IMPL (meta_barrier_impl_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaBarrierImpl,
meta_barrier_impl,
META, BARRIER_IMPL,
GObject)
struct _MetaBarrierImplClass
{
@ -56,8 +47,6 @@ struct _MetaBarrierImplClass
void (*destroy) (MetaBarrierImpl *barrier);
};
GType meta_barrier_impl_get_type (void) G_GNUC_CONST;
void _meta_barrier_emit_hit_signal (MetaBarrier *barrier,
MetaBarrierEvent *event);
void _meta_barrier_emit_left_signal (MetaBarrier *barrier,

View File

@ -49,10 +49,6 @@ struct _MetaCursorTracker {
MetaCursorSpriteXfixes *xfixes_cursor;
};
struct _MetaCursorTrackerClass {
GObjectClass parent_class;
};
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
XEvent *xevent);

View File

@ -65,8 +65,10 @@ typedef enum {
META_BARRIER_STATE_LEFT,
} MetaBarrierState;
struct _MetaBarrierImplNativePrivate
struct _MetaBarrierImplNative
{
MetaBarrierImpl parent;
MetaBarrier *barrier;
MetaBarrierManagerNative *manager;
@ -77,8 +79,9 @@ struct _MetaBarrierImplNativePrivate
MetaBarrierDirection blocked_dir;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplNative, meta_barrier_impl_native,
META_TYPE_BARRIER_IMPL)
G_DEFINE_TYPE (MetaBarrierImplNative,
meta_barrier_impl_native,
META_TYPE_BARRIER_IMPL)
static int
next_serial (void)
@ -111,10 +114,7 @@ is_barrier_blocking_directions (MetaBarrier *barrier,
static void
dismiss_pointer (MetaBarrierImplNative *self)
{
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
priv->state = META_BARRIER_STATE_LEFT;
self->state = META_BARRIER_STATE_LEFT;
}
/*
@ -164,13 +164,11 @@ maybe_release_barrier (gpointer key,
gpointer user_data)
{
MetaBarrierImplNative *self = key;
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
MetaBarrier *barrier = self->barrier;
MetaLine2 *motion = user_data;
MetaLine2 hit_box;
if (priv->state != META_BARRIER_STATE_HELD)
if (self->state != META_BARRIER_STATE_HELD)
return;
/* Release if we end up outside barrier end points. */
@ -250,9 +248,7 @@ update_closest_barrier (gpointer key,
gpointer user_data)
{
MetaBarrierImplNative *self = key;
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
MetaBarrier *barrier = self->barrier;
MetaClosestBarrierData *data = user_data;
MetaVector2 intersection;
float dx, dy;
@ -263,12 +259,12 @@ update_closest_barrier (gpointer key,
return;
/* Ignore if the barrier released the pointer. */
if (priv->state == META_BARRIER_STATE_RELEASE)
if (self->state == META_BARRIER_STATE_RELEASE)
return;
/* Ignore if we are moving away from barrier. */
if (priv->state == META_BARRIER_STATE_HELD &&
(data->in.directions & priv->blocked_dir) == 0)
if (self->state == META_BARRIER_STATE_HELD &&
(data->in.directions & self->blocked_dir) == 0)
return;
/* Check if the motion intersects with the barrier, and retrieve the
@ -354,27 +350,25 @@ emit_barrier_event (MetaBarrierImplNative *self,
float dx,
float dy)
{
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
MetaBarrier *barrier = self->barrier;
MetaBarrierEvent *event = g_slice_new0 (MetaBarrierEvent);
MetaBarrierState old_state = priv->state;
MetaBarrierState old_state = self->state;
switch (priv->state)
switch (self->state)
{
case META_BARRIER_STATE_HIT:
priv->state = META_BARRIER_STATE_HELD;
priv->trigger_serial = next_serial ();
self->state = META_BARRIER_STATE_HELD;
self->trigger_serial = next_serial ();
event->dt = 0;
break;
case META_BARRIER_STATE_RELEASE:
case META_BARRIER_STATE_LEFT:
priv->state = META_BARRIER_STATE_ACTIVE;
self->state = META_BARRIER_STATE_ACTIVE;
/* Intentional fall-through. */
case META_BARRIER_STATE_HELD:
event->dt = time - priv->last_event_time;
event->dt = time - self->last_event_time;
break;
case META_BARRIER_STATE_ACTIVE:
@ -382,7 +376,7 @@ emit_barrier_event (MetaBarrierImplNative *self,
}
event->ref_count = 1;
event->event_id = priv->trigger_serial;
event->event_id = self->trigger_serial;
event->time = time;
event->x = x;
@ -390,12 +384,12 @@ emit_barrier_event (MetaBarrierImplNative *self,
event->dx = dx;
event->dy = dy;
event->grabbed = priv->state == META_BARRIER_STATE_HELD;
event->grabbed = self->state == META_BARRIER_STATE_HELD;
event->released = old_state == META_BARRIER_STATE_RELEASE;
priv->last_event_time = time;
self->last_event_time = time;
if (priv->state == META_BARRIER_STATE_HELD)
if (self->state == META_BARRIER_STATE_HELD)
_meta_barrier_emit_hit_signal (barrier, event);
else
_meta_barrier_emit_left_signal (barrier, event);
@ -407,11 +401,10 @@ static void
maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data)
{
MetaBarrierImplNative *self = key;
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrierEventData *data = user_data;
switch (priv->state) {
switch (self->state)
{
case META_BARRIER_STATE_ACTIVE:
break;
case META_BARRIER_STATE_HIT:
@ -437,9 +430,7 @@ clamp_to_barrier (MetaBarrierImplNative *self,
float *x,
float *y)
{
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
MetaBarrier *barrier = priv->barrier;
MetaBarrier *barrier = self->barrier;
if (is_barrier_horizontal (barrier))
{
@ -448,7 +439,7 @@ clamp_to_barrier (MetaBarrierImplNative *self,
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_Y)
*y = barrier->priv->border.line.a.y;
priv->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_Y |
self->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_Y |
META_BARRIER_DIRECTION_NEGATIVE_Y);
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_Y |
META_BARRIER_DIRECTION_NEGATIVE_Y);
@ -460,13 +451,13 @@ clamp_to_barrier (MetaBarrierImplNative *self,
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_X)
*x = barrier->priv->border.line.a.x;
priv->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_X |
self->blocked_dir = *motion_dir & (META_BARRIER_DIRECTION_POSITIVE_X |
META_BARRIER_DIRECTION_NEGATIVE_X);
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_X |
META_BARRIER_DIRECTION_NEGATIVE_X);
}
priv->state = META_BARRIER_STATE_HIT;
self->state = META_BARRIER_STATE_HIT;
}
void
@ -538,10 +529,8 @@ static gboolean
_meta_barrier_impl_native_is_active (MetaBarrierImpl *impl)
{
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
return priv->is_active;
return self->is_active;
}
static void
@ -549,42 +538,36 @@ _meta_barrier_impl_native_release (MetaBarrierImpl *impl,
MetaBarrierEvent *event)
{
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
if (priv->state == META_BARRIER_STATE_HELD &&
event->event_id == priv->trigger_serial)
priv->state = META_BARRIER_STATE_RELEASE;
if (self->state == META_BARRIER_STATE_HELD &&
event->event_id == self->trigger_serial)
self->state = META_BARRIER_STATE_RELEASE;
}
static void
_meta_barrier_impl_native_destroy (MetaBarrierImpl *impl)
{
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
MetaBarrierImplNativePrivate *priv =
meta_barrier_impl_native_get_instance_private (self);
g_hash_table_remove (priv->manager->barriers, self);
priv->is_active = FALSE;
g_hash_table_remove (self->manager->barriers, self);
self->is_active = FALSE;
}
MetaBarrierImpl *
meta_barrier_impl_native_new (MetaBarrier *barrier)
{
MetaBarrierImplNative *self;
MetaBarrierImplNativePrivate *priv;
MetaBackendNative *native;
MetaBarrierManagerNative *manager;
self = g_object_new (META_TYPE_BARRIER_IMPL_NATIVE, NULL);
priv = meta_barrier_impl_native_get_instance_private (self);
priv->barrier = barrier;
priv->is_active = TRUE;
self->barrier = barrier;
self->is_active = TRUE;
native = META_BACKEND_NATIVE (meta_get_backend ());
manager = meta_backend_native_get_barrier_manager (native);
priv->manager = manager;
self->manager = manager;
g_hash_table_add (manager->barriers, self);
return META_BARRIER_IMPL (self);

View File

@ -29,30 +29,14 @@
G_BEGIN_DECLS
#define META_TYPE_BARRIER_IMPL_NATIVE (meta_barrier_impl_native_get_type ())
#define META_BARRIER_IMPL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BARRIER_IMPL_NATIVE, MetaBarrierImplNative))
#define META_BARRIER_IMPL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL_NATIVE, MetaBarrierImplNativeClass))
#define META_IS_BARRIER_IMPL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL_NATIVE))
#define META_IS_BARRIER_IMPL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL_NATIVE))
#define META_BARRIER_IMPL_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BARRIER_IMPL_NATIVE, MetaBarrierImplNativeClass))
typedef struct _MetaBarrierImplNative MetaBarrierImplNative;
typedef struct _MetaBarrierImplNativeClass MetaBarrierImplNativeClass;
typedef struct _MetaBarrierImplNativePrivate MetaBarrierImplNativePrivate;
#define META_TYPE_BARRIER_IMPL_NATIVE (meta_barrier_impl_native_get_type ())
G_DECLARE_FINAL_TYPE (MetaBarrierImplNative,
meta_barrier_impl_native,
META, BARRIER_IMPL_NATIVE,
MetaBarrierImpl)
typedef struct _MetaBarrierManagerNative MetaBarrierManagerNative;
struct _MetaBarrierImplNative
{
MetaBarrierImpl parent;
};
struct _MetaBarrierImplNativeClass
{
MetaBarrierImplClass parent_class;
};
GType meta_barrier_impl_native_get_type (void) G_GNUC_CONST;
MetaBarrierImpl *meta_barrier_impl_native_new (MetaBarrier *barrier);

View File

@ -40,23 +40,24 @@
#include "meta/barrier.h"
#include "x11/meta-x11-display-private.h"
struct _MetaBarrierImplX11Private
struct _MetaBarrierImplX11
{
MetaBarrierImpl parent;
MetaBarrier *barrier;
PointerBarrier xbarrier;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplX11, meta_barrier_impl_x11,
META_TYPE_BARRIER_IMPL)
G_DEFINE_TYPE (MetaBarrierImplX11,
meta_barrier_impl_x11,
META_TYPE_BARRIER_IMPL)
static gboolean
_meta_barrier_impl_x11_is_active (MetaBarrierImpl *impl)
{
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
MetaBarrierImplX11Private *priv =
meta_barrier_impl_x11_get_instance_private (self);
return priv->xbarrier != 0;
return self->xbarrier != 0;
}
static void
@ -64,16 +65,14 @@ _meta_barrier_impl_x11_release (MetaBarrierImpl *impl,
MetaBarrierEvent *event)
{
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
MetaBarrierImplX11Private *priv =
meta_barrier_impl_x11_get_instance_private (self);
MetaDisplay *display = priv->barrier->priv->display;
MetaDisplay *display = self->barrier->priv->display;
Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
if (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display))
{
XIBarrierReleasePointer (dpy,
META_VIRTUAL_CORE_POINTER_ID,
priv->xbarrier, event->event_id);
self->xbarrier, event->event_id);
}
}
@ -81,9 +80,7 @@ static void
_meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
{
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
MetaBarrierImplX11Private *priv =
meta_barrier_impl_x11_get_instance_private (self);
MetaDisplay *display = priv->barrier->priv->display;
MetaDisplay *display = self->barrier->priv->display;
Display *dpy;
if (display == NULL)
@ -91,19 +88,18 @@ _meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
dpy = meta_x11_display_get_xdisplay (display->x11_display);
if (!meta_barrier_is_active (priv->barrier))
if (!meta_barrier_is_active (self->barrier))
return;
XFixesDestroyPointerBarrier (dpy, priv->xbarrier);
g_hash_table_remove (display->x11_display->xids, &priv->xbarrier);
priv->xbarrier = 0;
XFixesDestroyPointerBarrier (dpy, self->xbarrier);
g_hash_table_remove (display->x11_display->xids, &self->xbarrier);
self->xbarrier = 0;
}
MetaBarrierImpl *
meta_barrier_impl_x11_new (MetaBarrier *barrier)
{
MetaBarrierImplX11 *self;
MetaBarrierImplX11Private *priv;
MetaDisplay *display = barrier->priv->display;
Display *dpy;
Window root;
@ -116,15 +112,14 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
}
self = g_object_new (META_TYPE_BARRIER_IMPL_X11, NULL);
priv = meta_barrier_impl_x11_get_instance_private (self);
priv->barrier = barrier;
self->barrier = barrier;
dpy = meta_x11_display_get_xdisplay (display->x11_display);
root = DefaultRootWindow (dpy);
allowed_motion_dirs =
meta_border_get_allows_directions (&barrier->priv->border);
priv->xbarrier = XFixesCreatePointerBarrier (dpy, root,
self->xbarrier = XFixesCreatePointerBarrier (dpy, root,
barrier->priv->border.line.a.x,
barrier->priv->border.line.a.y,
barrier->priv->border.line.b.x,
@ -132,7 +127,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
allowed_motion_dirs,
0, NULL);
g_hash_table_insert (display->x11_display->xids, &priv->xbarrier, barrier);
g_hash_table_insert (display->x11_display->xids, &self->xbarrier, barrier);
return META_BARRIER_IMPL (self);
}

View File

@ -29,28 +29,11 @@
G_BEGIN_DECLS
#define META_TYPE_BARRIER_IMPL_X11 (meta_barrier_impl_x11_get_type ())
#define META_BARRIER_IMPL_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BARRIER_IMPL_X11, MetaBarrierImplX11))
#define META_BARRIER_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL_X11, MetaBarrierImplX11Class))
#define META_IS_BARRIER_IMPL_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL_X11))
#define META_IS_BARRIER_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL_X11))
#define META_BARRIER_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BARRIER_IMPL_X11, MetaBarrierImplX11Class))
typedef struct _MetaBarrierImplX11 MetaBarrierImplX11;
typedef struct _MetaBarrierImplX11Class MetaBarrierImplX11Class;
typedef struct _MetaBarrierImplX11Private MetaBarrierImplX11Private;
struct _MetaBarrierImplX11
{
MetaBarrierImpl parent;
};
struct _MetaBarrierImplX11Class
{
MetaBarrierImplClass parent_class;
};
GType meta_barrier_impl_x11_get_type (void) G_GNUC_CONST;
#define META_TYPE_BARRIER_IMPL_X11 (meta_barrier_impl_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaBarrierImplX11,
meta_barrier_impl_x11,
META, BARRIER_IMPL_X11,
MetaBarrierImpl)
MetaBarrierImpl *meta_barrier_impl_x11_new (MetaBarrier *barrier);

View File

@ -153,8 +153,10 @@ typedef enum {
PIPELINE_GRADIENT = (1 << 2),
} PipelineFlags;
struct _MetaBackgroundActorPrivate
struct _MetaBackgroundActor
{
ClutterActor parent;
MetaDisplay *display;
int monitor;
@ -180,32 +182,28 @@ struct _MetaBackgroundActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaBackgroundActor)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
static void
set_clip_region (MetaBackgroundActor *self,
cairo_region_t *clip_region)
{
MetaBackgroundActorPrivate *priv = self->priv;
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
g_clear_pointer (&self->clip_region, cairo_region_destroy);
if (clip_region)
priv->clip_region = cairo_region_copy (clip_region);
self->clip_region = cairo_region_copy (clip_region);
}
static void
meta_background_actor_dispose (GObject *object)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
MetaBackgroundActorPrivate *priv = self->priv;
set_clip_region (self, NULL);
meta_background_actor_set_background (self, NULL);
if (priv->pipeline)
if (self->pipeline)
{
cogl_object_unref (priv->pipeline);
priv->pipeline = NULL;
cogl_object_unref (self->pipeline);
self->pipeline = NULL;
}
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
@ -216,11 +214,10 @@ get_preferred_size (MetaBackgroundActor *self,
gfloat *width,
gfloat *height)
{
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (self)->priv;
MetaRectangle monitor_geometry;
meta_display_get_monitor_geometry (priv->display,
priv->monitor,
meta_display_get_monitor_geometry (self->display,
self->monitor,
&monitor_geometry);
if (width != NULL)
@ -329,7 +326,6 @@ static void
setup_pipeline (MetaBackgroundActor *self,
cairo_rectangle_int_t *actor_pixel_rect)
{
MetaBackgroundActorPrivate *priv = self->priv;
PipelineFlags pipeline_flags = 0;
guint8 opacity;
float color_component;
@ -338,75 +334,75 @@ setup_pipeline (MetaBackgroundActor *self,
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
if (opacity < 255)
pipeline_flags |= PIPELINE_BLEND;
if (priv->vignette && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
if (self->vignette && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_VIGNETTE;
if (priv->gradient && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
if (self->gradient && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_GRADIENT;
if (priv->pipeline &&
pipeline_flags != priv->pipeline_flags)
if (self->pipeline &&
pipeline_flags != self->pipeline_flags)
{
cogl_object_unref (priv->pipeline);
priv->pipeline = NULL;
cogl_object_unref (self->pipeline);
self->pipeline = NULL;
}
if (priv->pipeline == NULL)
if (self->pipeline == NULL)
{
priv->pipeline_flags = pipeline_flags;
priv->pipeline = make_pipeline (pipeline_flags);
priv->changed = CHANGED_ALL;
self->pipeline_flags = pipeline_flags;
self->pipeline = make_pipeline (pipeline_flags);
self->changed = CHANGED_ALL;
}
if ((priv->changed & CHANGED_BACKGROUND) != 0)
if ((self->changed & CHANGED_BACKGROUND) != 0)
{
CoglPipelineWrapMode wrap_mode;
CoglTexture *texture = meta_background_get_texture (priv->background,
priv->monitor,
&priv->texture_area,
CoglTexture *texture = meta_background_get_texture (self->background,
self->monitor,
&self->texture_area,
&wrap_mode);
priv->force_bilinear = texture &&
(priv->texture_area.width != (int)cogl_texture_get_width (texture) ||
priv->texture_area.height != (int)cogl_texture_get_height (texture));
self->force_bilinear = texture &&
(self->texture_area.width != (int)cogl_texture_get_width (texture) ||
self->texture_area.height != (int)cogl_texture_get_height (texture));
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0, wrap_mode);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (self->pipeline, 0, wrap_mode);
priv->changed &= ~CHANGED_BACKGROUND;
self->changed &= ~CHANGED_BACKGROUND;
}
if ((priv->changed & CHANGED_VIGNETTE_PARAMETERS) != 0)
if ((self->changed & CHANGED_VIGNETTE_PARAMETERS) != 0)
{
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline,
"vignette_sharpness"),
priv->vignette_sharpness);
self->vignette_sharpness);
priv->changed &= ~CHANGED_VIGNETTE_PARAMETERS;
self->changed &= ~CHANGED_VIGNETTE_PARAMETERS;
}
if ((priv->changed & CHANGED_GRADIENT_PARAMETERS) != 0)
if ((self->changed & CHANGED_GRADIENT_PARAMETERS) != 0)
{
MetaRectangle monitor_geometry;
float gradient_height_perc;
meta_display_get_monitor_geometry (priv->display,
priv->monitor, &monitor_geometry);
gradient_height_perc = MAX (0.0001, priv->gradient_height / (float)monitor_geometry.height);
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
meta_display_get_monitor_geometry (self->display,
self->monitor, &monitor_geometry);
gradient_height_perc = MAX (0.0001, self->gradient_height / (float)monitor_geometry.height);
cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline,
"gradient_height_perc"),
gradient_height_perc);
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_set_uniform_1f (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline,
"gradient_max_darkness"),
priv->gradient_max_darkness);
self->gradient_max_darkness);
priv->changed &= ~CHANGED_GRADIENT_PARAMETERS;
self->changed &= ~CHANGED_GRADIENT_PARAMETERS;
}
if (priv->vignette)
if (self->vignette)
{
color_component = priv->vignette_brightness * opacity / 255.;
color_component = self->vignette_brightness * opacity / 255.;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
@ -414,50 +410,49 @@ setup_pipeline (MetaBackgroundActor *self,
* be there if we were drawing the vignette, which is
* (1 - (pi/12.) * vignette_sharpness) [exercise for the reader :]
*/
color_component *= (1 - 0.74 * priv->vignette_sharpness);
color_component *= (1 - 0.74 * self->vignette_sharpness);
}
}
else
color_component = opacity / 255.;
cogl_pipeline_set_color4f (priv->pipeline,
cogl_pipeline_set_color4f (self->pipeline,
color_component,
color_component,
color_component,
opacity / 255.);
if (!priv->force_bilinear &&
if (!self->force_bilinear &&
meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
else
filter = COGL_PIPELINE_FILTER_LINEAR;
cogl_pipeline_set_layer_filters (priv->pipeline, 0, filter, filter);
cogl_pipeline_set_layer_filters (self->pipeline, 0, filter, filter);
}
static void
set_glsl_parameters (MetaBackgroundActor *self,
cairo_rectangle_int_t *actor_pixel_rect)
{
MetaBackgroundActorPrivate *priv = self->priv;
float scale[2];
float offset[2];
/* Compute a scale and offset for transforming texture coordinates to the
* coordinate system from [-0.5 to 0.5] across the area of the actor
*/
scale[0] = priv->texture_area.width / (float)actor_pixel_rect->width;
scale[1] = priv->texture_area.height / (float)actor_pixel_rect->height;
offset[0] = priv->texture_area.x / (float)actor_pixel_rect->width - 0.5;
offset[1] = priv->texture_area.y / (float)actor_pixel_rect->height - 0.5;
scale[0] = self->texture_area.width / (float)actor_pixel_rect->width;
scale[1] = self->texture_area.height / (float)actor_pixel_rect->height;
offset[0] = self->texture_area.x / (float)actor_pixel_rect->width - 0.5;
offset[1] = self->texture_area.y / (float)actor_pixel_rect->height - 0.5;
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_set_uniform_float (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline,
"scale"),
2, 1, scale);
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_set_uniform_float (self->pipeline,
cogl_pipeline_get_uniform_location (self->pipeline,
"offset"),
2, 1, offset);
}
@ -497,13 +492,12 @@ static void
meta_background_actor_paint (ClutterActor *actor)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
MetaBackgroundActorPrivate *priv = self->priv;
ClutterActorBox actor_box;
cairo_rectangle_int_t actor_pixel_rect;
CoglFramebuffer *fb;
int i;
if ((priv->clip_region && cairo_region_is_empty (priv->clip_region)))
if ((self->clip_region && cairo_region_is_empty (self->clip_region)))
return;
clutter_actor_get_content_box (actor, &actor_box);
@ -523,27 +517,27 @@ meta_background_actor_paint (ClutterActor *actor)
/* Now figure out what to actually paint.
*/
if (priv->clip_region != NULL)
if (self->clip_region != NULL)
{
int n_rects = cairo_region_num_rectangles (priv->clip_region);
int n_rects = cairo_region_num_rectangles (self->clip_region);
if (n_rects <= MAX_RECTS)
{
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (priv->clip_region, i, &rect);
cairo_region_get_rectangle (self->clip_region, i, &rect);
if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
continue;
paint_clipped_rectangle (fb, priv->pipeline, &rect, &priv->texture_area);
paint_clipped_rectangle (fb, self->pipeline, &rect, &self->texture_area);
}
return;
}
}
paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect, &priv->texture_area);
paint_clipped_rectangle (fb, self->pipeline, &actor_pixel_rect, &self->texture_area);
}
static void
@ -553,12 +547,11 @@ meta_background_actor_set_property (GObject *object,
GParamSpec *pspec)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
MetaBackgroundActorPrivate *priv = self->priv;
switch (prop_id)
{
case PROP_META_DISPLAY:
priv->display = g_value_get_object (value);
self->display = g_value_get_object (value);
break;
case PROP_MONITOR:
meta_background_actor_set_monitor (self, g_value_get_int (value));
@ -569,38 +562,38 @@ meta_background_actor_set_property (GObject *object,
case PROP_GRADIENT:
meta_background_actor_set_gradient (self,
g_value_get_boolean (value),
priv->gradient_height,
priv->gradient_max_darkness);
self->gradient_height,
self->gradient_max_darkness);
break;
case PROP_GRADIENT_HEIGHT:
meta_background_actor_set_gradient (self,
priv->gradient,
self->gradient,
g_value_get_int (value),
priv->gradient_max_darkness);
self->gradient_max_darkness);
break;
case PROP_GRADIENT_MAX_DARKNESS:
meta_background_actor_set_gradient (self,
priv->gradient,
priv->gradient_height,
self->gradient,
self->gradient_height,
g_value_get_double (value));
break;
case PROP_VIGNETTE:
meta_background_actor_set_vignette (self,
g_value_get_boolean (value),
priv->vignette_brightness,
priv->vignette_sharpness);
self->vignette_brightness,
self->vignette_sharpness);
break;
case PROP_VIGNETTE_SHARPNESS:
meta_background_actor_set_vignette (self,
priv->vignette,
priv->vignette_brightness,
self->vignette,
self->vignette_brightness,
g_value_get_double (value));
break;
case PROP_VIGNETTE_BRIGHTNESS:
meta_background_actor_set_vignette (self,
priv->vignette,
self->vignette,
g_value_get_double (value),
priv->vignette_sharpness);
self->vignette_sharpness);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -614,36 +607,36 @@ meta_background_actor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (object)->priv;
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
switch (prop_id)
{
case PROP_META_DISPLAY:
g_value_set_object (value, priv->display);
g_value_set_object (value, self->display);
break;
case PROP_MONITOR:
g_value_set_int (value, priv->monitor);
g_value_set_int (value, self->monitor);
break;
case PROP_BACKGROUND:
g_value_set_object (value, priv->background);
g_value_set_object (value, self->background);
break;
case PROP_GRADIENT:
g_value_set_boolean (value, priv->gradient);
g_value_set_boolean (value, self->gradient);
break;
case PROP_GRADIENT_HEIGHT:
g_value_set_int (value, priv->gradient_height);
g_value_set_int (value, self->gradient_height);
break;
case PROP_GRADIENT_MAX_DARKNESS:
g_value_set_double (value, priv->gradient_max_darkness);
g_value_set_double (value, self->gradient_max_darkness);
break;
case PROP_VIGNETTE:
g_value_set_boolean (value, priv->vignette);
g_value_set_boolean (value, self->vignette);
break;
case PROP_VIGNETTE_BRIGHTNESS:
g_value_set_double (value, priv->vignette_brightness);
g_value_set_double (value, self->vignette_brightness);
break;
case PROP_VIGNETTE_SHARPNESS:
g_value_set_double (value, priv->vignette_sharpness);
g_value_set_double (value, self->vignette_sharpness);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -761,19 +754,13 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
static void
meta_background_actor_init (MetaBackgroundActor *self)
{
MetaBackgroundActorPrivate *priv;
self->gradient = FALSE;
self->gradient_height = 0;
self->gradient_max_darkness = 0.0;
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_BACKGROUND_ACTOR,
MetaBackgroundActorPrivate);
priv->gradient = FALSE;
priv->gradient_height = 0;
priv->gradient_max_darkness = 0.0;
priv->vignette = FALSE;
priv->vignette_brightness = 1.0;
priv->vignette_sharpness = 0.0;
self->vignette = FALSE;
self->vignette_brightness = 1.0;
self->vignette_sharpness = 0.0;
}
/**
@ -832,17 +819,14 @@ cullable_iface_init (MetaCullableInterface *iface)
cairo_region_t *
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
{
MetaBackgroundActorPrivate *priv = self->priv;
return priv->clip_region;
return self->clip_region;
}
static void
invalidate_pipeline (MetaBackgroundActor *self,
ChangedFlags changed)
{
MetaBackgroundActorPrivate *priv = self->priv;
priv->changed |= changed;
self->changed |= changed;
}
static void
@ -857,29 +841,25 @@ void
meta_background_actor_set_background (MetaBackgroundActor *self,
MetaBackground *background)
{
MetaBackgroundActorPrivate *priv;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
g_return_if_fail (background == NULL || META_IS_BACKGROUND (background));
priv = self->priv;
if (background == priv->background)
if (background == self->background)
return;
if (priv->background)
if (self->background)
{
g_signal_handlers_disconnect_by_func (priv->background,
g_signal_handlers_disconnect_by_func (self->background,
(gpointer)on_background_changed,
self);
g_object_unref (priv->background);
priv->background = NULL;
g_object_unref (self->background);
self->background = NULL;
}
if (background)
{
priv->background = g_object_ref (background);
g_signal_connect (priv->background, "changed",
self->background = g_object_ref (background);
g_signal_connect (self->background, "changed",
G_CALLBACK (on_background_changed), self);
}
@ -893,28 +873,25 @@ meta_background_actor_set_gradient (MetaBackgroundActor *self,
int height,
double max_darkness)
{
MetaBackgroundActorPrivate *priv;
gboolean changed = FALSE;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
g_return_if_fail (height >= 0);
g_return_if_fail (max_darkness >= 0. && max_darkness <= 1.);
priv = self->priv;
enabled = enabled != FALSE && height != 0;
if (enabled != priv->gradient)
if (enabled != self->gradient)
{
priv->gradient = enabled;
self->gradient = enabled;
invalidate_pipeline (self, CHANGED_EFFECTS);
changed = TRUE;
}
if (height != priv->gradient_height || max_darkness != priv->gradient_max_darkness)
if (height != self->gradient_height || max_darkness != self->gradient_max_darkness)
{
priv->gradient_height = height;
priv->gradient_max_darkness = max_darkness;
self->gradient_height = height;
self->gradient_max_darkness = max_darkness;
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
changed = TRUE;
}
@ -927,20 +904,19 @@ void
meta_background_actor_set_monitor (MetaBackgroundActor *self,
int monitor)
{
MetaBackgroundActorPrivate *priv = self->priv;
MetaRectangle old_monitor_geometry;
MetaRectangle new_monitor_geometry;
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
if(priv->monitor == monitor)
if(self->monitor == monitor)
return;
meta_display_get_monitor_geometry (display, priv->monitor, &old_monitor_geometry);
meta_display_get_monitor_geometry (display, self->monitor, &old_monitor_geometry);
meta_display_get_monitor_geometry (display, monitor, &new_monitor_geometry);
if(old_monitor_geometry.height != new_monitor_geometry.height)
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
priv->monitor = monitor;
self->monitor = monitor;
}
void
@ -949,28 +925,25 @@ meta_background_actor_set_vignette (MetaBackgroundActor *self,
double brightness,
double sharpness)
{
MetaBackgroundActorPrivate *priv;
gboolean changed = FALSE;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
g_return_if_fail (brightness >= 0. && brightness <= 1.);
g_return_if_fail (sharpness >= 0.);
priv = self->priv;
enabled = enabled != FALSE;
if (enabled != priv->vignette)
if (enabled != self->vignette)
{
priv->vignette = enabled;
self->vignette = enabled;
invalidate_pipeline (self, CHANGED_EFFECTS);
changed = TRUE;
}
if (brightness != priv->vignette_brightness || sharpness != priv->vignette_sharpness)
if (brightness != self->vignette_brightness || sharpness != self->vignette_sharpness)
{
priv->vignette_brightness = brightness;
priv->vignette_sharpness = sharpness;
self->vignette_brightness = brightness;
self->vignette_sharpness = sharpness;
invalidate_pipeline (self, CHANGED_VIGNETTE_PARAMETERS);
changed = TRUE;
}

View File

@ -19,6 +19,11 @@
#include "compositor/meta-cullable.h"
#include "meta/meta-background-group.h"
struct _MetaBackgroundGroup
{
ClutterActor parent;
};
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,

View File

@ -40,6 +40,13 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
/**
* MetaBackgroundImageCache:
*
* #MetaBackgroundImageCache caches loading of textures for backgrounds; there's actually
* nothing background specific about it, other than it is tuned to work well for
* large images as typically are used for backgrounds.
*/
struct _MetaBackgroundImageCache
{
GObject parent_instance;
@ -47,11 +54,11 @@ struct _MetaBackgroundImageCache
GHashTable *images;
};
struct _MetaBackgroundImageCacheClass
{
GObjectClass parent_class;
};
/**
* MetaBackgroundImage:
*
* #MetaBackgroundImage is an object that represents a loaded or loading background image.
*/
struct _MetaBackgroundImage
{
GObject parent_instance;
@ -62,11 +69,6 @@ struct _MetaBackgroundImage
CoglTexture *texture;
};
struct _MetaBackgroundImageClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
static void

View File

@ -47,8 +47,10 @@ struct _MetaBackgroundMonitor
CoglFramebuffer *fbo;
};
struct _MetaBackgroundPrivate
struct _MetaBackground
{
GObject parent;
MetaDisplay *display;
MetaBackgroundMonitor *monitors;
int n_monitors;
@ -77,7 +79,7 @@ enum
PROP_MONITOR,
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaBackground, meta_background, G_TYPE_OBJECT)
G_DEFINE_TYPE (MetaBackground, meta_background, G_TYPE_OBJECT)
static gboolean texture_has_alpha (CoglTexture *texture);
@ -86,13 +88,11 @@ static GSList *all_backgrounds = NULL;
static void
free_fbos (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
int i;
for (i = 0; i < priv->n_monitors; i++)
for (i = 0; i < self->n_monitors; i++)
{
MetaBackgroundMonitor *monitor = &priv->monitors[i];
MetaBackgroundMonitor *monitor = &self->monitors[i];
if (monitor->fbo)
{
cogl_object_unref (monitor->fbo);
@ -109,48 +109,42 @@ free_fbos (MetaBackground *self)
static void
free_color_texture (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
if (priv->color_texture != NULL)
if (self->color_texture != NULL)
{
cogl_object_unref (priv->color_texture);
priv->color_texture = NULL;
cogl_object_unref (self->color_texture);
self->color_texture = NULL;
}
}
static void
free_wallpaper_texture (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
if (priv->wallpaper_texture != NULL)
if (self->wallpaper_texture != NULL)
{
cogl_object_unref (priv->wallpaper_texture);
priv->wallpaper_texture = NULL;
cogl_object_unref (self->wallpaper_texture);
self->wallpaper_texture = NULL;
}
priv->wallpaper_allocation_failed = FALSE;
self->wallpaper_allocation_failed = FALSE;
}
static void
invalidate_monitor_backgrounds (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
free_fbos (self);
g_free (priv->monitors);
priv->monitors = NULL;
priv->n_monitors = 0;
g_free (self->monitors);
self->monitors = NULL;
self->n_monitors = 0;
if (priv->display)
if (self->display)
{
int i;
priv->n_monitors = meta_display_get_n_monitors (priv->display);
priv->monitors = g_new0 (MetaBackgroundMonitor, priv->n_monitors);
self->n_monitors = meta_display_get_n_monitors (self->display);
self->monitors = g_new0 (MetaBackgroundMonitor, self->n_monitors);
for (i = 0; i < priv->n_monitors; i++)
priv->monitors[i].dirty = TRUE;
for (i = 0; i < self->n_monitors; i++)
self->monitors[i].dirty = TRUE;
}
}
@ -164,9 +158,7 @@ static void
set_display (MetaBackground *self,
MetaDisplay *display)
{
MetaBackgroundPrivate *priv = self->priv;
g_set_object (&priv->display, display);
g_set_object (&self->display, display);
invalidate_monitor_backgrounds (self);
}
@ -194,12 +186,12 @@ meta_background_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
MetaBackgroundPrivate *priv = META_BACKGROUND (object)->priv;
MetaBackground *self = META_BACKGROUND (object);
switch (prop_id)
{
case PROP_META_DISPLAY:
g_value_set_object (value, priv->display);
g_value_set_object (value, self->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -210,14 +202,13 @@ meta_background_get_property (GObject *object,
static gboolean
need_prerender (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
CoglTexture *texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
CoglTexture *texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
CoglTexture *texture1 = self->background_image1 ? meta_background_image_get_texture (self->background_image1) : NULL;
CoglTexture *texture2 = self->background_image2 ? meta_background_image_get_texture (self->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
return FALSE;
if (texture2 == NULL && priv->style == G_DESKTOP_BACKGROUND_STYLE_WALLPAPER)
if (texture2 == NULL && self->style == G_DESKTOP_BACKGROUND_STYLE_WALLPAPER)
return FALSE;
return TRUE;
@ -226,14 +217,13 @@ need_prerender (MetaBackground *self)
static void
mark_changed (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
int i;
if (!need_prerender (self))
free_fbos (self);
for (i = 0; i < priv->n_monitors; i++)
priv->monitors[i].dirty = TRUE;
for (i = 0; i < self->n_monitors; i++)
self->monitors[i].dirty = TRUE;
g_signal_emit (self, signals[CHANGED], 0);
}
@ -293,13 +283,12 @@ static void
meta_background_dispose (GObject *object)
{
MetaBackground *self = META_BACKGROUND (object);
MetaBackgroundPrivate *priv = self->priv;
free_color_texture (self);
free_wallpaper_texture (self);
set_file (self, &priv->file1, &priv->background_image1, NULL);
set_file (self, &priv->file2, &priv->background_image2, NULL);
set_file (self, &self->file1, &self->background_image1, NULL);
set_file (self, &self->file2, &self->background_image2, NULL);
set_display (self, NULL);
@ -318,12 +307,11 @@ static void
meta_background_constructed (GObject *object)
{
MetaBackground *self = META_BACKGROUND (object);
MetaBackgroundPrivate *priv = self->priv;
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
g_signal_connect_object (priv->display, "gl-video-memory-purged",
g_signal_connect_object (self->display, "gl-video-memory-purged",
G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
g_signal_connect_object (monitor_manager, "monitors-changed",
@ -366,9 +354,6 @@ meta_background_class_init (MetaBackgroundClass *klass)
static void
meta_background_init (MetaBackground *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_BACKGROUND,
MetaBackgroundPrivate);
all_backgrounds = g_slist_prepend (all_backgrounds, self);
}
@ -388,7 +373,6 @@ get_texture_area (MetaBackground *self,
CoglTexture *texture,
cairo_rectangle_int_t *texture_area)
{
MetaBackgroundPrivate *priv = self->priv;
cairo_rectangle_int_t image_area;
int screen_width, screen_height;
float texture_width, texture_height;
@ -397,7 +381,7 @@ get_texture_area (MetaBackground *self,
texture_width = cogl_texture_get_width (texture);
texture_height = cogl_texture_get_height (texture);
switch (priv->style)
switch (self->style)
{
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
default:
@ -407,7 +391,7 @@ get_texture_area (MetaBackground *self,
set_texture_area_from_monitor_area (monitor_rect, texture_area);
break;
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
meta_display_get_size (priv->display, &screen_width, &screen_height);
meta_display_get_size (self->display, &screen_width, &screen_height);
/* Start off by centering a tile in the middle of the
* total screen area.
@ -444,9 +428,9 @@ get_texture_area (MetaBackground *self,
monitor_x_scale = monitor_rect->width / texture_width;
monitor_y_scale = monitor_rect->height / texture_height;
if ((priv->style == G_DESKTOP_BACKGROUND_STYLE_SCALED &&
if ((self->style == G_DESKTOP_BACKGROUND_STYLE_SCALED &&
(monitor_x_scale < monitor_y_scale)) ||
(priv->style == G_DESKTOP_BACKGROUND_STYLE_ZOOM &&
(self->style == G_DESKTOP_BACKGROUND_STYLE_ZOOM &&
(monitor_x_scale > monitor_y_scale)))
{
/* Fill image to exactly fit actor horizontally */
@ -476,7 +460,7 @@ get_texture_area (MetaBackground *self,
/* paint region is the union of all monitors, with the origin
* of the region set to align with monitor associated with the background.
*/
meta_display_get_size (priv->display, &screen_width, &screen_height);
meta_display_get_size (self->display, &screen_width, &screen_height);
/* unclipped texture area is whole screen */
image_area.width = screen_width;
@ -499,13 +483,12 @@ draw_texture (MetaBackground *self,
CoglTexture *texture,
cairo_rectangle_int_t *monitor_area)
{
MetaBackgroundPrivate *priv = self->priv;
cairo_rectangle_int_t texture_area;
gboolean bare_region_visible;
get_texture_area (self, monitor_area, texture, &texture_area);
switch (priv->style)
switch (self->style)
{
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
@ -550,9 +533,7 @@ draw_texture (MetaBackground *self,
static void
ensure_color_texture (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
if (priv->color_texture == NULL)
if (self->color_texture == NULL)
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
@ -560,18 +541,18 @@ ensure_color_texture (MetaBackground *self)
uint8_t pixels[6];
int width, height;
if (priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID)
if (self->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID)
{
width = 1;
height = 1;
pixels[0] = priv->color.red;
pixels[1] = priv->color.green;
pixels[2] = priv->color.blue;
pixels[0] = self->color.red;
pixels[1] = self->color.green;
pixels[2] = self->color.blue;
}
else
{
switch (priv->shading_direction)
switch (self->shading_direction)
{
case G_DESKTOP_BACKGROUND_SHADING_VERTICAL:
width = 1;
@ -585,15 +566,15 @@ ensure_color_texture (MetaBackground *self)
g_return_if_reached ();
}
pixels[0] = priv->color.red;
pixels[1] = priv->color.green;
pixels[2] = priv->color.blue;
pixels[3] = priv->second_color.red;
pixels[4] = priv->second_color.green;
pixels[5] = priv->second_color.blue;
pixels[0] = self->color.red;
pixels[1] = self->color.green;
pixels[2] = self->color.blue;
pixels[3] = self->second_color.red;
pixels[4] = self->second_color.green;
pixels[5] = self->second_color.blue;
}
priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
self->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
COGL_PIXEL_FORMAT_RGB_888,
width * 3,
pixels,
@ -661,9 +642,7 @@ static gboolean
ensure_wallpaper_texture (MetaBackground *self,
CoglTexture *texture)
{
MetaBackgroundPrivate *priv = self->priv;
if (priv->wallpaper_texture == NULL && !priv->wallpaper_allocation_failed)
if (self->wallpaper_texture == NULL && !self->wallpaper_allocation_failed)
{
int width = cogl_texture_get_width (texture);
int height = cogl_texture_get_height (texture);
@ -672,10 +651,10 @@ ensure_wallpaper_texture (MetaBackground *self,
CoglError *catch_error = NULL;
CoglPipeline *pipeline;
priv->wallpaper_texture = meta_create_texture (width, height,
self->wallpaper_texture = meta_create_texture (width, height,
COGL_TEXTURE_COMPONENTS_RGBA,
META_TEXTURE_FLAGS_NONE);
offscreen = cogl_offscreen_new_with_texture (priv->wallpaper_texture);
offscreen = cogl_offscreen_new_with_texture (self->wallpaper_texture);
fbo = COGL_FRAMEBUFFER (offscreen);
if (!cogl_framebuffer_allocate (fbo, &catch_error))
@ -686,11 +665,11 @@ ensure_wallpaper_texture (MetaBackground *self,
*/
cogl_error_free (catch_error);
cogl_object_unref (priv->wallpaper_texture);
priv->wallpaper_texture = NULL;
cogl_object_unref (self->wallpaper_texture);
self->wallpaper_texture = NULL;
cogl_object_unref (fbo);
priv->wallpaper_allocation_failed = TRUE;
self->wallpaper_allocation_failed = TRUE;
return FALSE;
}
@ -708,7 +687,7 @@ ensure_wallpaper_texture (MetaBackground *self,
ensure_color_texture (self);
pipeline = create_pipeline (PIPELINE_OVER_REVERSE);
cogl_pipeline_set_layer_texture (pipeline, 0, priv->color_texture);
cogl_pipeline_set_layer_texture (pipeline, 0, self->color_texture);
cogl_framebuffer_draw_rectangle (fbo, pipeline, 0, 0, width, height);
cogl_object_unref (pipeline);
}
@ -716,7 +695,7 @@ ensure_wallpaper_texture (MetaBackground *self,
cogl_object_unref (fbo);
}
return priv->wallpaper_texture != NULL;
return self->wallpaper_texture != NULL;
}
static CoglPipelineWrapMode
@ -743,26 +722,24 @@ meta_background_get_texture (MetaBackground *self,
cairo_rectangle_int_t *texture_area,
CoglPipelineWrapMode *wrap_mode)
{
MetaBackgroundPrivate *priv;
MetaBackgroundMonitor *monitor;
MetaRectangle geometry;
cairo_rectangle_int_t monitor_area;
CoglTexture *texture1, *texture2;
g_return_val_if_fail (META_IS_BACKGROUND (self), NULL);
priv = self->priv;
g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->n_monitors, NULL);
g_return_val_if_fail (monitor_index >= 0 && monitor_index < self->n_monitors, NULL);
monitor = &priv->monitors[monitor_index];
monitor = &self->monitors[monitor_index];
meta_display_get_monitor_geometry (priv->display, monitor_index, &geometry);
meta_display_get_monitor_geometry (self->display, monitor_index, &geometry);
monitor_area.x = geometry.x;
monitor_area.y = geometry.y;
monitor_area.width = geometry.width;
monitor_area.height = geometry.height;
texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
texture1 = self->background_image1 ? meta_background_image_get_texture (self->background_image1) : NULL;
texture2 = self->background_image2 ? meta_background_image_get_texture (self->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
{
@ -771,19 +748,19 @@ meta_background_get_texture (MetaBackground *self,
set_texture_area_from_monitor_area (&monitor_area, texture_area);
if (wrap_mode)
*wrap_mode = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
return priv->color_texture;
return self->color_texture;
}
if (texture2 == NULL && priv->style == G_DESKTOP_BACKGROUND_STYLE_WALLPAPER &&
priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID &&
if (texture2 == NULL && self->style == G_DESKTOP_BACKGROUND_STYLE_WALLPAPER &&
self->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID &&
ensure_wallpaper_texture (self, texture1))
{
if (texture_area)
get_texture_area (self, &monitor_area, priv->wallpaper_texture,
get_texture_area (self, &monitor_area, self->wallpaper_texture,
texture_area);
if (wrap_mode)
*wrap_mode = COGL_PIPELINE_WRAP_MODE_REPEAT;
return priv->wallpaper_texture;
return self->wallpaper_texture;
}
if (monitor->dirty)
@ -820,13 +797,13 @@ meta_background_get_texture (MetaBackground *self,
cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
monitor_area.width, monitor_area.height, -1., 1.);
if (texture2 != NULL && priv->blend_factor != 0.0)
if (texture2 != NULL && self->blend_factor != 0.0)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE);
cogl_pipeline_set_color4f (pipeline,
priv->blend_factor, priv->blend_factor, priv->blend_factor, priv->blend_factor);
self->blend_factor, self->blend_factor, self->blend_factor, self->blend_factor);
cogl_pipeline_set_layer_texture (pipeline, 0, texture2);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (self->style));
bare_region_visible = draw_texture (self,
monitor->fbo, pipeline,
@ -841,16 +818,16 @@ meta_background_get_texture (MetaBackground *self,
0.0, 0.0, 0.0, 0.0);
}
if (texture1 != NULL && priv->blend_factor != 1.0)
if (texture1 != NULL && self->blend_factor != 1.0)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_ADD);
cogl_pipeline_set_color4f (pipeline,
(1 - priv->blend_factor),
(1 - priv->blend_factor),
(1 - priv->blend_factor),
(1 - priv->blend_factor));;
(1 - self->blend_factor),
(1 - self->blend_factor),
(1 - self->blend_factor),
(1 - self->blend_factor));;
cogl_pipeline_set_layer_texture (pipeline, 0, texture1);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (self->style));
bare_region_visible = bare_region_visible || draw_texture (self,
monitor->fbo, pipeline,
@ -864,7 +841,7 @@ meta_background_get_texture (MetaBackground *self,
CoglPipeline *pipeline = create_pipeline (PIPELINE_OVER_REVERSE);
ensure_color_texture (self);
cogl_pipeline_set_layer_texture (pipeline, 0, priv->color_texture);
cogl_pipeline_set_layer_texture (pipeline, 0, self->color_texture);
cogl_framebuffer_draw_rectangle (monitor->fbo,
pipeline,
0, 0,
@ -911,17 +888,13 @@ meta_background_set_gradient (MetaBackground *self,
ClutterColor *color,
ClutterColor *second_color)
{
MetaBackgroundPrivate *priv;
g_return_if_fail (META_IS_BACKGROUND (self));
g_return_if_fail (color != NULL);
g_return_if_fail (second_color != NULL);
priv = self->priv;
priv->shading_direction = shading_direction;
priv->color = *color;
priv->second_color = *second_color;
self->shading_direction = shading_direction;
self->color = *color;
self->second_color = *second_color;
free_color_texture (self);
free_wallpaper_texture (self);
@ -945,18 +918,14 @@ meta_background_set_blend (MetaBackground *self,
double blend_factor,
GDesktopBackgroundStyle style)
{
MetaBackgroundPrivate *priv;
g_return_if_fail (META_IS_BACKGROUND (self));
g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0);
priv = self->priv;
set_file (self, &self->file1, &self->background_image1, file1);
set_file (self, &self->file2, &self->background_image2, file2);
set_file (self, &priv->file1, &priv->background_image1, file1);
set_file (self, &priv->file2, &priv->background_image2, file2);
priv->blend_factor = blend_factor;
priv->style = style;
self->blend_factor = blend_factor;
self->style = style;
free_wallpaper_texture (self);
mark_changed (self);

View File

@ -29,13 +29,8 @@
G_BEGIN_DECLS
#define META_TYPE_CULLABLE (meta_cullable_get_type ())
#define META_CULLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_CULLABLE, MetaCullable))
#define META_IS_CULLABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_CULLABLE))
#define META_CULLABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), META_TYPE_CULLABLE, MetaCullableInterface))
typedef struct _MetaCullable MetaCullable;
typedef struct _MetaCullableInterface MetaCullableInterface;
#define META_TYPE_CULLABLE (meta_cullable_get_type ())
G_DECLARE_INTERFACE (MetaCullable, meta_cullable, META, CULLABLE, ClutterActor)
struct _MetaCullableInterface
{
@ -47,8 +42,6 @@ struct _MetaCullableInterface
void (* reset_culling) (MetaCullable *cullable);
};
GType meta_cullable_get_type (void);
void meta_cullable_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region);

View File

@ -31,28 +31,12 @@
* This class handles the rendering of the DnD surface
*/
#define META_TYPE_DND_ACTOR (meta_dnd_actor_get_type ())
#define META_DND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DND_ACTOR, MetaDnDActor))
#define META_DND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DND_ACTOR, MetaDnDActorClass))
#define META_IS_DND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DND_ACTOR))
#define META_IS_DND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DND_ACTOR))
#define META_DND_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DND_ACTOR, MetaDnDActorClass))
#define META_TYPE_DND_ACTOR (meta_dnd_actor_get_type ())
G_DECLARE_FINAL_TYPE (MetaDnDActor,
meta_dnd_actor,
META, DND_ACTOR,
MetaFeedbackActor)
typedef struct _MetaDnDActor MetaDnDActor;
typedef struct _MetaDnDActorClass MetaDnDActorClass;
struct _MetaDnDActorClass
{
/*< private >*/
MetaFeedbackActorClass parent_class;
};
struct _MetaDnDActor
{
MetaFeedbackActor parent;
};
GType meta_dnd_actor_get_type (void);
ClutterActor *meta_dnd_actor_new (ClutterActor *drag_origin,
int start_x,

View File

@ -39,16 +39,16 @@ enum {
PROP_DRAG_START_Y
};
typedef struct _MetaDnDActorPrivate MetaDnDActorPrivate;
struct _MetaDnDActorPrivate
struct _MetaDnDActor
{
MetaFeedbackActor parent;
ClutterActor *drag_origin;
int drag_start_x;
int drag_start_y;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaDnDActor, meta_dnd_actor, META_TYPE_FEEDBACK_ACTOR)
G_DEFINE_TYPE (MetaDnDActor, meta_dnd_actor, META_TYPE_FEEDBACK_ACTOR)
static void
meta_dnd_actor_set_property (GObject *object,
@ -57,18 +57,17 @@ meta_dnd_actor_set_property (GObject *object,
GParamSpec *pspec)
{
MetaDnDActor *self = META_DND_ACTOR (object);
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
switch (prop_id)
{
case PROP_DRAG_ORIGIN:
priv->drag_origin = g_value_get_object (value);
self->drag_origin = g_value_get_object (value);
break;
case PROP_DRAG_START_X:
priv->drag_start_x = g_value_get_int (value);
self->drag_start_x = g_value_get_int (value);
break;
case PROP_DRAG_START_Y:
priv->drag_start_y = g_value_get_int (value);
self->drag_start_y = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -83,18 +82,17 @@ meta_dnd_actor_get_property (GObject *object,
GParamSpec *pspec)
{
MetaDnDActor *self = META_DND_ACTOR (object);
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
switch (prop_id)
{
case PROP_DRAG_ORIGIN:
g_value_set_object (value, priv->drag_origin);
g_value_set_object (value, self->drag_origin);
break;
case PROP_DRAG_START_X:
g_value_set_int (value, priv->drag_start_x);
g_value_set_int (value, self->drag_start_x);
break;
case PROP_DRAG_START_Y:
g_value_set_int (value, priv->drag_start_y);
g_value_set_int (value, self->drag_start_y);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -185,13 +183,11 @@ void
meta_dnd_actor_drag_finish (MetaDnDActor *self,
gboolean success)
{
MetaDnDActorPrivate *priv;
ClutterActor *actor;
g_return_if_fail (META_IS_DND_ACTOR (self));
actor = CLUTTER_ACTOR (self);
priv = meta_dnd_actor_get_instance_private (self);
if (success)
{
@ -207,18 +203,18 @@ meta_dnd_actor_drag_finish (MetaDnDActor *self,
clutter_actor_set_easing_duration (actor, DRAG_FAILED_DURATION);
clutter_actor_set_opacity (actor, 0);
if (CLUTTER_ACTOR_IS_VISIBLE (priv->drag_origin))
if (CLUTTER_ACTOR_IS_VISIBLE (self->drag_origin))
{
int anchor_x, anchor_y;
ClutterPoint dest;
clutter_actor_get_transformed_position (priv->drag_origin,
clutter_actor_get_transformed_position (self->drag_origin,
&dest.x, &dest.y);
meta_feedback_actor_get_anchor (META_FEEDBACK_ACTOR (self),
&anchor_x, &anchor_y);
dest.x += priv->drag_start_x - anchor_x;
dest.y += priv->drag_start_y - anchor_y;
dest.x += self->drag_start_x - anchor_x;
dest.y += self->drag_start_y - anchor_y;
clutter_actor_set_position (actor, dest.x, dest.y);
}

View File

@ -31,15 +31,12 @@
* This class handles the rendering of user interaction feedback
*/
#define META_TYPE_FEEDBACK_ACTOR (meta_feedback_actor_get_type ())
#define META_FEEDBACK_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_FEEDBACK_ACTOR, MetaFeedbackActor))
#define META_FEEDBACK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FEEDBACK_ACTOR, MetaFeedbackActorClass))
#define META_IS_FEEDBACK_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FEEDBACK_ACTOR))
#define META_IS_FEEDBACK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FEEDBACK_ACTOR))
#define META_FEEDBACK_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FEEDBACK_ACTOR, MetaFeedbackActorClass))
#define META_TYPE_FEEDBACK_ACTOR (meta_feedback_actor_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaFeedbackActor,
meta_feedback_actor,
META, FEEDBACK_ACTOR,
ClutterActor)
typedef struct _MetaFeedbackActor MetaFeedbackActor;
typedef struct _MetaFeedbackActorClass MetaFeedbackActorClass;
struct _MetaFeedbackActorClass
{
@ -47,12 +44,6 @@ struct _MetaFeedbackActorClass
ClutterActorClass parent_class;
};
struct _MetaFeedbackActor
{
ClutterActor parent;
};
GType meta_feedback_actor_get_type (void);
ClutterActor *meta_feedback_actor_new (int anchor_x,
int anchor_y);

View File

@ -106,11 +106,6 @@ struct _MetaShadowFactory
GHashTable *shadow_classes;
};
struct _MetaShadowFactoryClass
{
GObjectClass parent_class;
};
enum
{
CHANGED,

View File

@ -70,10 +70,6 @@ static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, Clutte
static void cullable_iface_init (MetaCullableInterface *iface);
#define META_SHAPED_TEXTURE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
MetaShapedTexturePrivate))
enum {
SIZE_CHANGED,
@ -82,8 +78,10 @@ enum {
static guint signals[LAST_SIGNAL];
struct _MetaShapedTexturePrivate
struct _MetaShapedTexture
{
ClutterActor parent;
MetaTextureTower *paint_tower;
CoglTexture *texture;
@ -119,7 +117,6 @@ struct _MetaShapedTexturePrivate
};
G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaShapedTexture)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
static void
@ -146,73 +143,66 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
static void
invalidate_size (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
priv->size_invalid = TRUE;
stex->size_invalid = TRUE;
}
static void
meta_shaped_texture_init (MetaShapedTexture *self)
meta_shaped_texture_init (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv;
stex->paint_tower = meta_texture_tower_new ();
priv = self->priv = META_SHAPED_TEXTURE_GET_PRIVATE (self);
stex->texture = NULL;
stex->mask_texture = NULL;
stex->create_mipmaps = TRUE;
stex->is_y_inverted = TRUE;
stex->transform = META_MONITOR_TRANSFORM_NORMAL;
priv->paint_tower = meta_texture_tower_new ();
priv->texture = NULL;
priv->mask_texture = NULL;
priv->create_mipmaps = TRUE;
priv->is_y_inverted = TRUE;
priv->transform = META_MONITOR_TRANSFORM_NORMAL;
g_signal_connect (self,
g_signal_connect (stex,
"notify::scale-x",
G_CALLBACK (invalidate_size),
self);
stex);
}
static void
update_size (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
int dst_width;
int dst_height;
if (meta_monitor_transform_is_rotated (priv->transform))
if (meta_monitor_transform_is_rotated (stex->transform))
{
if (priv->texture)
if (stex->texture)
{
dst_width = priv->tex_height;
dst_height = priv->tex_width;
dst_width = stex->tex_height;
dst_height = stex->tex_width;
}
else
{
dst_width = priv->fallback_height;
dst_height = priv->fallback_width;
dst_width = stex->fallback_height;
dst_height = stex->fallback_width;
}
}
else
{
if (priv->texture)
if (stex->texture)
{
dst_width = priv->tex_width;
dst_height = priv->tex_height;
dst_width = stex->tex_width;
dst_height = stex->tex_height;
}
else
{
dst_width = priv->fallback_width;
dst_height = priv->fallback_height;
dst_width = stex->fallback_width;
dst_height = stex->fallback_height;
}
}
priv->size_invalid = FALSE;
stex->size_invalid = FALSE;
if (priv->dst_width != dst_width ||
priv->dst_height != dst_height)
if (stex->dst_width != dst_width ||
stex->dst_height != dst_height)
{
priv->dst_width = dst_width;
priv->dst_height = dst_height;
stex->dst_width = dst_width;
stex->dst_height = dst_height;
meta_shaped_texture_set_mask_texture (stex, NULL);
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
g_signal_emit (stex, signals[SIZE_CHANGED], 0);
@ -222,80 +212,71 @@ update_size (MetaShapedTexture *stex)
static void
ensure_size_valid (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
if (priv->size_invalid)
if (stex->size_invalid)
update_size (stex);
}
static void
set_unobscured_region (MetaShapedTexture *self,
set_unobscured_region (MetaShapedTexture *stex,
cairo_region_t *unobscured_region)
{
MetaShapedTexturePrivate *priv = self->priv;
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
g_clear_pointer (&stex->unobscured_region, cairo_region_destroy);
if (unobscured_region)
{
int width, height;
ensure_size_valid (self);
width = priv->dst_width;
height = priv->dst_height;
ensure_size_valid (stex);
width = stex->dst_width;
height = stex->dst_height;
cairo_rectangle_int_t bounds = { 0, 0, width, height };
priv->unobscured_region = cairo_region_copy (unobscured_region);
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
stex->unobscured_region = cairo_region_copy (unobscured_region);
cairo_region_intersect_rectangle (stex->unobscured_region, &bounds);
}
}
static void
set_clip_region (MetaShapedTexture *self,
set_clip_region (MetaShapedTexture *stex,
cairo_region_t *clip_region)
{
MetaShapedTexturePrivate *priv = self->priv;
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
g_clear_pointer (&stex->clip_region, cairo_region_destroy);
if (clip_region)
priv->clip_region = cairo_region_copy (clip_region);
stex->clip_region = cairo_region_copy (clip_region);
}
static void
meta_shaped_texture_reset_pipelines (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
g_clear_pointer (&priv->base_pipeline, cogl_object_unref);
g_clear_pointer (&priv->masked_pipeline, cogl_object_unref);
g_clear_pointer (&priv->unblended_pipeline, cogl_object_unref);
g_clear_pointer (&stex->base_pipeline, cogl_object_unref);
g_clear_pointer (&stex->masked_pipeline, cogl_object_unref);
g_clear_pointer (&stex->unblended_pipeline, cogl_object_unref);
}
static void
meta_shaped_texture_dispose (GObject *object)
{
MetaShapedTexture *self = (MetaShapedTexture *) object;
MetaShapedTexturePrivate *priv = self->priv;
MetaShapedTexture *stex = (MetaShapedTexture *) object;
if (priv->remipmap_timeout_id)
if (stex->remipmap_timeout_id)
{
g_source_remove (priv->remipmap_timeout_id);
priv->remipmap_timeout_id = 0;
g_source_remove (stex->remipmap_timeout_id);
stex->remipmap_timeout_id = 0;
}
if (priv->paint_tower)
meta_texture_tower_free (priv->paint_tower);
priv->paint_tower = NULL;
if (stex->paint_tower)
meta_texture_tower_free (stex->paint_tower);
stex->paint_tower = NULL;
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
g_clear_pointer (&stex->texture, cogl_object_unref);
g_clear_pointer (&stex->opaque_region, cairo_region_destroy);
meta_shaped_texture_set_mask_texture (self, NULL);
set_unobscured_region (self, NULL);
set_clip_region (self, NULL);
meta_shaped_texture_set_mask_texture (stex, NULL);
set_unobscured_region (stex, NULL);
set_clip_region (stex, NULL);
meta_shaped_texture_reset_pipelines (self);
meta_shaped_texture_reset_pipelines (stex);
g_clear_pointer (&priv->snippet, cogl_object_unref);
g_clear_pointer (&stex->snippet, cogl_object_unref);
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object);
}
@ -304,11 +285,10 @@ static CoglPipeline *
get_base_pipeline (MetaShapedTexture *stex,
CoglContext *ctx)
{
MetaShapedTexturePrivate *priv = stex->priv;
CoglPipeline *pipeline;
if (priv->base_pipeline)
return priv->base_pipeline;
if (stex->base_pipeline)
return stex->base_pipeline;
pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_wrap_mode_s (pipeline, 0,
@ -319,7 +299,7 @@ get_base_pipeline (MetaShapedTexture *stex,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
cogl_pipeline_set_layer_wrap_mode_t (pipeline, 1,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
if (!priv->is_y_inverted)
if (!stex->is_y_inverted)
{
CoglMatrix matrix;
@ -329,13 +309,13 @@ get_base_pipeline (MetaShapedTexture *stex,
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
}
if (priv->transform != META_MONITOR_TRANSFORM_NORMAL)
if (stex->transform != META_MONITOR_TRANSFORM_NORMAL)
{
CoglMatrix matrix;
CoglEuler euler;
cogl_matrix_init_translation (&matrix, 0.5, 0.5, 0.0);
switch (priv->transform)
switch (stex->transform)
{
case META_MONITOR_TRANSFORM_90:
cogl_euler_init (&euler, 0.0, 0.0, 90.0);
@ -368,12 +348,12 @@ get_base_pipeline (MetaShapedTexture *stex,
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
}
if (priv->snippet)
cogl_pipeline_add_layer_snippet (pipeline, 0, priv->snippet);
if (stex->snippet)
cogl_pipeline_add_layer_snippet (pipeline, 0, stex->snippet);
priv->base_pipeline = pipeline;
stex->base_pipeline = pipeline;
return priv->base_pipeline;
return stex->base_pipeline;
}
static CoglPipeline *
@ -387,18 +367,17 @@ static CoglPipeline *
get_masked_pipeline (MetaShapedTexture *stex,
CoglContext *ctx)
{
MetaShapedTexturePrivate *priv = stex->priv;
CoglPipeline *pipeline;
if (priv->masked_pipeline)
return priv->masked_pipeline;
if (stex->masked_pipeline)
return stex->masked_pipeline;
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
cogl_pipeline_set_layer_combine (pipeline, 1,
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
NULL);
priv->masked_pipeline = pipeline;
stex->masked_pipeline = pipeline;
return pipeline;
}
@ -407,12 +386,11 @@ static CoglPipeline *
get_unblended_pipeline (MetaShapedTexture *stex,
CoglContext *ctx)
{
MetaShapedTexturePrivate *priv = stex->priv;
CoglPipeline *pipeline;
CoglColor color;
if (priv->unblended_pipeline)
return priv->unblended_pipeline;
if (stex->unblended_pipeline)
return stex->unblended_pipeline;
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
@ -421,7 +399,7 @@ get_unblended_pipeline (MetaShapedTexture *stex,
NULL);
cogl_pipeline_set_color (pipeline, &color);
priv->unblended_pipeline = pipeline;
stex->unblended_pipeline = pipeline;
return pipeline;
}
@ -459,17 +437,14 @@ static void
set_cogl_texture (MetaShapedTexture *stex,
CoglTexture *cogl_tex)
{
MetaShapedTexturePrivate *priv;
int width, height;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
if (stex->texture)
cogl_object_unref (stex->texture);
if (priv->texture)
cogl_object_unref (priv->texture);
priv->texture = cogl_tex;
stex->texture = cogl_tex;
if (cogl_tex != NULL)
{
@ -483,11 +458,11 @@ set_cogl_texture (MetaShapedTexture *stex,
height = 0;
}
if (priv->tex_width != width ||
priv->tex_height != height)
if (stex->tex_width != width ||
stex->tex_height != height)
{
priv->tex_width = width;
priv->tex_height = height;
stex->tex_width = width;
stex->tex_height = height;
update_size (stex);
}
@ -496,21 +471,20 @@ set_cogl_texture (MetaShapedTexture *stex,
* previous buffer. We only queue a redraw in response to surface
* damage. */
if (priv->create_mipmaps)
meta_texture_tower_set_base_texture (priv->paint_tower, cogl_tex);
if (stex->create_mipmaps)
meta_texture_tower_set_base_texture (stex->paint_tower, cogl_tex);
}
static gboolean
texture_is_idle_and_not_mipmapped (gpointer user_data)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (user_data);
MetaShapedTexturePrivate *priv = stex->priv;
if ((g_get_monotonic_time () - priv->earliest_remipmap) < 0)
if ((g_get_monotonic_time () - stex->earliest_remipmap) < 0)
return G_SOURCE_CONTINUE;
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
priv->remipmap_timeout_id = 0;
stex->remipmap_timeout_id = 0;
return G_SOURCE_REMOVE;
}
@ -519,7 +493,6 @@ static void
meta_shaped_texture_paint (ClutterActor *actor)
{
MetaShapedTexture *stex = (MetaShapedTexture *) actor;
MetaShapedTexturePrivate *priv = stex->priv;
double tex_scale;
int dst_width, dst_height;
cairo_rectangle_int_t tex_rect;
@ -535,7 +508,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
CoglPipelineFilter filter;
gint64 now = g_get_monotonic_time ();
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
if (stex->clip_region && cairo_region_is_empty (stex->clip_region))
return;
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR (stex)))
@ -556,29 +529,29 @@ meta_shaped_texture_paint (ClutterActor *actor)
* Setting the texture quality to high without SGIS_generate_mipmap
* support for TFP textures will result in fallbacks to XGetImage.
*/
if (priv->create_mipmaps && priv->last_invalidation)
if (stex->create_mipmaps && stex->last_invalidation)
{
gint64 age = now - priv->last_invalidation;
gint64 age = now - stex->last_invalidation;
if (age >= MIN_MIPMAP_AGE_USEC ||
priv->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
paint_tex = meta_texture_tower_get_paint_texture (priv->paint_tower);
stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
paint_tex = meta_texture_tower_get_paint_texture (stex->paint_tower);
}
if (paint_tex == NULL)
{
paint_tex = COGL_TEXTURE (priv->texture);
paint_tex = COGL_TEXTURE (stex->texture);
if (paint_tex == NULL)
return;
if (priv->create_mipmaps)
if (stex->create_mipmaps)
{
/* Minus 1000 to ensure we don't fail the age test in timeout */
priv->earliest_remipmap = now + MIN_MIPMAP_AGE_USEC - 1000;
stex->earliest_remipmap = now + MIN_MIPMAP_AGE_USEC - 1000;
if (!priv->remipmap_timeout_id)
priv->remipmap_timeout_id =
if (!stex->remipmap_timeout_id)
stex->remipmap_timeout_id =
g_timeout_add (MIN_MIPMAP_AGE_USEC / 1000,
texture_is_idle_and_not_mipmapped,
stex);
@ -587,9 +560,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
clutter_actor_get_scale (actor, &tex_scale, NULL);
ensure_size_valid (stex);
dst_width = priv->dst_width;
dst_height = priv->dst_height;
dst_width = stex->dst_width;
dst_height = stex->dst_height;
if (dst_width == 0 || dst_height == 0) /* no contents yet */
return;
@ -610,10 +583,10 @@ meta_shaped_texture_paint (ClutterActor *actor)
opacity = clutter_actor_get_paint_opacity (actor);
clutter_actor_get_allocation_box (actor, &alloc);
if (priv->opaque_region && opacity == 255)
if (stex->opaque_region && opacity == 255)
{
opaque_tex_region =
meta_region_scale_double (priv->opaque_region,
meta_region_scale_double (stex->opaque_region,
1.0 / tex_scale,
META_ROUNDING_STRATEGY_SHRINK);
use_opaque_region = TRUE;
@ -624,10 +597,10 @@ meta_shaped_texture_paint (ClutterActor *actor)
use_opaque_region = FALSE;
}
if (priv->clip_region)
if (stex->clip_region)
{
clip_tex_region =
meta_region_scale_double (priv->clip_region,
meta_region_scale_double (stex->clip_region,
1.0 / tex_scale,
META_ROUNDING_STRATEGY_GROW);
}
@ -719,14 +692,14 @@ meta_shaped_texture_paint (ClutterActor *actor)
{
CoglPipeline *blended_pipeline;
if (priv->mask_texture == NULL)
if (stex->mask_texture == NULL)
{
blended_pipeline = get_unmasked_pipeline (stex, ctx);
}
else
{
blended_pipeline = get_masked_pipeline (stex, ctx);
cogl_pipeline_set_layer_texture (blended_pipeline, 1, priv->mask_texture);
cogl_pipeline_set_layer_texture (blended_pipeline, 1, stex->mask_texture);
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
}
@ -776,14 +749,13 @@ meta_shaped_texture_get_preferred_width (ClutterActor *self,
gfloat *natural_width_p)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
MetaShapedTexturePrivate *priv = stex->priv;
ensure_size_valid (stex);
if (min_width_p)
*min_width_p = priv->dst_width;
*min_width_p = stex->dst_width;
if (natural_width_p)
*natural_width_p = priv->dst_width;
*natural_width_p = stex->dst_width;
}
static void
@ -793,24 +765,22 @@ meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat *natural_height_p)
{
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
MetaShapedTexturePrivate *priv = stex->priv;
ensure_size_valid (stex);
if (min_height_p)
*min_height_p = priv->dst_height;
*min_height_p = stex->dst_height;
if (natural_height_p)
*natural_height_p = priv->dst_height;
*natural_height_p = stex->dst_height;
}
static cairo_region_t *
effective_unobscured_region (MetaShapedTexture *self)
effective_unobscured_region (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = self->priv;
ClutterActor *actor;
/* Fail if we have any mapped clones. */
actor = CLUTTER_ACTOR (self);
actor = CLUTTER_ACTOR (stex);
do
{
if (clutter_actor_has_mapped_clones (actor))
@ -819,7 +789,7 @@ effective_unobscured_region (MetaShapedTexture *self)
}
while (actor != NULL);
return priv->unobscured_region;
return stex->unobscured_region;
}
static gboolean
@ -833,20 +803,16 @@ void
meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
gboolean create_mipmaps)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
create_mipmaps = create_mipmaps != FALSE;
if (create_mipmaps != priv->create_mipmaps)
if (create_mipmaps != stex->create_mipmaps)
{
CoglTexture *base_texture;
priv->create_mipmaps = create_mipmaps;
base_texture = create_mipmaps ? priv->texture : NULL;
meta_texture_tower_set_base_texture (priv->paint_tower, base_texture);
stex->create_mipmaps = create_mipmaps;
base_texture = create_mipmaps ? stex->texture : NULL;
meta_texture_tower_set_base_texture (stex->paint_tower, base_texture);
}
}
@ -854,27 +820,23 @@ void
meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
CoglTexture *mask_texture)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
g_clear_pointer (&priv->mask_texture, cogl_object_unref);
g_clear_pointer (&stex->mask_texture, cogl_object_unref);
if (mask_texture != NULL)
{
priv->mask_texture = mask_texture;
cogl_object_ref (priv->mask_texture);
stex->mask_texture = mask_texture;
cogl_object_ref (stex->mask_texture);
}
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
}
gboolean
meta_shaped_texture_is_obscured (MetaShapedTexture *self)
meta_shaped_texture_is_obscured (MetaShapedTexture *stex)
{
cairo_region_t *unobscured_region = effective_unobscured_region (self);
cairo_region_t *unobscured_region = effective_unobscured_region (stex);
if (unobscured_region)
return cairo_region_is_empty (unobscured_region);
@ -902,29 +864,26 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
int width,
int height)
{
MetaShapedTexturePrivate *priv;
cairo_region_t *unobscured_region;
const cairo_rectangle_int_t clip = { x, y, width, height };
priv = stex->priv;
if (priv->texture == NULL)
if (stex->texture == NULL)
return FALSE;
meta_texture_tower_update_area (priv->paint_tower, x, y, width, height);
meta_texture_tower_update_area (stex->paint_tower, x, y, width, height);
priv->prev_invalidation = priv->last_invalidation;
priv->last_invalidation = g_get_monotonic_time ();
stex->prev_invalidation = stex->last_invalidation;
stex->last_invalidation = g_get_monotonic_time ();
if (priv->prev_invalidation)
if (stex->prev_invalidation)
{
gint64 interval = priv->last_invalidation - priv->prev_invalidation;
gint64 interval = stex->last_invalidation - stex->prev_invalidation;
gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
if (!fast_update)
priv->fast_updates = 0;
else if (priv->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
priv->fast_updates++;
stex->fast_updates = 0;
else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
stex->fast_updates++;
}
unobscured_region = effective_unobscured_region (stex);
@ -978,14 +937,12 @@ void
meta_shaped_texture_set_is_y_inverted (MetaShapedTexture *stex,
gboolean is_y_inverted)
{
MetaShapedTexturePrivate *priv = stex->priv;
if (priv->is_y_inverted == is_y_inverted)
if (stex->is_y_inverted == is_y_inverted)
return;
meta_shaped_texture_reset_pipelines (stex);
priv->is_y_inverted = is_y_inverted;
stex->is_y_inverted = is_y_inverted;
}
/**
@ -995,16 +952,14 @@ void
meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
CoglSnippet *snippet)
{
MetaShapedTexturePrivate *priv = stex->priv;
if (priv->snippet == snippet)
if (stex->snippet == snippet)
return;
meta_shaped_texture_reset_pipelines (stex);
g_clear_pointer (&priv->snippet, cogl_object_unref);
g_clear_pointer (&stex->snippet, cogl_object_unref);
if (snippet)
priv->snippet = cogl_object_ref (snippet);
stex->snippet = cogl_object_ref (snippet);
}
/**
@ -1017,7 +972,7 @@ CoglTexture *
meta_shaped_texture_get_texture (MetaShapedTexture *stex)
{
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
return COGL_TEXTURE (stex->priv->texture);
return COGL_TEXTURE (stex->texture);
}
/**
@ -1035,38 +990,31 @@ void
meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
cairo_region_t *opaque_region)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
if (priv->opaque_region)
cairo_region_destroy (priv->opaque_region);
if (stex->opaque_region)
cairo_region_destroy (stex->opaque_region);
if (opaque_region)
priv->opaque_region = cairo_region_reference (opaque_region);
stex->opaque_region = cairo_region_reference (opaque_region);
else
priv->opaque_region = NULL;
stex->opaque_region = NULL;
}
cairo_region_t *
meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
return priv->opaque_region;
return stex->opaque_region;
}
void
meta_shaped_texture_set_transform (MetaShapedTexture *stex,
MetaMonitorTransform transform)
{
MetaShapedTexturePrivate *priv = stex->priv;
if (priv->transform == transform)
if (stex->transform == transform)
return;
priv->transform = transform;
stex->transform = transform;
meta_shaped_texture_reset_pipelines (stex);
invalidate_size (stex);
@ -1096,7 +1044,7 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
texture = COGL_TEXTURE (stex->priv->texture);
texture = COGL_TEXTURE (stex->texture);
if (texture == NULL)
return NULL;
@ -1132,7 +1080,7 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
if (clip != NULL)
cogl_object_unref (texture);
mask_texture = stex->priv->mask_texture;
mask_texture = stex->mask_texture;
if (mask_texture != NULL)
{
cairo_t *cr;
@ -1175,10 +1123,8 @@ meta_shaped_texture_set_fallback_size (MetaShapedTexture *stex,
int fallback_width,
int fallback_height)
{
MetaShapedTexturePrivate *priv = stex->priv;
priv->fallback_width = fallback_width;
priv->fallback_height = fallback_height;
stex->fallback_width = fallback_width;
stex->fallback_height = fallback_height;
invalidate_size (stex);
}
@ -1188,20 +1134,19 @@ meta_shaped_texture_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region)
{
MetaShapedTexture *self = META_SHAPED_TEXTURE (cullable);
MetaShapedTexturePrivate *priv = self->priv;
MetaShapedTexture *stex = META_SHAPED_TEXTURE (cullable);
set_unobscured_region (self, unobscured_region);
set_clip_region (self, clip_region);
set_unobscured_region (stex, unobscured_region);
set_clip_region (stex, clip_region);
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)) == 0xff)
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (stex)) == 0xff)
{
if (priv->opaque_region)
if (stex->opaque_region)
{
if (unobscured_region)
cairo_region_subtract (unobscured_region, priv->opaque_region);
cairo_region_subtract (unobscured_region, stex->opaque_region);
if (clip_region)
cairo_region_subtract (clip_region, priv->opaque_region);
cairo_region_subtract (clip_region, stex->opaque_region);
}
}
}

View File

@ -37,15 +37,17 @@
#include "wayland/meta-wayland-private.h"
#include "wayland/meta-window-wayland.h"
typedef struct _MetaSurfaceActorWaylandPrivate
struct _MetaSurfaceActorWayland
{
MetaSurfaceActor parent;
MetaWaylandSurface *surface;
struct wl_list frame_callback_list;
} MetaSurfaceActorWaylandPrivate;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorWayland,
meta_surface_actor_wayland,
META_TYPE_SURFACE_ACTOR)
G_DEFINE_TYPE (MetaSurfaceActorWayland,
meta_surface_actor_wayland,
META_TYPE_SURFACE_ACTOR)
static void
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
@ -93,9 +95,7 @@ void
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
struct wl_list *frame_callbacks)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
wl_list_insert_list (&priv->frame_callback_list, frame_callbacks);
wl_list_insert_list (&self->frame_callback_list, frame_callbacks);
}
static MetaWindow *
@ -162,15 +162,13 @@ static void
meta_surface_actor_wayland_paint (ClutterActor *actor)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
if (priv->surface)
if (self->surface)
{
MetaWaylandCompositor *compositor = priv->surface->compositor;
MetaWaylandCompositor *compositor = self->surface->compositor;
wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
wl_list_init (&priv->frame_callback_list);
wl_list_insert_list (&compositor->frame_callbacks, &self->frame_callback_list);
wl_list_init (&self->frame_callback_list);
}
CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
@ -180,21 +178,19 @@ static void
meta_surface_actor_wayland_dispose (GObject *object)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (object);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
MetaWaylandFrameCallback *cb, *next;
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
meta_shaped_texture_set_texture (stex, NULL);
if (priv->surface)
if (self->surface)
{
g_object_remove_weak_pointer (G_OBJECT (priv->surface),
(gpointer *) &priv->surface);
priv->surface = NULL;
g_object_remove_weak_pointer (G_OBJECT (self->surface),
(gpointer *) &self->surface);
self->surface = NULL;
}
wl_list_for_each_safe (cb, next, &priv->frame_callback_list, link)
wl_list_for_each_safe (cb, next, &self->frame_callback_list, link)
wl_resource_destroy (cb->resource);
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
@ -233,14 +229,13 @@ MetaSurfaceActor *
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
{
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
g_assert (meta_is_wayland_compositor ());
wl_list_init (&priv->frame_callback_list);
priv->surface = surface;
g_object_add_weak_pointer (G_OBJECT (priv->surface),
(gpointer *) &priv->surface);
wl_list_init (&self->frame_callback_list);
self->surface = surface;
g_object_add_weak_pointer (G_OBJECT (self->surface),
(gpointer *) &self->surface);
return META_SURFACE_ACTOR (self);
}
@ -248,6 +243,5 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
MetaWaylandSurface *
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
return priv->surface;
return self->surface;
}

View File

@ -34,27 +34,11 @@
G_BEGIN_DECLS
#define META_TYPE_SURFACE_ACTOR_WAYLAND (meta_surface_actor_wayland_get_type ())
#define META_SURFACE_ACTOR_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWayland))
#define META_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWaylandClass))
#define META_IS_SURFACE_ACTOR_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND))
#define META_IS_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND))
#define META_SURFACE_ACTOR_WAYLAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWaylandClass))
typedef struct _MetaSurfaceActorWayland MetaSurfaceActorWayland;
typedef struct _MetaSurfaceActorWaylandClass MetaSurfaceActorWaylandClass;
struct _MetaSurfaceActorWayland
{
MetaSurfaceActor parent;
};
struct _MetaSurfaceActorWaylandClass
{
MetaSurfaceActorClass parent_class;
};
GType meta_surface_actor_wayland_get_type (void);
#define META_TYPE_SURFACE_ACTOR_WAYLAND (meta_surface_actor_wayland_get_type ())
G_DECLARE_FINAL_TYPE (MetaSurfaceActorWayland,
meta_surface_actor_wayland,
META, SURFACE_ACTOR_WAYLAND,
MetaSurfaceActor)
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);

View File

@ -37,8 +37,10 @@
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
struct _MetaSurfaceActorX11Private
struct _MetaSurfaceActorX11
{
MetaSurfaceActor parent;
MetaWindow *window;
MetaDisplay *display;
@ -60,35 +62,34 @@ struct _MetaSurfaceActorX11Private
guint unredirected : 1;
};
typedef struct _MetaSurfaceActorX11Private MetaSurfaceActorX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11, META_TYPE_SURFACE_ACTOR)
G_DEFINE_TYPE (MetaSurfaceActorX11,
meta_surface_actor_x11,
META_TYPE_SURFACE_ACTOR)
static void
free_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->damage == None)
if (self->damage == None)
return;
meta_x11_error_trap_push (display->x11_display);
XDamageDestroy (xdisplay, priv->damage);
priv->damage = None;
XDamageDestroy (xdisplay, self->damage);
self->damage = None;
meta_x11_error_trap_pop (display->x11_display);
}
static void
detach_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->pixmap == None)
if (self->pixmap == None)
return;
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
@ -99,28 +100,26 @@ detach_pixmap (MetaSurfaceActorX11 *self)
cogl_flush ();
meta_x11_error_trap_push (display->x11_display);
XFreePixmap (xdisplay, priv->pixmap);
priv->pixmap = None;
XFreePixmap (xdisplay, self->pixmap);
self->pixmap = None;
meta_x11_error_trap_pop (display->x11_display);
g_clear_pointer (&priv->texture, cogl_object_unref);
g_clear_pointer (&self->texture, cogl_object_unref);
}
static void
set_pixmap (MetaSurfaceActorX11 *self,
Pixmap pixmap)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglError *error = NULL;
CoglTexture *texture;
g_assert (priv->pixmap == None);
priv->pixmap = pixmap;
g_assert (self->pixmap == None);
self->pixmap = pixmap;
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, &error));
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, self->pixmap, FALSE, &error));
if (error != NULL)
{
@ -130,27 +129,26 @@ set_pixmap (MetaSurfaceActorX11 *self,
else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
g_warning ("NOTE: Not using GLX TFP!\n");
priv->texture = texture;
self->texture = texture;
meta_shaped_texture_set_texture (stex, texture);
}
static void
update_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->size_changed)
if (self->size_changed)
{
detach_pixmap (self);
priv->size_changed = FALSE;
self->size_changed = FALSE;
}
if (priv->pixmap == None)
if (self->pixmap == None)
{
Pixmap new_pixmap;
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (display->x11_display);
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
@ -170,7 +168,7 @@ update_pixmap (MetaSurfaceActorX11 *self)
if (new_pixmap == None)
{
meta_verbose ("Unable to get named pixmap for %s\n",
meta_window_get_description (priv->window));
meta_window_get_description (self->window));
return;
}
@ -181,8 +179,7 @@ update_pixmap (MetaSurfaceActorX11 *self)
static gboolean
is_visible (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
return (priv->pixmap != None) && !priv->unredirected;
return (self->pixmap != None) && !self->unredirected;
}
static void
@ -190,31 +187,30 @@ meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
int x, int y, int width, int height)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
priv->received_damage = TRUE;
self->received_damage = TRUE;
if (meta_window_is_fullscreen (priv->window) && !priv->unredirected && !priv->does_full_damage)
if (meta_window_is_fullscreen (self->window) && !self->unredirected && !self->does_full_damage)
{
MetaRectangle window_rect;
meta_window_get_frame_rect (priv->window, &window_rect);
meta_window_get_frame_rect (self->window, &window_rect);
if (x == 0 &&
y == 0 &&
window_rect.width == width &&
window_rect.height == height)
priv->full_damage_frames_count++;
self->full_damage_frames_count++;
else
priv->full_damage_frames_count = 0;
self->full_damage_frames_count = 0;
if (priv->full_damage_frames_count >= 100)
priv->does_full_damage = TRUE;
if (self->full_damage_frames_count >= 100)
self->does_full_damage = TRUE;
}
if (!is_visible (self))
return;
cogl_texture_pixmap_x11_update_area (COGL_TEXTURE_PIXMAP_X11 (priv->texture),
cogl_texture_pixmap_x11_update_area (COGL_TEXTURE_PIXMAP_X11 (self->texture),
x, y, width, height);
}
@ -222,17 +218,16 @@ static void
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (priv->received_damage)
if (self->received_damage)
{
meta_x11_error_trap_push (display->x11_display);
XDamageSubtract (xdisplay, priv->damage, None, None);
XDamageSubtract (xdisplay, self->damage, None, None);
meta_x11_error_trap_pop (display->x11_display);
priv->received_damage = FALSE;
self->received_damage = FALSE;
}
update_pixmap (self);
@ -249,7 +244,6 @@ static gboolean
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
/* If we're not ARGB32, then we're opaque. */
if (!meta_surface_actor_is_argb32 (actor))
@ -261,7 +255,7 @@ meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
if (!opaque_region)
return FALSE;
MetaWindow *window = priv->window;
MetaWindow *window = self->window;
cairo_rectangle_int_t client_area;
meta_window_get_client_area_rect (window, &client_area);
@ -276,9 +270,8 @@ static gboolean
meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaWindow *window = priv->window;
MetaWindow *window = self->window;
if (meta_window_requested_dont_bypass_compositor (window))
return FALSE;
@ -301,7 +294,7 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
if (meta_window_is_override_redirect (window))
return TRUE;
if (priv->does_full_damage)
if (self->does_full_damage)
return TRUE;
return FALSE;
@ -310,14 +303,13 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
static void
sync_unredirected (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
MetaDisplay *display = self->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (display->x11_display);
if (priv->unredirected)
if (self->unredirected)
{
detach_pixmap (self);
XCompositeUnredirectWindow (xdisplay, xwindow, CompositeRedirectManual);
@ -335,12 +327,11 @@ meta_surface_actor_x11_set_unredirected (MetaSurfaceActor *actor,
gboolean unredirected)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
if (priv->unredirected == unredirected)
if (self->unredirected == unredirected)
return;
priv->unredirected = unredirected;
self->unredirected = unredirected;
sync_unredirected (self);
}
@ -348,9 +339,8 @@ static gboolean
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
return priv->unredirected;
return self->unredirected;
}
static void
@ -367,9 +357,8 @@ meta_surface_actor_x11_dispose (GObject *object)
static MetaWindow *
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
return priv->window;
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
return self->window;
}
static void
@ -394,20 +383,17 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
static void
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
priv->last_width = -1;
priv->last_height = -1;
self->last_width = -1;
self->last_height = -1;
}
static void
create_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
Display *xdisplay = meta_x11_display_get_xdisplay (priv->display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
Display *xdisplay = meta_x11_display_get_xdisplay (self->display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
self->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
}
static void
@ -425,39 +411,37 @@ window_decorated_notify (MetaWindow *window,
static void
reset_texture (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (!priv->texture)
if (!self->texture)
return;
/* Setting the texture to NULL will cause all the FBO's cached by the
* shaped texture's MetaTextureTower to be discarded and recreated.
*/
meta_shaped_texture_set_texture (stex, NULL);
meta_shaped_texture_set_texture (stex, priv->texture);
meta_shaped_texture_set_texture (stex, self->texture);
}
MetaSurfaceActor *
meta_surface_actor_x11_new (MetaWindow *window)
{
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = meta_window_get_display (window);
g_assert (!meta_is_wayland_compositor ());
priv->window = window;
priv->display = display;
self->window = window;
self->display = display;
g_signal_connect_object (priv->display, "gl-video-memory-purged",
g_signal_connect_object (self->display, "gl-video-memory-purged",
G_CALLBACK (reset_texture), self, G_CONNECT_SWAPPED);
create_damage (self);
g_signal_connect_object (priv->window, "notify::decorated",
g_signal_connect_object (self->window, "notify::decorated",
G_CALLBACK (window_decorated_notify), self, 0);
priv->unredirected = FALSE;
self->unredirected = FALSE;
sync_unredirected (self);
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
@ -468,15 +452,14 @@ void
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
int width, int height)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->last_width == width &&
priv->last_height == height)
if (self->last_width == width &&
self->last_height == height)
return;
priv->size_changed = TRUE;
priv->last_width = width;
priv->last_height = height;
self->size_changed = TRUE;
self->last_width = width;
self->last_height = height;
meta_shaped_texture_set_fallback_size (stex, width, height);
}

View File

@ -36,27 +36,11 @@
G_BEGIN_DECLS
#define META_TYPE_SURFACE_ACTOR_X11 (meta_surface_actor_x11_get_type ())
#define META_SURFACE_ACTOR_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11))
#define META_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11Class))
#define META_IS_SURFACE_ACTOR_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_X11))
#define META_IS_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_X11))
#define META_SURFACE_ACTOR_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11Class))
typedef struct _MetaSurfaceActorX11 MetaSurfaceActorX11;
typedef struct _MetaSurfaceActorX11Class MetaSurfaceActorX11Class;
struct _MetaSurfaceActorX11
{
MetaSurfaceActor parent;
};
struct _MetaSurfaceActorX11Class
{
MetaSurfaceActorClass parent_class;
};
GType meta_surface_actor_x11_get_type (void);
#define META_TYPE_SURFACE_ACTOR_X11 (meta_surface_actor_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaSurfaceActorX11,
meta_surface_actor_x11,
META, SURFACE_ACTOR_X11,
MetaSurfaceActor)
MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window);

View File

@ -18,7 +18,7 @@
#include "compositor/meta-shaped-texture-private.h"
#include "meta/meta-shaped-texture.h"
struct _MetaSurfaceActorPrivate
typedef struct _MetaSurfaceActorPrivate
{
MetaShapedTexture *texture;
@ -27,7 +27,7 @@ struct _MetaSurfaceActorPrivate
/* Freeze/thaw accounting */
cairo_region_t *pending_damage;
guint frozen : 1;
};
} MetaSurfaceActorPrivate;
static void cullable_iface_init (MetaCullableInterface *iface);
@ -49,7 +49,8 @@ meta_surface_actor_pick (ClutterActor *actor,
const ClutterColor *color)
{
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
ClutterActorIter iter;
ClutterActor *child;
@ -113,7 +114,8 @@ static void
meta_surface_actor_dispose (GObject *object)
{
MetaSurfaceActor *self = META_SURFACE_ACTOR (object);
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
g_clear_pointer (&priv->input_region, cairo_region_destroy);
@ -177,11 +179,8 @@ texture_size_changed (MetaShapedTexture *texture,
static void
meta_surface_actor_init (MetaSurfaceActor *self)
{
MetaSurfaceActorPrivate *priv;
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_SURFACE_ACTOR,
MetaSurfaceActorPrivate);
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
priv->texture = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
g_signal_connect_object (priv->texture, "size-changed",
@ -193,20 +192,27 @@ cairo_surface_t *
meta_surface_actor_get_image (MetaSurfaceActor *self,
cairo_rectangle_int_t *clip)
{
return meta_shaped_texture_get_image (self->priv->texture, clip);
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
return meta_shaped_texture_get_image (priv->texture, clip);
}
MetaShapedTexture *
meta_surface_actor_get_texture (MetaSurfaceActor *self)
{
return self->priv->texture;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
return priv->texture;
}
static void
meta_surface_actor_update_area (MetaSurfaceActor *self,
int x, int y, int width, int height)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height))
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
@ -215,7 +221,9 @@ meta_surface_actor_update_area (MetaSurfaceActor *self,
gboolean
meta_surface_actor_is_obscured (MetaSurfaceActor *self)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
return meta_shaped_texture_is_obscured (priv->texture);
}
@ -223,7 +231,8 @@ void
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
cairo_region_t *region)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
if (priv->input_region)
cairo_region_destroy (priv->input_region);
@ -238,21 +247,27 @@ void
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
cairo_region_t *region)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
meta_shaped_texture_set_opaque_region (priv->texture, region);
}
cairo_region_t *
meta_surface_actor_get_opaque_region (MetaSurfaceActor *actor)
meta_surface_actor_get_opaque_region (MetaSurfaceActor *self)
{
MetaSurfaceActorPrivate *priv = actor->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
return meta_shaped_texture_get_opaque_region (priv->texture);
}
static gboolean
is_frozen (MetaSurfaceActor *self)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
return priv->frozen;
}
@ -260,7 +275,8 @@ void
meta_surface_actor_process_damage (MetaSurfaceActor *self,
int x, int y, int width, int height)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
if (is_frozen (self))
{
@ -339,7 +355,8 @@ void
meta_surface_actor_set_frozen (MetaSurfaceActor *self,
gboolean frozen)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
priv->frozen = frozen;
@ -390,7 +407,8 @@ void
meta_surface_actor_set_transform (MetaSurfaceActor *self,
MetaMonitorTransform transform)
{
MetaSurfaceActorPrivate *priv = self->priv;
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
meta_shaped_texture_set_transform (priv->texture, transform);
}

View File

@ -11,16 +11,11 @@
G_BEGIN_DECLS
#define META_TYPE_SURFACE_ACTOR (meta_surface_actor_get_type())
#define META_SURFACE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SURFACE_ACTOR, MetaSurfaceActor))
#define META_SURFACE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR, MetaSurfaceActorClass))
#define META_IS_SURFACE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR))
#define META_IS_SURFACE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR))
#define META_SURFACE_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SURFACE_ACTOR, MetaSurfaceActorClass))
typedef struct _MetaSurfaceActor MetaSurfaceActor;
typedef struct _MetaSurfaceActorClass MetaSurfaceActorClass;
typedef struct _MetaSurfaceActorPrivate MetaSurfaceActorPrivate;
#define META_TYPE_SURFACE_ACTOR (meta_surface_actor_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaSurfaceActor,
meta_surface_actor,
META, SURFACE_ACTOR,
ClutterActor)
struct _MetaSurfaceActorClass
{
@ -40,15 +35,6 @@ struct _MetaSurfaceActorClass
MetaWindow *(* get_window) (MetaSurfaceActor *actor);
};
struct _MetaSurfaceActor
{
ClutterActor parent;
MetaSurfaceActorPrivate *priv;
};
GType meta_surface_actor_get_type (void);
cairo_surface_t *meta_surface_actor_get_image (MetaSurfaceActor *self,
cairo_rectangle_int_t *clip);

File diff suppressed because it is too large Load Diff

View File

@ -34,31 +34,12 @@
* the background that are obscured by other windows.
*/
#define META_TYPE_BACKGROUND_ACTOR (meta_background_actor_get_type ())
#define META_BACKGROUND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActor))
#define META_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
#define META_IS_BACKGROUND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_ACTOR))
#define META_IS_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_ACTOR))
#define META_BACKGROUND_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
#define META_TYPE_BACKGROUND_ACTOR (meta_background_actor_get_type ())
G_DECLARE_FINAL_TYPE (MetaBackgroundActor,
meta_background_actor,
META, BACKGROUND_ACTOR,
ClutterActor)
typedef struct _MetaBackgroundActor MetaBackgroundActor;
typedef struct _MetaBackgroundActorClass MetaBackgroundActorClass;
typedef struct _MetaBackgroundActorPrivate MetaBackgroundActorPrivate;
struct _MetaBackgroundActorClass
{
/*< private >*/
ClutterActorClass parent_class;
};
struct _MetaBackgroundActor
{
ClutterActor parent;
MetaBackgroundActorPrivate *priv;
};
GType meta_background_actor_get_type (void);
ClutterActor *meta_background_actor_new (MetaDisplay *display,
int monitor);

View File

@ -5,32 +5,11 @@
#include "clutter/clutter.h"
#define META_TYPE_BACKGROUND_GROUP (meta_background_group_get_type ())
#define META_BACKGROUND_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_GROUP, MetaBackgroundGroup))
#define META_BACKGROUND_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_GROUP, MetaBackgroundGroupClass))
#define META_IS_BACKGROUND_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_GROUP))
#define META_IS_BACKGROUND_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_GROUP))
#define META_BACKGROUND_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_GROUP, MetaBackgroundGroupClass))
typedef struct _MetaBackgroundGroup MetaBackgroundGroup;
typedef struct _MetaBackgroundGroupClass MetaBackgroundGroupClass;
typedef struct _MetaBackgroundGroupPrivate MetaBackgroundGroupPrivate;
struct _MetaBackgroundGroupClass
{
/*< private >*/
ClutterActorClass parent_class;
};
struct _MetaBackgroundGroup
{
/*< private >*/
ClutterActor parent;
MetaBackgroundGroupPrivate *priv;
};
GType meta_background_group_get_type (void);
#define META_TYPE_BACKGROUND_GROUP (meta_background_group_get_type ())
G_DECLARE_FINAL_TYPE (MetaBackgroundGroup,
meta_background_group,
META, BACKGROUND_GROUP,
ClutterActor)
ClutterActor *meta_background_group_new (void);

View File

@ -29,48 +29,25 @@
#include "cogl/cogl.h"
#include "meta/display.h"
#define META_TYPE_BACKGROUND_IMAGE (meta_background_image_get_type ())
#define META_BACKGROUND_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImage))
#define META_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImageClass))
#define META_IS_BACKGROUND_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_IMAGE))
#define META_IS_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_IMAGE))
#define META_BACKGROUND_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImageClass))
/**
* MetaBackgroundImage:
*
* #MetaBackgroundImage is an object that represents a loaded or loading background image.
*/
typedef struct _MetaBackgroundImage MetaBackgroundImage;
typedef struct _MetaBackgroundImageClass MetaBackgroundImageClass;
GType meta_background_image_get_type (void);
#define META_TYPE_BACKGROUND_IMAGE (meta_background_image_get_type ())
G_DECLARE_FINAL_TYPE (MetaBackgroundImage,
meta_background_image,
META, BACKGROUND_IMAGE,
GObject)
gboolean meta_background_image_is_loaded (MetaBackgroundImage *image);
gboolean meta_background_image_get_success (MetaBackgroundImage *image);
CoglTexture *meta_background_image_get_texture (MetaBackgroundImage *image);
#define META_TYPE_BACKGROUND_IMAGE_CACHE (meta_background_image_cache_get_type ())
#define META_BACKGROUND_IMAGE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCache))
#define META_BACKGROUND_IMAGE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCacheClass))
#define META_IS_BACKGROUND_IMAGE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE))
#define META_IS_BACKGROUND_IMAGE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_IMAGE_CACHE))
#define META_BACKGROUND_IMAGE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_IMAGE_CACHE, MetaBackgroundImageCacheClass))
/**
* MetaBackgroundImageCache:
*
* #MetaBackgroundImageCache caches loading of textures for backgrounds; there's actually
* nothing background specific about it, other than it is tuned to work well for
* large images as typically are used for backgrounds.
*/
typedef struct _MetaBackgroundImageCache MetaBackgroundImageCache;
typedef struct _MetaBackgroundImageCacheClass MetaBackgroundImageCacheClass;
#define META_TYPE_BACKGROUND_IMAGE_CACHE (meta_background_image_cache_get_type ())
G_DECLARE_FINAL_TYPE (MetaBackgroundImageCache,
meta_background_image_cache,
META, BACKGROUND_IMAGE_CACHE,
GObject)
MetaBackgroundImageCache *meta_background_image_cache_get_default (void);
GType meta_background_image_cache_get_type (void);
MetaBackgroundImage *meta_background_image_cache_load (MetaBackgroundImageCache *cache,
GFile *file);
void meta_background_image_cache_purge (MetaBackgroundImageCache *cache,

View File

@ -34,34 +34,15 @@
* the background that are obscured by other windows.
*/
#define META_TYPE_BACKGROUND (meta_background_get_type ())
#define META_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND, MetaBackground))
#define META_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND, MetaBackgroundClass))
#define META_IS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND))
#define META_IS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND))
#define META_BACKGROUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND, MetaBackgroundClass))
#define META_TYPE_BACKGROUND (meta_background_get_type ())
G_DECLARE_FINAL_TYPE (MetaBackground,
meta_background,
META, BACKGROUND,
GObject)
typedef struct _MetaBackground MetaBackground;
typedef struct _MetaBackgroundClass MetaBackgroundClass;
typedef struct _MetaBackgroundPrivate MetaBackgroundPrivate;
struct _MetaBackgroundClass
{
/*< private >*/
GObjectClass parent_class;
};
struct _MetaBackground
{
GObject parent;
MetaBackgroundPrivate *priv;
};
void meta_background_refresh_all (void);
GType meta_background_get_type (void);
MetaBackground *meta_background_new (MetaDisplay *display);
void meta_background_set_color (MetaBackground *self,

View File

@ -29,16 +29,12 @@
#include "meta/types.h"
#include "meta/workspace.h"
#define META_TYPE_CURSOR_TRACKER (meta_cursor_tracker_get_type ())
#define META_CURSOR_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_CURSOR_TRACKER, MetaCursorTracker))
#define META_CURSOR_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_CURSOR_TRACKER, MetaCursorTrackerClass))
#define META_IS_CURSOR_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_CURSOR_TRACKER))
#define META_IS_CURSOR_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_CURSOR_TRACKER))
#define META_CURSOR_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_CURSOR_TRACKER, MetaCursorTrackerClass))
#define META_TYPE_CURSOR_TRACKER (meta_cursor_tracker_get_type ())
G_DECLARE_FINAL_TYPE (MetaCursorTracker,
meta_cursor_tracker,
META, CURSOR_TRACKER,
GObject)
typedef struct _MetaCursorTrackerClass MetaCursorTrackerClass;
GType meta_cursor_tracker_get_type (void);
MetaCursorTracker *meta_cursor_tracker_get_for_display (MetaDisplay *display);

View File

@ -57,12 +57,11 @@ struct _MetaShadowParams
guint8 opacity;
};
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
#define META_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactory))
#define META_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
#define META_IS_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHADOW_FACTORY))
#define META_IS_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHADOW_FACTORY))
#define META_SHADOW_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
G_DECLARE_FINAL_TYPE (MetaShadowFactory,
meta_shadow_factory,
META, SHADOW_FACTORY,
GObject)
/**
* MetaShadowFactory:
@ -71,13 +70,9 @@ struct _MetaShadowParams
* so that multiple shadows created for the same shape with the same radius will
* share the same MetaShadow.
*/
typedef struct _MetaShadowFactory MetaShadowFactory;
typedef struct _MetaShadowFactoryClass MetaShadowFactoryClass;
MetaShadowFactory *meta_shadow_factory_get_default (void);
GType meta_shadow_factory_get_type (void);
void meta_shadow_factory_set_params (MetaShadowFactory *factory,
const char *class_name,
gboolean focused,

View File

@ -30,38 +30,12 @@
G_BEGIN_DECLS
#define META_TYPE_SHAPED_TEXTURE (meta_shaped_texture_get_type())
#define META_SHAPED_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),META_TYPE_SHAPED_TEXTURE, MetaShapedTexture))
#define META_SHAPED_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHAPED_TEXTURE, MetaShapedTextureClass))
#define META_IS_SHAPED_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHAPED_TEXTURE))
#define META_IS_SHAPED_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHAPED_TEXTURE))
#define META_SHAPED_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHAPED_TEXTURE, MetaShapedTextureClass))
#define META_TYPE_SHAPED_TEXTURE (meta_shaped_texture_get_type ())
G_DECLARE_FINAL_TYPE (MetaShapedTexture,
meta_shaped_texture,
META, SHAPED_TEXTURE,
ClutterActor)
typedef struct _MetaShapedTexture MetaShapedTexture;
typedef struct _MetaShapedTextureClass MetaShapedTextureClass;
typedef struct _MetaShapedTexturePrivate MetaShapedTexturePrivate;
struct _MetaShapedTextureClass
{
/*< private >*/
ClutterActorClass parent_class;
};
/**
* MetaShapedTexture:
*
* The <structname>MetaShapedTexture</structname> structure contains
* only private data and should be accessed using the provided API
*/
struct _MetaShapedTexture
{
/*< private >*/
ClutterActor parent;
MetaShapedTexturePrivate *priv;
};
GType meta_shaped_texture_get_type (void) G_GNUC_CONST;
void meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
gboolean create_mipmaps);

View File

@ -28,34 +28,12 @@
#include "clutter/clutter.h"
#include "meta/compositor.h"
/*
* MetaWindowActor object (ClutterGroup sub-class)
*/
#define META_TYPE_WINDOW_ACTOR (meta_window_actor_get_type ())
#define META_WINDOW_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_WINDOW_ACTOR, MetaWindowActor))
#define META_WINDOW_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_WINDOW_ACTOR, MetaWindowActorClass))
#define META_IS_WINDOW_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_WINDOW_ACTOR))
#define META_IS_WINDOW_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_WINDOW_ACTOR))
#define META_WINDOW_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_WINDOW_ACTOR, MetaWindowActorClass))
#define META_TYPE_WINDOW_ACTOR (meta_window_actor_get_type ())
G_DECLARE_FINAL_TYPE (MetaWindowActor,
meta_window_actor,
META, WINDOW_ACTOR,
ClutterActor)
typedef struct _MetaWindowActor MetaWindowActor;
typedef struct _MetaWindowActorClass MetaWindowActorClass;
typedef struct _MetaWindowActorPrivate MetaWindowActorPrivate;
struct _MetaWindowActorClass
{
/*< private >*/
ClutterActorClass parent_class;
};
struct _MetaWindowActor
{
ClutterActor parent;
MetaWindowActorPrivate *priv;
};
GType meta_window_actor_get_type (void);
Window meta_window_actor_get_x_window (MetaWindowActor *self);
MetaWindow * meta_window_actor_get_meta_window (MetaWindowActor *self);

View File

@ -6,6 +6,9 @@
#include "clutter/clutter.h"
#define META_TYPE_WINDOW_GROUP (meta_window_group_get_type())
G_DECLARE_FINAL_TYPE (MetaWindowGroup, meta_window_group, META, WINDOW_GROUP, ClutterActor)
G_DECLARE_FINAL_TYPE (MetaWindowGroup,
meta_window_group,
META, WINDOW_GROUP,
ClutterActor)
#endif /* META_WINDOW_GROUP_H */

View File

@ -30,7 +30,10 @@
#include <meta/types.h>
#define META_TYPE_WORKSPACE_MANAGER (meta_workspace_manager_get_type ())
G_DECLARE_FINAL_TYPE (MetaWorkspaceManager, meta_workspace_manager, META, WORKSPACE_MANAGER, GObject)
G_DECLARE_FINAL_TYPE (MetaWorkspaceManager,
meta_workspace_manager,
META, WORKSPACE_MANAGER,
GObject)
GList *meta_workspace_manager_get_workspaces (MetaWorkspaceManager *workspace_manager);