mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
c84da3ce1b
If mutter is going to be a "real" library, then it should install its includes so that users can do #include <meta/display.h> rather than #include <display.h> So rename the includedir accordingly, move src/include to src/meta, and fix up all internal references. There were a handful of header files in src/include that were not installed; this appears to have been part of a plan to keep core/, ui/, and compositor/ from looking at each others' private includes, but that wasn't really working anyway. So move all non-installed headers back into core/ or ui/. https://bugzilla.gnome.org/show_bug.cgi?id=643959
109 lines
3.7 KiB
C
109 lines
3.7 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
/* Simple box operations */
|
|
|
|
/*
|
|
* Copyright (C) 2005, 2006 Elijah Newren
|
|
*
|
|
* 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_BOXES_H
|
|
#define META_BOXES_H
|
|
|
|
#include <glib-object.h>
|
|
#include <meta/common.h>
|
|
|
|
#define META_TYPE_RECTANGLE (meta_rectangle_get_type ())
|
|
|
|
typedef struct _MetaRectangle MetaRectangle;
|
|
struct _MetaRectangle
|
|
{
|
|
int x;
|
|
int y;
|
|
int width;
|
|
int height;
|
|
};
|
|
|
|
typedef struct _MetaStrut MetaStrut;
|
|
struct _MetaStrut
|
|
{
|
|
MetaRectangle rect;
|
|
MetaSide side;
|
|
};
|
|
|
|
typedef enum
|
|
{
|
|
META_EDGE_WINDOW,
|
|
META_EDGE_MONITOR,
|
|
META_EDGE_SCREEN
|
|
} MetaEdgeType;
|
|
|
|
typedef struct _MetaEdge MetaEdge;
|
|
struct _MetaEdge
|
|
{
|
|
MetaRectangle rect; /* width or height should be 1 */
|
|
MetaSide side_type;
|
|
MetaEdgeType edge_type;
|
|
};
|
|
|
|
GType meta_rectangle_get_type (void);
|
|
|
|
MetaRectangle *meta_rectangle_copy (const MetaRectangle *rect);
|
|
void meta_rectangle_free (MetaRectangle *rect);
|
|
|
|
/* Function to make initializing a rect with a single line of code easy */
|
|
MetaRectangle meta_rect (int x, int y, int width, int height);
|
|
|
|
/* Basic comparison functions */
|
|
int meta_rectangle_area (const MetaRectangle *rect);
|
|
gboolean meta_rectangle_intersect (const MetaRectangle *src1,
|
|
const MetaRectangle *src2,
|
|
MetaRectangle *dest);
|
|
gboolean meta_rectangle_equal (const MetaRectangle *src1,
|
|
const MetaRectangle *src2);
|
|
|
|
/* Find the bounding box of the union of two rectangles */
|
|
void meta_rectangle_union (const MetaRectangle *rect1,
|
|
const MetaRectangle *rect2,
|
|
MetaRectangle *dest);
|
|
|
|
/* overlap is similar to intersect but doesn't provide location of
|
|
* intersection information.
|
|
*/
|
|
gboolean meta_rectangle_overlap (const MetaRectangle *rect1,
|
|
const MetaRectangle *rect2);
|
|
|
|
/* vert_overlap means ignore the horizontal location and ask if the
|
|
* vertical parts overlap. An alternate way to think of it is "Does there
|
|
* exist a way to shift either rect horizontally so that the two rects
|
|
* overlap?" horiz_overlap is similar.
|
|
*/
|
|
gboolean meta_rectangle_vert_overlap (const MetaRectangle *rect1,
|
|
const MetaRectangle *rect2);
|
|
gboolean meta_rectangle_horiz_overlap (const MetaRectangle *rect1,
|
|
const MetaRectangle *rect2);
|
|
|
|
/* could_fit_rect determines whether "outer_rect" is big enough to contain
|
|
* inner_rect. contains_rect checks whether it actually contains it.
|
|
*/
|
|
gboolean meta_rectangle_could_fit_rect (const MetaRectangle *outer_rect,
|
|
const MetaRectangle *inner_rect);
|
|
gboolean meta_rectangle_contains_rect (const MetaRectangle *outer_rect,
|
|
const MetaRectangle *inner_rect);
|
|
|
|
#endif /* META_BOXES_H */
|