1
0
Fork 0

introspection: remove --allow-unprefixed

Remove --allow-unprefixed option to the scanner, and fix resulting
problems:

 * theme.h and boxes.h are split into a main -header and a private
   header that includes stuff that is not generally useful and
   hard to introspect. Merge theme-parser.h into theme.h.

 * meta_display_get_atom() and meta_window_get_window_type_atom()
   are marked as (skip)

 * Fix annotation: (element-type Strut) => (element-type Meta.Strut)

https://bugzilla.gnome.org/show_bug.cgi?id=632494
This commit is contained in:
Owen W. Taylor 2010-10-18 14:34:14 -04:00
parent 1920f211b0
commit 52bc675fcb
20 changed files with 1477 additions and 1424 deletions

View file

@ -23,6 +23,7 @@ mutter_SOURCES= \
core/bell.c \
core/bell.h \
core/boxes.c \
core/boxes-private.h \
include/boxes.h \
compositor/compositor.c \
compositor/compositor-private.h \
@ -126,9 +127,9 @@ mutter_SOURCES= \
ui/tile-preview.c \
include/tile-preview.h \
ui/theme-parser.c \
ui/theme-parser.h \
ui/theme.c \
ui/theme.h \
ui/theme-private.h \
ui/ui.c \
include/all-keybindings.h \
$(mutter_built_sources)
@ -149,7 +150,6 @@ libmutter_private_la_SOURCES= \
gdk2-drawing-utils.c \
gdk2-drawing-utils.h \
ui/theme-parser.c \
ui/theme-parser.h \
ui/theme.c \
ui/theme.h
@ -164,7 +164,6 @@ libmutterinclude_base_headers = \
include/main.h \
include/util.h \
include/common.h \
ui/theme-parser.h \
ui/theme.h \
include/prefs.h \
include/window.h \
@ -226,7 +225,6 @@ Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mu
--nsversion=$(api_version) \
--warn-all \
--warn-error \
--accept-unprefixed \
--include=GObject-2.0 \
--include=Gdk-@GTK_API_VERSION@ \
--include=Gtk-@GTK_API_VERSION@ \

220
src/core/boxes-private.h Normal file
View file

