mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
Use cairo_region_t when building with gtk+-3.0
GdkRegion has been removed from Gtk+. The replacement is a yet-unreleased cairo API, so use it only when building with Gtk+-3.0. https://bugzilla.gnome.org/show_bug.cgi?id=587991
This commit is contained in:
parent
01447d94d1
commit
7feeb72721
@ -143,6 +143,7 @@ case "$with_gtk" in
|
||||
3.0) GTK_API_VERSION=3.0
|
||||
GTK_MIN_VERSION=2.90
|
||||
CANBERRA_GTK=libcanberra-gtk3
|
||||
AC_DEFINE(USE_CAIRO_REGION, 1, [Use cairo_region_t instead of GdkRegion])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -44,6 +44,7 @@ mutter_SOURCES= \
|
||||
include/compositor.h \
|
||||
include/mutter-plugin.h \
|
||||
include/mutter-window.h \
|
||||
include/region.h \
|
||||
include/compositor-mutter.h \
|
||||
core/constraints.c \
|
||||
core/constraints.h \
|
||||
|
@ -71,7 +71,7 @@ struct _MutterShapedTexturePrivate
|
||||
CoglHandle material_workaround;
|
||||
#endif
|
||||
|
||||
GdkRegion *clip_region;
|
||||
MetaRegion *clip_region;
|
||||
|
||||
guint mask_width, mask_height;
|
||||
|
||||
@ -300,7 +300,7 @@ mutter_shaped_texture_paint (ClutterActor *actor)
|
||||
ClutterActorBox alloc;
|
||||
CoglHandle material;
|
||||
|
||||
if (priv->clip_region && gdk_region_empty (priv->clip_region))
|
||||
if (priv->clip_region && meta_region_is_empty (priv->clip_region))
|
||||
return;
|
||||
|
||||
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR (stex)))
|
||||
@ -387,7 +387,7 @@ mutter_shaped_texture_paint (ClutterActor *actor)
|
||||
# define MAX_RECTS 16
|
||||
|
||||
/* Would be nice to be able to check the number of rects first */
|
||||
gdk_region_get_rectangles (priv->clip_region, &rects, &n_rects);
|
||||
meta_region_get_rectangles (priv->clip_region, &rects, &n_rects);
|
||||
if (n_rects > MAX_RECTS)
|
||||
{
|
||||
g_free (rects);
|
||||
@ -557,7 +557,7 @@ mutter_shaped_texture_add_rectangles (MutterShapedTexture *stex,
|
||||
*/
|
||||
void
|
||||
mutter_shaped_texture_set_clip_region (MutterShapedTexture *stex,
|
||||
GdkRegion *clip_region)
|
||||
MetaRegion *clip_region)
|
||||
{
|
||||
MutterShapedTexturePrivate *priv;
|
||||
|
||||
@ -567,7 +567,7 @@ mutter_shaped_texture_set_clip_region (MutterShapedTexture *stex,
|
||||
|
||||
if (priv->clip_region)
|
||||
{
|
||||
gdk_region_destroy (priv->clip_region);
|
||||
meta_region_destroy (priv->clip_region);
|
||||
priv->clip_region = NULL;
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,14 @@
|
||||
#ifndef __MUTTER_SHAPED_TEXTURE_H__
|
||||
#define __MUTTER_SHAPED_TEXTURE_H__
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#ifdef HAVE_GLX_TEXTURE_PIXMAP
|
||||
#include <clutter/glx/clutter-glx.h>
|
||||
#endif /* HAVE_GLX_TEXTURE_PIXMAP */
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "region.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -94,7 +96,7 @@ void mutter_shaped_texture_add_rectangles (MutterShapedTexture *stex,
|
||||
|
||||
/* Assumes ownership of clip_region */
|
||||
void mutter_shaped_texture_set_clip_region (MutterShapedTexture *stex,
|
||||
GdkRegion *clip_region);
|
||||
MetaRegion *clip_region);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define _ISOC99_SOURCE /* for roundf */
|
||||
#include <math.h>
|
||||
|
||||
#include "mutter-window-private.h"
|
||||
#include "mutter-window-group.h"
|
||||
#include "region.h"
|
||||
|
||||
struct _MutterWindowGroupClass
|
||||
{
|
||||
@ -99,7 +102,7 @@ static void
|
||||
mutter_window_group_paint (ClutterActor *actor)
|
||||
{
|
||||
MutterWindowGroup *window_group = MUTTER_WINDOW_GROUP (actor);
|
||||
GdkRegion *visible_region;
|
||||
MetaRegion *visible_region;
|
||||
GdkRectangle screen_rect = { 0 };
|
||||
GList *children, *l;
|
||||
|
||||
@ -116,7 +119,7 @@ mutter_window_group_paint (ClutterActor *actor)
|
||||
* optimization, however.)
|
||||
*/
|
||||
meta_screen_get_size (window_group->screen, &screen_rect.width, &screen_rect.height);
|
||||
visible_region = gdk_region_rectangle (&screen_rect);
|
||||
visible_region = meta_region_new_from_rectangle (&screen_rect);
|
||||
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
@ -132,22 +135,22 @@ mutter_window_group_paint (ClutterActor *actor)
|
||||
continue;
|
||||
|
||||
/* Temporarily move to the coordinate system of the actor */
|
||||
gdk_region_offset (visible_region, - x, - y);
|
||||
meta_region_translate (visible_region, - x, - y);
|
||||
|
||||
mutter_window_set_visible_region (cw, visible_region);
|
||||
|
||||
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (cw)) == 0xff)
|
||||
{
|
||||
GdkRegion *obscured_region = mutter_window_get_obscured_region (cw);
|
||||
MetaRegion *obscured_region = mutter_window_get_obscured_region (cw);
|
||||
if (obscured_region)
|
||||
gdk_region_subtract (visible_region, obscured_region);
|
||||
meta_region_subtract (visible_region, obscured_region);
|
||||
}
|
||||
|
||||
mutter_window_set_visible_region_beneath (cw, visible_region);
|
||||
gdk_region_offset (visible_region, x, y);
|
||||
meta_region_translate (visible_region, x, y);
|
||||
}
|
||||
|
||||
gdk_region_destroy (visible_region);
|
||||
meta_region_destroy (visible_region);
|
||||
|
||||
CLUTTER_ACTOR_CLASS (mutter_window_group_parent_class)->paint (actor);
|
||||
|
||||
|
@ -3,9 +3,11 @@
|
||||
#ifndef MUTTER_WINDOW_PRIVATE_H
|
||||
#define MUTTER_WINDOW_PRIVATE_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include "compositor-mutter.h"
|
||||
#include "region.h"
|
||||
|
||||
MutterWindow *mutter_window_new (MetaWindow *window);
|
||||
|
||||
@ -37,12 +39,12 @@ void mutter_window_update_opacity (MutterWindow *cw);
|
||||
void mutter_window_mapped (MutterWindow *cw);
|
||||
void mutter_window_unmapped (MutterWindow *cw);
|
||||
|
||||
GdkRegion *mutter_window_get_obscured_region (MutterWindow *cw);
|
||||
MetaRegion *mutter_window_get_obscured_region (MutterWindow *cw);
|
||||
|
||||
void mutter_window_set_visible_region (MutterWindow *cw,
|
||||
GdkRegion *visible_region);
|
||||
MetaRegion *visible_region);
|
||||
void mutter_window_set_visible_region_beneath (MutterWindow *cw,
|
||||
GdkRegion *beneath_region);
|
||||
MetaRegion *beneath_region);
|
||||
void mutter_window_reset_visible_regions (MutterWindow *cw);
|
||||
|
||||
void mutter_window_effect_completed (MutterWindow *actor,
|
||||
|
@ -42,10 +42,10 @@ struct _MutterWindowPrivate
|
||||
gchar * desc;
|
||||
|
||||
/* If the window is shaped, a region that matches the shape */
|
||||
GdkRegion *shape_region;
|
||||
MetaRegion *shape_region;
|
||||
/* A rectangular region with the unshaped extends of the window
|
||||
* texture */
|
||||
GdkRegion *bounding_region;
|
||||
MetaRegion *bounding_region;
|
||||
|
||||
gint freeze_count;
|
||||
|
||||
@ -1350,7 +1350,7 @@ mutter_window_clear_shape_region (MutterWindow *self)
|
||||
|
||||
if (priv->shape_region)
|
||||
{
|
||||
gdk_region_destroy (priv->shape_region);
|
||||
meta_region_destroy (priv->shape_region);
|
||||
priv->shape_region = NULL;
|
||||
}
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ mutter_window_clear_bounding_region (MutterWindow *self)
|
||||
|
||||
if (priv->bounding_region)
|
||||
{
|
||||
gdk_region_destroy (priv->bounding_region);
|
||||
meta_region_destroy (priv->bounding_region);
|
||||
priv->bounding_region = NULL;
|
||||
}
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ mutter_window_update_bounding_region (MutterWindow *self,
|
||||
|
||||
mutter_window_clear_bounding_region (self);
|
||||
|
||||
priv->bounding_region = gdk_region_rectangle (&bounding_rectangle);
|
||||
priv->bounding_region = meta_region_new_from_rectangle (&bounding_rectangle);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1390,11 +1390,11 @@ mutter_window_update_shape_region (MutterWindow *self,
|
||||
|
||||
mutter_window_clear_shape_region (self);
|
||||
|
||||
priv->shape_region = gdk_region_new ();
|
||||
priv->shape_region = meta_region_new ();
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
GdkRectangle rect = { rects[i].x, rects[i].y, rects[i].width, rects[i].height };
|
||||
gdk_region_union_with_rect (priv->shape_region, &rect);
|
||||
meta_region_union_rectangle (priv->shape_region, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1408,7 +1408,7 @@ mutter_window_update_shape_region (MutterWindow *self,
|
||||
* Return value: (transfer none): the area obscured by the window,
|
||||
* %NULL is the same as an empty region.
|
||||
*/
|
||||
GdkRegion *
|
||||
MetaRegion *
|
||||
mutter_window_get_obscured_region (MutterWindow *self)
|
||||
{
|
||||
MutterWindowPrivate *priv = self->priv;
|
||||
@ -1427,13 +1427,13 @@ mutter_window_get_obscured_region (MutterWindow *self)
|
||||
#if 0
|
||||
/* Print out a region; useful for debugging */
|
||||
static void
|
||||
dump_region (GdkRegion *region)
|
||||
dump_region (MetaRegion *region)
|
||||
{
|
||||
GdkRectangle *rects;
|
||||
int n_rects;
|
||||
int i;
|
||||
|
||||
gdk_region_get_rectangles (region, &rects, &n_rects);
|
||||
meta_region_get_rectangles (region, &rects, &n_rects);
|
||||
g_print ("[");
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
@ -1457,10 +1457,10 @@ dump_region (GdkRegion *region)
|
||||
*/
|
||||
void
|
||||
mutter_window_set_visible_region (MutterWindow *self,
|
||||
GdkRegion *visible_region)
|
||||
MetaRegion *visible_region)
|
||||
{
|
||||
MutterWindowPrivate *priv = self->priv;
|
||||
GdkRegion *texture_clip_region = NULL;
|
||||
MetaRegion *texture_clip_region = NULL;
|
||||
|
||||
/* Get the area of the window texture that would be drawn if
|
||||
* we weren't obscured at all
|
||||
@ -1468,21 +1468,21 @@ mutter_window_set_visible_region (MutterWindow *self,
|
||||
if (priv->shaped)
|
||||
{
|
||||
if (priv->shape_region)
|
||||
texture_clip_region = gdk_region_copy (priv->shape_region);
|
||||
texture_clip_region = meta_region_copy (priv->shape_region);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->bounding_region)
|
||||
texture_clip_region = gdk_region_copy (priv->bounding_region);
|
||||
texture_clip_region = meta_region_copy (priv->bounding_region);
|
||||
}
|
||||
|
||||
if (!texture_clip_region)
|
||||
texture_clip_region = gdk_region_new ();
|
||||
texture_clip_region = meta_region_new ();
|
||||
|
||||
/* Then intersect that with the visible region to get the region
|
||||
* that we actually need to redraw.
|
||||
*/
|
||||
gdk_region_intersect (texture_clip_region, visible_region);
|
||||
meta_region_intersect (texture_clip_region, visible_region);
|
||||
|
||||
/* Assumes ownership */
|
||||
mutter_shaped_texture_set_clip_region (MUTTER_SHAPED_TEXTURE (priv->actor),
|
||||
@ -1503,7 +1503,7 @@ mutter_window_set_visible_region (MutterWindow *self,
|
||||
*/
|
||||
void
|
||||
mutter_window_set_visible_region_beneath (MutterWindow *self,
|
||||
GdkRegion *beneath_region)
|
||||
MetaRegion *beneath_region)
|
||||
{
|
||||
MutterWindowPrivate *priv = self->priv;
|
||||
|
||||
@ -1511,7 +1511,7 @@ mutter_window_set_visible_region_beneath (MutterWindow *self,
|
||||
{
|
||||
GdkRectangle shadow_rect;
|
||||
ClutterActorBox box;
|
||||
GdkOverlapType overlap;
|
||||
MetaOverlapType overlap;
|
||||
|
||||
/* We could compute an full clip region as we do for the window
|
||||
* texture, but the shadow is relatively cheap to draw, and
|
||||
@ -1526,10 +1526,10 @@ mutter_window_set_visible_region_beneath (MutterWindow *self,
|
||||
shadow_rect.width = roundf (box.x2 - box.x1);
|
||||
shadow_rect.height = roundf (box.y2 - box.y1);
|
||||
|
||||
overlap = gdk_region_rect_in (beneath_region, &shadow_rect);
|
||||
overlap = meta_region_contains_rectangle (beneath_region, &shadow_rect);
|
||||
|
||||
tidy_texture_frame_set_needs_paint (TIDY_TEXTURE_FRAME (priv->shadow),
|
||||
overlap != GDK_OVERLAP_RECTANGLE_OUT);
|
||||
overlap != META_REGION_OVERLAP_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -879,5 +879,29 @@ meta_later_remove (guint later_id)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
#include "region.h"
|
||||
|
||||
void
|
||||
meta_region_get_rectangles (MetaRegion *region,
|
||||
GdkRectangle **rectangles,
|
||||
int *n_rectangles)
|
||||
{
|
||||
int n = cairo_region_num_rectangles (region);
|
||||
|
||||
if (n_rectangles != NULL)
|
||||
*n_rectangles = n;
|
||||
|
||||
if (rectangles != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
*rectangles = g_new (cairo_rectangle_int_t, n);
|
||||
for (i = 0; i < n; i++)
|
||||
cairo_region_get_rectangle (region, i, *rectangles + i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* eof util.c */
|
||||
|
||||
|
60
src/include/region.h
Normal file
60
src/include/region.h
Normal file
@ -0,0 +1,60 @@
|
||||
#ifndef META_REGION_H
|
||||
#define META_REGION_H
|
||||
|
||||
#ifndef PACKAGE_NAME
|
||||
#error "<config.h> must be included before region.h"
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifdef USE_CAIRO_REGION
|
||||
#include <cairo.h>
|
||||
|
||||
#define MetaRegion cairo_region_t
|
||||
|
||||
typedef enum {
|
||||
META_REGION_OVERLAP_IN = CAIRO_REGION_OVERLAP_IN,
|
||||
META_REGION_OVERLAP_OUT = CAIRO_REGION_OVERLAP_OUT,
|
||||
META_REGION_OVERLAP_PART = CAIRO_REGION_OVERLAP_PART
|
||||
} MetaOverlapType;
|
||||
|
||||
#define meta_region_new() cairo_region_create()
|
||||
#define meta_region_new_from_rectangle(rect) cairo_region_create_rectangle(rect)
|
||||
#define meta_region_copy(r) cairo_region_copy(r)
|
||||
#define meta_region_destroy(r) cairo_region_destroy(r)
|
||||
#define meta_region_is_empty(r) cairo_region_is_empty(r)
|
||||
#define meta_region_union_rectangle(r, rect) cairo_region_union_rectangle(r, rect)
|
||||
#define meta_region_subtract(r, other) cairo_region_subtract(r, other)
|
||||
#define meta_region_translate(r, x, y) cairo_region_translate(r, x, y)
|
||||
#define meta_region_intersect(r, other) cairo_region_intersect(r, other)
|
||||
#define meta_region_contains_rectangle(r, rect) cairo_region_contains_rectangle(r, rect)
|
||||
|
||||
void meta_region_get_rectangles (MetaRegion *region,
|
||||
GdkRectangle **rectangles,
|
||||
int *n_rectangles);
|
||||
|
||||
#else
|
||||
|
||||
#define MetaRegion GdkRegion
|
||||
|
||||
typedef enum {
|
||||
META_REGION_OVERLAP_IN = GDK_OVERLAP_RECTANGLE_IN,
|
||||
META_REGION_OVERLAP_OUT = GDK_OVERLAP_RECTANGLE_OUT,
|
||||
META_REGION_OVERLAP_PART = GDK_OVERLAP_RECTANGLE_PART
|
||||
} MetaOverlapType;
|
||||
|
||||
#define meta_region_new() gdk_region_new()
|
||||
#define meta_region_new_from_rectangle(rect) gdk_region_rectangle(rect)
|
||||
#define meta_region_copy(r) gdk_region_copy(r)
|
||||
#define meta_region_destroy(r) gdk_region_destroy(r)
|
||||
#define meta_region_is_empty(r) gdk_region_empty(r)
|
||||
#define meta_region_union_rectangle(r, rect) gdk_region_union_with_rect(r, rect)
|
||||
#define meta_region_subtract(r, other) gdk_region_subtract(r, other)
|
||||
#define meta_region_translate(r, x, y) gdk_region_offset(r, x, y)
|
||||
#define meta_region_intersect(r, other) gdk_region_intersect(r, other)
|
||||
#define meta_region_contains_rectangle(r, rect) gdk_region_rect_in(r, rect)
|
||||
#define meta_region_get_rectangles(r, rects, num) gdk_region_get_rectangles(r, rects, num)
|
||||
|
||||
#endif /* HAVE_CAIRO_REGION */
|
||||
|
||||
#endif /* META_REGION_H */
|
@ -27,6 +27,7 @@
|
||||
#include <math.h>
|
||||
#include "boxes.h"
|
||||
#include "frames.h"
|
||||
#include "region.h"
|
||||
#include "util.h"
|
||||
#include "core.h"
|
||||
#include "menu.h"
|
||||
@ -75,7 +76,7 @@ static void meta_frames_attach_style (MetaFrames *frames,
|
||||
static void meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
MetaUIFrame *frame,
|
||||
GdkDrawable *drawable,
|
||||
GdkRegion *region,
|
||||
MetaRegion *region,
|
||||
int x_offset,
|
||||
int y_offset);
|
||||
|
||||
@ -2068,7 +2069,7 @@ generate_pixmap (MetaFrames *frames,
|
||||
MetaRectangle rect)
|
||||
{
|
||||
GdkRectangle rectangle;
|
||||
GdkRegion *region;
|
||||
MetaRegion *region;
|
||||
GdkPixmap *result;
|
||||
|
||||
rectangle.x = rect.x;
|
||||
@ -2081,12 +2082,12 @@ generate_pixmap (MetaFrames *frames,
|
||||
|
||||
clear_backing (result, frame->window, rectangle.x, rectangle.y);
|
||||
|
||||
region = gdk_region_rectangle (&rectangle);
|
||||
region = meta_region_new_from_rectangle (&rectangle);
|
||||
|
||||
meta_frames_paint_to_drawable (frames, frame, result, region,
|
||||
-rectangle.x, -rectangle.y);
|
||||
|
||||
gdk_region_destroy (region);
|
||||
meta_region_destroy (region);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2170,11 +2171,11 @@ populate_cache (MetaFrames *frames,
|
||||
}
|
||||
|
||||
static void
|
||||
clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
|
||||
clip_to_screen (MetaRegion *region, MetaUIFrame *frame)
|
||||
{
|
||||
GdkRectangle frame_area;
|
||||
GdkRectangle screen_area = { 0, 0, 0, 0 };
|
||||
GdkRegion *tmp_region;
|
||||
MetaRegion *tmp_region;
|
||||
|
||||
/* Chop off stuff outside the screen; this optimization
|
||||
* is crucial to handle huge client windows,
|
||||
@ -2189,35 +2190,35 @@ clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
|
||||
META_CORE_GET_SCREEN_HEIGHT, &screen_area.height,
|
||||
META_CORE_GET_END);
|
||||
|
||||
gdk_region_offset (region, frame_area.x, frame_area.y);
|
||||
meta_region_translate (region, frame_area.x, frame_area.y);
|
||||
|
||||
tmp_region = gdk_region_rectangle (&frame_area);
|
||||
gdk_region_intersect (region, tmp_region);
|
||||
gdk_region_destroy (tmp_region);
|
||||
tmp_region = meta_region_new_from_rectangle (&frame_area);
|
||||
meta_region_intersect (region, tmp_region);
|
||||
meta_region_destroy (tmp_region);
|
||||
|
||||
gdk_region_offset (region, - frame_area.x, - frame_area.y);
|
||||
meta_region_translate (region, - frame_area.x, - frame_area.y);
|
||||
}
|
||||
|
||||
static void
|
||||
subtract_from_region (GdkRegion *region, GdkDrawable *drawable,
|
||||
subtract_from_region (MetaRegion *region, GdkDrawable *drawable,
|
||||
gint x, gint y)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
GdkRegion *reg_rect;
|
||||
MetaRegion *reg_rect;
|
||||
|
||||
gdk_drawable_get_size (drawable, &rect.width, &rect.height);
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
|
||||
reg_rect = gdk_region_rectangle (&rect);
|
||||
gdk_region_subtract (region, reg_rect);
|
||||
gdk_region_destroy (reg_rect);
|
||||
reg_rect = meta_region_new_from_rectangle (&rect);
|
||||
meta_region_subtract (region, reg_rect);
|
||||
meta_region_destroy (reg_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
cached_pixels_draw (CachedPixels *pixels,
|
||||
GdkWindow *window,
|
||||
GdkRegion *region)
|
||||
MetaRegion *region)
|
||||
{
|
||||
GdkGC *gc;
|
||||
int i;
|
||||
@ -2249,8 +2250,8 @@ meta_frames_expose_event (GtkWidget *widget,
|
||||
{
|
||||
MetaUIFrame *frame;
|
||||
MetaFrames *frames;
|
||||
GdkRegion *region;
|
||||
CachedPixels *pixels;
|
||||
MetaRegion *region;
|
||||
|
||||
frames = META_FRAMES (widget);
|
||||
|
||||
@ -2267,7 +2268,7 @@ meta_frames_expose_event (GtkWidget *widget,
|
||||
|
||||
populate_cache (frames, frame);
|
||||
|
||||
region = gdk_region_copy (event->region);
|
||||
region = meta_region_copy (event->region);
|
||||
|
||||
pixels = get_cache (frames, frame);
|
||||
|
||||
@ -2276,7 +2277,7 @@ meta_frames_expose_event (GtkWidget *widget,
|
||||
clip_to_screen (region, frame);
|
||||
meta_frames_paint_to_drawable (frames, frame, frame->window, region, 0, 0);
|
||||
|
||||
gdk_region_destroy (region);
|
||||
meta_region_destroy (region);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -2290,7 +2291,7 @@ static void
|
||||
meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
MetaUIFrame *frame,
|
||||
GdkDrawable *drawable,
|
||||
GdkRegion *region,
|
||||
MetaRegion *region,
|
||||
int x_offset,
|
||||
int y_offset)
|
||||
{
|
||||
@ -2423,7 +2424,7 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
GdkRectangle area, *areas;
|
||||
int n_areas;
|
||||
int screen_width, screen_height;
|
||||
GdkRegion *edges, *tmp_region;
|
||||
MetaRegion *edges, *tmp_region;
|
||||
int top, bottom, left, right;
|
||||
|
||||
/* Repaint each side of the frame */
|
||||
@ -2437,7 +2438,7 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
META_CORE_GET_SCREEN_HEIGHT, &screen_height,
|
||||
META_CORE_GET_END);
|
||||
|
||||
edges = gdk_region_copy (region);
|
||||
edges = meta_region_copy (region);
|
||||
|
||||
/* Punch out the client area */
|
||||
|
||||
@ -2445,13 +2446,13 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
area.y = top;
|
||||
area.width = w;
|
||||
area.height = h;
|
||||
tmp_region = gdk_region_rectangle (&area);
|
||||
gdk_region_subtract (edges, tmp_region);
|
||||
gdk_region_destroy (tmp_region);
|
||||
tmp_region = meta_region_new_from_rectangle (&area);
|
||||
meta_region_subtract (edges, tmp_region);
|
||||
meta_region_destroy (tmp_region);
|
||||
|
||||
/* Now draw remaining portion of region */
|
||||
|
||||
gdk_region_get_rectangles (edges, &areas, &n_areas);
|
||||
meta_region_get_rectangles (edges, &areas, &n_areas);
|
||||
|
||||
for (i = 0; i < n_areas; i++)
|
||||
{
|
||||
@ -2494,7 +2495,7 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
|
||||
}
|
||||
|
||||
g_free (areas);
|
||||
gdk_region_destroy (edges);
|
||||
meta_region_destroy (edges);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -455,11 +455,11 @@ meta_preview_get_mini_icon (void)
|
||||
return default_icon;
|
||||
}
|
||||
|
||||
GdkRegion *
|
||||
MetaRegion *
|
||||
meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint new_window_height)
|
||||
{
|
||||
GdkRectangle xrect;
|
||||
GdkRegion *corners_xregion, *window_xregion;
|
||||
MetaRegion *corners_xregion, *window_xregion;
|
||||
gint flags;
|
||||
MetaFrameLayout *fgeom;
|
||||
MetaFrameStyle *frame_style;
|
||||
@ -468,14 +468,14 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
|
||||
flags = (META_PREVIEW (preview)->flags);
|
||||
|
||||
window_xregion = gdk_region_new ();
|
||||
window_xregion = meta_region_new ();
|
||||
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = new_window_width;
|
||||
xrect.height = new_window_height;
|
||||
|
||||
gdk_region_union_with_rect (window_xregion, &xrect);
|
||||
meta_region_union_rectangle (window_xregion, &xrect);
|
||||
|
||||
if (preview->theme == NULL)
|
||||
return window_xregion;
|
||||
@ -486,7 +486,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
|
||||
fgeom = frame_style->layout;
|
||||
|
||||
corners_xregion = gdk_region_new ();
|
||||
corners_xregion = meta_region_new ();
|
||||
|
||||
if (fgeom->top_left_corner_rounded_radius != 0)
|
||||
{
|
||||
@ -503,7 +503,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
gdk_region_union_with_rect (corners_xregion, &xrect);
|
||||
meta_region_union_rectangle (corners_xregion, &xrect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
gdk_region_union_with_rect (corners_xregion, &xrect);
|
||||
meta_region_union_rectangle (corners_xregion, &xrect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -539,7 +539,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
gdk_region_union_with_rect (corners_xregion, &xrect);
|
||||
meta_region_union_rectangle (corners_xregion, &xrect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -557,12 +557,12 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
|
||||
xrect.width = width;
|
||||
xrect.height = 1;
|
||||
|
||||
gdk_region_union_with_rect (corners_xregion, &xrect);
|
||||
meta_region_union_rectangle (corners_xregion, &xrect);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_region_subtract (window_xregion, corners_xregion);
|
||||
gdk_region_destroy (corners_xregion);
|
||||
meta_region_subtract (window_xregion, corners_xregion);
|
||||
meta_region_destroy (corners_xregion);
|
||||
|
||||
return window_xregion;
|
||||
}
|
||||
|
@ -21,7 +21,10 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "theme.h"
|
||||
#include "region.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifndef META_PREVIEW_WIDGET_H
|
||||
@ -77,7 +80,7 @@ void meta_preview_set_frame_flags (MetaPreview *preview,
|
||||
void meta_preview_set_button_layout (MetaPreview *preview,
|
||||
const MetaButtonLayout *button_layout);
|
||||
|
||||
GdkRegion * meta_preview_get_clip_region (MetaPreview *preview,
|
||||
MetaRegion * meta_preview_get_clip_region (MetaPreview *preview,
|
||||
gint new_window_width,
|
||||
gint new_window_height);
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
*/
|
||||
#include "../core/workspace-private.h"
|
||||
#include "../core/frame-private.h"
|
||||
#include "region.h"
|
||||
#include "draw-workspace.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <math.h>
|
||||
@ -459,9 +460,9 @@ display_entry (MetaTabPopup *popup,
|
||||
TabEntry *te)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
GdkRegion *region;
|
||||
GdkRegion *inner_region;
|
||||
GdkWindow *window;
|
||||
MetaRegion *region;
|
||||
MetaRegion *inner_region;
|
||||
|
||||
|
||||
if (popup->current_selected_entry)
|
||||
@ -498,16 +499,16 @@ display_entry (MetaTabPopup *popup,
|
||||
gdk_window_set_background (window,
|
||||
>k_widget_get_style (popup->outline_window)->black);
|
||||
|
||||
region = gdk_region_rectangle (&rect);
|
||||
inner_region = gdk_region_rectangle (&te->inner_rect);
|
||||
gdk_region_subtract (region, inner_region);
|
||||
gdk_region_destroy (inner_region);
|
||||
region = meta_region_new_from_rectangle (&rect);
|
||||
inner_region = meta_region_new_from_rectangle (&te->inner_rect);
|
||||
meta_region_subtract (region, inner_region);
|
||||
meta_region_destroy (inner_region);
|
||||
|
||||
gdk_window_shape_combine_region (window,
|
||||
region,
|
||||
0, 0);
|
||||
|
||||
gdk_region_destroy (region);
|
||||
meta_region_destroy (region);
|
||||
|
||||
/* This should piss off gtk a bit, but we don't want to raise
|
||||
* above the tab popup. So, instead of calling gtk_widget_show,
|
||||
|
Loading…
Reference in New Issue
Block a user