mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 20:12:06 +00:00
Export the shadow factory
The elementary guys would like this as an API, and I don't see any reason to refuse -- this is quite nice shadow painting code :) For some reason, gobject-introspection can't seem to cope with MetaWindowShape. I'll look into it a bit later, but for now, mark the function it has trouble with as (skip).
This commit is contained in:
parent
2705c87f74
commit
b33a82eb7c
@ -84,7 +84,6 @@ IGNORE_HFILES= \
|
||||
meta-dbus-login1.h \
|
||||
meta-module.h \
|
||||
meta-plugin-manager.h \
|
||||
meta-shadow-factory-private.h \
|
||||
meta-texture-rectangle.h \
|
||||
meta-texture-tower.h \
|
||||
meta-window-actor-private.h \
|
||||
|
@ -132,7 +132,6 @@ libmutter_la_SOURCES = \
|
||||
compositor/meta-plugin-manager.c \
|
||||
compositor/meta-plugin-manager.h \
|
||||
compositor/meta-shadow-factory.c \
|
||||
compositor/meta-shadow-factory-private.h \
|
||||
compositor/meta-shaped-texture.c \
|
||||
compositor/meta-shaped-texture-private.h \
|
||||
compositor/meta-surface-actor.c \
|
||||
@ -148,7 +147,6 @@ libmutter_la_SOURCES = \
|
||||
compositor/meta-window-group.c \
|
||||
compositor/meta-window-group.h \
|
||||
compositor/meta-window-shape.c \
|
||||
compositor/meta-window-shape.h \
|
||||
compositor/region-utils.c \
|
||||
compositor/region-utils.h \
|
||||
meta/compositor.h \
|
||||
@ -159,6 +157,7 @@ libmutter_la_SOURCES = \
|
||||
meta/meta-plugin.h \
|
||||
meta/meta-shadow-factory.h \
|
||||
meta/meta-window-actor.h \
|
||||
meta/meta-window-shape.h \
|
||||
meta/compositor-mutter.h \
|
||||
core/constraints.c \
|
||||
core/constraints.h \
|
||||
|
@ -1,66 +0,0 @@
|
||||
/* -*- 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_SHADOW_FACTORY_PRIVATE_H__
|
||||
#define __META_SHADOW_FACTORY_PRIVATE_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "meta-window-shape.h"
|
||||
#include <meta/meta-shadow-factory.h>
|
||||
|
||||
/**
|
||||
* MetaShadow:
|
||||
* #MetaShadow holds a shadow texture along with information about how to
|
||||
* apply that texture to draw a window texture. (E.g., it knows how big the
|
||||
* unscaled borders are on each side of the shadow texture.)
|
||||
*/
|
||||
typedef struct _MetaShadow MetaShadow;
|
||||
|
||||
MetaShadow *meta_shadow_ref (MetaShadow *shadow);
|
||||
void meta_shadow_unref (MetaShadow *shadow);
|
||||
CoglTexture*meta_shadow_get_texture (MetaShadow *shadow);
|
||||
void meta_shadow_paint (MetaShadow *shadow,
|
||||
int window_x,
|
||||
int window_y,
|
||||
int window_width,
|
||||
int window_height,
|
||||
guint8 opacity,
|
||||
cairo_region_t *clip,
|
||||
gboolean clip_strictly);
|
||||
void meta_shadow_get_bounds (MetaShadow *shadow,
|
||||
int window_x,
|
||||
int window_y,
|
||||
int window_width,
|
||||
int window_height,
|
||||
cairo_rectangle_int_t *bounds);
|
||||
|
||||
MetaShadowFactory *meta_shadow_factory_new (void);
|
||||
|
||||
MetaShadow *meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
|
||||
MetaWindowShape *shape,
|
||||
int width,
|
||||
int height,
|
||||
const char *class_name,
|
||||
gboolean focused);
|
||||
|
||||
#endif /* __META_SHADOW_FACTORY_PRIVATE_H__ */
|
@ -26,8 +26,9 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <meta/meta-shadow-factory.h>
|
||||
|
||||
#include "cogl-utils.h"
|
||||
#include "meta-shadow-factory-private.h"
|
||||
#include "region-utils.h"
|
||||
|
||||
/* This file implements blurring the shape of a window to produce a
|
||||
@ -844,7 +845,7 @@ get_shadow_params (MetaShadowFactory *factory,
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_shadow_factory_get_shadow:
|
||||
* meta_shadow_factory_get_shadow: (skip)
|
||||
* @factory: a #MetaShadowFactory
|
||||
* @shape: the size-invariant shape of the window's region
|
||||
* @width: the actual width of the window's region
|
||||
@ -1048,3 +1049,6 @@ meta_shadow_factory_get_params (MetaShadowFactory *factory,
|
||||
if (params)
|
||||
*params = *stored_params;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (MetaShadow, meta_shadow,
|
||||
meta_shadow_ref, meta_shadow_unref)
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include <meta/window.h>
|
||||
#include <meta/meta-shaped-texture.h>
|
||||
#include <meta/meta-enum-types.h>
|
||||
#include <meta/meta-shadow-factory.h>
|
||||
|
||||
#include "compositor-private.h"
|
||||
#include "meta-shaped-texture-private.h"
|
||||
#include "meta-shadow-factory-private.h"
|
||||
#include "meta-window-actor-private.h"
|
||||
#include "meta-texture-rectangle.h"
|
||||
#include "region-utils.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* MetaWindowShape
|
||||
*
|
||||
@ -19,9 +20,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "meta-window-shape.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <meta/meta-window-shape.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "region-utils.h"
|
||||
|
||||
struct _MetaWindowShape
|
||||
@ -250,3 +254,5 @@ meta_window_shape_to_region (MetaWindowShape *shape,
|
||||
return region;
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (MetaWindowShape, meta_window_shape,
|
||||
meta_window_shape_ref, meta_window_shape_unref)
|
||||
|
@ -23,7 +23,12 @@
|
||||
#ifndef __META_SHADOW_FACTORY_H__
|
||||
#define __META_SHADOW_FACTORY_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <cairo.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include <meta/meta-window-shape.h>
|
||||
|
||||
G_GNUC_CONST
|
||||
GType meta_shadow_get_type (void);
|
||||
|
||||
/**
|
||||
* MetaShadowParams:
|
||||
@ -81,4 +86,38 @@ void meta_shadow_factory_get_params (MetaShadowFactory *factory,
|
||||
gboolean focused,
|
||||
MetaShadowParams *params);
|
||||
|
||||
/**
|
||||
* MetaShadow:
|
||||
* #MetaShadow holds a shadow texture along with information about how to
|
||||
* apply that texture to draw a window texture. (E.g., it knows how big the
|
||||
* unscaled borders are on each side of the shadow texture.)
|
||||
*/
|
||||
typedef struct _MetaShadow MetaShadow;
|
||||
|
||||
MetaShadow *meta_shadow_ref (MetaShadow *shadow);
|
||||
void meta_shadow_unref (MetaShadow *shadow);
|
||||
void meta_shadow_paint (MetaShadow *shadow,
|
||||
int window_x,
|
||||
int window_y,
|
||||
int window_width,
|
||||
int window_height,
|
||||
guint8 opacity,
|
||||
cairo_region_t *clip,
|
||||
gboolean clip_strictly);
|
||||
void meta_shadow_get_bounds (MetaShadow *shadow,
|
||||
int window_x,
|
||||
int window_y,
|
||||
int window_width,
|
||||
int window_height,
|
||||
cairo_rectangle_int_t *bounds);
|
||||
|
||||
MetaShadowFactory *meta_shadow_factory_new (void);
|
||||
|
||||
MetaShadow *meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
|
||||
MetaWindowShape *shape,
|
||||
int width,
|
||||
int height,
|
||||
const char *class_name,
|
||||
gboolean focused);
|
||||
|
||||
#endif /* __META_SHADOW_FACTORY_H__ */
|
||||
|
@ -24,7 +24,10 @@
|
||||
#define __META_WINDOW_SHAPE_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_GNUC_CONST
|
||||
GType meta_window_shape_get_type (void);
|
||||
|
||||
/**
|
||||
* MetaWindowShape:
|
Loading…
Reference in New Issue
Block a user