@ -0,0 +1,220 @@
/* -*- 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_PRIVATE_H
#define META_BOXES_PRIVATE_H
#include <glib-object.h>
#include "common.h"
#include "boxes.h"
#define BOX_LEFT(box) ((box).x) /* Leftmost pixel of rect */
#define BOX_RIGHT(box) ((box).x + (box).width) /* One pixel past right */
#define BOX_TOP(box) ((box).y) /* Topmost pixel of rect */
#define BOX_BOTTOM(box) ((box).y + (box).height) /* One pixel past bottom */
typedef enum
{
FIXED_DIRECTION_NONE = 0,
FIXED_DIRECTION_X = 1 << 0,
FIXED_DIRECTION_Y = 1 << 1,
} FixedDirections;
/* Output functions -- note that the output buffer had better be big enough:
* rect_to_string: RECT_LENGTH
* region_to_string: (RECT_LENGTH+strlen(separator_string)) *
* g_list_length (region)
* edge_to_string: EDGE_LENGTH
* edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) *
* g_list_length (edge_list)
*/
#define RECT_LENGTH 27
#define EDGE_LENGTH 37
char* meta_rectangle_to_string (const MetaRectangle *rect,
char *output);
char* meta_rectangle_region_to_string (GList *region,
const char *separator_string,
char *output);
char* meta_rectangle_edge_to_string (const MetaEdge *edge,
char *output);
char* meta_rectangle_edge_list_to_string (
GList *edge_list,
const char *separator_string,
char *output);
/* Resize old_rect to the given new_width and new_height, but store the
* result in rect. NOTE THAT THIS IS RESIZE ONLY SO IT CANNOT BE USED FOR
* A MOVERESIZE OPERATION (that simplies the routine a little bit as it
* means there's no difference between NorthWestGravity and StaticGravity.
* Also, I lied a little bit--technically, you could use it in a MoveResize
* operation if you muck with old_rect just right).
*/
void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
MetaRectangle *rect,
int gravity,
int new_width,
int new_height);
/* find a list of rectangles with the property that a window is contained
* in the given region if and only if it is contained in one of the
* rectangles in the list.
*
* In this case, the region is given by taking basic_rect, removing from
* it the intersections with all the rectangles in the all_struts list,
* then expanding all the rectangles in the resulting list by the given
* amounts on each side.
*
* See boxes.c for more details.
*/
GList* meta_rectangle_get_minimal_spanning_set_for_region (
const MetaRectangle *basic_rect,
const GSList *all_struts);
/* Expand all rectangles in region by the given amount on each side */
GList* meta_rectangle_expand_region (GList *region,
const int left_expand,
const int right_expand,
const int top_expand,
const int bottom_expand);
/* Same as for meta_rectangle_expand_region except that rectangles not at
* least min_x or min_y in size are not expanded in that direction
*/
GList* meta_rectangle_expand_region_conditionally (
GList *region,
const int left_expand,
const int right_expand,
const int top_expand,
const int bottom_expand,
const int min_x,
const int min_y);
/* Expand rect in direction to the size of expand_to, and then clip out any
* overlapping struts oriented orthognal to the expansion direction. (Think
* horizontal or vertical maximization)
*/
void meta_rectangle_expand_to_avoiding_struts (
MetaRectangle *rect,
const MetaRectangle *expand_to,
const MetaDirection direction,
const GSList *all_struts);
/* Free the list created by
* meta_rectangle_get_minimal_spanning_set_for_region()
* or
* meta_rectangle_find_onscreen_edges ()
* or
* meta_rectangle_find_nonintersected_monitor_edges()
*/
void meta_rectangle_free_list_and_elements (GList *filled_list);
/* could_fit_in_region determines whether one of the spanning_rects is
* big enough to contain rect. contained_in_region checks whether one
* actually contains it.
*/
gboolean meta_rectangle_could_fit_in_region (
const GList *spanning_rects,
const MetaRectangle *rect);
gboolean meta_rectangle_contained_in_region (
const GList *spanning_rects,
const MetaRectangle *rect);
gboolean meta_rectangle_overlaps_with_region (
const GList *spanning_rects,
const MetaRectangle *rect);
/* Make the rectangle small enough to fit into one of the spanning_rects,
* but make it no smaller than min_size.
*/
void meta_rectangle_clamp_to_fit_into_region (
const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect,
const MetaRectangle *min_size);
/* Clip the rectangle so that it fits into one of the spanning_rects, assuming
* it overlaps with at least one of them
*/
void meta_rectangle_clip_to_region (const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect);
/* Shove the rectangle into one of the spanning_rects, assuming it fits in
* one of them.
*/
void meta_rectangle_shove_into_region(
const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect);
/* Finds the point on the line connecting (x1,y1) to (x2,y2) which is closest
* to (px, py). Useful for finding an optimal rectangle size when given a
* range between two sizes that are all candidates.
*/
void meta_rectangle_find_linepoint_closest_to_point (double x1, double y1,
double x2, double y2,
double px, double py,
double *valx, double *valy);
/***************************************************************************/
/* */
/* Switching gears to code for edges instead of just rectangles */
/* */
/***************************************************************************/
/* Return whether an edge overlaps or is adjacent to the rectangle in the
* nonzero-width dimension of the edge.
*/
gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect,
const MetaEdge *edge);
/* Compare two edges, so that sorting functions can put a list of edges in
* canonical order.
*/
gint meta_rectangle_edge_cmp (gconstpointer a, gconstpointer b);
/* Compare two edges, so that sorting functions can put a list of edges in
* order. This function doesn't separate left edges first, then right edges,
* etc., but rather compares only upon location.
*/
gint meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b);
/* Removes an parts of edges in the given list that intersect any box in the
* given rectangle list. Returns the result.
*/
GList* meta_rectangle_remove_intersections_with_boxes_from_edges (
GList *edges,
const GSList *rectangles);
/* Finds all the edges of an onscreen region, returning a GList* of
* MetaEdgeRect's.
*/
GList* meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
const GSList *all_struts);
/* Finds edges between adjacent monitors which are not covered by the given
* struts.
*/
GList* meta_rectangle_find_nonintersected_monitor_edges (
const GList *monitor_rects,
const GSList *all_struts);
#endif /* META_BOXES_PRIVATE_H */

