Make MetaShadowFactory public

The basic MetaShadowFactory type is moved to a public header, while
the functions to fetch and paint shadows are kept private.
The public object will be used for configuration of shadows by
plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
This commit is contained in:
Owen W. Taylor 2010-11-11 10:21:36 -05:00
parent d56d267f7d
commit 3c4d52732e
5 changed files with 66 additions and 26 deletions

View File

@ -29,7 +29,7 @@ mutter_SOURCES= \
compositor/meta-plugin-manager.c \ compositor/meta-plugin-manager.c \
compositor/meta-plugin-manager.h \ compositor/meta-plugin-manager.h \
compositor/meta-shadow-factory.c \ compositor/meta-shadow-factory.c \
compositor/meta-shadow-factory.h \ compositor/meta-shadow-factory-private.h \
compositor/meta-shaped-texture.c \ compositor/meta-shaped-texture.c \
compositor/meta-shaped-texture.h \ compositor/meta-shaped-texture.h \
compositor/meta-texture-tower.c \ compositor/meta-texture-tower.c \
@ -44,6 +44,7 @@ mutter_SOURCES= \
compositor/region-utils.h \ compositor/region-utils.h \
include/compositor.h \ include/compositor.h \
include/meta-plugin.h \ include/meta-plugin.h \
include/meta-shadow-factory.h \
include/meta-window-actor.h \ include/meta-window-actor.h \
include/compositor-mutter.h \ include/compositor-mutter.h \
core/constraints.c \ core/constraints.c \
@ -169,6 +170,7 @@ libmutterinclude_base_headers = \
include/group.h \ include/group.h \
include/keybindings.h \ include/keybindings.h \
include/meta-plugin.h \ include/meta-plugin.h \
include/meta-shadow-factory.h \
include/meta-window-actor.h include/meta-window-actor.h
# Excluded from scanning for introspection but installed # Excluded from scanning for introspection but installed

View File

@ -22,18 +22,13 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef __META_SHADOW_FACTORY_H__ #ifndef __META_SHADOW_FACTORY_PRIVATE_H__
#define __META_SHADOW_FACTORY_H__ #define __META_SHADOW_FACTORY_PRIVATE_H__
#include <cairo.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include "meta-window-shape.h" #include "meta-window-shape.h"
#include "meta-shadow-factory.h"
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
#define META_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactory))
#define META_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
#define META_IS_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHADOW_FACTORY))
#define META_IS_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHADOW_FACTORY))
#define META_SHADOW_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
/** /**
* MetaShadow: * MetaShadow:
@ -59,20 +54,8 @@ void meta_shadow_get_bounds (MetaShadow *shadow,
int window_height, int window_height,
cairo_rectangle_int_t *bounds); cairo_rectangle_int_t *bounds);
/**
* MetaShadowFactory:
* #MetaShadowFactory is used to create window shadows. It caches shadows internally
* so that multiple shadows created for the same shape with the same radius will
* share the same MetaShadow.
*/
typedef struct _MetaShadowFactory MetaShadowFactory;
typedef struct _MetaShadowFactoryClass MetaShadowFactoryClass;
MetaShadowFactory *meta_shadow_factory_get_default (void);
GType meta_shadow_factory_get_type (void);
MetaShadowFactory *meta_shadow_factory_new (void); MetaShadowFactory *meta_shadow_factory_new (void);
MetaShadow * meta_shadow_factory_get_shadow (MetaShadowFactory *factory, MetaShadow * meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
MetaWindowShape *shape, MetaWindowShape *shape,
int width, int width,
@ -80,4 +63,4 @@ MetaShadow * meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
int radius, int radius,
int top_fade); int top_fade);
#endif /* __META_SHADOW_FACTORY_H__ */ #endif /* __META_SHADOW_FACTORY_PRIVATE_H__ */

View File

@ -25,7 +25,7 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include "meta-shadow-factory.h" #include "meta-shadow-factory-private.h"
#include "region-utils.h" #include "region-utils.h"
/* This file implements blurring the shape of a window to produce a /* This file implements blurring the shape of a window to produce a
@ -304,6 +304,11 @@ meta_shadow_factory_new (void)
return g_object_new (META_TYPE_SHADOW_FACTORY, NULL); return g_object_new (META_TYPE_SHADOW_FACTORY, NULL);
} }
/**
* meta_shadow_factory_get_default:
*
* Return value: (transfer none): the global singleton shadow factory
*/
MetaShadowFactory * MetaShadowFactory *
meta_shadow_factory_get_default (void) meta_shadow_factory_get_default (void)
{ {

View File

@ -17,7 +17,7 @@
#include "xprops.h" #include "xprops.h"
#include "compositor-private.h" #include "compositor-private.h"
#include "meta-shadow-factory.h" #include "meta-shadow-factory-private.h"
#include "meta-shaped-texture.h" #include "meta-shaped-texture.h"
#include "meta-window-actor-private.h" #include "meta-window-actor-private.h"

View File

@ -0,0 +1,50 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* MetaShadowFactory:
*
* Create and cache shadow textures for arbitrary window shapes
*
* Copyright (C) 2010 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __META_SHADOW_FACTORY_H__
#define __META_SHADOW_FACTORY_H__
#include <glib-object.h>
#define META_TYPE_SHADOW_FACTORY (meta_shadow_factory_get_type ())
#define META_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactory))
#define META_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
#define META_IS_SHADOW_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SHADOW_FACTORY))
#define META_IS_SHADOW_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SHADOW_FACTORY))
#define META_SHADOW_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SHADOW_FACTORY, MetaShadowFactoryClass))
/**
* MetaShadowFactory:
* #MetaShadowFactory is used to create window shadows. It caches shadows internally
* so that multiple shadows created for the same shape with the same radius will
* share the same MetaShadow.
*/
typedef struct _MetaShadowFactory MetaShadowFactory;
typedef struct _MetaShadowFactoryClass MetaShadowFactoryClass;
MetaShadowFactory *meta_shadow_factory_get_default (void);
GType meta_shadow_factory_get_type (void);
#endif /* __META_SHADOW_FACTORY_H__ */