mirror of
https://github.com/brl/mutter.git
synced 2025-02-17 21:54:10 +00:00
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:
parent
7759adf8e9
commit
d539fe28d5
@ -32,19 +32,10 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_BARRIER_IMPL (meta_barrier_impl_get_type ())
|
#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))
|
G_DECLARE_DERIVABLE_TYPE (MetaBarrierImpl,
|
||||||
#define META_BARRIER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL, MetaBarrierImplClass))
|
meta_barrier_impl,
|
||||||
#define META_IS_BARRIER_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL))
|
META, BARRIER_IMPL,
|
||||||
#define META_IS_BARRIER_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL))
|
GObject)
|
||||||
#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;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _MetaBarrierImplClass
|
struct _MetaBarrierImplClass
|
||||||
{
|
{
|
||||||
@ -56,8 +47,6 @@ struct _MetaBarrierImplClass
|
|||||||
void (*destroy) (MetaBarrierImpl *barrier);
|
void (*destroy) (MetaBarrierImpl *barrier);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType meta_barrier_impl_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
void _meta_barrier_emit_hit_signal (MetaBarrier *barrier,
|
void _meta_barrier_emit_hit_signal (MetaBarrier *barrier,
|
||||||
MetaBarrierEvent *event);
|
MetaBarrierEvent *event);
|
||||||
void _meta_barrier_emit_left_signal (MetaBarrier *barrier,
|
void _meta_barrier_emit_left_signal (MetaBarrier *barrier,
|
||||||
|
@ -49,10 +49,6 @@ struct _MetaCursorTracker {
|
|||||||
MetaCursorSpriteXfixes *xfixes_cursor;
|
MetaCursorSpriteXfixes *xfixes_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaCursorTrackerClass {
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||||
XEvent *xevent);
|
XEvent *xevent);
|
||||||
|
|
||||||
|
@ -65,8 +65,10 @@ typedef enum {
|
|||||||
META_BARRIER_STATE_LEFT,
|
META_BARRIER_STATE_LEFT,
|
||||||
} MetaBarrierState;
|
} MetaBarrierState;
|
||||||
|
|
||||||
struct _MetaBarrierImplNativePrivate
|
struct _MetaBarrierImplNative
|
||||||
{
|
{
|
||||||
|
MetaBarrierImpl parent;
|
||||||
|
|
||||||
MetaBarrier *barrier;
|
MetaBarrier *barrier;
|
||||||
MetaBarrierManagerNative *manager;
|
MetaBarrierManagerNative *manager;
|
||||||
|
|
||||||
@ -77,7 +79,8 @@ struct _MetaBarrierImplNativePrivate
|
|||||||
MetaBarrierDirection blocked_dir;
|
MetaBarrierDirection blocked_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplNative, meta_barrier_impl_native,
|
G_DEFINE_TYPE (MetaBarrierImplNative,
|
||||||
|
meta_barrier_impl_native,
|
||||||
META_TYPE_BARRIER_IMPL)
|
META_TYPE_BARRIER_IMPL)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -111,10 +114,7 @@ is_barrier_blocking_directions (MetaBarrier *barrier,
|
|||||||
static void
|
static void
|
||||||
dismiss_pointer (MetaBarrierImplNative *self)
|
dismiss_pointer (MetaBarrierImplNative *self)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNativePrivate *priv =
|
self->state = META_BARRIER_STATE_LEFT;
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
|
|
||||||
priv->state = META_BARRIER_STATE_LEFT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -164,13 +164,11 @@ maybe_release_barrier (gpointer key,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = key;
|
MetaBarrierImplNative *self = key;
|
||||||
MetaBarrierImplNativePrivate *priv =
|
MetaBarrier *barrier = self->barrier;
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
MetaBarrier *barrier = priv->barrier;
|
|
||||||
MetaLine2 *motion = user_data;
|
MetaLine2 *motion = user_data;
|
||||||
MetaLine2 hit_box;
|
MetaLine2 hit_box;
|
||||||
|
|
||||||
if (priv->state != META_BARRIER_STATE_HELD)
|
if (self->state != META_BARRIER_STATE_HELD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Release if we end up outside barrier end points. */
|
/* Release if we end up outside barrier end points. */
|
||||||
@ -250,9 +248,7 @@ update_closest_barrier (gpointer key,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = key;
|
MetaBarrierImplNative *self = key;
|
||||||
MetaBarrierImplNativePrivate *priv =
|
MetaBarrier *barrier = self->barrier;
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
MetaBarrier *barrier = priv->barrier;
|
|
||||||
MetaClosestBarrierData *data = user_data;
|
MetaClosestBarrierData *data = user_data;
|
||||||
MetaVector2 intersection;
|
MetaVector2 intersection;
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
@ -263,12 +259,12 @@ update_closest_barrier (gpointer key,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Ignore if the barrier released the pointer. */
|
/* Ignore if the barrier released the pointer. */
|
||||||
if (priv->state == META_BARRIER_STATE_RELEASE)
|
if (self->state == META_BARRIER_STATE_RELEASE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Ignore if we are moving away from barrier. */
|
/* Ignore if we are moving away from barrier. */
|
||||||
if (priv->state == META_BARRIER_STATE_HELD &&
|
if (self->state == META_BARRIER_STATE_HELD &&
|
||||||
(data->in.directions & priv->blocked_dir) == 0)
|
(data->in.directions & self->blocked_dir) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if the motion intersects with the barrier, and retrieve the
|
/* Check if the motion intersects with the barrier, and retrieve the
|
||||||
@ -354,27 +350,25 @@ emit_barrier_event (MetaBarrierImplNative *self,
|
|||||||
float dx,
|
float dx,
|
||||||
float dy)
|
float dy)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNativePrivate *priv =
|
MetaBarrier *barrier = self->barrier;
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
MetaBarrier *barrier = priv->barrier;
|
|
||||||
MetaBarrierEvent *event = g_slice_new0 (MetaBarrierEvent);
|
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:
|
case META_BARRIER_STATE_HIT:
|
||||||
priv->state = META_BARRIER_STATE_HELD;
|
self->state = META_BARRIER_STATE_HELD;
|
||||||
priv->trigger_serial = next_serial ();
|
self->trigger_serial = next_serial ();
|
||||||
event->dt = 0;
|
event->dt = 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case META_BARRIER_STATE_RELEASE:
|
case META_BARRIER_STATE_RELEASE:
|
||||||
case META_BARRIER_STATE_LEFT:
|
case META_BARRIER_STATE_LEFT:
|
||||||
priv->state = META_BARRIER_STATE_ACTIVE;
|
self->state = META_BARRIER_STATE_ACTIVE;
|
||||||
|
|
||||||
/* Intentional fall-through. */
|
/* Intentional fall-through. */
|
||||||
case META_BARRIER_STATE_HELD:
|
case META_BARRIER_STATE_HELD:
|
||||||
event->dt = time - priv->last_event_time;
|
event->dt = time - self->last_event_time;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case META_BARRIER_STATE_ACTIVE:
|
case META_BARRIER_STATE_ACTIVE:
|
||||||
@ -382,7 +376,7 @@ emit_barrier_event (MetaBarrierImplNative *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
event->ref_count = 1;
|
event->ref_count = 1;
|
||||||
event->event_id = priv->trigger_serial;
|
event->event_id = self->trigger_serial;
|
||||||
event->time = time;
|
event->time = time;
|
||||||
|
|
||||||
event->x = x;
|
event->x = x;
|
||||||
@ -390,12 +384,12 @@ emit_barrier_event (MetaBarrierImplNative *self,
|
|||||||
event->dx = dx;
|
event->dx = dx;
|
||||||
event->dy = dy;
|
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;
|
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);
|
_meta_barrier_emit_hit_signal (barrier, event);
|
||||||
else
|
else
|
||||||
_meta_barrier_emit_left_signal (barrier, event);
|
_meta_barrier_emit_left_signal (barrier, event);
|
||||||
@ -407,11 +401,10 @@ static void
|
|||||||
maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data)
|
maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = key;
|
MetaBarrierImplNative *self = key;
|
||||||
MetaBarrierImplNativePrivate *priv =
|
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
MetaBarrierEventData *data = user_data;
|
MetaBarrierEventData *data = user_data;
|
||||||
|
|
||||||
switch (priv->state) {
|
switch (self->state)
|
||||||
|
{
|
||||||
case META_BARRIER_STATE_ACTIVE:
|
case META_BARRIER_STATE_ACTIVE:
|
||||||
break;
|
break;
|
||||||
case META_BARRIER_STATE_HIT:
|
case META_BARRIER_STATE_HIT:
|
||||||
@ -437,9 +430,7 @@ clamp_to_barrier (MetaBarrierImplNative *self,
|
|||||||
float *x,
|
float *x,
|
||||||
float *y)
|
float *y)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNativePrivate *priv =
|
MetaBarrier *barrier = self->barrier;
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
MetaBarrier *barrier = priv->barrier;
|
|
||||||
|
|
||||||
if (is_barrier_horizontal (barrier))
|
if (is_barrier_horizontal (barrier))
|
||||||
{
|
{
|
||||||
@ -448,7 +439,7 @@ clamp_to_barrier (MetaBarrierImplNative *self,
|
|||||||
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_Y)
|
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_Y)
|
||||||
*y = barrier->priv->border.line.a.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);
|
META_BARRIER_DIRECTION_NEGATIVE_Y);
|
||||||
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_Y |
|
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_Y |
|
||||||
META_BARRIER_DIRECTION_NEGATIVE_Y);
|
META_BARRIER_DIRECTION_NEGATIVE_Y);
|
||||||
@ -460,13 +451,13 @@ clamp_to_barrier (MetaBarrierImplNative *self,
|
|||||||
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_X)
|
else if (*motion_dir & META_BARRIER_DIRECTION_NEGATIVE_X)
|
||||||
*x = barrier->priv->border.line.a.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);
|
META_BARRIER_DIRECTION_NEGATIVE_X);
|
||||||
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_X |
|
*motion_dir &= ~(META_BARRIER_DIRECTION_POSITIVE_X |
|
||||||
META_BARRIER_DIRECTION_NEGATIVE_X);
|
META_BARRIER_DIRECTION_NEGATIVE_X);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->state = META_BARRIER_STATE_HIT;
|
self->state = META_BARRIER_STATE_HIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -538,10 +529,8 @@ static gboolean
|
|||||||
_meta_barrier_impl_native_is_active (MetaBarrierImpl *impl)
|
_meta_barrier_impl_native_is_active (MetaBarrierImpl *impl)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (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
|
static void
|
||||||
@ -549,42 +538,36 @@ _meta_barrier_impl_native_release (MetaBarrierImpl *impl,
|
|||||||
MetaBarrierEvent *event)
|
MetaBarrierEvent *event)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
|
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (impl);
|
||||||
MetaBarrierImplNativePrivate *priv =
|
|
||||||
meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
|
|
||||||
if (priv->state == META_BARRIER_STATE_HELD &&
|
if (self->state == META_BARRIER_STATE_HELD &&
|
||||||
event->event_id == priv->trigger_serial)
|
event->event_id == self->trigger_serial)
|
||||||
priv->state = META_BARRIER_STATE_RELEASE;
|
self->state = META_BARRIER_STATE_RELEASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_meta_barrier_impl_native_destroy (MetaBarrierImpl *impl)
|
_meta_barrier_impl_native_destroy (MetaBarrierImpl *impl)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self = META_BARRIER_IMPL_NATIVE (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);
|
g_hash_table_remove (self->manager->barriers, self);
|
||||||
priv->is_active = FALSE;
|
self->is_active = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaBarrierImpl *
|
MetaBarrierImpl *
|
||||||
meta_barrier_impl_native_new (MetaBarrier *barrier)
|
meta_barrier_impl_native_new (MetaBarrier *barrier)
|
||||||
{
|
{
|
||||||
MetaBarrierImplNative *self;
|
MetaBarrierImplNative *self;
|
||||||
MetaBarrierImplNativePrivate *priv;
|
|
||||||
MetaBackendNative *native;
|
MetaBackendNative *native;
|
||||||
MetaBarrierManagerNative *manager;
|
MetaBarrierManagerNative *manager;
|
||||||
|
|
||||||
self = g_object_new (META_TYPE_BARRIER_IMPL_NATIVE, NULL);
|
self = g_object_new (META_TYPE_BARRIER_IMPL_NATIVE, NULL);
|
||||||
priv = meta_barrier_impl_native_get_instance_private (self);
|
|
||||||
|
|
||||||
priv->barrier = barrier;
|
self->barrier = barrier;
|
||||||
priv->is_active = TRUE;
|
self->is_active = TRUE;
|
||||||
|
|
||||||
native = META_BACKEND_NATIVE (meta_get_backend ());
|
native = META_BACKEND_NATIVE (meta_get_backend ());
|
||||||
manager = meta_backend_native_get_barrier_manager (native);
|
manager = meta_backend_native_get_barrier_manager (native);
|
||||||
priv->manager = manager;
|
self->manager = manager;
|
||||||
g_hash_table_add (manager->barriers, self);
|
g_hash_table_add (manager->barriers, self);
|
||||||
|
|
||||||
return META_BARRIER_IMPL (self);
|
return META_BARRIER_IMPL (self);
|
||||||
|
@ -30,29 +30,13 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_BARRIER_IMPL_NATIVE (meta_barrier_impl_native_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaBarrierImplNative,
|
||||||
#define META_BARRIER_IMPL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL_NATIVE, MetaBarrierImplNativeClass))
|
meta_barrier_impl_native,
|
||||||
#define META_IS_BARRIER_IMPL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL_NATIVE))
|
META, BARRIER_IMPL_NATIVE,
|
||||||
#define META_IS_BARRIER_IMPL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL_NATIVE))
|
MetaBarrierImpl)
|
||||||
#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;
|
|
||||||
|
|
||||||
typedef struct _MetaBarrierManagerNative MetaBarrierManagerNative;
|
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);
|
MetaBarrierImpl *meta_barrier_impl_native_new (MetaBarrier *barrier);
|
||||||
|
|
||||||
|
@ -40,23 +40,24 @@
|
|||||||
#include "meta/barrier.h"
|
#include "meta/barrier.h"
|
||||||
#include "x11/meta-x11-display-private.h"
|
#include "x11/meta-x11-display-private.h"
|
||||||
|
|
||||||
struct _MetaBarrierImplX11Private
|
struct _MetaBarrierImplX11
|
||||||
{
|
{
|
||||||
|
MetaBarrierImpl parent;
|
||||||
|
|
||||||
MetaBarrier *barrier;
|
MetaBarrier *barrier;
|
||||||
PointerBarrier xbarrier;
|
PointerBarrier xbarrier;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplX11, meta_barrier_impl_x11,
|
G_DEFINE_TYPE (MetaBarrierImplX11,
|
||||||
|
meta_barrier_impl_x11,
|
||||||
META_TYPE_BARRIER_IMPL)
|
META_TYPE_BARRIER_IMPL)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_meta_barrier_impl_x11_is_active (MetaBarrierImpl *impl)
|
_meta_barrier_impl_x11_is_active (MetaBarrierImpl *impl)
|
||||||
{
|
{
|
||||||
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (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
|
static void
|
||||||
@ -64,16 +65,14 @@ _meta_barrier_impl_x11_release (MetaBarrierImpl *impl,
|
|||||||
MetaBarrierEvent *event)
|
MetaBarrierEvent *event)
|
||||||
{
|
{
|
||||||
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
|
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
|
||||||
MetaBarrierImplX11Private *priv =
|
MetaDisplay *display = self->barrier->priv->display;
|
||||||
meta_barrier_impl_x11_get_instance_private (self);
|
|
||||||
MetaDisplay *display = priv->barrier->priv->display;
|
|
||||||
Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
if (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display))
|
if (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display))
|
||||||
{
|
{
|
||||||
XIBarrierReleasePointer (dpy,
|
XIBarrierReleasePointer (dpy,
|
||||||
META_VIRTUAL_CORE_POINTER_ID,
|
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)
|
_meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
|
||||||
{
|
{
|
||||||
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
|
MetaBarrierImplX11 *self = META_BARRIER_IMPL_X11 (impl);
|
||||||
MetaBarrierImplX11Private *priv =
|
MetaDisplay *display = self->barrier->priv->display;
|
||||||
meta_barrier_impl_x11_get_instance_private (self);
|
|
||||||
MetaDisplay *display = priv->barrier->priv->display;
|
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
if (display == NULL)
|
if (display == NULL)
|
||||||
@ -91,19 +88,18 @@ _meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
|
|||||||
|
|
||||||
dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
if (!meta_barrier_is_active (priv->barrier))
|
if (!meta_barrier_is_active (self->barrier))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XFixesDestroyPointerBarrier (dpy, priv->xbarrier);
|
XFixesDestroyPointerBarrier (dpy, self->xbarrier);
|
||||||
g_hash_table_remove (display->x11_display->xids, &priv->xbarrier);
|
g_hash_table_remove (display->x11_display->xids, &self->xbarrier);
|
||||||
priv->xbarrier = 0;
|
self->xbarrier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaBarrierImpl *
|
MetaBarrierImpl *
|
||||||
meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
||||||
{
|
{
|
||||||
MetaBarrierImplX11 *self;
|
MetaBarrierImplX11 *self;
|
||||||
MetaBarrierImplX11Private *priv;
|
|
||||||
MetaDisplay *display = barrier->priv->display;
|
MetaDisplay *display = barrier->priv->display;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Window root;
|
Window root;
|
||||||
@ -116,15 +112,14 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
|||||||
}
|
}
|
||||||
|
|
||||||
self = g_object_new (META_TYPE_BARRIER_IMPL_X11, NULL);
|
self = g_object_new (META_TYPE_BARRIER_IMPL_X11, NULL);
|
||||||
priv = meta_barrier_impl_x11_get_instance_private (self);
|
self->barrier = barrier;
|
||||||
priv->barrier = barrier;
|
|
||||||
|
|
||||||
dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
dpy = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
root = DefaultRootWindow (dpy);
|
root = DefaultRootWindow (dpy);
|
||||||
|
|
||||||
allowed_motion_dirs =
|
allowed_motion_dirs =
|
||||||
meta_border_get_allows_directions (&barrier->priv->border);
|
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.x,
|
||||||
barrier->priv->border.line.a.y,
|
barrier->priv->border.line.a.y,
|
||||||
barrier->priv->border.line.b.x,
|
barrier->priv->border.line.b.x,
|
||||||
@ -132,7 +127,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
|
|||||||
allowed_motion_dirs,
|
allowed_motion_dirs,
|
||||||
0, NULL);
|
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);
|
return META_BARRIER_IMPL (self);
|
||||||
}
|
}
|
||||||
|
@ -30,27 +30,10 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_BARRIER_IMPL_X11 (meta_barrier_impl_x11_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaBarrierImplX11,
|
||||||
#define META_BARRIER_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BARRIER_IMPL_X11, MetaBarrierImplX11Class))
|
meta_barrier_impl_x11,
|
||||||
#define META_IS_BARRIER_IMPL_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BARRIER_IMPL_X11))
|
META, BARRIER_IMPL_X11,
|
||||||
#define META_IS_BARRIER_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BARRIER_IMPL_X11))
|
MetaBarrierImpl)
|
||||||
#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;
|
|
||||||
|
|
||||||
MetaBarrierImpl *meta_barrier_impl_x11_new (MetaBarrier *barrier);
|
MetaBarrierImpl *meta_barrier_impl_x11_new (MetaBarrier *barrier);
|
||||||
|
|
||||||
|
@ -153,8 +153,10 @@ typedef enum {
|
|||||||
PIPELINE_GRADIENT = (1 << 2),
|
PIPELINE_GRADIENT = (1 << 2),
|
||||||
} PipelineFlags;
|
} PipelineFlags;
|
||||||
|
|
||||||
struct _MetaBackgroundActorPrivate
|
struct _MetaBackgroundActor
|
||||||
{
|
{
|
||||||
|
ClutterActor parent;
|
||||||
|
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
int monitor;
|
int monitor;
|
||||||
|
|
||||||
@ -180,32 +182,28 @@ struct _MetaBackgroundActorPrivate
|
|||||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR,
|
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));
|
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_region (MetaBackgroundActor *self,
|
set_clip_region (MetaBackgroundActor *self,
|
||||||
cairo_region_t *clip_region)
|
cairo_region_t *clip_region)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
g_clear_pointer (&self->clip_region, cairo_region_destroy);
|
||||||
|
|
||||||
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
|
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
priv->clip_region = cairo_region_copy (clip_region);
|
self->clip_region = cairo_region_copy (clip_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_background_actor_dispose (GObject *object)
|
meta_background_actor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
set_clip_region (self, NULL);
|
set_clip_region (self, NULL);
|
||||||
meta_background_actor_set_background (self, NULL);
|
meta_background_actor_set_background (self, NULL);
|
||||||
if (priv->pipeline)
|
if (self->pipeline)
|
||||||
{
|
{
|
||||||
cogl_object_unref (priv->pipeline);
|
cogl_object_unref (self->pipeline);
|
||||||
priv->pipeline = NULL;
|
self->pipeline = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
|
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
|
||||||
@ -216,11 +214,10 @@ get_preferred_size (MetaBackgroundActor *self,
|
|||||||
gfloat *width,
|
gfloat *width,
|
||||||
gfloat *height)
|
gfloat *height)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (self)->priv;
|
|
||||||
MetaRectangle monitor_geometry;
|
MetaRectangle monitor_geometry;
|
||||||
|
|
||||||
meta_display_get_monitor_geometry (priv->display,
|
meta_display_get_monitor_geometry (self->display,
|
||||||
priv->monitor,
|
self->monitor,
|
||||||
&monitor_geometry);
|
&monitor_geometry);
|
||||||
|
|
||||||
if (width != NULL)
|
if (width != NULL)
|
||||||
@ -329,7 +326,6 @@ static void
|
|||||||
setup_pipeline (MetaBackgroundActor *self,
|
setup_pipeline (MetaBackgroundActor *self,
|
||||||
cairo_rectangle_int_t *actor_pixel_rect)
|
cairo_rectangle_int_t *actor_pixel_rect)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
PipelineFlags pipeline_flags = 0;
|
PipelineFlags pipeline_flags = 0;
|
||||||
guint8 opacity;
|
guint8 opacity;
|
||||||
float color_component;
|
float color_component;
|
||||||
@ -338,75 +334,75 @@ setup_pipeline (MetaBackgroundActor *self,
|
|||||||
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
|
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
|
||||||
if (opacity < 255)
|
if (opacity < 255)
|
||||||
pipeline_flags |= PIPELINE_BLEND;
|
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;
|
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;
|
pipeline_flags |= PIPELINE_GRADIENT;
|
||||||
|
|
||||||
if (priv->pipeline &&
|
if (self->pipeline &&
|
||||||
pipeline_flags != priv->pipeline_flags)
|
pipeline_flags != self->pipeline_flags)
|
||||||
{
|
{
|
||||||
cogl_object_unref (priv->pipeline);
|
cogl_object_unref (self->pipeline);
|
||||||
priv->pipeline = NULL;
|
self->pipeline = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->pipeline == NULL)
|
if (self->pipeline == NULL)
|
||||||
{
|
{
|
||||||
priv->pipeline_flags = pipeline_flags;
|
self->pipeline_flags = pipeline_flags;
|
||||||
priv->pipeline = make_pipeline (pipeline_flags);
|
self->pipeline = make_pipeline (pipeline_flags);
|
||||||
priv->changed = CHANGED_ALL;
|
self->changed = CHANGED_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((priv->changed & CHANGED_BACKGROUND) != 0)
|
if ((self->changed & CHANGED_BACKGROUND) != 0)
|
||||||
{
|
{
|
||||||
CoglPipelineWrapMode wrap_mode;
|
CoglPipelineWrapMode wrap_mode;
|
||||||
CoglTexture *texture = meta_background_get_texture (priv->background,
|
CoglTexture *texture = meta_background_get_texture (self->background,
|
||||||
priv->monitor,
|
self->monitor,
|
||||||
&priv->texture_area,
|
&self->texture_area,
|
||||||
&wrap_mode);
|
&wrap_mode);
|
||||||
priv->force_bilinear = texture &&
|
self->force_bilinear = texture &&
|
||||||
(priv->texture_area.width != (int)cogl_texture_get_width (texture) ||
|
(self->texture_area.width != (int)cogl_texture_get_width (texture) ||
|
||||||
priv->texture_area.height != (int)cogl_texture_get_height (texture));
|
self->texture_area.height != (int)cogl_texture_get_height (texture));
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
|
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
|
||||||
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0, wrap_mode);
|
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_set_uniform_1f (self->pipeline,
|
||||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||||
"vignette_sharpness"),
|
"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;
|
MetaRectangle monitor_geometry;
|
||||||
float gradient_height_perc;
|
float gradient_height_perc;
|
||||||
|
|
||||||
meta_display_get_monitor_geometry (priv->display,
|
meta_display_get_monitor_geometry (self->display,
|
||||||
priv->monitor, &monitor_geometry);
|
self->monitor, &monitor_geometry);
|
||||||
gradient_height_perc = MAX (0.0001, priv->gradient_height / (float)monitor_geometry.height);
|
gradient_height_perc = MAX (0.0001, self->gradient_height / (float)monitor_geometry.height);
|
||||||
cogl_pipeline_set_uniform_1f (priv->pipeline,
|
cogl_pipeline_set_uniform_1f (self->pipeline,
|
||||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||||
"gradient_height_perc"),
|
"gradient_height_perc"),
|
||||||
gradient_height_perc);
|
gradient_height_perc);
|
||||||
cogl_pipeline_set_uniform_1f (priv->pipeline,
|
cogl_pipeline_set_uniform_1f (self->pipeline,
|
||||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||||
"gradient_max_darkness"),
|
"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))
|
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
|
* be there if we were drawing the vignette, which is
|
||||||
* (1 - (pi/12.) * vignette_sharpness) [exercise for the reader :]
|
* (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
|
else
|
||||||
color_component = opacity / 255.;
|
color_component = opacity / 255.;
|
||||||
|
|
||||||
cogl_pipeline_set_color4f (priv->pipeline,
|
cogl_pipeline_set_color4f (self->pipeline,
|
||||||
color_component,
|
color_component,
|
||||||
color_component,
|
color_component,
|
||||||
color_component,
|
color_component,
|
||||||
opacity / 255.);
|
opacity / 255.);
|
||||||
|
|
||||||
if (!priv->force_bilinear &&
|
if (!self->force_bilinear &&
|
||||||
meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
|
meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
|
||||||
filter = COGL_PIPELINE_FILTER_NEAREST;
|
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||||
else
|
else
|
||||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
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
|
static void
|
||||||
set_glsl_parameters (MetaBackgroundActor *self,
|
set_glsl_parameters (MetaBackgroundActor *self,
|
||||||
cairo_rectangle_int_t *actor_pixel_rect)
|
cairo_rectangle_int_t *actor_pixel_rect)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
float scale[2];
|
float scale[2];
|
||||||
float offset[2];
|
float offset[2];
|
||||||
|
|
||||||
/* Compute a scale and offset for transforming texture coordinates to the
|
/* 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
|
* 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[0] = self->texture_area.width / (float)actor_pixel_rect->width;
|
||||||
scale[1] = priv->texture_area.height / (float)actor_pixel_rect->height;
|
scale[1] = self->texture_area.height / (float)actor_pixel_rect->height;
|
||||||
offset[0] = priv->texture_area.x / (float)actor_pixel_rect->width - 0.5;
|
offset[0] = self->texture_area.x / (float)actor_pixel_rect->width - 0.5;
|
||||||
offset[1] = priv->texture_area.y / (float)actor_pixel_rect->height - 0.5;
|
offset[1] = self->texture_area.y / (float)actor_pixel_rect->height - 0.5;
|
||||||
|
|
||||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||||
"scale"),
|
"scale"),
|
||||||
2, 1, scale);
|
2, 1, scale);
|
||||||
|
|
||||||
cogl_pipeline_set_uniform_float (priv->pipeline,
|
cogl_pipeline_set_uniform_float (self->pipeline,
|
||||||
cogl_pipeline_get_uniform_location (priv->pipeline,
|
cogl_pipeline_get_uniform_location (self->pipeline,
|
||||||
"offset"),
|
"offset"),
|
||||||
2, 1, offset);
|
2, 1, offset);
|
||||||
}
|
}
|
||||||
@ -497,13 +492,12 @@ static void
|
|||||||
meta_background_actor_paint (ClutterActor *actor)
|
meta_background_actor_paint (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
ClutterActorBox actor_box;
|
ClutterActorBox actor_box;
|
||||||
cairo_rectangle_int_t actor_pixel_rect;
|
cairo_rectangle_int_t actor_pixel_rect;
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
int i;
|
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;
|
return;
|
||||||
|
|
||||||
clutter_actor_get_content_box (actor, &actor_box);
|
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.
|
/* 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)
|
if (n_rects <= MAX_RECTS)
|
||||||
{
|
{
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
cairo_rectangle_int_t rect;
|
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))
|
if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
paint_clipped_rectangle (fb, priv->pipeline, &rect, &priv->texture_area);
|
paint_clipped_rectangle (fb, self->pipeline, &rect, &self->texture_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
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
|
static void
|
||||||
@ -553,12 +547,11 @@ meta_background_actor_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_META_DISPLAY:
|
case PROP_META_DISPLAY:
|
||||||
priv->display = g_value_get_object (value);
|
self->display = g_value_get_object (value);
|
||||||
break;
|
break;
|
||||||
case PROP_MONITOR:
|
case PROP_MONITOR:
|
||||||
meta_background_actor_set_monitor (self, g_value_get_int (value));
|
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:
|
case PROP_GRADIENT:
|
||||||
meta_background_actor_set_gradient (self,
|
meta_background_actor_set_gradient (self,
|
||||||
g_value_get_boolean (value),
|
g_value_get_boolean (value),
|
||||||
priv->gradient_height,
|
self->gradient_height,
|
||||||
priv->gradient_max_darkness);
|
self->gradient_max_darkness);
|
||||||
break;
|
break;
|
||||||
case PROP_GRADIENT_HEIGHT:
|
case PROP_GRADIENT_HEIGHT:
|
||||||
meta_background_actor_set_gradient (self,
|
meta_background_actor_set_gradient (self,
|
||||||
priv->gradient,
|
self->gradient,
|
||||||
g_value_get_int (value),
|
g_value_get_int (value),
|
||||||
priv->gradient_max_darkness);
|
self->gradient_max_darkness);
|
||||||
break;
|
break;
|
||||||
case PROP_GRADIENT_MAX_DARKNESS:
|
case PROP_GRADIENT_MAX_DARKNESS:
|
||||||
meta_background_actor_set_gradient (self,
|
meta_background_actor_set_gradient (self,
|
||||||
priv->gradient,
|
self->gradient,
|
||||||
priv->gradient_height,
|
self->gradient_height,
|
||||||
g_value_get_double (value));
|
g_value_get_double (value));
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE:
|
case PROP_VIGNETTE:
|
||||||
meta_background_actor_set_vignette (self,
|
meta_background_actor_set_vignette (self,
|
||||||
g_value_get_boolean (value),
|
g_value_get_boolean (value),
|
||||||
priv->vignette_brightness,
|
self->vignette_brightness,
|
||||||
priv->vignette_sharpness);
|
self->vignette_sharpness);
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE_SHARPNESS:
|
case PROP_VIGNETTE_SHARPNESS:
|
||||||
meta_background_actor_set_vignette (self,
|
meta_background_actor_set_vignette (self,
|
||||||
priv->vignette,
|
self->vignette,
|
||||||
priv->vignette_brightness,
|
self->vignette_brightness,
|
||||||
g_value_get_double (value));
|
g_value_get_double (value));
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE_BRIGHTNESS:
|
case PROP_VIGNETTE_BRIGHTNESS:
|
||||||
meta_background_actor_set_vignette (self,
|
meta_background_actor_set_vignette (self,
|
||||||
priv->vignette,
|
self->vignette,
|
||||||
g_value_get_double (value),
|
g_value_get_double (value),
|
||||||
priv->vignette_sharpness);
|
self->vignette_sharpness);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -614,36 +607,36 @@ meta_background_actor_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (object)->priv;
|
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_META_DISPLAY:
|
case PROP_META_DISPLAY:
|
||||||
g_value_set_object (value, priv->display);
|
g_value_set_object (value, self->display);
|
||||||
break;
|
break;
|
||||||
case PROP_MONITOR:
|
case PROP_MONITOR:
|
||||||
g_value_set_int (value, priv->monitor);
|
g_value_set_int (value, self->monitor);
|
||||||
break;
|
break;
|
||||||
case PROP_BACKGROUND:
|
case PROP_BACKGROUND:
|
||||||
g_value_set_object (value, priv->background);
|
g_value_set_object (value, self->background);
|
||||||
break;
|
break;
|
||||||
case PROP_GRADIENT:
|
case PROP_GRADIENT:
|
||||||
g_value_set_boolean (value, priv->gradient);
|
g_value_set_boolean (value, self->gradient);
|
||||||
break;
|
break;
|
||||||
case PROP_GRADIENT_HEIGHT:
|
case PROP_GRADIENT_HEIGHT:
|
||||||
g_value_set_int (value, priv->gradient_height);
|
g_value_set_int (value, self->gradient_height);
|
||||||
break;
|
break;
|
||||||
case PROP_GRADIENT_MAX_DARKNESS:
|
case PROP_GRADIENT_MAX_DARKNESS:
|
||||||
g_value_set_double (value, priv->gradient_max_darkness);
|
g_value_set_double (value, self->gradient_max_darkness);
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE:
|
case PROP_VIGNETTE:
|
||||||
g_value_set_boolean (value, priv->vignette);
|
g_value_set_boolean (value, self->vignette);
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE_BRIGHTNESS:
|
case PROP_VIGNETTE_BRIGHTNESS:
|
||||||
g_value_set_double (value, priv->vignette_brightness);
|
g_value_set_double (value, self->vignette_brightness);
|
||||||
break;
|
break;
|
||||||
case PROP_VIGNETTE_SHARPNESS:
|
case PROP_VIGNETTE_SHARPNESS:
|
||||||
g_value_set_double (value, priv->vignette_sharpness);
|
g_value_set_double (value, self->vignette_sharpness);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -761,19 +754,13 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
|
|||||||
static void
|
static void
|
||||||
meta_background_actor_init (MetaBackgroundActor *self)
|
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,
|
self->vignette = FALSE;
|
||||||
META_TYPE_BACKGROUND_ACTOR,
|
self->vignette_brightness = 1.0;
|
||||||
MetaBackgroundActorPrivate);
|
self->vignette_sharpness = 0.0;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -832,17 +819,14 @@ cullable_iface_init (MetaCullableInterface *iface)
|
|||||||
cairo_region_t *
|
cairo_region_t *
|
||||||
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
|
meta_background_actor_get_clip_region (MetaBackgroundActor *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
return self->clip_region;
|
||||||
return priv->clip_region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
invalidate_pipeline (MetaBackgroundActor *self,
|
invalidate_pipeline (MetaBackgroundActor *self,
|
||||||
ChangedFlags changed)
|
ChangedFlags changed)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
self->changed |= changed;
|
||||||
|
|
||||||
priv->changed |= changed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -857,29 +841,25 @@ void
|
|||||||
meta_background_actor_set_background (MetaBackgroundActor *self,
|
meta_background_actor_set_background (MetaBackgroundActor *self,
|
||||||
MetaBackground *background)
|
MetaBackground *background)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
||||||
g_return_if_fail (background == NULL || META_IS_BACKGROUND (background));
|
g_return_if_fail (background == NULL || META_IS_BACKGROUND (background));
|
||||||
|
|
||||||
priv = self->priv;
|
if (background == self->background)
|
||||||
|
|
||||||
if (background == priv->background)
|
|
||||||
return;
|
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,
|
(gpointer)on_background_changed,
|
||||||
self);
|
self);
|
||||||
g_object_unref (priv->background);
|
g_object_unref (self->background);
|
||||||
priv->background = NULL;
|
self->background = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (background)
|
if (background)
|
||||||
{
|
{
|
||||||
priv->background = g_object_ref (background);
|
self->background = g_object_ref (background);
|
||||||
g_signal_connect (priv->background, "changed",
|
g_signal_connect (self->background, "changed",
|
||||||
G_CALLBACK (on_background_changed), self);
|
G_CALLBACK (on_background_changed), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,28 +873,25 @@ meta_background_actor_set_gradient (MetaBackgroundActor *self,
|
|||||||
int height,
|
int height,
|
||||||
double max_darkness)
|
double max_darkness)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv;
|
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
||||||
g_return_if_fail (height >= 0);
|
g_return_if_fail (height >= 0);
|
||||||
g_return_if_fail (max_darkness >= 0. && max_darkness <= 1.);
|
g_return_if_fail (max_darkness >= 0. && max_darkness <= 1.);
|
||||||
|
|
||||||
priv = self->priv;
|
|
||||||
|
|
||||||
enabled = enabled != FALSE && height != 0;
|
enabled = enabled != FALSE && height != 0;
|
||||||
|
|
||||||
if (enabled != priv->gradient)
|
if (enabled != self->gradient)
|
||||||
{
|
{
|
||||||
priv->gradient = enabled;
|
self->gradient = enabled;
|
||||||
invalidate_pipeline (self, CHANGED_EFFECTS);
|
invalidate_pipeline (self, CHANGED_EFFECTS);
|
||||||
changed = TRUE;
|
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;
|
self->gradient_height = height;
|
||||||
priv->gradient_max_darkness = max_darkness;
|
self->gradient_max_darkness = max_darkness;
|
||||||
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
|
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
@ -927,20 +904,19 @@ void
|
|||||||
meta_background_actor_set_monitor (MetaBackgroundActor *self,
|
meta_background_actor_set_monitor (MetaBackgroundActor *self,
|
||||||
int monitor)
|
int monitor)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv = self->priv;
|
|
||||||
MetaRectangle old_monitor_geometry;
|
MetaRectangle old_monitor_geometry;
|
||||||
MetaRectangle new_monitor_geometry;
|
MetaRectangle new_monitor_geometry;
|
||||||
MetaDisplay *display = priv->display;
|
MetaDisplay *display = self->display;
|
||||||
|
|
||||||
if(priv->monitor == monitor)
|
if(self->monitor == monitor)
|
||||||
return;
|
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);
|
meta_display_get_monitor_geometry (display, monitor, &new_monitor_geometry);
|
||||||
if(old_monitor_geometry.height != new_monitor_geometry.height)
|
if(old_monitor_geometry.height != new_monitor_geometry.height)
|
||||||
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
|
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
|
||||||
|
|
||||||
priv->monitor = monitor;
|
self->monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -949,28 +925,25 @@ meta_background_actor_set_vignette (MetaBackgroundActor *self,
|
|||||||
double brightness,
|
double brightness,
|
||||||
double sharpness)
|
double sharpness)
|
||||||
{
|
{
|
||||||
MetaBackgroundActorPrivate *priv;
|
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
||||||
g_return_if_fail (brightness >= 0. && brightness <= 1.);
|
g_return_if_fail (brightness >= 0. && brightness <= 1.);
|
||||||
g_return_if_fail (sharpness >= 0.);
|
g_return_if_fail (sharpness >= 0.);
|
||||||
|
|
||||||
priv = self->priv;
|
|
||||||
|
|
||||||
enabled = enabled != FALSE;
|
enabled = enabled != FALSE;
|
||||||
|
|
||||||
if (enabled != priv->vignette)
|
if (enabled != self->vignette)
|
||||||
{
|
{
|
||||||
priv->vignette = enabled;
|
self->vignette = enabled;
|
||||||
invalidate_pipeline (self, CHANGED_EFFECTS);
|
invalidate_pipeline (self, CHANGED_EFFECTS);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brightness != priv->vignette_brightness || sharpness != priv->vignette_sharpness)
|
if (brightness != self->vignette_brightness || sharpness != self->vignette_sharpness)
|
||||||
{
|
{
|
||||||
priv->vignette_brightness = brightness;
|
self->vignette_brightness = brightness;
|
||||||
priv->vignette_sharpness = sharpness;
|
self->vignette_sharpness = sharpness;
|
||||||
invalidate_pipeline (self, CHANGED_VIGNETTE_PARAMETERS);
|
invalidate_pipeline (self, CHANGED_VIGNETTE_PARAMETERS);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
#include "compositor/meta-cullable.h"
|
#include "compositor/meta-cullable.h"
|
||||||
#include "meta/meta-background-group.h"
|
#include "meta/meta-background-group.h"
|
||||||
|
|
||||||
|
struct _MetaBackgroundGroup
|
||||||
|
{
|
||||||
|
ClutterActor parent;
|
||||||
|
};
|
||||||
|
|
||||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,
|
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,
|
||||||
|
@ -40,6 +40,13 @@ enum
|
|||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
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
|
struct _MetaBackgroundImageCache
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
@ -47,11 +54,11 @@ struct _MetaBackgroundImageCache
|
|||||||
GHashTable *images;
|
GHashTable *images;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaBackgroundImageCacheClass
|
/**
|
||||||
{
|
* MetaBackgroundImage:
|
||||||
GObjectClass parent_class;
|
*
|
||||||
};
|
* #MetaBackgroundImage is an object that represents a loaded or loading background image.
|
||||||
|
*/
|
||||||
struct _MetaBackgroundImage
|
struct _MetaBackgroundImage
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
@ -62,11 +69,6 @@ struct _MetaBackgroundImage
|
|||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaBackgroundImageClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -47,8 +47,10 @@ struct _MetaBackgroundMonitor
|
|||||||
CoglFramebuffer *fbo;
|
CoglFramebuffer *fbo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaBackgroundPrivate
|
struct _MetaBackground
|
||||||
{
|
{
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
MetaBackgroundMonitor *monitors;
|
MetaBackgroundMonitor *monitors;
|
||||||
int n_monitors;
|
int n_monitors;
|
||||||
@ -77,7 +79,7 @@ enum
|
|||||||
PROP_MONITOR,
|
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);
|
static gboolean texture_has_alpha (CoglTexture *texture);
|
||||||
|
|
||||||
@ -86,13 +88,11 @@ static GSList *all_backgrounds = NULL;
|
|||||||
static void
|
static void
|
||||||
free_fbos (MetaBackground *self)
|
free_fbos (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
int i;
|
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)
|
if (monitor->fbo)
|
||||||
{
|
{
|
||||||
cogl_object_unref (monitor->fbo);
|
cogl_object_unref (monitor->fbo);
|
||||||
@ -109,48 +109,42 @@ free_fbos (MetaBackground *self)
|
|||||||
static void
|
static void
|
||||||
free_color_texture (MetaBackground *self)
|
free_color_texture (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
if (self->color_texture != NULL)
|
||||||
|
|
||||||
if (priv->color_texture != NULL)
|
|
||||||
{
|
{
|
||||||
cogl_object_unref (priv->color_texture);
|
cogl_object_unref (self->color_texture);
|
||||||
priv->color_texture = NULL;
|
self->color_texture = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_wallpaper_texture (MetaBackground *self)
|
free_wallpaper_texture (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
if (self->wallpaper_texture != NULL)
|
||||||
|
|
||||||
if (priv->wallpaper_texture != NULL)
|
|
||||||
{
|
{
|
||||||
cogl_object_unref (priv->wallpaper_texture);
|
cogl_object_unref (self->wallpaper_texture);
|
||||||
priv->wallpaper_texture = NULL;
|
self->wallpaper_texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->wallpaper_allocation_failed = FALSE;
|
self->wallpaper_allocation_failed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
invalidate_monitor_backgrounds (MetaBackground *self)
|
invalidate_monitor_backgrounds (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
free_fbos (self);
|
free_fbos (self);
|
||||||
g_free (priv->monitors);
|
g_free (self->monitors);
|
||||||
priv->monitors = NULL;
|
self->monitors = NULL;
|
||||||
priv->n_monitors = 0;
|
self->n_monitors = 0;
|
||||||
|
|
||||||
if (priv->display)
|
if (self->display)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
priv->n_monitors = meta_display_get_n_monitors (priv->display);
|
self->n_monitors = meta_display_get_n_monitors (self->display);
|
||||||
priv->monitors = g_new0 (MetaBackgroundMonitor, priv->n_monitors);
|
self->monitors = g_new0 (MetaBackgroundMonitor, self->n_monitors);
|
||||||
|
|
||||||
for (i = 0; i < priv->n_monitors; i++)
|
for (i = 0; i < self->n_monitors; i++)
|
||||||
priv->monitors[i].dirty = TRUE;
|
self->monitors[i].dirty = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,9 +158,7 @@ static void
|
|||||||
set_display (MetaBackground *self,
|
set_display (MetaBackground *self,
|
||||||
MetaDisplay *display)
|
MetaDisplay *display)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
g_set_object (&self->display, display);
|
||||||
|
|
||||||
g_set_object (&priv->display, display);
|
|
||||||
|
|
||||||
invalidate_monitor_backgrounds (self);
|
invalidate_monitor_backgrounds (self);
|
||||||
}
|
}
|
||||||
@ -194,12 +186,12 @@ meta_background_get_property (GObject *object,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = META_BACKGROUND (object)->priv;
|
MetaBackground *self = META_BACKGROUND (object);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_META_DISPLAY:
|
case PROP_META_DISPLAY:
|
||||||
g_value_set_object (value, priv->display);
|
g_value_set_object (value, self->display);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -210,14 +202,13 @@ meta_background_get_property (GObject *object,
|
|||||||
static gboolean
|
static gboolean
|
||||||
need_prerender (MetaBackground *self)
|
need_prerender (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
CoglTexture *texture1 = self->background_image1 ? meta_background_image_get_texture (self->background_image1) : NULL;
|
||||||
CoglTexture *texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
|
CoglTexture *texture2 = self->background_image2 ? meta_background_image_get_texture (self->background_image2) : NULL;
|
||||||
CoglTexture *texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
|
|
||||||
|
|
||||||
if (texture1 == NULL && texture2 == NULL)
|
if (texture1 == NULL && texture2 == NULL)
|
||||||
return FALSE;
|
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 FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -226,14 +217,13 @@ need_prerender (MetaBackground *self)
|
|||||||
static void
|
static void
|
||||||
mark_changed (MetaBackground *self)
|
mark_changed (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!need_prerender (self))
|
if (!need_prerender (self))
|
||||||
free_fbos (self);
|
free_fbos (self);
|
||||||
|
|
||||||
for (i = 0; i < priv->n_monitors; i++)
|
for (i = 0; i < self->n_monitors; i++)
|
||||||
priv->monitors[i].dirty = TRUE;
|
self->monitors[i].dirty = TRUE;
|
||||||
|
|
||||||
g_signal_emit (self, signals[CHANGED], 0);
|
g_signal_emit (self, signals[CHANGED], 0);
|
||||||
}
|
}
|
||||||
@ -293,13 +283,12 @@ static void
|
|||||||
meta_background_dispose (GObject *object)
|
meta_background_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackground *self = META_BACKGROUND (object);
|
MetaBackground *self = META_BACKGROUND (object);
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
free_color_texture (self);
|
free_color_texture (self);
|
||||||
free_wallpaper_texture (self);
|
free_wallpaper_texture (self);
|
||||||
|
|
||||||
set_file (self, &priv->file1, &priv->background_image1, NULL);
|
set_file (self, &self->file1, &self->background_image1, NULL);
|
||||||
set_file (self, &priv->file2, &priv->background_image2, NULL);
|
set_file (self, &self->file2, &self->background_image2, NULL);
|
||||||
|
|
||||||
set_display (self, NULL);
|
set_display (self, NULL);
|
||||||
|
|
||||||
@ -318,12 +307,11 @@ static void
|
|||||||
meta_background_constructed (GObject *object)
|
meta_background_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackground *self = META_BACKGROUND (object);
|
MetaBackground *self = META_BACKGROUND (object);
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
|
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_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_signal_connect_object (monitor_manager, "monitors-changed",
|
g_signal_connect_object (monitor_manager, "monitors-changed",
|
||||||
@ -366,9 +354,6 @@ meta_background_class_init (MetaBackgroundClass *klass)
|
|||||||
static void
|
static void
|
||||||
meta_background_init (MetaBackground *self)
|
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);
|
all_backgrounds = g_slist_prepend (all_backgrounds, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +373,6 @@ get_texture_area (MetaBackground *self,
|
|||||||
CoglTexture *texture,
|
CoglTexture *texture,
|
||||||
cairo_rectangle_int_t *texture_area)
|
cairo_rectangle_int_t *texture_area)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
cairo_rectangle_int_t image_area;
|
cairo_rectangle_int_t image_area;
|
||||||
int screen_width, screen_height;
|
int screen_width, screen_height;
|
||||||
float texture_width, texture_height;
|
float texture_width, texture_height;
|
||||||
@ -397,7 +381,7 @@ get_texture_area (MetaBackground *self,
|
|||||||
texture_width = cogl_texture_get_width (texture);
|
texture_width = cogl_texture_get_width (texture);
|
||||||
texture_height = cogl_texture_get_height (texture);
|
texture_height = cogl_texture_get_height (texture);
|
||||||
|
|
||||||
switch (priv->style)
|
switch (self->style)
|
||||||
{
|
{
|
||||||
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
|
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
|
||||||
default:
|
default:
|
||||||
@ -407,7 +391,7 @@ get_texture_area (MetaBackground *self,
|
|||||||
set_texture_area_from_monitor_area (monitor_rect, texture_area);
|
set_texture_area_from_monitor_area (monitor_rect, texture_area);
|
||||||
break;
|
break;
|
||||||
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
|
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
|
/* Start off by centering a tile in the middle of the
|
||||||
* total screen area.
|
* total screen area.
|
||||||
@ -444,9 +428,9 @@ get_texture_area (MetaBackground *self,
|
|||||||
monitor_x_scale = monitor_rect->width / texture_width;
|
monitor_x_scale = monitor_rect->width / texture_width;
|
||||||
monitor_y_scale = monitor_rect->height / texture_height;
|
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)) ||
|
(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)))
|
(monitor_x_scale > monitor_y_scale)))
|
||||||
{
|
{
|
||||||
/* Fill image to exactly fit actor horizontally */
|
/* 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
|
/* paint region is the union of all monitors, with the origin
|
||||||
* of the region set to align with monitor associated with the background.
|
* 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 */
|
/* unclipped texture area is whole screen */
|
||||||
image_area.width = screen_width;
|
image_area.width = screen_width;
|
||||||
@ -499,13 +483,12 @@ draw_texture (MetaBackground *self,
|
|||||||
CoglTexture *texture,
|
CoglTexture *texture,
|
||||||
cairo_rectangle_int_t *monitor_area)
|
cairo_rectangle_int_t *monitor_area)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
|
||||||
cairo_rectangle_int_t texture_area;
|
cairo_rectangle_int_t texture_area;
|
||||||
gboolean bare_region_visible;
|
gboolean bare_region_visible;
|
||||||
|
|
||||||
get_texture_area (self, monitor_area, texture, &texture_area);
|
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_STRETCHED:
|
||||||
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
|
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
|
||||||
@ -550,9 +533,7 @@ draw_texture (MetaBackground *self,
|
|||||||
static void
|
static void
|
||||||
ensure_color_texture (MetaBackground *self)
|
ensure_color_texture (MetaBackground *self)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
if (self->color_texture == NULL)
|
||||||
|
|
||||||
if (priv->color_texture == NULL)
|
|
||||||
{
|
{
|
||||||
ClutterBackend *backend = clutter_get_default_backend ();
|
ClutterBackend *backend = clutter_get_default_backend ();
|
||||||
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
|
||||||
@ -560,18 +541,18 @@ ensure_color_texture (MetaBackground *self)
|
|||||||
uint8_t pixels[6];
|
uint8_t pixels[6];
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
if (priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID)
|
if (self->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID)
|
||||||
{
|
{
|
||||||
width = 1;
|
width = 1;
|
||||||
height = 1;
|
height = 1;
|
||||||
|
|
||||||
pixels[0] = priv->color.red;
|
pixels[0] = self->color.red;
|
||||||
pixels[1] = priv->color.green;
|
pixels[1] = self->color.green;
|
||||||
pixels[2] = priv->color.blue;
|
pixels[2] = self->color.blue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (priv->shading_direction)
|
switch (self->shading_direction)
|
||||||
{
|
{
|
||||||
case G_DESKTOP_BACKGROUND_SHADING_VERTICAL:
|
case G_DESKTOP_BACKGROUND_SHADING_VERTICAL:
|
||||||
width = 1;
|
width = 1;
|
||||||
@ -585,15 +566,15 @@ ensure_color_texture (MetaBackground *self)
|
|||||||
g_return_if_reached ();
|
g_return_if_reached ();
|
||||||
}
|
}
|
||||||
|
|
||||||
pixels[0] = priv->color.red;
|
pixels[0] = self->color.red;
|
||||||
pixels[1] = priv->color.green;
|
pixels[1] = self->color.green;
|
||||||
pixels[2] = priv->color.blue;
|
pixels[2] = self->color.blue;
|
||||||
pixels[3] = priv->second_color.red;
|
pixels[3] = self->second_color.red;
|
||||||
pixels[4] = priv->second_color.green;
|
pixels[4] = self->second_color.green;
|
||||||
pixels[5] = priv->second_color.blue;
|
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,
|
COGL_PIXEL_FORMAT_RGB_888,
|
||||||
width * 3,
|
width * 3,
|
||||||
pixels,
|
pixels,
|
||||||
@ -661,9 +642,7 @@ static gboolean
|
|||||||
ensure_wallpaper_texture (MetaBackground *self,
|
ensure_wallpaper_texture (MetaBackground *self,
|
||||||
CoglTexture *texture)
|
CoglTexture *texture)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv = self->priv;
|
if (self->wallpaper_texture == NULL && !self->wallpaper_allocation_failed)
|
||||||
|
|
||||||
if (priv->wallpaper_texture == NULL && !priv->wallpaper_allocation_failed)
|
|
||||||
{
|
{
|
||||||
int width = cogl_texture_get_width (texture);
|
int width = cogl_texture_get_width (texture);
|
||||||
int height = cogl_texture_get_height (texture);
|
int height = cogl_texture_get_height (texture);
|
||||||
@ -672,10 +651,10 @@ ensure_wallpaper_texture (MetaBackground *self,
|
|||||||
CoglError *catch_error = NULL;
|
CoglError *catch_error = NULL;
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
priv->wallpaper_texture = meta_create_texture (width, height,
|
self->wallpaper_texture = meta_create_texture (width, height,
|
||||||
COGL_TEXTURE_COMPONENTS_RGBA,
|
COGL_TEXTURE_COMPONENTS_RGBA,
|
||||||
META_TEXTURE_FLAGS_NONE);
|
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);
|
fbo = COGL_FRAMEBUFFER (offscreen);
|
||||||
|
|
||||||
if (!cogl_framebuffer_allocate (fbo, &catch_error))
|
if (!cogl_framebuffer_allocate (fbo, &catch_error))
|
||||||
@ -686,11 +665,11 @@ ensure_wallpaper_texture (MetaBackground *self,
|
|||||||
*/
|
*/
|
||||||
cogl_error_free (catch_error);
|
cogl_error_free (catch_error);
|
||||||
|
|
||||||
cogl_object_unref (priv->wallpaper_texture);
|
cogl_object_unref (self->wallpaper_texture);
|
||||||
priv->wallpaper_texture = NULL;
|
self->wallpaper_texture = NULL;
|
||||||
cogl_object_unref (fbo);
|
cogl_object_unref (fbo);
|
||||||
|
|
||||||
priv->wallpaper_allocation_failed = TRUE;
|
self->wallpaper_allocation_failed = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,7 +687,7 @@ ensure_wallpaper_texture (MetaBackground *self,
|
|||||||
ensure_color_texture (self);
|
ensure_color_texture (self);
|
||||||
|
|
||||||
pipeline = create_pipeline (PIPELINE_OVER_REVERSE);
|
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_framebuffer_draw_rectangle (fbo, pipeline, 0, 0, width, height);
|
||||||
cogl_object_unref (pipeline);
|
cogl_object_unref (pipeline);
|
||||||
}
|
}
|
||||||
@ -716,7 +695,7 @@ ensure_wallpaper_texture (MetaBackground *self,
|
|||||||
cogl_object_unref (fbo);
|
cogl_object_unref (fbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return priv->wallpaper_texture != NULL;
|
return self->wallpaper_texture != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CoglPipelineWrapMode
|
static CoglPipelineWrapMode
|
||||||
@ -743,26 +722,24 @@ meta_background_get_texture (MetaBackground *self,
|
|||||||
cairo_rectangle_int_t *texture_area,
|
cairo_rectangle_int_t *texture_area,
|
||||||
CoglPipelineWrapMode *wrap_mode)
|
CoglPipelineWrapMode *wrap_mode)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv;
|
|
||||||
MetaBackgroundMonitor *monitor;
|
MetaBackgroundMonitor *monitor;
|
||||||
MetaRectangle geometry;
|
MetaRectangle geometry;
|
||||||
cairo_rectangle_int_t monitor_area;
|
cairo_rectangle_int_t monitor_area;
|
||||||
CoglTexture *texture1, *texture2;
|
CoglTexture *texture1, *texture2;
|
||||||
|
|
||||||
g_return_val_if_fail (META_IS_BACKGROUND (self), NULL);
|
g_return_val_if_fail (META_IS_BACKGROUND (self), NULL);
|
||||||
priv = self->priv;
|
g_return_val_if_fail (monitor_index >= 0 && monitor_index < self->n_monitors, NULL);
|
||||||
g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->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.x = geometry.x;
|
||||||
monitor_area.y = geometry.y;
|
monitor_area.y = geometry.y;
|
||||||
monitor_area.width = geometry.width;
|
monitor_area.width = geometry.width;
|
||||||
monitor_area.height = geometry.height;
|
monitor_area.height = geometry.height;
|
||||||
|
|
||||||
texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
|
texture1 = self->background_image1 ? meta_background_image_get_texture (self->background_image1) : NULL;
|
||||||
texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
|
texture2 = self->background_image2 ? meta_background_image_get_texture (self->background_image2) : NULL;
|
||||||
|
|
||||||
if (texture1 == NULL && texture2 == 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);
|
set_texture_area_from_monitor_area (&monitor_area, texture_area);
|
||||||
if (wrap_mode)
|
if (wrap_mode)
|
||||||
*wrap_mode = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
|
*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 &&
|
if (texture2 == NULL && self->style == G_DESKTOP_BACKGROUND_STYLE_WALLPAPER &&
|
||||||
priv->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID &&
|
self->shading_direction == G_DESKTOP_BACKGROUND_SHADING_SOLID &&
|
||||||
ensure_wallpaper_texture (self, texture1))
|
ensure_wallpaper_texture (self, texture1))
|
||||||
{
|
{
|
||||||
if (texture_area)
|
if (texture_area)
|
||||||
get_texture_area (self, &monitor_area, priv->wallpaper_texture,
|
get_texture_area (self, &monitor_area, self->wallpaper_texture,
|
||||||
texture_area);
|
texture_area);
|
||||||
if (wrap_mode)
|
if (wrap_mode)
|
||||||
*wrap_mode = COGL_PIPELINE_WRAP_MODE_REPEAT;
|
*wrap_mode = COGL_PIPELINE_WRAP_MODE_REPEAT;
|
||||||
return priv->wallpaper_texture;
|
return self->wallpaper_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor->dirty)
|
if (monitor->dirty)
|
||||||
@ -820,13 +797,13 @@ meta_background_get_texture (MetaBackground *self,
|
|||||||
cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
|
cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
|
||||||
monitor_area.width, monitor_area.height, -1., 1.);
|
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);
|
CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE);
|
||||||
cogl_pipeline_set_color4f (pipeline,
|
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_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,
|
bare_region_visible = draw_texture (self,
|
||||||
monitor->fbo, pipeline,
|
monitor->fbo, pipeline,
|
||||||
@ -841,16 +818,16 @@ meta_background_get_texture (MetaBackground *self,
|
|||||||
0.0, 0.0, 0.0, 0.0);
|
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);
|
CoglPipeline *pipeline = create_pipeline (PIPELINE_ADD);
|
||||||
cogl_pipeline_set_color4f (pipeline,
|
cogl_pipeline_set_color4f (pipeline,
|
||||||
(1 - priv->blend_factor),
|
(1 - self->blend_factor),
|
||||||
(1 - priv->blend_factor),
|
(1 - self->blend_factor),
|
||||||
(1 - priv->blend_factor),
|
(1 - self->blend_factor),
|
||||||
(1 - priv->blend_factor));;
|
(1 - self->blend_factor));;
|
||||||
cogl_pipeline_set_layer_texture (pipeline, 0, texture1);
|
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,
|
bare_region_visible = bare_region_visible || draw_texture (self,
|
||||||
monitor->fbo, pipeline,
|
monitor->fbo, pipeline,
|
||||||
@ -864,7 +841,7 @@ meta_background_get_texture (MetaBackground *self,
|
|||||||
CoglPipeline *pipeline = create_pipeline (PIPELINE_OVER_REVERSE);
|
CoglPipeline *pipeline = create_pipeline (PIPELINE_OVER_REVERSE);
|
||||||
|
|
||||||
ensure_color_texture (self);
|
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,
|
cogl_framebuffer_draw_rectangle (monitor->fbo,
|
||||||
pipeline,
|
pipeline,
|
||||||
0, 0,
|
0, 0,
|
||||||
@ -911,17 +888,13 @@ meta_background_set_gradient (MetaBackground *self,
|
|||||||
ClutterColor *color,
|
ClutterColor *color,
|
||||||
ClutterColor *second_color)
|
ClutterColor *second_color)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_BACKGROUND (self));
|
g_return_if_fail (META_IS_BACKGROUND (self));
|
||||||
g_return_if_fail (color != NULL);
|
g_return_if_fail (color != NULL);
|
||||||
g_return_if_fail (second_color != NULL);
|
g_return_if_fail (second_color != NULL);
|
||||||
|
|
||||||
priv = self->priv;
|
self->shading_direction = shading_direction;
|
||||||
|
self->color = *color;
|
||||||
priv->shading_direction = shading_direction;
|
self->second_color = *second_color;
|
||||||
priv->color = *color;
|
|
||||||
priv->second_color = *second_color;
|
|
||||||
|
|
||||||
free_color_texture (self);
|
free_color_texture (self);
|
||||||
free_wallpaper_texture (self);
|
free_wallpaper_texture (self);
|
||||||
@ -945,18 +918,14 @@ meta_background_set_blend (MetaBackground *self,
|
|||||||
double blend_factor,
|
double blend_factor,
|
||||||
GDesktopBackgroundStyle style)
|
GDesktopBackgroundStyle style)
|
||||||
{
|
{
|
||||||
MetaBackgroundPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_BACKGROUND (self));
|
g_return_if_fail (META_IS_BACKGROUND (self));
|
||||||
g_return_if_fail (blend_factor >= 0.0 && blend_factor <= 1.0);
|
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);
|
self->blend_factor = blend_factor;
|
||||||
set_file (self, &priv->file2, &priv->background_image2, file2);
|
self->style = style;
|
||||||
|
|
||||||
priv->blend_factor = blend_factor;
|
|
||||||
priv->style = style;
|
|
||||||
|
|
||||||
free_wallpaper_texture (self);
|
free_wallpaper_texture (self);
|
||||||
mark_changed (self);
|
mark_changed (self);
|
||||||
|
@ -30,12 +30,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_CULLABLE (meta_cullable_get_type ())
|
#define META_TYPE_CULLABLE (meta_cullable_get_type ())
|
||||||
#define META_CULLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_CULLABLE, MetaCullable))
|
G_DECLARE_INTERFACE (MetaCullable, meta_cullable, META, CULLABLE, ClutterActor)
|
||||||
#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;
|
|
||||||
|
|
||||||
struct _MetaCullableInterface
|
struct _MetaCullableInterface
|
||||||
{
|
{
|
||||||
@ -47,8 +42,6 @@ struct _MetaCullableInterface
|
|||||||
void (* reset_culling) (MetaCullable *cullable);
|
void (* reset_culling) (MetaCullable *cullable);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType meta_cullable_get_type (void);
|
|
||||||
|
|
||||||
void meta_cullable_cull_out (MetaCullable *cullable,
|
void meta_cullable_cull_out (MetaCullable *cullable,
|
||||||
cairo_region_t *unobscured_region,
|
cairo_region_t *unobscured_region,
|
||||||
cairo_region_t *clip_region);
|
cairo_region_t *clip_region);
|
||||||
|
@ -32,27 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define META_TYPE_DND_ACTOR (meta_dnd_actor_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaDnDActor,
|
||||||
#define META_DND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DND_ACTOR, MetaDnDActorClass))
|
meta_dnd_actor,
|
||||||
#define META_IS_DND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_DND_ACTOR))
|
META, DND_ACTOR,
|
||||||
#define META_IS_DND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DND_ACTOR))
|
MetaFeedbackActor)
|
||||||
#define META_DND_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DND_ACTOR, MetaDnDActorClass))
|
|
||||||
|
|
||||||
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,
|
ClutterActor *meta_dnd_actor_new (ClutterActor *drag_origin,
|
||||||
int start_x,
|
int start_x,
|
||||||
|
@ -39,16 +39,16 @@ enum {
|
|||||||
PROP_DRAG_START_Y
|
PROP_DRAG_START_Y
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _MetaDnDActorPrivate MetaDnDActorPrivate;
|
struct _MetaDnDActor
|
||||||
|
|
||||||
struct _MetaDnDActorPrivate
|
|
||||||
{
|
{
|
||||||
|
MetaFeedbackActor parent;
|
||||||
|
|
||||||
ClutterActor *drag_origin;
|
ClutterActor *drag_origin;
|
||||||
int drag_start_x;
|
int drag_start_x;
|
||||||
int drag_start_y;
|
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
|
static void
|
||||||
meta_dnd_actor_set_property (GObject *object,
|
meta_dnd_actor_set_property (GObject *object,
|
||||||
@ -57,18 +57,17 @@ meta_dnd_actor_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
MetaDnDActor *self = META_DND_ACTOR (object);
|
MetaDnDActor *self = META_DND_ACTOR (object);
|
||||||
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_DRAG_ORIGIN:
|
case PROP_DRAG_ORIGIN:
|
||||||
priv->drag_origin = g_value_get_object (value);
|
self->drag_origin = g_value_get_object (value);
|
||||||
break;
|
break;
|
||||||
case PROP_DRAG_START_X:
|
case PROP_DRAG_START_X:
|
||||||
priv->drag_start_x = g_value_get_int (value);
|
self->drag_start_x = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
case PROP_DRAG_START_Y:
|
case PROP_DRAG_START_Y:
|
||||||
priv->drag_start_y = g_value_get_int (value);
|
self->drag_start_y = g_value_get_int (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -83,18 +82,17 @@ meta_dnd_actor_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
MetaDnDActor *self = META_DND_ACTOR (object);
|
MetaDnDActor *self = META_DND_ACTOR (object);
|
||||||
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
|
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_DRAG_ORIGIN:
|
case PROP_DRAG_ORIGIN:
|
||||||
g_value_set_object (value, priv->drag_origin);
|
g_value_set_object (value, self->drag_origin);
|
||||||
break;
|
break;
|
||||||
case PROP_DRAG_START_X:
|
case PROP_DRAG_START_X:
|
||||||
g_value_set_int (value, priv->drag_start_x);
|
g_value_set_int (value, self->drag_start_x);
|
||||||
break;
|
break;
|
||||||
case PROP_DRAG_START_Y:
|
case PROP_DRAG_START_Y:
|
||||||
g_value_set_int (value, priv->drag_start_y);
|
g_value_set_int (value, self->drag_start_y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -185,13 +183,11 @@ void
|
|||||||
meta_dnd_actor_drag_finish (MetaDnDActor *self,
|
meta_dnd_actor_drag_finish (MetaDnDActor *self,
|
||||||
gboolean success)
|
gboolean success)
|
||||||
{
|
{
|
||||||
MetaDnDActorPrivate *priv;
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_DND_ACTOR (self));
|
g_return_if_fail (META_IS_DND_ACTOR (self));
|
||||||
|
|
||||||
actor = CLUTTER_ACTOR (self);
|
actor = CLUTTER_ACTOR (self);
|
||||||
priv = meta_dnd_actor_get_instance_private (self);
|
|
||||||
|
|
||||||
if (success)
|
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_easing_duration (actor, DRAG_FAILED_DURATION);
|
||||||
clutter_actor_set_opacity (actor, 0);
|
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;
|
int anchor_x, anchor_y;
|
||||||
ClutterPoint dest;
|
ClutterPoint dest;
|
||||||
|
|
||||||
clutter_actor_get_transformed_position (priv->drag_origin,
|
clutter_actor_get_transformed_position (self->drag_origin,
|
||||||
&dest.x, &dest.y);
|
&dest.x, &dest.y);
|
||||||
meta_feedback_actor_get_anchor (META_FEEDBACK_ACTOR (self),
|
meta_feedback_actor_get_anchor (META_FEEDBACK_ACTOR (self),
|
||||||
&anchor_x, &anchor_y);
|
&anchor_x, &anchor_y);
|
||||||
|
|
||||||
dest.x += priv->drag_start_x - anchor_x;
|
dest.x += self->drag_start_x - anchor_x;
|
||||||
dest.y += priv->drag_start_y - anchor_y;
|
dest.y += self->drag_start_y - anchor_y;
|
||||||
clutter_actor_set_position (actor, dest.x, dest.y);
|
clutter_actor_set_position (actor, dest.x, dest.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,14 +32,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define META_TYPE_FEEDBACK_ACTOR (meta_feedback_actor_get_type ())
|
#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))
|
G_DECLARE_DERIVABLE_TYPE (MetaFeedbackActor,
|
||||||
#define META_FEEDBACK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FEEDBACK_ACTOR, MetaFeedbackActorClass))
|
meta_feedback_actor,
|
||||||
#define META_IS_FEEDBACK_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FEEDBACK_ACTOR))
|
META, FEEDBACK_ACTOR,
|
||||||
#define META_IS_FEEDBACK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FEEDBACK_ACTOR))
|
ClutterActor)
|
||||||
#define META_FEEDBACK_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FEEDBACK_ACTOR, MetaFeedbackActorClass))
|
|
||||||
|
|
||||||
typedef struct _MetaFeedbackActor MetaFeedbackActor;
|
|
||||||
typedef struct _MetaFeedbackActorClass MetaFeedbackActorClass;
|
|
||||||
|
|
||||||
struct _MetaFeedbackActorClass
|
struct _MetaFeedbackActorClass
|
||||||
{
|
{
|
||||||
@ -47,12 +44,6 @@ struct _MetaFeedbackActorClass
|
|||||||
ClutterActorClass parent_class;
|
ClutterActorClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaFeedbackActor
|
|
||||||
{
|
|
||||||
ClutterActor parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType meta_feedback_actor_get_type (void);
|
|
||||||
|
|
||||||
ClutterActor *meta_feedback_actor_new (int anchor_x,
|
ClutterActor *meta_feedback_actor_new (int anchor_x,
|
||||||
int anchor_y);
|
int anchor_y);
|
||||||
|
@ -106,11 +106,6 @@ struct _MetaShadowFactory
|
|||||||
GHashTable *shadow_classes;
|
GHashTable *shadow_classes;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaShadowFactoryClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CHANGED,
|
CHANGED,
|
||||||
|
@ -70,10 +70,6 @@ static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, Clutte
|
|||||||
|
|
||||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
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 {
|
enum {
|
||||||
SIZE_CHANGED,
|
SIZE_CHANGED,
|
||||||
|
|
||||||
@ -82,8 +78,10 @@ enum {
|
|||||||
|
|
||||||
static guint signals[LAST_SIGNAL];
|
static guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
struct _MetaShapedTexturePrivate
|
struct _MetaShapedTexture
|
||||||
{
|
{
|
||||||
|
ClutterActor parent;
|
||||||
|
|
||||||
MetaTextureTower *paint_tower;
|
MetaTextureTower *paint_tower;
|
||||||
|
|
||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
@ -119,7 +117,6 @@ struct _MetaShapedTexturePrivate
|
|||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR,
|
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));
|
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -146,73 +143,66 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
|
|||||||
static void
|
static void
|
||||||
invalidate_size (MetaShapedTexture *stex)
|
invalidate_size (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
stex->size_invalid = TRUE;
|
||||||
|
|
||||||
priv->size_invalid = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 ();
|
g_signal_connect (stex,
|
||||||
|
|
||||||
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,
|
|
||||||
"notify::scale-x",
|
"notify::scale-x",
|
||||||
G_CALLBACK (invalidate_size),
|
G_CALLBACK (invalidate_size),
|
||||||
self);
|
stex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_size (MetaShapedTexture *stex)
|
update_size (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
int dst_width;
|
int dst_width;
|
||||||
int dst_height;
|
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_width = stex->tex_height;
|
||||||
dst_height = priv->tex_width;
|
dst_height = stex->tex_width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst_width = priv->fallback_height;
|
dst_width = stex->fallback_height;
|
||||||
dst_height = priv->fallback_width;
|
dst_height = stex->fallback_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (priv->texture)
|
if (stex->texture)
|
||||||
{
|
{
|
||||||
dst_width = priv->tex_width;
|
dst_width = stex->tex_width;
|
||||||
dst_height = priv->tex_height;
|
dst_height = stex->tex_height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst_width = priv->fallback_width;
|
dst_width = stex->fallback_width;
|
||||||
dst_height = priv->fallback_height;
|
dst_height = stex->fallback_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->size_invalid = FALSE;
|
stex->size_invalid = FALSE;
|
||||||
|
|
||||||
if (priv->dst_width != dst_width ||
|
if (stex->dst_width != dst_width ||
|
||||||
priv->dst_height != dst_height)
|
stex->dst_height != dst_height)
|
||||||
{
|
{
|
||||||
priv->dst_width = dst_width;
|
stex->dst_width = dst_width;
|
||||||
priv->dst_height = dst_height;
|
stex->dst_height = dst_height;
|
||||||
meta_shaped_texture_set_mask_texture (stex, NULL);
|
meta_shaped_texture_set_mask_texture (stex, NULL);
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
|
||||||
g_signal_emit (stex, signals[SIZE_CHANGED], 0);
|
g_signal_emit (stex, signals[SIZE_CHANGED], 0);
|
||||||
@ -222,80 +212,71 @@ update_size (MetaShapedTexture *stex)
|
|||||||
static void
|
static void
|
||||||
ensure_size_valid (MetaShapedTexture *stex)
|
ensure_size_valid (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
if (stex->size_invalid)
|
||||||
|
|
||||||
if (priv->size_invalid)
|
|
||||||
update_size (stex);
|
update_size (stex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_unobscured_region (MetaShapedTexture *self,
|
set_unobscured_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *unobscured_region)
|
cairo_region_t *unobscured_region)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = self->priv;
|
g_clear_pointer (&stex->unobscured_region, cairo_region_destroy);
|
||||||
|
|
||||||
g_clear_pointer (&priv->unobscured_region, cairo_region_destroy);
|
|
||||||
if (unobscured_region)
|
if (unobscured_region)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
ensure_size_valid (self);
|
ensure_size_valid (stex);
|
||||||
width = priv->dst_width;
|
width = stex->dst_width;
|
||||||
height = priv->dst_height;
|
height = stex->dst_height;
|
||||||
|
|
||||||
cairo_rectangle_int_t bounds = { 0, 0, width, height };
|
cairo_rectangle_int_t bounds = { 0, 0, width, height };
|
||||||
priv->unobscured_region = cairo_region_copy (unobscured_region);
|
stex->unobscured_region = cairo_region_copy (unobscured_region);
|
||||||
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
cairo_region_intersect_rectangle (stex->unobscured_region, &bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_clip_region (MetaShapedTexture *self,
|
set_clip_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *clip_region)
|
cairo_region_t *clip_region)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = self->priv;
|
g_clear_pointer (&stex->clip_region, cairo_region_destroy);
|
||||||
|
|
||||||
g_clear_pointer (&priv->clip_region, cairo_region_destroy);
|
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
priv->clip_region = cairo_region_copy (clip_region);
|
stex->clip_region = cairo_region_copy (clip_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_shaped_texture_reset_pipelines (MetaShapedTexture *stex)
|
meta_shaped_texture_reset_pipelines (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
g_clear_pointer (&stex->base_pipeline, cogl_object_unref);
|
||||||
|
g_clear_pointer (&stex->masked_pipeline, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->base_pipeline, cogl_object_unref);
|
g_clear_pointer (&stex->unblended_pipeline, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->masked_pipeline, cogl_object_unref);
|
|
||||||
g_clear_pointer (&priv->unblended_pipeline, cogl_object_unref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_shaped_texture_dispose (GObject *object)
|
meta_shaped_texture_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *self = (MetaShapedTexture *) object;
|
MetaShapedTexture *stex = (MetaShapedTexture *) object;
|
||||||
MetaShapedTexturePrivate *priv = self->priv;
|
|
||||||
|
|
||||||
if (priv->remipmap_timeout_id)
|
if (stex->remipmap_timeout_id)
|
||||||
{
|
{
|
||||||
g_source_remove (priv->remipmap_timeout_id);
|
g_source_remove (stex->remipmap_timeout_id);
|
||||||
priv->remipmap_timeout_id = 0;
|
stex->remipmap_timeout_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->paint_tower)
|
if (stex->paint_tower)
|
||||||
meta_texture_tower_free (priv->paint_tower);
|
meta_texture_tower_free (stex->paint_tower);
|
||||||
priv->paint_tower = NULL;
|
stex->paint_tower = NULL;
|
||||||
|
|
||||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
g_clear_pointer (&stex->texture, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
g_clear_pointer (&stex->opaque_region, cairo_region_destroy);
|
||||||
|
|
||||||
meta_shaped_texture_set_mask_texture (self, NULL);
|
meta_shaped_texture_set_mask_texture (stex, NULL);
|
||||||
set_unobscured_region (self, NULL);
|
set_unobscured_region (stex, NULL);
|
||||||
set_clip_region (self, 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);
|
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
@ -304,11 +285,10 @@ static CoglPipeline *
|
|||||||
get_base_pipeline (MetaShapedTexture *stex,
|
get_base_pipeline (MetaShapedTexture *stex,
|
||||||
CoglContext *ctx)
|
CoglContext *ctx)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
if (priv->base_pipeline)
|
if (stex->base_pipeline)
|
||||||
return priv->base_pipeline;
|
return stex->base_pipeline;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_new (ctx);
|
pipeline = cogl_pipeline_new (ctx);
|
||||||
cogl_pipeline_set_layer_wrap_mode_s (pipeline, 0,
|
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_WRAP_MODE_CLAMP_TO_EDGE);
|
||||||
cogl_pipeline_set_layer_wrap_mode_t (pipeline, 1,
|
cogl_pipeline_set_layer_wrap_mode_t (pipeline, 1,
|
||||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
|
||||||
if (!priv->is_y_inverted)
|
if (!stex->is_y_inverted)
|
||||||
{
|
{
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
|
|
||||||
@ -329,13 +309,13 @@ get_base_pipeline (MetaShapedTexture *stex,
|
|||||||
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->transform != META_MONITOR_TRANSFORM_NORMAL)
|
if (stex->transform != META_MONITOR_TRANSFORM_NORMAL)
|
||||||
{
|
{
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
CoglEuler euler;
|
CoglEuler euler;
|
||||||
|
|
||||||
cogl_matrix_init_translation (&matrix, 0.5, 0.5, 0.0);
|
cogl_matrix_init_translation (&matrix, 0.5, 0.5, 0.0);
|
||||||
switch (priv->transform)
|
switch (stex->transform)
|
||||||
{
|
{
|
||||||
case META_MONITOR_TRANSFORM_90:
|
case META_MONITOR_TRANSFORM_90:
|
||||||
cogl_euler_init (&euler, 0.0, 0.0, 90.0);
|
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);
|
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->snippet)
|
if (stex->snippet)
|
||||||
cogl_pipeline_add_layer_snippet (pipeline, 0, priv->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 *
|
static CoglPipeline *
|
||||||
@ -387,18 +367,17 @@ static CoglPipeline *
|
|||||||
get_masked_pipeline (MetaShapedTexture *stex,
|
get_masked_pipeline (MetaShapedTexture *stex,
|
||||||
CoglContext *ctx)
|
CoglContext *ctx)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
|
|
||||||
if (priv->masked_pipeline)
|
if (stex->masked_pipeline)
|
||||||
return priv->masked_pipeline;
|
return stex->masked_pipeline;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
cogl_pipeline_set_layer_combine (pipeline, 1,
|
cogl_pipeline_set_layer_combine (pipeline, 1,
|
||||||
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
priv->masked_pipeline = pipeline;
|
stex->masked_pipeline = pipeline;
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
@ -407,12 +386,11 @@ static CoglPipeline *
|
|||||||
get_unblended_pipeline (MetaShapedTexture *stex,
|
get_unblended_pipeline (MetaShapedTexture *stex,
|
||||||
CoglContext *ctx)
|
CoglContext *ctx)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
|
|
||||||
if (priv->unblended_pipeline)
|
if (stex->unblended_pipeline)
|
||||||
return priv->unblended_pipeline;
|
return stex->unblended_pipeline;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
|
cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
|
||||||
@ -421,7 +399,7 @@ get_unblended_pipeline (MetaShapedTexture *stex,
|
|||||||
NULL);
|
NULL);
|
||||||
cogl_pipeline_set_color (pipeline, &color);
|
cogl_pipeline_set_color (pipeline, &color);
|
||||||
|
|
||||||
priv->unblended_pipeline = pipeline;
|
stex->unblended_pipeline = pipeline;
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
@ -459,17 +437,14 @@ static void
|
|||||||
set_cogl_texture (MetaShapedTexture *stex,
|
set_cogl_texture (MetaShapedTexture *stex,
|
||||||
CoglTexture *cogl_tex)
|
CoglTexture *cogl_tex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv;
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||||
|
|
||||||
priv = stex->priv;
|
if (stex->texture)
|
||||||
|
cogl_object_unref (stex->texture);
|
||||||
|
|
||||||
if (priv->texture)
|
stex->texture = cogl_tex;
|
||||||
cogl_object_unref (priv->texture);
|
|
||||||
|
|
||||||
priv->texture = cogl_tex;
|
|
||||||
|
|
||||||
if (cogl_tex != NULL)
|
if (cogl_tex != NULL)
|
||||||
{
|
{
|
||||||
@ -483,11 +458,11 @@ set_cogl_texture (MetaShapedTexture *stex,
|
|||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->tex_width != width ||
|
if (stex->tex_width != width ||
|
||||||
priv->tex_height != height)
|
stex->tex_height != height)
|
||||||
{
|
{
|
||||||
priv->tex_width = width;
|
stex->tex_width = width;
|
||||||
priv->tex_height = height;
|
stex->tex_height = height;
|
||||||
update_size (stex);
|
update_size (stex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,21 +471,20 @@ set_cogl_texture (MetaShapedTexture *stex,
|
|||||||
* previous buffer. We only queue a redraw in response to surface
|
* previous buffer. We only queue a redraw in response to surface
|
||||||
* damage. */
|
* damage. */
|
||||||
|
|
||||||
if (priv->create_mipmaps)
|
if (stex->create_mipmaps)
|
||||||
meta_texture_tower_set_base_texture (priv->paint_tower, cogl_tex);
|
meta_texture_tower_set_base_texture (stex->paint_tower, cogl_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
texture_is_idle_and_not_mipmapped (gpointer user_data)
|
texture_is_idle_and_not_mipmapped (gpointer user_data)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *stex = META_SHAPED_TEXTURE (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;
|
return G_SOURCE_CONTINUE;
|
||||||
|
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||||
priv->remipmap_timeout_id = 0;
|
stex->remipmap_timeout_id = 0;
|
||||||
|
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
@ -519,7 +493,6 @@ static void
|
|||||||
meta_shaped_texture_paint (ClutterActor *actor)
|
meta_shaped_texture_paint (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *stex = (MetaShapedTexture *) actor;
|
MetaShapedTexture *stex = (MetaShapedTexture *) actor;
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
double tex_scale;
|
double tex_scale;
|
||||||
int dst_width, dst_height;
|
int dst_width, dst_height;
|
||||||
cairo_rectangle_int_t tex_rect;
|
cairo_rectangle_int_t tex_rect;
|
||||||
@ -535,7 +508,7 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
CoglPipelineFilter filter;
|
CoglPipelineFilter filter;
|
||||||
gint64 now = g_get_monotonic_time ();
|
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;
|
return;
|
||||||
|
|
||||||
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR (stex)))
|
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
|
* Setting the texture quality to high without SGIS_generate_mipmap
|
||||||
* support for TFP textures will result in fallbacks to XGetImage.
|
* 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 ||
|
if (age >= MIN_MIPMAP_AGE_USEC ||
|
||||||
priv->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
||||||
paint_tex = meta_texture_tower_get_paint_texture (priv->paint_tower);
|
paint_tex = meta_texture_tower_get_paint_texture (stex->paint_tower);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paint_tex == NULL)
|
if (paint_tex == NULL)
|
||||||
{
|
{
|
||||||
paint_tex = COGL_TEXTURE (priv->texture);
|
paint_tex = COGL_TEXTURE (stex->texture);
|
||||||
|
|
||||||
if (paint_tex == NULL)
|
if (paint_tex == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (priv->create_mipmaps)
|
if (stex->create_mipmaps)
|
||||||
{
|
{
|
||||||
/* Minus 1000 to ensure we don't fail the age test in timeout */
|
/* 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)
|
if (!stex->remipmap_timeout_id)
|
||||||
priv->remipmap_timeout_id =
|
stex->remipmap_timeout_id =
|
||||||
g_timeout_add (MIN_MIPMAP_AGE_USEC / 1000,
|
g_timeout_add (MIN_MIPMAP_AGE_USEC / 1000,
|
||||||
texture_is_idle_and_not_mipmapped,
|
texture_is_idle_and_not_mipmapped,
|
||||||
stex);
|
stex);
|
||||||
@ -587,9 +560,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
|
|
||||||
clutter_actor_get_scale (actor, &tex_scale, NULL);
|
clutter_actor_get_scale (actor, &tex_scale, NULL);
|
||||||
ensure_size_valid (stex);
|
ensure_size_valid (stex);
|
||||||
dst_width = priv->dst_width;
|
dst_width = stex->dst_width;
|
||||||
dst_height = priv->dst_height;
|
|
||||||
|
|
||||||
|
dst_height = stex->dst_height;
|
||||||
if (dst_width == 0 || dst_height == 0) /* no contents yet */
|
if (dst_width == 0 || dst_height == 0) /* no contents yet */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -610,10 +583,10 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
opacity = clutter_actor_get_paint_opacity (actor);
|
opacity = clutter_actor_get_paint_opacity (actor);
|
||||||
clutter_actor_get_allocation_box (actor, &alloc);
|
clutter_actor_get_allocation_box (actor, &alloc);
|
||||||
|
|
||||||
if (priv->opaque_region && opacity == 255)
|
if (stex->opaque_region && opacity == 255)
|
||||||
{
|
{
|
||||||
opaque_tex_region =
|
opaque_tex_region =
|
||||||
meta_region_scale_double (priv->opaque_region,
|
meta_region_scale_double (stex->opaque_region,
|
||||||
1.0 / tex_scale,
|
1.0 / tex_scale,
|
||||||
META_ROUNDING_STRATEGY_SHRINK);
|
META_ROUNDING_STRATEGY_SHRINK);
|
||||||
use_opaque_region = TRUE;
|
use_opaque_region = TRUE;
|
||||||
@ -624,10 +597,10 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
use_opaque_region = FALSE;
|
use_opaque_region = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->clip_region)
|
if (stex->clip_region)
|
||||||
{
|
{
|
||||||
clip_tex_region =
|
clip_tex_region =
|
||||||
meta_region_scale_double (priv->clip_region,
|
meta_region_scale_double (stex->clip_region,
|
||||||
1.0 / tex_scale,
|
1.0 / tex_scale,
|
||||||
META_ROUNDING_STRATEGY_GROW);
|
META_ROUNDING_STRATEGY_GROW);
|
||||||
}
|
}
|
||||||
@ -719,14 +692,14 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
|||||||
{
|
{
|
||||||
CoglPipeline *blended_pipeline;
|
CoglPipeline *blended_pipeline;
|
||||||
|
|
||||||
if (priv->mask_texture == NULL)
|
if (stex->mask_texture == NULL)
|
||||||
{
|
{
|
||||||
blended_pipeline = get_unmasked_pipeline (stex, ctx);
|
blended_pipeline = get_unmasked_pipeline (stex, ctx);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
blended_pipeline = get_masked_pipeline (stex, ctx);
|
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);
|
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)
|
gfloat *natural_width_p)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
|
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
|
|
||||||
ensure_size_valid (stex);
|
ensure_size_valid (stex);
|
||||||
|
|
||||||
if (min_width_p)
|
if (min_width_p)
|
||||||
*min_width_p = priv->dst_width;
|
*min_width_p = stex->dst_width;
|
||||||
if (natural_width_p)
|
if (natural_width_p)
|
||||||
*natural_width_p = priv->dst_width;
|
*natural_width_p = stex->dst_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -793,24 +765,22 @@ meta_shaped_texture_get_preferred_height (ClutterActor *self,
|
|||||||
gfloat *natural_height_p)
|
gfloat *natural_height_p)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
|
MetaShapedTexture *stex = META_SHAPED_TEXTURE (self);
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
|
||||||
|
|
||||||
ensure_size_valid (stex);
|
ensure_size_valid (stex);
|
||||||
|
|
||||||
if (min_height_p)
|
if (min_height_p)
|
||||||
*min_height_p = priv->dst_height;
|
*min_height_p = stex->dst_height;
|
||||||
if (natural_height_p)
|
if (natural_height_p)
|
||||||
*natural_height_p = priv->dst_height;
|
*natural_height_p = stex->dst_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_region_t *
|
static cairo_region_t *
|
||||||
effective_unobscured_region (MetaShapedTexture *self)
|
effective_unobscured_region (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = self->priv;
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
|
|
||||||
/* Fail if we have any mapped clones. */
|
/* Fail if we have any mapped clones. */
|
||||||
actor = CLUTTER_ACTOR (self);
|
actor = CLUTTER_ACTOR (stex);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (clutter_actor_has_mapped_clones (actor))
|
if (clutter_actor_has_mapped_clones (actor))
|
||||||
@ -819,7 +789,7 @@ effective_unobscured_region (MetaShapedTexture *self)
|
|||||||
}
|
}
|
||||||
while (actor != NULL);
|
while (actor != NULL);
|
||||||
|
|
||||||
return priv->unobscured_region;
|
return stex->unobscured_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -833,20 +803,16 @@ void
|
|||||||
meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
|
meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
|
||||||
gboolean create_mipmaps)
|
gboolean create_mipmaps)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||||
|
|
||||||
priv = stex->priv;
|
|
||||||
|
|
||||||
create_mipmaps = create_mipmaps != FALSE;
|
create_mipmaps = create_mipmaps != FALSE;
|
||||||
|
|
||||||
if (create_mipmaps != priv->create_mipmaps)
|
if (create_mipmaps != stex->create_mipmaps)
|
||||||
{
|
{
|
||||||
CoglTexture *base_texture;
|
CoglTexture *base_texture;
|
||||||
priv->create_mipmaps = create_mipmaps;
|
stex->create_mipmaps = create_mipmaps;
|
||||||
base_texture = create_mipmaps ? priv->texture : NULL;
|
base_texture = create_mipmaps ? stex->texture : NULL;
|
||||||
meta_texture_tower_set_base_texture (priv->paint_tower, base_texture);
|
meta_texture_tower_set_base_texture (stex->paint_tower, base_texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,27 +820,23 @@ void
|
|||||||
meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
||||||
CoglTexture *mask_texture)
|
CoglTexture *mask_texture)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||||
|
|
||||||
priv = stex->priv;
|
g_clear_pointer (&stex->mask_texture, cogl_object_unref);
|
||||||
|
|
||||||
g_clear_pointer (&priv->mask_texture, cogl_object_unref);
|
|
||||||
|
|
||||||
if (mask_texture != NULL)
|
if (mask_texture != NULL)
|
||||||
{
|
{
|
||||||
priv->mask_texture = mask_texture;
|
stex->mask_texture = mask_texture;
|
||||||
cogl_object_ref (priv->mask_texture);
|
cogl_object_ref (stex->mask_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
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)
|
if (unobscured_region)
|
||||||
return cairo_region_is_empty (unobscured_region);
|
return cairo_region_is_empty (unobscured_region);
|
||||||
@ -902,29 +864,26 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
|||||||
int width,
|
int width,
|
||||||
int height)
|
int height)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv;
|
|
||||||
cairo_region_t *unobscured_region;
|
cairo_region_t *unobscured_region;
|
||||||
const cairo_rectangle_int_t clip = { x, y, width, height };
|
const cairo_rectangle_int_t clip = { x, y, width, height };
|
||||||
|
|
||||||
priv = stex->priv;
|
if (stex->texture == NULL)
|
||||||
|
|
||||||
if (priv->texture == NULL)
|
|
||||||
return FALSE;
|
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;
|
stex->prev_invalidation = stex->last_invalidation;
|
||||||
priv->last_invalidation = g_get_monotonic_time ();
|
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;
|
gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
|
||||||
|
|
||||||
if (!fast_update)
|
if (!fast_update)
|
||||||
priv->fast_updates = 0;
|
stex->fast_updates = 0;
|
||||||
else if (priv->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
|
||||||
priv->fast_updates++;
|
stex->fast_updates++;
|
||||||
}
|
}
|
||||||
|
|
||||||
unobscured_region = effective_unobscured_region (stex);
|
unobscured_region = effective_unobscured_region (stex);
|
||||||
@ -978,14 +937,12 @@ void
|
|||||||
meta_shaped_texture_set_is_y_inverted (MetaShapedTexture *stex,
|
meta_shaped_texture_set_is_y_inverted (MetaShapedTexture *stex,
|
||||||
gboolean is_y_inverted)
|
gboolean is_y_inverted)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
if (stex->is_y_inverted == is_y_inverted)
|
||||||
|
|
||||||
if (priv->is_y_inverted == is_y_inverted)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_shaped_texture_reset_pipelines (stex);
|
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,
|
meta_shaped_texture_set_snippet (MetaShapedTexture *stex,
|
||||||
CoglSnippet *snippet)
|
CoglSnippet *snippet)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
if (stex->snippet == snippet)
|
||||||
|
|
||||||
if (priv->snippet == snippet)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_shaped_texture_reset_pipelines (stex);
|
meta_shaped_texture_reset_pipelines (stex);
|
||||||
|
|
||||||
g_clear_pointer (&priv->snippet, cogl_object_unref);
|
g_clear_pointer (&stex->snippet, cogl_object_unref);
|
||||||
if (snippet)
|
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)
|
meta_shaped_texture_get_texture (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
|
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,
|
meta_shaped_texture_set_opaque_region (MetaShapedTexture *stex,
|
||||||
cairo_region_t *opaque_region)
|
cairo_region_t *opaque_region)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||||
|
|
||||||
priv = stex->priv;
|
if (stex->opaque_region)
|
||||||
|
cairo_region_destroy (stex->opaque_region);
|
||||||
if (priv->opaque_region)
|
|
||||||
cairo_region_destroy (priv->opaque_region);
|
|
||||||
|
|
||||||
if (opaque_region)
|
if (opaque_region)
|
||||||
priv->opaque_region = cairo_region_reference (opaque_region);
|
stex->opaque_region = cairo_region_reference (opaque_region);
|
||||||
else
|
else
|
||||||
priv->opaque_region = NULL;
|
stex->opaque_region = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
cairo_region_t *
|
||||||
meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
|
meta_shaped_texture_get_opaque_region (MetaShapedTexture *stex)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
return stex->opaque_region;
|
||||||
return priv->opaque_region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_shaped_texture_set_transform (MetaShapedTexture *stex,
|
meta_shaped_texture_set_transform (MetaShapedTexture *stex,
|
||||||
MetaMonitorTransform transform)
|
MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
if (stex->transform == transform)
|
||||||
|
|
||||||
if (priv->transform == transform)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->transform = transform;
|
stex->transform = transform;
|
||||||
|
|
||||||
meta_shaped_texture_reset_pipelines (stex);
|
meta_shaped_texture_reset_pipelines (stex);
|
||||||
invalidate_size (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);
|
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)
|
if (texture == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1132,7 +1080,7 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
|||||||
if (clip != NULL)
|
if (clip != NULL)
|
||||||
cogl_object_unref (texture);
|
cogl_object_unref (texture);
|
||||||
|
|
||||||
mask_texture = stex->priv->mask_texture;
|
mask_texture = stex->mask_texture;
|
||||||
if (mask_texture != NULL)
|
if (mask_texture != NULL)
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
@ -1175,10 +1123,8 @@ meta_shaped_texture_set_fallback_size (MetaShapedTexture *stex,
|
|||||||
int fallback_width,
|
int fallback_width,
|
||||||
int fallback_height)
|
int fallback_height)
|
||||||
{
|
{
|
||||||
MetaShapedTexturePrivate *priv = stex->priv;
|
stex->fallback_width = fallback_width;
|
||||||
|
stex->fallback_height = fallback_height;
|
||||||
priv->fallback_width = fallback_width;
|
|
||||||
priv->fallback_height = fallback_height;
|
|
||||||
|
|
||||||
invalidate_size (stex);
|
invalidate_size (stex);
|
||||||
}
|
}
|
||||||
@ -1188,20 +1134,19 @@ meta_shaped_texture_cull_out (MetaCullable *cullable,
|
|||||||
cairo_region_t *unobscured_region,
|
cairo_region_t *unobscured_region,
|
||||||
cairo_region_t *clip_region)
|
cairo_region_t *clip_region)
|
||||||
{
|
{
|
||||||
MetaShapedTexture *self = META_SHAPED_TEXTURE (cullable);
|
MetaShapedTexture *stex = META_SHAPED_TEXTURE (cullable);
|
||||||
MetaShapedTexturePrivate *priv = self->priv;
|
|
||||||
|
|
||||||
set_unobscured_region (self, unobscured_region);
|
set_unobscured_region (stex, unobscured_region);
|
||||||
set_clip_region (self, clip_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)
|
if (unobscured_region)
|
||||||
cairo_region_subtract (unobscured_region, priv->opaque_region);
|
cairo_region_subtract (unobscured_region, stex->opaque_region);
|
||||||
if (clip_region)
|
if (clip_region)
|
||||||
cairo_region_subtract (clip_region, priv->opaque_region);
|
cairo_region_subtract (clip_region, stex->opaque_region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,15 @@
|
|||||||
#include "wayland/meta-wayland-private.h"
|
#include "wayland/meta-wayland-private.h"
|
||||||
#include "wayland/meta-window-wayland.h"
|
#include "wayland/meta-window-wayland.h"
|
||||||
|
|
||||||
typedef struct _MetaSurfaceActorWaylandPrivate
|
struct _MetaSurfaceActorWayland
|
||||||
{
|
{
|
||||||
|
MetaSurfaceActor parent;
|
||||||
|
|
||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
struct wl_list frame_callback_list;
|
struct wl_list frame_callback_list;
|
||||||
} MetaSurfaceActorWaylandPrivate;
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorWayland,
|
G_DEFINE_TYPE (MetaSurfaceActorWayland,
|
||||||
meta_surface_actor_wayland,
|
meta_surface_actor_wayland,
|
||||||
META_TYPE_SURFACE_ACTOR)
|
META_TYPE_SURFACE_ACTOR)
|
||||||
|
|
||||||
@ -93,9 +95,7 @@ void
|
|||||||
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
|
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
|
||||||
struct wl_list *frame_callbacks)
|
struct wl_list *frame_callbacks)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
wl_list_insert_list (&self->frame_callback_list, frame_callbacks);
|
||||||
|
|
||||||
wl_list_insert_list (&priv->frame_callback_list, frame_callbacks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaWindow *
|
static MetaWindow *
|
||||||
@ -162,15 +162,13 @@ static void
|
|||||||
meta_surface_actor_wayland_paint (ClutterActor *actor)
|
meta_surface_actor_wayland_paint (ClutterActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (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_insert_list (&compositor->frame_callbacks, &self->frame_callback_list);
|
||||||
wl_list_init (&priv->frame_callback_list);
|
wl_list_init (&self->frame_callback_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
|
CLUTTER_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->paint (actor);
|
||||||
@ -180,21 +178,19 @@ static void
|
|||||||
meta_surface_actor_wayland_dispose (GObject *object)
|
meta_surface_actor_wayland_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (object);
|
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (object);
|
||||||
MetaSurfaceActorWaylandPrivate *priv =
|
|
||||||
meta_surface_actor_wayland_get_instance_private (self);
|
|
||||||
MetaWaylandFrameCallback *cb, *next;
|
MetaWaylandFrameCallback *cb, *next;
|
||||||
MetaShapedTexture *stex =
|
MetaShapedTexture *stex =
|
||||||
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
|
|
||||||
meta_shaped_texture_set_texture (stex, NULL);
|
meta_shaped_texture_set_texture (stex, NULL);
|
||||||
if (priv->surface)
|
if (self->surface)
|
||||||
{
|
{
|
||||||
g_object_remove_weak_pointer (G_OBJECT (priv->surface),
|
g_object_remove_weak_pointer (G_OBJECT (self->surface),
|
||||||
(gpointer *) &priv->surface);
|
(gpointer *) &self->surface);
|
||||||
priv->surface = NULL;
|
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);
|
wl_resource_destroy (cb->resource);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
|
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
|
||||||
@ -233,14 +229,13 @@ MetaSurfaceActor *
|
|||||||
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
|
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 ());
|
g_assert (meta_is_wayland_compositor ());
|
||||||
|
|
||||||
wl_list_init (&priv->frame_callback_list);
|
wl_list_init (&self->frame_callback_list);
|
||||||
priv->surface = surface;
|
self->surface = surface;
|
||||||
g_object_add_weak_pointer (G_OBJECT (priv->surface),
|
g_object_add_weak_pointer (G_OBJECT (self->surface),
|
||||||
(gpointer *) &priv->surface);
|
(gpointer *) &self->surface);
|
||||||
|
|
||||||
return META_SURFACE_ACTOR (self);
|
return META_SURFACE_ACTOR (self);
|
||||||
}
|
}
|
||||||
@ -248,6 +243,5 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
|||||||
MetaWaylandSurface *
|
MetaWaylandSurface *
|
||||||
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
|
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
return self->surface;
|
||||||
return priv->surface;
|
|
||||||
}
|
}
|
||||||
|
@ -35,26 +35,10 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_SURFACE_ACTOR_WAYLAND (meta_surface_actor_wayland_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaSurfaceActorWayland,
|
||||||
#define META_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWaylandClass))
|
meta_surface_actor_wayland,
|
||||||
#define META_IS_SURFACE_ACTOR_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND))
|
META, SURFACE_ACTOR_WAYLAND,
|
||||||
#define META_IS_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND))
|
MetaSurfaceActor)
|
||||||
#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);
|
|
||||||
|
|
||||||
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
|
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
|
||||||
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);
|
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);
|
||||||
|
@ -37,8 +37,10 @@
|
|||||||
#include "x11/meta-x11-display-private.h"
|
#include "x11/meta-x11-display-private.h"
|
||||||
#include "x11/window-x11.h"
|
#include "x11/window-x11.h"
|
||||||
|
|
||||||
struct _MetaSurfaceActorX11Private
|
struct _MetaSurfaceActorX11
|
||||||
{
|
{
|
||||||
|
MetaSurfaceActor parent;
|
||||||
|
|
||||||
MetaWindow *window;
|
MetaWindow *window;
|
||||||
|
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
@ -60,35 +62,34 @@ struct _MetaSurfaceActorX11Private
|
|||||||
|
|
||||||
guint unredirected : 1;
|
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
|
static void
|
||||||
free_damage (MetaSurfaceActorX11 *self)
|
free_damage (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaDisplay *display = self->display;
|
||||||
MetaDisplay *display = priv->display;
|
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
if (priv->damage == None)
|
if (self->damage == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_x11_error_trap_push (display->x11_display);
|
meta_x11_error_trap_push (display->x11_display);
|
||||||
XDamageDestroy (xdisplay, priv->damage);
|
XDamageDestroy (xdisplay, self->damage);
|
||||||
priv->damage = None;
|
self->damage = None;
|
||||||
meta_x11_error_trap_pop (display->x11_display);
|
meta_x11_error_trap_pop (display->x11_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
detach_pixmap (MetaSurfaceActorX11 *self)
|
detach_pixmap (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaDisplay *display = self->display;
|
||||||
MetaDisplay *display = priv->display;
|
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
|
|
||||||
if (priv->pixmap == None)
|
if (self->pixmap == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
|
/* 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 ();
|
cogl_flush ();
|
||||||
|
|
||||||
meta_x11_error_trap_push (display->x11_display);
|
meta_x11_error_trap_push (display->x11_display);
|
||||||
XFreePixmap (xdisplay, priv->pixmap);
|
XFreePixmap (xdisplay, self->pixmap);
|
||||||
priv->pixmap = None;
|
self->pixmap = None;
|
||||||
meta_x11_error_trap_pop (display->x11_display);
|
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
|
static void
|
||||||
set_pixmap (MetaSurfaceActorX11 *self,
|
set_pixmap (MetaSurfaceActorX11 *self,
|
||||||
Pixmap pixmap)
|
Pixmap pixmap)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
|
||||||
|
|
||||||
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
CoglError *error = NULL;
|
CoglError *error = NULL;
|
||||||
CoglTexture *texture;
|
CoglTexture *texture;
|
||||||
|
|
||||||
g_assert (priv->pixmap == None);
|
g_assert (self->pixmap == None);
|
||||||
priv->pixmap = pixmap;
|
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)
|
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))))
|
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");
|
g_warning ("NOTE: Not using GLX TFP!\n");
|
||||||
|
|
||||||
priv->texture = texture;
|
self->texture = texture;
|
||||||
meta_shaped_texture_set_texture (stex, texture);
|
meta_shaped_texture_set_texture (stex, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_pixmap (MetaSurfaceActorX11 *self)
|
update_pixmap (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaDisplay *display = self->display;
|
||||||
MetaDisplay *display = priv->display;
|
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
|
||||||
|
|
||||||
if (priv->size_changed)
|
if (self->size_changed)
|
||||||
{
|
{
|
||||||
detach_pixmap (self);
|
detach_pixmap (self);
|
||||||
priv->size_changed = FALSE;
|
self->size_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->pixmap == None)
|
if (self->pixmap == None)
|
||||||
{
|
{
|
||||||
Pixmap new_pixmap;
|
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);
|
meta_x11_error_trap_push (display->x11_display);
|
||||||
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
||||||
@ -170,7 +168,7 @@ update_pixmap (MetaSurfaceActorX11 *self)
|
|||||||
if (new_pixmap == None)
|
if (new_pixmap == None)
|
||||||
{
|
{
|
||||||
meta_verbose ("Unable to get named pixmap for %s\n",
|
meta_verbose ("Unable to get named pixmap for %s\n",
|
||||||
meta_window_get_description (priv->window));
|
meta_window_get_description (self->window));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,8 +179,7 @@ update_pixmap (MetaSurfaceActorX11 *self)
|
|||||||
static gboolean
|
static gboolean
|
||||||
is_visible (MetaSurfaceActorX11 *self)
|
is_visible (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
return (self->pixmap != None) && !self->unredirected;
|
||||||
return (priv->pixmap != None) && !priv->unredirected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -190,31 +187,30 @@ meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
|
|||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
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;
|
MetaRectangle window_rect;
|
||||||
meta_window_get_frame_rect (priv->window, &window_rect);
|
meta_window_get_frame_rect (self->window, &window_rect);
|
||||||
|
|
||||||
if (x == 0 &&
|
if (x == 0 &&
|
||||||
y == 0 &&
|
y == 0 &&
|
||||||
window_rect.width == width &&
|
window_rect.width == width &&
|
||||||
window_rect.height == height)
|
window_rect.height == height)
|
||||||
priv->full_damage_frames_count++;
|
self->full_damage_frames_count++;
|
||||||
else
|
else
|
||||||
priv->full_damage_frames_count = 0;
|
self->full_damage_frames_count = 0;
|
||||||
|
|
||||||
if (priv->full_damage_frames_count >= 100)
|
if (self->full_damage_frames_count >= 100)
|
||||||
priv->does_full_damage = TRUE;
|
self->does_full_damage = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_visible (self))
|
if (!is_visible (self))
|
||||||
return;
|
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);
|
x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,17 +218,16 @@ static void
|
|||||||
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
|
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaDisplay *display = self->display;
|
||||||
MetaDisplay *display = priv->display;
|
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_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);
|
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);
|
meta_x11_error_trap_pop (display->x11_display);
|
||||||
|
|
||||||
priv->received_damage = FALSE;
|
self->received_damage = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_pixmap (self);
|
update_pixmap (self);
|
||||||
@ -249,7 +244,6 @@ static gboolean
|
|||||||
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
|
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (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 we're not ARGB32, then we're opaque. */
|
||||||
if (!meta_surface_actor_is_argb32 (actor))
|
if (!meta_surface_actor_is_argb32 (actor))
|
||||||
@ -261,7 +255,7 @@ meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
|
|||||||
if (!opaque_region)
|
if (!opaque_region)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
MetaWindow *window = priv->window;
|
MetaWindow *window = self->window;
|
||||||
cairo_rectangle_int_t client_area;
|
cairo_rectangle_int_t client_area;
|
||||||
meta_window_get_client_area_rect (window, &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)
|
meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (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))
|
if (meta_window_requested_dont_bypass_compositor (window))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -301,7 +294,7 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
|
|||||||
if (meta_window_is_override_redirect (window))
|
if (meta_window_is_override_redirect (window))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (priv->does_full_damage)
|
if (self->does_full_damage)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -310,14 +303,13 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
|
|||||||
static void
|
static void
|
||||||
sync_unredirected (MetaSurfaceActorX11 *self)
|
sync_unredirected (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaDisplay *display = self->display;
|
||||||
MetaDisplay *display = priv->display;
|
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_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);
|
meta_x11_error_trap_push (display->x11_display);
|
||||||
|
|
||||||
if (priv->unredirected)
|
if (self->unredirected)
|
||||||
{
|
{
|
||||||
detach_pixmap (self);
|
detach_pixmap (self);
|
||||||
XCompositeUnredirectWindow (xdisplay, xwindow, CompositeRedirectManual);
|
XCompositeUnredirectWindow (xdisplay, xwindow, CompositeRedirectManual);
|
||||||
@ -335,12 +327,11 @@ meta_surface_actor_x11_set_unredirected (MetaSurfaceActor *actor,
|
|||||||
gboolean unredirected)
|
gboolean unredirected)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
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;
|
return;
|
||||||
|
|
||||||
priv->unredirected = unredirected;
|
self->unredirected = unredirected;
|
||||||
sync_unredirected (self);
|
sync_unredirected (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,9 +339,8 @@ static gboolean
|
|||||||
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
|
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (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
|
static void
|
||||||
@ -367,9 +357,8 @@ meta_surface_actor_x11_dispose (GObject *object)
|
|||||||
static MetaWindow *
|
static MetaWindow *
|
||||||
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
|
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
|
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||||
|
return self->window;
|
||||||
return priv->window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -394,20 +383,17 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
|
|||||||
static void
|
static void
|
||||||
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
|
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
self->last_width = -1;
|
||||||
|
self->last_height = -1;
|
||||||
priv->last_width = -1;
|
|
||||||
priv->last_height = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_damage (MetaSurfaceActorX11 *self)
|
create_damage (MetaSurfaceActorX11 *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
Display *xdisplay = meta_x11_display_get_xdisplay (self->display->x11_display);
|
||||||
Display *xdisplay = meta_x11_display_get_xdisplay (priv->display->x11_display);
|
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
|
||||||
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
|
|
||||||
|
|
||||||
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
|
self->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -425,39 +411,37 @@ window_decorated_notify (MetaWindow *window,
|
|||||||
static void
|
static void
|
||||||
reset_texture (MetaSurfaceActorX11 *self)
|
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));
|
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
|
|
||||||
if (!priv->texture)
|
if (!self->texture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Setting the texture to NULL will cause all the FBO's cached by the
|
/* Setting the texture to NULL will cause all the FBO's cached by the
|
||||||
* shaped texture's MetaTextureTower to be discarded and recreated.
|
* shaped texture's MetaTextureTower to be discarded and recreated.
|
||||||
*/
|
*/
|
||||||
meta_shaped_texture_set_texture (stex, NULL);
|
meta_shaped_texture_set_texture (stex, NULL);
|
||||||
meta_shaped_texture_set_texture (stex, priv->texture);
|
meta_shaped_texture_set_texture (stex, self->texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaSurfaceActor *
|
MetaSurfaceActor *
|
||||||
meta_surface_actor_x11_new (MetaWindow *window)
|
meta_surface_actor_x11_new (MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
|
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);
|
MetaDisplay *display = meta_window_get_display (window);
|
||||||
|
|
||||||
g_assert (!meta_is_wayland_compositor ());
|
g_assert (!meta_is_wayland_compositor ());
|
||||||
|
|
||||||
priv->window = window;
|
self->window = window;
|
||||||
priv->display = display;
|
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);
|
G_CALLBACK (reset_texture), self, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
create_damage (self);
|
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);
|
G_CALLBACK (window_decorated_notify), self, 0);
|
||||||
|
|
||||||
priv->unredirected = FALSE;
|
self->unredirected = FALSE;
|
||||||
sync_unredirected (self);
|
sync_unredirected (self);
|
||||||
|
|
||||||
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
|
||||||
@ -468,15 +452,14 @@ void
|
|||||||
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
|
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
|
||||||
int width, int height)
|
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));
|
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||||
|
|
||||||
if (priv->last_width == width &&
|
if (self->last_width == width &&
|
||||||
priv->last_height == height)
|
self->last_height == height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv->size_changed = TRUE;
|
self->size_changed = TRUE;
|
||||||
priv->last_width = width;
|
self->last_width = width;
|
||||||
priv->last_height = height;
|
self->last_height = height;
|
||||||
meta_shaped_texture_set_fallback_size (stex, width, height);
|
meta_shaped_texture_set_fallback_size (stex, width, height);
|
||||||
}
|
}
|
||||||
|
@ -37,26 +37,10 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_SURFACE_ACTOR_X11 (meta_surface_actor_x11_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaSurfaceActorX11,
|
||||||
#define META_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11Class))
|
meta_surface_actor_x11,
|
||||||
#define META_IS_SURFACE_ACTOR_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_X11))
|
META, SURFACE_ACTOR_X11,
|
||||||
#define META_IS_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_X11))
|
MetaSurfaceActor)
|
||||||
#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);
|
|
||||||
|
|
||||||
MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window);
|
MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "compositor/meta-shaped-texture-private.h"
|
#include "compositor/meta-shaped-texture-private.h"
|
||||||
#include "meta/meta-shaped-texture.h"
|
#include "meta/meta-shaped-texture.h"
|
||||||
|
|
||||||
struct _MetaSurfaceActorPrivate
|
typedef struct _MetaSurfaceActorPrivate
|
||||||
{
|
{
|
||||||
MetaShapedTexture *texture;
|
MetaShapedTexture *texture;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ struct _MetaSurfaceActorPrivate
|
|||||||
/* Freeze/thaw accounting */
|
/* Freeze/thaw accounting */
|
||||||
cairo_region_t *pending_damage;
|
cairo_region_t *pending_damage;
|
||||||
guint frozen : 1;
|
guint frozen : 1;
|
||||||
};
|
} MetaSurfaceActorPrivate;
|
||||||
|
|
||||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||||
|
|
||||||
@ -49,7 +49,8 @@ meta_surface_actor_pick (ClutterActor *actor,
|
|||||||
const ClutterColor *color)
|
const ClutterColor *color)
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
|
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
|
||||||
MetaSurfaceActorPrivate *priv = self->priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
ClutterActorIter iter;
|
ClutterActorIter iter;
|
||||||
ClutterActor *child;
|
ClutterActor *child;
|
||||||
|
|
||||||
@ -113,7 +114,8 @@ static void
|
|||||||
meta_surface_actor_dispose (GObject *object)
|
meta_surface_actor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaSurfaceActor *self = META_SURFACE_ACTOR (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);
|
g_clear_pointer (&priv->input_region, cairo_region_destroy);
|
||||||
|
|
||||||
@ -177,11 +179,8 @@ texture_size_changed (MetaShapedTexture *texture,
|
|||||||
static void
|
static void
|
||||||
meta_surface_actor_init (MetaSurfaceActor *self)
|
meta_surface_actor_init (MetaSurfaceActor *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
||||||
META_TYPE_SURFACE_ACTOR,
|
|
||||||
MetaSurfaceActorPrivate);
|
|
||||||
|
|
||||||
priv->texture = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
|
priv->texture = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
|
||||||
g_signal_connect_object (priv->texture, "size-changed",
|
g_signal_connect_object (priv->texture, "size-changed",
|
||||||
@ -193,20 +192,27 @@ cairo_surface_t *
|
|||||||
meta_surface_actor_get_image (MetaSurfaceActor *self,
|
meta_surface_actor_get_image (MetaSurfaceActor *self,
|
||||||
cairo_rectangle_int_t *clip)
|
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 *
|
MetaShapedTexture *
|
||||||
meta_surface_actor_get_texture (MetaSurfaceActor *self)
|
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
|
static void
|
||||||
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
||||||
int x, int y, int width, int height)
|
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))
|
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height))
|
||||||
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
|
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
|
||||||
@ -215,7 +221,9 @@ meta_surface_actor_update_area (MetaSurfaceActor *self,
|
|||||||
gboolean
|
gboolean
|
||||||
meta_surface_actor_is_obscured (MetaSurfaceActor *self)
|
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);
|
return meta_shaped_texture_is_obscured (priv->texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +231,8 @@ void
|
|||||||
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region)
|
cairo_region_t *region)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv = self->priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
if (priv->input_region)
|
if (priv->input_region)
|
||||||
cairo_region_destroy (priv->input_region);
|
cairo_region_destroy (priv->input_region);
|
||||||
@ -238,21 +247,27 @@ void
|
|||||||
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region)
|
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);
|
meta_shaped_texture_set_opaque_region (priv->texture, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_region_t *
|
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);
|
return meta_shaped_texture_get_opaque_region (priv->texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
is_frozen (MetaSurfaceActor *self)
|
is_frozen (MetaSurfaceActor *self)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv = self->priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
return priv->frozen;
|
return priv->frozen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +275,8 @@ void
|
|||||||
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
||||||
int x, int y, int width, int height)
|
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))
|
if (is_frozen (self))
|
||||||
{
|
{
|
||||||
@ -339,7 +355,8 @@ void
|
|||||||
meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
meta_surface_actor_set_frozen (MetaSurfaceActor *self,
|
||||||
gboolean frozen)
|
gboolean frozen)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv = self->priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
priv->frozen = frozen;
|
priv->frozen = frozen;
|
||||||
|
|
||||||
@ -390,7 +407,8 @@ void
|
|||||||
meta_surface_actor_set_transform (MetaSurfaceActor *self,
|
meta_surface_actor_set_transform (MetaSurfaceActor *self,
|
||||||
MetaMonitorTransform transform)
|
MetaMonitorTransform transform)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorPrivate *priv = self->priv;
|
MetaSurfaceActorPrivate *priv =
|
||||||
|
meta_surface_actor_get_instance_private (self);
|
||||||
|
|
||||||
meta_shaped_texture_set_transform (priv->texture, transform);
|
meta_shaped_texture_set_transform (priv->texture, transform);
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,11 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_SURFACE_ACTOR (meta_surface_actor_get_type())
|
#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))
|
G_DECLARE_DERIVABLE_TYPE (MetaSurfaceActor,
|
||||||
#define META_SURFACE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR, MetaSurfaceActorClass))
|
meta_surface_actor,
|
||||||
#define META_IS_SURFACE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR))
|
META, SURFACE_ACTOR,
|
||||||
#define META_IS_SURFACE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR))
|
ClutterActor)
|
||||||
#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;
|
|
||||||
|
|
||||||
struct _MetaSurfaceActorClass
|
struct _MetaSurfaceActorClass
|
||||||
{
|
{
|
||||||
@ -40,15 +35,6 @@ struct _MetaSurfaceActorClass
|
|||||||
MetaWindow *(* get_window) (MetaSurfaceActor *actor);
|
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_surface_t *meta_surface_actor_get_image (MetaSurfaceActor *self,
|
||||||
cairo_rectangle_int_t *clip);
|
cairo_rectangle_int_t *clip);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,30 +35,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define META_TYPE_BACKGROUND_ACTOR (meta_background_actor_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaBackgroundActor,
|
||||||
#define META_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
|
meta_background_actor,
|
||||||
#define META_IS_BACKGROUND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_ACTOR))
|
META, BACKGROUND_ACTOR,
|
||||||
#define META_IS_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_ACTOR))
|
ClutterActor)
|
||||||
#define META_BACKGROUND_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
|
|
||||||
|
|
||||||
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,
|
ClutterActor *meta_background_actor_new (MetaDisplay *display,
|
||||||
int monitor);
|
int monitor);
|
||||||
|
@ -6,31 +6,10 @@
|
|||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
#define META_TYPE_BACKGROUND_GROUP (meta_background_group_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaBackgroundGroup,
|
||||||
#define META_BACKGROUND_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_GROUP, MetaBackgroundGroupClass))
|
meta_background_group,
|
||||||
#define META_IS_BACKGROUND_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_GROUP))
|
META, BACKGROUND_GROUP,
|
||||||
#define META_IS_BACKGROUND_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_GROUP))
|
ClutterActor)
|
||||||
#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);
|
|
||||||
|
|
||||||
ClutterActor *meta_background_group_new (void);
|
ClutterActor *meta_background_group_new (void);
|
||||||
|
|
||||||
|
@ -30,47 +30,24 @@
|
|||||||
#include "meta/display.h"
|
#include "meta/display.h"
|
||||||
|
|
||||||
#define META_TYPE_BACKGROUND_IMAGE (meta_background_image_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaBackgroundImage,
|
||||||
#define META_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_IMAGE, MetaBackgroundImageClass))
|
meta_background_image,
|
||||||
#define META_IS_BACKGROUND_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_IMAGE))
|
META, BACKGROUND_IMAGE,
|
||||||
#define META_IS_BACKGROUND_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_IMAGE))
|
GObject)
|
||||||
#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);
|
|
||||||
|
|
||||||
gboolean meta_background_image_is_loaded (MetaBackgroundImage *image);
|
gboolean meta_background_image_is_loaded (MetaBackgroundImage *image);
|
||||||
gboolean meta_background_image_get_success (MetaBackgroundImage *image);
|
gboolean meta_background_image_get_success (MetaBackgroundImage *image);
|
||||||
CoglTexture *meta_background_image_get_texture (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))
|
|
||||||
|
|
||||||
/**
|
#define META_TYPE_BACKGROUND_IMAGE_CACHE (meta_background_image_cache_get_type ())
|
||||||
* MetaBackgroundImageCache:
|
G_DECLARE_FINAL_TYPE (MetaBackgroundImageCache,
|
||||||
*
|
meta_background_image_cache,
|
||||||
* #MetaBackgroundImageCache caches loading of textures for backgrounds; there's actually
|
META, BACKGROUND_IMAGE_CACHE,
|
||||||
* nothing background specific about it, other than it is tuned to work well for
|
GObject)
|
||||||
* large images as typically are used for backgrounds.
|
|
||||||
*/
|
|
||||||
typedef struct _MetaBackgroundImageCache MetaBackgroundImageCache;
|
|
||||||
typedef struct _MetaBackgroundImageCacheClass MetaBackgroundImageCacheClass;
|
|
||||||
|
|
||||||
MetaBackgroundImageCache *meta_background_image_cache_get_default (void);
|
MetaBackgroundImageCache *meta_background_image_cache_get_default (void);
|
||||||
|
|
||||||
GType meta_background_image_cache_get_type (void);
|
|
||||||
|
|
||||||
MetaBackgroundImage *meta_background_image_cache_load (MetaBackgroundImageCache *cache,
|
MetaBackgroundImage *meta_background_image_cache_load (MetaBackgroundImageCache *cache,
|
||||||
GFile *file);
|
GFile *file);
|
||||||
void meta_background_image_cache_purge (MetaBackgroundImageCache *cache,
|
void meta_background_image_cache_purge (MetaBackgroundImageCache *cache,
|
||||||
|
@ -35,33 +35,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define META_TYPE_BACKGROUND (meta_background_get_type ())
|
#define META_TYPE_BACKGROUND (meta_background_get_type ())
|
||||||
#define META_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND, MetaBackground))
|
G_DECLARE_FINAL_TYPE (MetaBackground,
|
||||||
#define META_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND, MetaBackgroundClass))
|
meta_background,
|
||||||
#define META_IS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND))
|
META, BACKGROUND,
|
||||||
#define META_IS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND))
|
GObject)
|
||||||
#define META_BACKGROUND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND, MetaBackgroundClass))
|
|
||||||
|
|
||||||
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);
|
void meta_background_refresh_all (void);
|
||||||
|
|
||||||
GType meta_background_get_type (void);
|
|
||||||
|
|
||||||
MetaBackground *meta_background_new (MetaDisplay *display);
|
MetaBackground *meta_background_new (MetaDisplay *display);
|
||||||
|
|
||||||
void meta_background_set_color (MetaBackground *self,
|
void meta_background_set_color (MetaBackground *self,
|
||||||
|
@ -30,15 +30,11 @@
|
|||||||
#include "meta/workspace.h"
|
#include "meta/workspace.h"
|
||||||
|
|
||||||
#define META_TYPE_CURSOR_TRACKER (meta_cursor_tracker_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaCursorTracker,
|
||||||
#define META_CURSOR_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_CURSOR_TRACKER, MetaCursorTrackerClass))
|
meta_cursor_tracker,
|
||||||
#define META_IS_CURSOR_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_CURSOR_TRACKER))
|
META, CURSOR_TRACKER,
|
||||||
#define META_IS_CURSOR_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_CURSOR_TRACKER))
|
GObject)
|
||||||
#define META_CURSOR_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_CURSOR_TRACKER, MetaCursorTrackerClass))
|
|
||||||
|
|
||||||
typedef struct _MetaCursorTrackerClass MetaCursorTrackerClass;
|
|
||||||
|
|
||||||
GType meta_cursor_tracker_get_type (void);
|
|
||||||
|
|
||||||
MetaCursorTracker *meta_cursor_tracker_get_for_display (MetaDisplay *display);
|
MetaCursorTracker *meta_cursor_tracker_get_for_display (MetaDisplay *display);
|
||||||
|
|
||||||
|
@ -58,11 +58,10 @@ struct _MetaShadowParams
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaShadowFactory,
|
||||||
#define META_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
|
meta_shadow_factory,
|
||||||
#define META_IS_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHADOW_FACTORY))
|
META, SHADOW_FACTORY,
|
||||||
#define META_IS_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHADOW_FACTORY))
|
GObject)
|
||||||
#define META_SHADOW_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MetaShadowFactory:
|
* MetaShadowFactory:
|
||||||
@ -71,13 +70,9 @@ struct _MetaShadowParams
|
|||||||
* so that multiple shadows created for the same shape with the same radius will
|
* so that multiple shadows created for the same shape with the same radius will
|
||||||
* share the same MetaShadow.
|
* share the same MetaShadow.
|
||||||
*/
|
*/
|
||||||
typedef struct _MetaShadowFactory MetaShadowFactory;
|
|
||||||
typedef struct _MetaShadowFactoryClass MetaShadowFactoryClass;
|
|
||||||
|
|
||||||
MetaShadowFactory *meta_shadow_factory_get_default (void);
|
MetaShadowFactory *meta_shadow_factory_get_default (void);
|
||||||
|
|
||||||
GType meta_shadow_factory_get_type (void);
|
|
||||||
|
|
||||||
void meta_shadow_factory_set_params (MetaShadowFactory *factory,
|
void meta_shadow_factory_set_params (MetaShadowFactory *factory,
|
||||||
const char *class_name,
|
const char *class_name,
|
||||||
gboolean focused,
|
gboolean focused,
|
||||||
|
@ -30,38 +30,12 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define META_TYPE_SHAPED_TEXTURE (meta_shaped_texture_get_type())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaShapedTexture,
|
||||||
#define META_SHAPED_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHAPED_TEXTURE, MetaShapedTextureClass))
|
meta_shaped_texture,
|
||||||
#define META_IS_SHAPED_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHAPED_TEXTURE))
|
META, SHAPED_TEXTURE,
|
||||||
#define META_IS_SHAPED_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHAPED_TEXTURE))
|
ClutterActor)
|
||||||
#define META_SHAPED_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHAPED_TEXTURE, MetaShapedTextureClass))
|
|
||||||
|
|
||||||
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,
|
void meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
|
||||||
gboolean create_mipmaps);
|
gboolean create_mipmaps);
|
||||||
|
@ -28,34 +28,12 @@
|
|||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
#include "meta/compositor.h"
|
#include "meta/compositor.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* MetaWindowActor object (ClutterGroup sub-class)
|
|
||||||
*/
|
|
||||||
#define META_TYPE_WINDOW_ACTOR (meta_window_actor_get_type ())
|
#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))
|
G_DECLARE_FINAL_TYPE (MetaWindowActor,
|
||||||
#define META_WINDOW_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_WINDOW_ACTOR, MetaWindowActorClass))
|
meta_window_actor,
|
||||||
#define META_IS_WINDOW_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_WINDOW_ACTOR))
|
META, WINDOW_ACTOR,
|
||||||
#define META_IS_WINDOW_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_WINDOW_ACTOR))
|
ClutterActor)
|
||||||
#define META_WINDOW_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_WINDOW_ACTOR, MetaWindowActorClass))
|
|
||||||
|
|
||||||
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);
|
Window meta_window_actor_get_x_window (MetaWindowActor *self);
|
||||||
MetaWindow * meta_window_actor_get_meta_window (MetaWindowActor *self);
|
MetaWindow * meta_window_actor_get_meta_window (MetaWindowActor *self);
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
#define META_TYPE_WINDOW_GROUP (meta_window_group_get_type())
|
#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 */
|
#endif /* META_WINDOW_GROUP_H */
|
||||||
|
@ -30,7 +30,10 @@
|
|||||||
#include <meta/types.h>
|
#include <meta/types.h>
|
||||||
|
|
||||||
#define META_TYPE_WORKSPACE_MANAGER (meta_workspace_manager_get_type ())
|
#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);
|
GList *meta_workspace_manager_get_workspaces (MetaWorkspaceManager *workspace_manager);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user