View file

@ -26,7 +26,7 @@
* 02111-1307, USA.
*/
#include "boxes.h"
#include "boxes-private.h"
#include "util.h"
#include <X11/Xutil.h> /* Just for the definition of the various gravities */

View file

@ -24,6 +24,7 @@
*/
#include <config.h>
#include "boxes-private.h"
#include "constraints.h"
#include "workspace-private.h"
#include "place.h"

View file

@ -5491,6 +5491,13 @@ meta_display_get_shape_event_base (MetaDisplay *display)
}
#endif
/**
* meta_display_get_atom: (skip)
*
* Gets up an X atom that Mutter prefetched at startup.
*
* Return value: the X atom corresponding to the given atom enumeration
*/
Atom meta_display_get_atom (MetaDisplay *display, MetaAtom meta_atom)
{
Atom *atoms = & display->atom_WM_PROTOCOLS;

View file

@ -23,7 +23,7 @@
#include <config.h>
#include "edge-resistance.h"
#include "boxes.h"
#include "boxes-private.h"
#include "display-private.h"
#include "workspace-private.h"

View file

@ -26,6 +26,7 @@
#include <config.h>
#include "boxes-private.h"
#include "place.h"
#include "workspace.h"
#include "prefs.h"

View file

@ -21,7 +21,7 @@
* 02111-1307, USA.
*/
#include "boxes.h"
#include "boxes-private.h"
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -26,6 +26,7 @@
#include <config.h>
#include "window-private.h"
#include "boxes-private.h"
#include "edge-resistance.h"
#include "util.h"
#include "frame-private.h"
@ -9376,6 +9377,17 @@ meta_window_get_window_type (MetaWindow *window)
return window->type;
}
/**
* meta_window_get_window_type_atom: (skip)
* @window: a #MetaWindow
*
* Gets the X atom from the _NET_WM_WINDOW_TYPE property used by the
* application to set the window type. (Note that this is constrained
* to be some value that Mutter recognizes - a completely unrecognized
* type atom will be returned as None.)
*
* Return value: the raw X atom for the window type, or None
*/
Atom
meta_window_get_window_type_atom (MetaWindow *window)
{

View file

@ -26,6 +26,7 @@
#include <config.h>
#include "workspace.h"
#include "workspace-private.h"
#include "boxes-private.h"
#include "errors.h"
#include "prefs.h"
@ -1048,7 +1049,7 @@ strut_lists_equal (GSList *l,
/**
* meta_workspace_set_builtin_struts:
* @workspace: a #MetaWorkspace
* @struts: (element-type Strut) (transfer none): list of #MetaStrut
* @struts: (element-type Meta.Strut) (transfer none): list of #MetaStrut
*
* Sets a list of struts that will be used in addition to the struts
* of the windows in the workspace when computing the work area of

View file

@ -45,18 +45,6 @@ struct _MetaStrut
MetaSide side;
};
#define BOX_LEFT(box) ((box).x) /* Leftmost pixel of rect */
#define BOX_RIGHT(box) ((box).x + (box).width) /* One pixel past right */
#define BOX_TOP(box) ((box).y) /* Topmost pixel of rect */
#define BOX_BOTTOM(box) ((box).y + (box).height) /* One pixel past bottom */
typedef enum
{
FIXED_DIRECTION_NONE = 0,
FIXED_DIRECTION_X = 1 << 0,
FIXED_DIRECTION_Y = 1 << 1,
} FixedDirections;
typedef enum
{
META_EDGE_WINDOW,
@ -77,28 +65,6 @@ GType meta_rectangle_get_type (void);
MetaRectangle *meta_rectangle_copy (const MetaRectangle *rect);
void meta_rectangle_free (MetaRectangle *rect);
/* Output functions -- note that the output buffer had better be big enough:
* rect_to_string: RECT_LENGTH
* region_to_string: (RECT_LENGTH+strlen(separator_string)) *
* g_list_length (region)
* edge_to_string: EDGE_LENGTH
* edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) *
* g_list_length (edge_list)
*/
#define RECT_LENGTH 27
#define EDGE_LENGTH 37
char* meta_rectangle_to_string (const MetaRectangle *rect,
char *output);
char* meta_rectangle_region_to_string (GList *region,
const char *separator_string,
char *output);
char* meta_rectangle_edge_to_string (const MetaEdge *edge,
char *output);
char* meta_rectangle_edge_list_to_string (
GList *edge_list,
const char *separator_string,
char *output);
/* Function to make initializing a rect with a single line of code easy */
MetaRectangle meta_rect (int x, int y, int width, int height);
@ -139,159 +105,4 @@ gboolean meta_rectangle_could_fit_rect (const MetaRectangle *outer_rect,
gboolean meta_rectangle_contains_rect (const MetaRectangle *outer_rect,
const MetaRectangle *inner_rect);
/* Resize old_rect to the given new_width and new_height, but store the
* result in rect. NOTE THAT THIS IS RESIZE ONLY SO IT CANNOT BE USED FOR
* A MOVERESIZE OPERATION (that simplies the routine a little bit as it
* means there's no difference between NorthWestGravity and StaticGravity.
* Also, I lied a little bit--technically, you could use it in a MoveResize
* operation if you muck with old_rect just right).
*/
void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
MetaRectangle *rect,
int gravity,
int new_width,
int new_height);
/* find a list of rectangles with the property that a window is contained
* in the given region if and only if it is contained in one of the
* rectangles in the list.
*
* In this case, the region is given by taking basic_rect, removing from
* it the intersections with all the rectangles in the all_struts list,
* then expanding all the rectangles in the resulting list by the given
* amounts on each side.
*
* See boxes.c for more details.
*/
GList* meta_rectangle_get_minimal_spanning_set_for_region (
const MetaRectangle *basic_rect,
const GSList *all_struts);
/* Expand all rectangles in region by the given amount on each side */
GList* meta_rectangle_expand_region (GList *region,
const int left_expand,
const int right_expand,
const int top_expand,
const int bottom_expand);
/* Same as for meta_rectangle_expand_region except that rectangles not at
* least min_x or min_y in size are not expanded in that direction
*/
GList* meta_rectangle_expand_region_conditionally (
GList *region,
const int left_expand,
const int right_expand,
const int top_expand,
const int bottom_expand,
const int min_x,
const int min_y);
/* Expand rect in direction to the size of expand_to, and then clip out any
* overlapping struts oriented orthognal to the expansion direction. (Think
* horizontal or vertical maximization)
*/
void meta_rectangle_expand_to_avoiding_struts (
MetaRectangle *rect,
const MetaRectangle *expand_to,
const MetaDirection direction,
const GSList *all_struts);
/* Free the list created by
* meta_rectangle_get_minimal_spanning_set_for_region()
* or
* meta_rectangle_find_onscreen_edges ()
* or
* meta_rectangle_find_nonintersected_monitor_edges()
*/
void meta_rectangle_free_list_and_elements (GList *filled_list);
/* could_fit_in_region determines whether one of the spanning_rects is
* big enough to contain rect. contained_in_region checks whether one
* actually contains it.
*/
gboolean meta_rectangle_could_fit_in_region (
const GList *spanning_rects,
const MetaRectangle *rect);
gboolean meta_rectangle_contained_in_region (
const GList *spanning_rects,
const MetaRectangle *rect);
gboolean meta_rectangle_overlaps_with_region (
const GList *spanning_rects,
const MetaRectangle *rect);
/* Make the rectangle small enough to fit into one of the spanning_rects,
* but make it no smaller than min_size.
*/
void meta_rectangle_clamp_to_fit_into_region (
const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect,
const MetaRectangle *min_size);
/* Clip the rectangle so that it fits into one of the spanning_rects, assuming
* it overlaps with at least one of them
*/
void meta_rectangle_clip_to_region (const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect);
/* Shove the rectangle into one of the spanning_rects, assuming it fits in
* one of them.
*/
void meta_rectangle_shove_into_region(
const GList *spanning_rects,
FixedDirections fixed_directions,
MetaRectangle *rect);
/* Finds the point on the line connecting (x1,y1) to (x2,y2) which is closest
* to (px, py). Useful for finding an optimal rectangle size when given a
* range between two sizes that are all candidates.
*/
void meta_rectangle_find_linepoint_closest_to_point (double x1, double y1,
double x2, double y2,
double px, double py,
double *valx, double *valy);
/***************************************************************************/
/* */
/* Switching gears to code for edges instead of just rectangles */
/* */
/***************************************************************************/
/* Return whether an edge overlaps or is adjacent to the rectangle in the
* nonzero-width dimension of the edge.
*/
gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect,
const MetaEdge *edge);
/* Compare two edges, so that sorting functions can put a list of edges in
* canonical order.
*/
gint meta_rectangle_edge_cmp (gconstpointer a, gconstpointer b);
/* Compare two edges, so that sorting functions can put a list of edges in
* order. This function doesn't separate left edges first, then right edges,
* etc., but rather compares only upon location.
*/
gint meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b);
/* Removes an parts of edges in the given list that intersect any box in the
* given rectangle list. Returns the result.
*/
GList* meta_rectangle_remove_intersections_with_boxes_from_edges (
GList *edges,
const GSList *rectangles);
/* Finds all the edges of an onscreen region, returning a GList* of
* MetaEdgeRect's.
*/
GList* meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
const GSList *all_struts);
/* Finds edges between adjacent monitors which are not covered by the given
* struts.
*/
GList* meta_rectangle_find_nonintersected_monitor_edges (
const GList *monitor_rects,
const GSList *all_struts);
#endif /* META_BOXES_H */

