x11: Clean up TexturePixmap header and private data structure

Align the header file and use bitfields instead of booleans.
This commit is contained in:
Emmanuele Bassi 2010-07-21 15:14:36 +01:00
parent 0e80747a68
commit 8538e1bf58
2 changed files with 55 additions and 57 deletions

View File

@ -73,6 +73,7 @@ enum
{
UPDATE_AREA,
QUEUE_DAMAGE_REDRAW,
/* FIXME: Pixmap lost signal? */
LAST_SIGNAL
};
@ -100,23 +101,22 @@ struct _ClutterX11TexturePixmapPrivate
guint pixmap_width, pixmap_height;
guint depth;
gboolean automatic_updates;
Damage damage;
/* FIXME: lots of gbooleans. coalesce into bitfields */
gboolean window_redirect_automatic;
gboolean window_mapped;
gboolean destroyed;
gboolean owns_pixmap;
gboolean override_redirect;
gint window_x, window_y;
guint window_redirect_automatic : 1;
guint window_mapped : 1;
guint destroyed : 1;
guint owns_pixmap : 1;
guint override_redirect : 1;
guint automatic_updates : 1;
};
static int _damage_event_base = 0;
/* FIXME: Ultimatly with current cogl we should subclass clutter actor */
G_DEFINE_TYPE (ClutterX11TexturePixmap, \
clutter_x11_texture_pixmap, \
G_DEFINE_TYPE (ClutterX11TexturePixmap,
clutter_x11_texture_pixmap,
CLUTTER_TYPE_TEXTURE);
static gboolean
@ -1161,6 +1161,7 @@ clutter_x11_texture_pixmap_set_automatic (ClutterX11TexturePixmap *texture,
priv = texture->priv;
setting = !!setting;
if (setting == priv->automatic_updates)
return;
@ -1173,4 +1174,3 @@ clutter_x11_texture_pixmap_set_automatic (ClutterX11TexturePixmap *texture,
priv->automatic_updates = setting;
}

View File

@ -29,21 +29,37 @@
#include <glib.h>
#include <glib-object.h>
#include <clutter/clutter.h>
#include <X11/Xlib.h>
G_BEGIN_DECLS
#define CLUTTER_X11_TYPE_TEXTURE_PIXMAP (clutter_x11_texture_pixmap_get_type ())
#define CLUTTER_X11_TEXTURE_PIXMAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmap))
#define CLUTTER_X11_TEXTURE_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmapClass))
#define CLUTTER_X11_IS_TEXTURE_PIXMAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP))
#define CLUTTER_X11_IS_TEXTURE_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_X11_TYPE_TEXTURE_PIXMAP))
#define CLUTTER_X11_TEXTURE_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmapClass))
#define CLUTTER_X11_TYPE_TEXTURE_PIXMAP (clutter_x11_texture_pixmap_get_type ())
#define CLUTTER_X11_TEXTURE_PIXMAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmap))
#define CLUTTER_X11_TEXTURE_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmapClass))
#define CLUTTER_X11_IS_TEXTURE_PIXMAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP))
#define CLUTTER_X11_IS_TEXTURE_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_X11_TYPE_TEXTURE_PIXMAP))
#define CLUTTER_X11_TEXTURE_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_X11_TYPE_TEXTURE_PIXMAP, ClutterX11TexturePixmapClass))
typedef struct _ClutterX11TexturePixmap ClutterX11TexturePixmap;
typedef struct _ClutterX11TexturePixmapClass ClutterX11TexturePixmapClass;
typedef struct _ClutterX11TexturePixmapPrivate ClutterX11TexturePixmapPrivate;
/**
* ClutterX11TexturePixmap:
*
* The #ClutterX11TexturePixmap structure contains only private data
*
* Since: 0.8
*/
struct _ClutterX11TexturePixmap
{
/*< private >*/
ClutterTexture parent;
ClutterX11TexturePixmapPrivate *priv;
};
/**
* ClutterX11TexturePixmapClass:
* @update_area: virtual function for updating the area of the texture
@ -55,54 +71,36 @@ typedef struct _ClutterX11TexturePixmapPrivate ClutterX11TexturePixmapPrivate;
struct _ClutterX11TexturePixmapClass
{
/*< private >*/
ClutterTextureClass parent_class;
ClutterTextureClass parent_class;
/*< public >*/
void (*update_area) (ClutterX11TexturePixmap *texture,
gint x,
gint y,
gint width,
gint height);
};
/**
* ClutterX11TexturePixmap:
*
* The #ClutterX11TexturePixmap structure contains only private data
*
* Since: 0.8
*/
struct _ClutterX11TexturePixmap
{
/*< private >*/
ClutterTexture parent;
ClutterX11TexturePixmapPrivate *priv;
void (* update_area) (ClutterX11TexturePixmap *texture,
gint x,
gint y,
gint width,
gint height);
};
GType clutter_x11_texture_pixmap_get_type (void) G_GNUC_CONST;
ClutterActor * clutter_x11_texture_pixmap_new (void);
ClutterActor * clutter_x11_texture_pixmap_new_with_pixmap (Pixmap pixmap);
ClutterActor *clutter_x11_texture_pixmap_new (void);
ClutterActor *clutter_x11_texture_pixmap_new_with_pixmap (Pixmap pixmap);
ClutterActor *clutter_x11_texture_pixmap_new_with_window (Window window);
ClutterActor * clutter_x11_texture_pixmap_new_with_window (Window window);
void clutter_x11_texture_pixmap_set_automatic (ClutterX11TexturePixmap *texture,
gboolean setting);
void clutter_x11_texture_pixmap_set_pixmap (ClutterX11TexturePixmap *texture,
Pixmap pixmap);
void clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
Window window,
gboolean automatic);
void clutter_x11_texture_pixmap_set_pixmap (ClutterX11TexturePixmap *texture,
Pixmap pixmap);
void clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
Window window,
gboolean automatic);
void clutter_x11_texture_pixmap_sync_window (ClutterX11TexturePixmap *texture);
void clutter_x11_texture_pixmap_update_area (ClutterX11TexturePixmap *texture,
gint x,
gint y,
gint width,
gint height);
void clutter_x11_texture_pixmap_set_automatic (ClutterX11TexturePixmap *texture,
gboolean setting);
void clutter_x11_texture_pixmap_sync_window (ClutterX11TexturePixmap *texture);
void clutter_x11_texture_pixmap_update_area (ClutterX11TexturePixmap *texture,
gint x,
gint y,
gint width,
gint height);
G_END_DECLS