From 3c4d52732ec1bcb17cfc53ba43b57c9a2932e24a Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 11 Nov 2010 10:21:36 -0500 Subject: [PATCH] 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 --- src/Makefile.am | 4 +- ...actory.h => meta-shadow-factory-private.h} | 29 +++-------- src/compositor/meta-shadow-factory.c | 7 ++- src/compositor/meta-window-actor.c | 2 +- src/include/meta-shadow-factory.h | 50 +++++++++++++++++++ 5 files changed, 66 insertions(+), 26 deletions(-) rename src/compositor/{meta-shadow-factory.h => meta-shadow-factory-private.h} (68%) create mode 100644 src/include/meta-shadow-factory.h diff --git a/src/Makefile.am b/src/Makefile.am index 154f6add7..d010ace15 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ mutter_SOURCES= \ compositor/meta-plugin-manager.c \ compositor/meta-plugin-manager.h \ 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.h \ compositor/meta-texture-tower.c \ @@ -44,6 +44,7 @@ mutter_SOURCES= \ compositor/region-utils.h \ include/compositor.h \ include/meta-plugin.h \ + include/meta-shadow-factory.h \ include/meta-window-actor.h \ include/compositor-mutter.h \ core/constraints.c \ @@ -169,6 +170,7 @@ libmutterinclude_base_headers = \ include/group.h \ include/keybindings.h \ include/meta-plugin.h \ + include/meta-shadow-factory.h \ include/meta-window-actor.h # Excluded from scanning for introspection but installed diff --git a/src/compositor/meta-shadow-factory.h b/src/compositor/meta-shadow-factory-private.h similarity index 68% rename from src/compositor/meta-shadow-factory.h rename to src/compositor/meta-shadow-factory-private.h index 8dc9e958d..713ddc601 100644 --- a/src/compositor/meta-shadow-factory.h +++ b/src/compositor/meta-shadow-factory-private.h @@ -22,18 +22,13 @@ * 02111-1307, USA. */ -#ifndef __META_SHADOW_FACTORY_H__ -#define __META_SHADOW_FACTORY_H__ +#ifndef __META_SHADOW_FACTORY_PRIVATE_H__ +#define __META_SHADOW_FACTORY_PRIVATE_H__ +#include #include #include "meta-window-shape.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)) +#include "meta-shadow-factory.h" /** * MetaShadow: @@ -59,20 +54,8 @@ void meta_shadow_get_bounds (MetaShadow *shadow, int window_height, 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_new (void); -MetaShadowFactory *meta_shadow_factory_get_default (void); - -GType meta_shadow_factory_get_type (void); - -MetaShadowFactory *meta_shadow_factory_new (void); MetaShadow * meta_shadow_factory_get_shadow (MetaShadowFactory *factory, MetaWindowShape *shape, int width, @@ -80,4 +63,4 @@ MetaShadow * meta_shadow_factory_get_shadow (MetaShadowFactory *factory, int radius, int top_fade); -#endif /* __META_SHADOW_FACTORY_H__ */ +#endif /* __META_SHADOW_FACTORY_PRIVATE_H__ */ diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index 11431c603..2dc426acc 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -25,7 +25,7 @@ #include #include -#include "meta-shadow-factory.h" +#include "meta-shadow-factory-private.h" #include "region-utils.h" /* 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); } +/** + * meta_shadow_factory_get_default: + * + * Return value: (transfer none): the global singleton shadow factory + */ MetaShadowFactory * meta_shadow_factory_get_default (void) { diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index ddedd51ef..6f0496fbd 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -17,7 +17,7 @@ #include "xprops.h" #include "compositor-private.h" -#include "meta-shadow-factory.h" +#include "meta-shadow-factory-private.h" #include "meta-shaped-texture.h" #include "meta-window-actor-private.h" diff --git a/src/include/meta-shadow-factory.h b/src/include/meta-shadow-factory.h new file mode 100644 index 000000000..c121c7cf2 --- /dev/null +++ b/src/include/meta-shadow-factory.h @@ -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 + +#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__ */