View file

@ -27,7 +27,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "common.h"
#include "theme.h"
#include "theme-private.h"
typedef enum
{

View file

@ -23,7 +23,7 @@
#include <config.h>
#include "theme.h"
#include "theme-private.h"
#include <gtk/gtk.h>
#ifndef META_PREVIEW_WIDGET_H

View file

@ -22,7 +22,7 @@
*/
#include <config.h>
#include "theme-parser.h"
#include "theme-private.h"
#include "util.h"
#include <string.h>
#include <stdlib.h>

View file

@ -1,32 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Metacity theme parsing */
/*
* Copyright (C) 2001 Havoc Pennington
*
* 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.
*/
#include "theme.h"
#ifndef META_THEME_PARSER_H
#define META_THEME_PARSER_H
MetaTheme* meta_theme_load (const char *theme_name,
GError **err);
#endif

1220
src/ui/theme-private.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,6 @@
#include <config.h>
#include "util.h"
#include "theme.h"
#include "theme-parser.h"
#include "preview-widget.h"
#include <gtk/gtk.h>
#include <time.h>

View file

@ -53,8 +53,7 @@
*/
#include <config.h>
#include "theme.h"
#include "theme-parser.h"
#include "theme-private.h"
#include "util.h"
#include "gradient.h"
#include <gtk/gtk.h>

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,7 @@
#include "util.h"
#include "menu.h"
#include "core.h"
#include "theme.h"
#include "theme-private.h"
#include "inlinepixbufs.h"
#include "gdk-compat.h"