summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2007-12-19 21:17:50 +0000
committerHavoc Pennington <hp@src.gnome.org>2007-12-19 21:17:50 +0000
commit72b08c82b16a850fd4f0cd52d58812b4180fe969 (patch)
tree587cf32237864f2ff6241c1cbf1045074eed130d /src/include
parent3880951458910982807fc20ee9f11e22e947ddd2 (diff)
downloadmetacity-72b08c82b16a850fd4f0cd52d58812b4180fe969.tar.gz
sort source files into these directories according to which part of the WM
2007-12-19 Havoc Pennington <hp@redhat.com> * src/ui, src/core, src/include: sort source files into these directories according to which part of the WM they are supposed to be in. In an eventual plan, we should also create src/compositor/render, src/compositor/fallback and move some of the compositor stuff into that. * autogen.sh: require a newer automake, so we don't have to use a recursive build * src/ui/tabpopup.c: put in a hack to make the build temporarily work, want to commit the large rearrangement before fixing this not to include workspace.h or frame.h * src/core/iconcache.c (meta_read_icons): temporarily break this to get the build to work, want to commit the large rearrangement before fixing this file not to include theme.h svn path=/trunk/; revision=3491
Diffstat (limited to 'src/include')
-rw-r--r--src/include/boxes.h285
-rw-r--r--src/include/common.h286
-rw-r--r--src/include/core.h204
-rw-r--r--src/include/main.h45
-rw-r--r--src/include/prefs.h323
-rw-r--r--src/include/resizepopup.h47
-rw-r--r--src/include/tabpopup.h67
-rw-r--r--src/include/ui.h209
-rw-r--r--src/include/util.h125
9 files changed, 1591 insertions, 0 deletions
diff --git a/src/include/boxes.h b/src/include/boxes.h
new file mode 100644
index 00000000..145dbb05
--- /dev/null
+++ b/src/include/boxes.h
@@ -0,0 +1,285 @@
+/* -*- 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.h>
+#include "common.h"
+
+typedef struct _MetaRectangle MetaRectangle;
+struct _MetaRectangle
+{
+ int x;
+ int y;
+ int width;
+ int height;
+};
+
+typedef struct _MetaStrut MetaStrut;
+struct _MetaStrut
+{
+ MetaRectangle rect;
+ MetaDirection 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,
+ META_EDGE_XINERAMA,
+ META_EDGE_SCREEN
+} MetaEdgeType;
+
+typedef struct _MetaEdge MetaEdge;
+struct _MetaEdge
+{
+ MetaRectangle rect; /* width or height should be 1 */
+ MetaDirection side_type; /* should only have 1 of the 4 directions set */
+ MetaEdgeType edge_type;
+};
+
+/* 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);
+
+/* 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);
+
+/* 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);
+
+/* 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_xinerama_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 xineramas which are not covered by the given
+ * struts.
+ */
+GList* meta_rectangle_find_nonintersected_xinerama_edges (
+ const GList *xinerama_rects,
+ const GSList *all_struts);
+
+#endif /* META_BOXES_H */
diff --git a/src/include/common.h b/src/include/common.h
new file mode 100644
index 00000000..8bdce9d3
--- /dev/null
+++ b/src/include/common.h
@@ -0,0 +1,286 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity common types shared by core.h and ui.h */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2005 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_COMMON_H
+#define META_COMMON_H
+
+/* Don't include GTK or core headers here */
+#include <X11/Xlib.h>
+#include <glib.h>
+
+typedef struct _MetaResizePopup MetaResizePopup;
+
+typedef enum
+{
+ META_FRAME_ALLOWS_DELETE = 1 << 0,
+ META_FRAME_ALLOWS_MENU = 1 << 1,
+ META_FRAME_ALLOWS_MINIMIZE = 1 << 2,
+ META_FRAME_ALLOWS_MAXIMIZE = 1 << 3,
+ META_FRAME_ALLOWS_VERTICAL_RESIZE = 1 << 4,
+ META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 5,
+ META_FRAME_HAS_FOCUS = 1 << 6,
+ META_FRAME_SHADED = 1 << 7,
+ META_FRAME_STUCK = 1 << 8,
+ META_FRAME_MAXIMIZED = 1 << 9,
+ META_FRAME_ALLOWS_SHADE = 1 << 10,
+ META_FRAME_ALLOWS_MOVE = 1 << 11,
+ META_FRAME_FULLSCREEN = 1 << 12,
+ META_FRAME_IS_FLASHING = 1 << 13,
+ META_FRAME_ABOVE = 1 << 14
+} MetaFrameFlags;
+
+typedef enum
+{
+ META_MENU_OP_DELETE = 1 << 0,
+ META_MENU_OP_MINIMIZE = 1 << 1,
+ META_MENU_OP_UNMAXIMIZE = 1 << 2,
+ META_MENU_OP_MAXIMIZE = 1 << 3,
+ META_MENU_OP_UNSHADE = 1 << 4,
+ META_MENU_OP_SHADE = 1 << 5,
+ META_MENU_OP_UNSTICK = 1 << 6,
+ META_MENU_OP_STICK = 1 << 7,
+ META_MENU_OP_WORKSPACES = 1 << 8,
+ META_MENU_OP_MOVE = 1 << 9,
+ META_MENU_OP_RESIZE = 1 << 10,
+ META_MENU_OP_ABOVE = 1 << 11,
+ META_MENU_OP_UNABOVE = 1 << 12,
+ META_MENU_OP_MOVE_LEFT = 1 << 13,
+ META_MENU_OP_MOVE_RIGHT = 1 << 14,
+ META_MENU_OP_MOVE_UP = 1 << 15,
+ META_MENU_OP_MOVE_DOWN = 1 << 16,
+ META_MENU_OP_RECOVER = 1 << 17
+} MetaMenuOp;
+
+typedef struct _MetaWindowMenu MetaWindowMenu;
+
+typedef void (* MetaWindowMenuFunc) (MetaWindowMenu *menu,
+ Display *xdisplay,
+ Window client_xwindow,
+ guint32 timestamp,
+ MetaMenuOp op,
+ int workspace,
+ gpointer data);
+
+/* when changing this enum, there are various switch statements
+ * you have to update
+ */
+typedef enum
+{
+ META_GRAB_OP_NONE,
+
+ /* Mouse ops */
+ META_GRAB_OP_MOVING,
+ META_GRAB_OP_RESIZING_SE,
+ META_GRAB_OP_RESIZING_S,
+ META_GRAB_OP_RESIZING_SW,
+ META_GRAB_OP_RESIZING_N,
+ META_GRAB_OP_RESIZING_NE,
+ META_GRAB_OP_RESIZING_NW,
+ META_GRAB_OP_RESIZING_W,
+ META_GRAB_OP_RESIZING_E,
+
+ /* Keyboard ops */
+ META_GRAB_OP_KEYBOARD_MOVING,
+ META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
+ META_GRAB_OP_KEYBOARD_RESIZING_S,
+ META_GRAB_OP_KEYBOARD_RESIZING_N,
+ META_GRAB_OP_KEYBOARD_RESIZING_W,
+ META_GRAB_OP_KEYBOARD_RESIZING_E,
+ META_GRAB_OP_KEYBOARD_RESIZING_SE,
+ META_GRAB_OP_KEYBOARD_RESIZING_NE,
+ META_GRAB_OP_KEYBOARD_RESIZING_SW,
+ META_GRAB_OP_KEYBOARD_RESIZING_NW,
+
+ /* Alt+Tab */
+ META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
+ META_GRAB_OP_KEYBOARD_TABBING_DOCK,
+
+ /* Alt+Esc */
+ META_GRAB_OP_KEYBOARD_ESCAPING_NORMAL,
+ META_GRAB_OP_KEYBOARD_ESCAPING_DOCK,
+
+ META_GRAB_OP_KEYBOARD_ESCAPING_GROUP,
+
+ /* Alt+F6 */
+ META_GRAB_OP_KEYBOARD_TABBING_GROUP,
+
+ META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
+
+ /* Frame button ops */
+ META_GRAB_OP_CLICKING_MINIMIZE,
+ META_GRAB_OP_CLICKING_MAXIMIZE,
+ META_GRAB_OP_CLICKING_UNMAXIMIZE,
+ META_GRAB_OP_CLICKING_DELETE,
+ META_GRAB_OP_CLICKING_MENU,
+ META_GRAB_OP_CLICKING_SHADE,
+ META_GRAB_OP_CLICKING_UNSHADE,
+ META_GRAB_OP_CLICKING_ABOVE,
+ META_GRAB_OP_CLICKING_UNABOVE,
+ META_GRAB_OP_CLICKING_STICK,
+ META_GRAB_OP_CLICKING_UNSTICK
+} MetaGrabOp;
+
+typedef enum
+{
+ META_CURSOR_DEFAULT,
+ META_CURSOR_NORTH_RESIZE,
+ META_CURSOR_SOUTH_RESIZE,
+ META_CURSOR_WEST_RESIZE,
+ META_CURSOR_EAST_RESIZE,
+ META_CURSOR_SE_RESIZE,
+ META_CURSOR_SW_RESIZE,
+ META_CURSOR_NE_RESIZE,
+ META_CURSOR_NW_RESIZE,
+ META_CURSOR_MOVE_OR_RESIZE_WINDOW,
+ META_CURSOR_BUSY
+
+} MetaCursor;
+
+typedef enum
+{
+ META_FOCUS_MODE_CLICK,
+ META_FOCUS_MODE_SLOPPY,
+ META_FOCUS_MODE_MOUSE
+} MetaFocusMode;
+
+typedef enum
+{
+ META_FOCUS_NEW_WINDOWS_SMART,
+ META_FOCUS_NEW_WINDOWS_STRICT
+} MetaFocusNewWindows;
+
+typedef enum
+{
+ META_ACTION_TITLEBAR_TOGGLE_SHADE,
+ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
+ META_ACTION_TITLEBAR_MINIMIZE,
+ META_ACTION_TITLEBAR_NONE,
+ META_ACTION_TITLEBAR_LOWER,
+ META_ACTION_TITLEBAR_MENU,
+ META_ACTION_TITLEBAR_LAST
+} MetaActionTitlebar;
+
+typedef enum
+{
+ META_FRAME_TYPE_NORMAL,
+ META_FRAME_TYPE_DIALOG,
+ META_FRAME_TYPE_MODAL_DIALOG,
+ META_FRAME_TYPE_UTILITY,
+ META_FRAME_TYPE_MENU,
+ META_FRAME_TYPE_BORDER,
+ META_FRAME_TYPE_LAST
+} MetaFrameType;
+
+typedef enum
+{
+ /* Create gratuitous divergence from regular
+ * X mod bits, to be sure we find bugs
+ */
+ META_VIRTUAL_SHIFT_MASK = 1 << 5,
+ META_VIRTUAL_CONTROL_MASK = 1 << 6,
+ META_VIRTUAL_ALT_MASK = 1 << 7,
+ META_VIRTUAL_META_MASK = 1 << 8,
+ META_VIRTUAL_SUPER_MASK = 1 << 9,
+ META_VIRTUAL_HYPER_MASK = 1 << 10,
+ META_VIRTUAL_MOD2_MASK = 1 << 11,
+ META_VIRTUAL_MOD3_MASK = 1 << 12,
+ META_VIRTUAL_MOD4_MASK = 1 << 13,
+ META_VIRTUAL_MOD5_MASK = 1 << 14
+} MetaVirtualModifier;
+
+/* Relative directions or sides seem to come up all over the place... */
+/* FIXME: Replace
+ * screen.[ch]:MetaScreenDirection,
+ * workspace.[ch]:MetaMotionDirection,
+ * with the use of MetaDirection.
+ */
+typedef enum
+{
+ META_DIRECTION_LEFT = 1 << 0,
+ META_DIRECTION_RIGHT = 1 << 1,
+ META_DIRECTION_TOP = 1 << 2,
+ META_DIRECTION_BOTTOM = 1 << 3,
+
+ /* Some aliases for making code more readable for various circumstances. */
+ META_DIRECTION_UP = META_DIRECTION_TOP,
+ META_DIRECTION_DOWN = META_DIRECTION_BOTTOM,
+
+ /* A few more definitions using aliases */
+ META_DIRECTION_HORIZONTAL = META_DIRECTION_LEFT | META_DIRECTION_RIGHT,
+ META_DIRECTION_VERTICAL = META_DIRECTION_UP | META_DIRECTION_DOWN,
+
+ /* And a few more aliases */
+ META_SIDE_LEFT = META_DIRECTION_LEFT,
+ META_SIDE_RIGHT = META_DIRECTION_RIGHT,
+ META_SIDE_TOP = META_DIRECTION_TOP,
+ META_SIDE_BOTTOM = META_DIRECTION_BOTTOM
+} MetaDirection;
+
+/* Function a window button can have. Note, you can't add stuff here
+ * without extending the theme format to draw a new function and
+ * breaking all existing themes.
+ */
+typedef enum
+{
+ META_BUTTON_FUNCTION_MENU,
+ META_BUTTON_FUNCTION_MINIMIZE,
+ META_BUTTON_FUNCTION_MAXIMIZE,
+ META_BUTTON_FUNCTION_CLOSE,
+ META_BUTTON_FUNCTION_SHADE,
+ META_BUTTON_FUNCTION_ABOVE,
+ META_BUTTON_FUNCTION_STICK,
+ META_BUTTON_FUNCTION_UNSHADE,
+ META_BUTTON_FUNCTION_UNABOVE,
+ META_BUTTON_FUNCTION_UNSTICK,
+ META_BUTTON_FUNCTION_LAST
+} MetaButtonFunction;
+
+#define MAX_BUTTONS_PER_CORNER META_BUTTON_FUNCTION_LAST
+
+typedef struct _MetaButtonLayout MetaButtonLayout;
+struct _MetaButtonLayout
+{
+ /* buttons in the group on the left side */
+ MetaButtonFunction left_buttons[MAX_BUTTONS_PER_CORNER];
+
+ /* buttons in the group on the right side */
+ MetaButtonFunction right_buttons[MAX_BUTTONS_PER_CORNER];
+};
+
+/* should investigate changing these to whatever most apps use */
+#define META_ICON_WIDTH 32
+#define META_ICON_HEIGHT 32
+#define META_MINI_ICON_WIDTH 16
+#define META_MINI_ICON_HEIGHT 16
+
+#define META_PRIORITY_PREFS_NOTIFY (G_PRIORITY_DEFAULT_IDLE + 10)
+#define META_PRIORITY_WORK_AREA_HINT (G_PRIORITY_DEFAULT_IDLE + 15)
+
+#define POINT_IN_RECT(xcoord, ycoord, rect) \
+ ((xcoord) >= (rect).x && \
+ (xcoord) < ((rect).x + (rect).width) && \
+ (ycoord) >= (rect).y && \
+ (ycoord) < ((rect).y + (rect).height))
+
+#endif
diff --git a/src/include/core.h b/src/include/core.h
new file mode 100644
index 00000000..c374429f
--- /dev/null
+++ b/src/include/core.h
@@ -0,0 +1,204 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity interface used by GTK+ UI to talk to core */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2005 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_CORE_H
+#define META_CORE_H
+
+/* Don't include core headers here */
+#include <gdk/gdkx.h>
+#include "common.h"
+
+typedef enum
+{
+ META_CORE_GET_END = 0,
+ META_CORE_WINDOW_HAS_FRAME,
+ META_CORE_GET_CLIENT_WIDTH,
+ META_CORE_GET_CLIENT_HEIGHT,
+ META_CORE_IS_TITLEBAR_ONSCREEN,
+ META_CORE_GET_CLIENT_XWINDOW,
+ META_CORE_GET_FRAME_FLAGS,
+ META_CORE_GET_FRAME_TYPE,
+ META_CORE_GET_MINI_ICON,
+ META_CORE_GET_ICON,
+ META_CORE_GET_X,
+ META_CORE_GET_Y,
+ META_CORE_GET_FRAME_WORKSPACE,
+ META_CORE_GET_FRAME_X,
+ META_CORE_GET_FRAME_Y,
+ META_CORE_GET_FRAME_WIDTH,
+ META_CORE_GET_FRAME_HEIGHT,
+ META_CORE_GET_SCREEN_WIDTH,
+ META_CORE_GET_SCREEN_HEIGHT,
+} MetaCoreGetType;
+
+/* General information function about the given window. Pass in a sequence of
+ * pairs of MetaCoreGetTypes and pointers to variables; the variables will be
+ * filled with the requested values. End the list with META_CORE_GET_END.
+ * For example:
+ *
+ * meta_core_get (my_display, my_window,
+ * META_CORE_GET_X, &x,
+ * META_CORE_GET_Y, &y,
+ * META_CORE_GET_END);
+ *
+ * If the window doesn't have a frame, this will raise a meta_bug. To suppress
+ * this behaviour, ask META_CORE_WINDOW_HAS_FRAME as the *first* question in
+ * the list. If the window has no frame, the answer to this question will be
+ * False, and anything else you asked will be undefined. Otherwise, the answer
+ * will be True. The answer will necessarily be True if you ask the question
+ * in any other position. The positions of all other questions don't matter.
+ *
+ * The reason for this function is that some parts of the program don't know
+ * about MetaWindows. But they *can* see core.h. So we used to have a whole
+ * load of functions which took a display and an X window, looked up the
+ * relevant MetaWindow, and returned information about it. The trouble with
+ * that is that looking up the MetaWindow is a nontrivial operation, and
+ * consolidating the calls in this way makes (for example) frame exposes
+ * 33% faster, according to valgrind.
+ *
+ * This function would perhaps be slightly better if the questions were
+ * represented by pointers, perhaps gchar*s, because then we could take
+ * advantage of gcc's automatic sentinel checking. On the other hand, this
+ * immediately suggests string comparison, and that's slow.
+ *
+ * Another possible improvement is that core.h still has a bunch of
+ * functions which can't be described by the formula "give a display and
+ * an X window, get a single value" (meta_core_user_move, for example), but
+ * which could theoretically be handled by this function if we relaxed the
+ * requirement that all questions should have exactly one argument.
+ */
+void meta_core_get (Display *xdisplay,
+ Window window,
+ ...);
+
+void meta_core_queue_frame_resize (Display *xdisplay,
+ Window frame_xwindow);
+
+/* Move as a result of user operation */
+void meta_core_user_move (Display *xdisplay,
+ Window frame_xwindow,
+ int x,
+ int y);
+void meta_core_user_resize (Display *xdisplay,
+ Window frame_xwindow,
+ int gravity,
+ int width,
+ int height);
+
+void meta_core_user_raise (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_user_lower_and_unfocus (Display *xdisplay,
+ Window frame_xwindow,
+ guint32 timestamp);
+
+void meta_core_user_focus (Display *xdisplay,
+ Window frame_xwindow,
+ guint32 timestamp);
+
+void meta_core_minimize (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_toggle_maximize (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_unmaximize (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_maximize (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_delete (Display *xdisplay,
+ Window frame_xwindow,
+ guint32 timestamp);
+void meta_core_unshade (Display *xdisplay,
+ Window frame_xwindow,
+ guint32 timestamp);
+void meta_core_shade (Display *xdisplay,
+ Window frame_xwindow,
+ guint32 timestamp);
+void meta_core_unstick (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_stick (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_unmake_above (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_make_above (Display *xdisplay,
+ Window frame_xwindow);
+void meta_core_change_workspace (Display *xdisplay,
+ Window frame_xwindow,
+ int new_workspace);
+
+int meta_core_get_num_workspaces (Screen *xscreen);
+int meta_core_get_active_workspace (Screen *xscreen);
+int meta_core_get_frame_workspace (Display *xdisplay,
+ Window frame_xwindow);
+const char* meta_core_get_workspace_name_with_index (Display *xdisplay,
+ Window xroot,
+ int index);
+
+void meta_core_show_window_menu (Display *xdisplay,
+ Window frame_xwindow,
+ int root_x,
+ int root_y,
+ int button,
+ guint32 timestamp);
+
+void meta_core_get_menu_accelerator (MetaMenuOp menu_op,
+ int workspace,
+ unsigned int *keysym,
+ MetaVirtualModifier *modifiers);
+
+gboolean meta_core_begin_grab_op (Display *xdisplay,
+ Window frame_xwindow,
+ MetaGrabOp op,
+ gboolean pointer_already_grabbed,
+ gboolean frame_action,
+ int button,
+ gulong modmask,
+ guint32 timestamp,
+ int root_x,
+ int root_y);
+void meta_core_end_grab_op (Display *xdisplay,
+ guint32 timestamp);
+MetaGrabOp meta_core_get_grab_op (Display *xdisplay);
+Window meta_core_get_grab_frame (Display *xdisplay);
+int meta_core_get_grab_button (Display *xdisplay);
+
+
+void meta_core_grab_buttons (Display *xdisplay,
+ Window frame_xwindow);
+
+void meta_core_set_screen_cursor (Display *xdisplay,
+ Window frame_on_screen,
+ MetaCursor cursor);
+
+/* Used because we ignore EnterNotify when a window is unmapped that
+ * really shouldn't cause focus changes, by comparing the event serial
+ * of the EnterNotify and the UnmapNotify.
+ */
+void meta_core_increment_event_serial (Display *display);
+
+void meta_invalidate_default_icons (void);
+
+#endif
+
+
+
+
diff --git a/src/include/main.h b/src/include/main.h
new file mode 100644
index 00000000..1eada677
--- /dev/null
+++ b/src/include/main.h
@@ -0,0 +1,45 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity main */
+
+/*
+ * 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.
+ */
+
+#ifndef META_MAIN_H
+#define META_MAIN_H
+
+#include <glib.h>
+
+typedef enum
+{
+ META_EXIT_SUCCESS,
+ META_EXIT_ERROR
+} MetaExitCode;
+
+/* exit immediately */
+void meta_exit (MetaExitCode code);
+
+/* g_main_quit() then fall out of main() */
+void meta_quit (MetaExitCode code);
+
+void meta_restart (void);
+
+GMainLoop* meta_get_main_loop (void);
+
+#endif
diff --git a/src/include/prefs.h b/src/include/prefs.h
new file mode 100644
index 00000000..4f2deef2
--- /dev/null
+++ b/src/include/prefs.h
@@ -0,0 +1,323 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity preferences */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 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_PREFS_H
+#define META_PREFS_H
+
+/* This header is a "common" one between the UI and core side */
+#include "common.h"
+#include <pango/pango-font.h>
+
+typedef enum
+{
+ META_PREF_MOUSE_BUTTON_MODS,
+ META_PREF_FOCUS_MODE,
+ META_PREF_FOCUS_NEW_WINDOWS,
+ META_PREF_RAISE_ON_CLICK,
+ META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
+ META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
+ META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
+ META_PREF_AUTO_RAISE,
+ META_PREF_AUTO_RAISE_DELAY,
+ META_PREF_THEME,
+ META_PREF_TITLEBAR_FONT,
+ META_PREF_NUM_WORKSPACES,
+ META_PREF_APPLICATION_BASED,
+ META_PREF_WINDOW_KEYBINDINGS,
+ META_PREF_SCREEN_KEYBINDINGS,
+ META_PREF_DISABLE_WORKAROUNDS,
+ META_PREF_COMMANDS,
+ META_PREF_TERMINAL_COMMAND,
+ META_PREF_BUTTON_LAYOUT,
+ META_PREF_WORKSPACE_NAMES,
+ META_PREF_VISUAL_BELL,
+ META_PREF_AUDIBLE_BELL,
+ META_PREF_VISUAL_BELL_TYPE,
+ META_PREF_REDUCED_RESOURCES,
+ META_PREF_GNOME_ACCESSIBILITY,
+ META_PREF_CURSOR_THEME,
+ META_PREF_CURSOR_SIZE,
+ META_PREF_COMPOSITING_MANAGER
+} MetaPreference;
+
+typedef void (* MetaPrefsChangedFunc) (MetaPreference pref,
+ gpointer data);
+
+void meta_prefs_add_listener (MetaPrefsChangedFunc func,
+ gpointer data);
+void meta_prefs_remove_listener (MetaPrefsChangedFunc func,
+ gpointer data);
+
+void meta_prefs_init (void);
+const char* meta_preference_to_string (MetaPreference pref);
+
+MetaVirtualModifier meta_prefs_get_mouse_button_mods (void);
+MetaFocusMode meta_prefs_get_focus_mode (void);
+MetaFocusNewWindows meta_prefs_get_focus_new_windows (void);
+gboolean meta_prefs_get_raise_on_click (void);
+const char* meta_prefs_get_theme (void);
+/* returns NULL if GTK default should be used */
+const PangoFontDescription* meta_prefs_get_titlebar_font (void);
+int meta_prefs_get_num_workspaces (void);
+gboolean meta_prefs_get_application_based (void);
+gboolean meta_prefs_get_disable_workarounds (void);
+gboolean meta_prefs_get_auto_raise (void);
+int meta_prefs_get_auto_raise_delay (void);
+gboolean meta_prefs_get_reduced_resources (void);
+gboolean meta_prefs_get_gnome_accessibility (void);
+
+const char* meta_prefs_get_command (int i);
+
+char* meta_prefs_get_gconf_key_for_command (int i);
+
+const char* meta_prefs_get_terminal_command (void);
+const char* meta_prefs_get_gconf_key_for_terminal_command (void);
+
+void meta_prefs_get_button_layout (MetaButtonLayout *button_layout);
+
+/* Double, right, middle click can be configured to any titlebar meta-action */
+MetaActionTitlebar meta_prefs_get_action_double_click_titlebar (void);
+MetaActionTitlebar meta_prefs_get_action_middle_click_titlebar (void);
+MetaActionTitlebar meta_prefs_get_action_right_click_titlebar (void);
+
+void meta_prefs_set_num_workspaces (int n_workspaces);
+
+const char* meta_prefs_get_workspace_name (int i);
+void meta_prefs_change_workspace_name (int i,
+ const char *name);
+
+const char* meta_prefs_get_cursor_theme (void);
+int meta_prefs_get_cursor_size (void);
+gboolean meta_prefs_get_compositing_manager (void);
+
+/* Screen bindings */
+#define META_KEYBINDING_WORKSPACE_1 "switch_to_workspace_1"
+#define META_KEYBINDING_WORKSPACE_2 "switch_to_workspace_2"
+#define META_KEYBINDING_WORKSPACE_3 "switch_to_workspace_3"
+#define META_KEYBINDING_WORKSPACE_4 "switch_to_workspace_4"
+#define META_KEYBINDING_WORKSPACE_5 "switch_to_workspace_5"
+#define META_KEYBINDING_WORKSPACE_6 "switch_to_workspace_6"
+#define META_KEYBINDING_WORKSPACE_7 "switch_to_workspace_7"
+#define META_KEYBINDING_WORKSPACE_8 "switch_to_workspace_8"
+#define META_KEYBINDING_WORKSPACE_9 "switch_to_workspace_9"
+#define META_KEYBINDING_WORKSPACE_10 "switch_to_workspace_10"
+#define META_KEYBINDING_WORKSPACE_11 "switch_to_workspace_11"
+#define META_KEYBINDING_WORKSPACE_12 "switch_to_workspace_12"
+#define META_KEYBINDING_WORKSPACE_LEFT "switch_to_workspace_left"
+#define META_KEYBINDING_WORKSPACE_RIGHT "switch_to_workspace_right"
+#define META_KEYBINDING_WORKSPACE_UP "switch_to_workspace_up"
+#define META_KEYBINDING_WORKSPACE_DOWN "switch_to_workspace_down"
+#define META_KEYBINDING_SWITCH_GROUP "switch_group"
+#define META_KEYBINDING_SWITCH_GROUP_BACKWARD "switch_group_backward"
+#define META_KEYBINDING_SWITCH_WINDOWS "switch_windows"
+#define META_KEYBINDING_SWITCH_WINDOWS_BACKWARD "switch_windows_backward"
+#define META_KEYBINDING_SWITCH_PANELS "switch_panels"
+#define META_KEYBINDING_SWITCH_PANELS_BACKWARD "switch_panels_backward"
+#define META_KEYBINDING_CYCLE_GROUP "cycle_group"
+#define META_KEYBINDING_CYCLE_GROUP_BACKWARD "cycle_group_backward"
+#define META_KEYBINDING_CYCLE_WINDOWS "cycle_windows"
+#define META_KEYBINDING_CYCLE_WINDOWS_BACKWARD "cycle_windows_backward"
+#define META_KEYBINDING_CYCLE_PANELS "cycle_panels"
+#define META_KEYBINDING_CYCLE_PANELS_BACKWARD "cycle_panels_backward"
+#define META_KEYBINDING_SHOW_DESKTOP "show_desktop"
+#define META_KEYBINDING_PANEL_MAIN_MENU "panel_main_menu"
+#define META_KEYBINDING_PANEL_RUN_DIALOG "panel_run_dialog"
+#define META_KEYBINDING_COMMAND_1 "run_command_1"
+#define META_KEYBINDING_COMMAND_2 "run_command_2"
+#define META_KEYBINDING_COMMAND_3 "run_command_3"
+#define META_KEYBINDING_COMMAND_4 "run_command_4"
+#define META_KEYBINDING_COMMAND_5 "run_command_5"
+#define META_KEYBINDING_COMMAND_6 "run_command_6"
+#define META_KEYBINDING_COMMAND_7 "run_command_7"
+#define META_KEYBINDING_COMMAND_8 "run_command_8"
+#define META_KEYBINDING_COMMAND_9 "run_command_9"
+#define META_KEYBINDING_COMMAND_10 "run_command_10"
+#define META_KEYBINDING_COMMAND_11 "run_command_11"
+#define META_KEYBINDING_COMMAND_12 "run_command_12"
+#define META_KEYBINDING_COMMAND_13 "run_command_13"
+#define META_KEYBINDING_COMMAND_14 "run_command_14"
+#define META_KEYBINDING_COMMAND_15 "run_command_15"
+#define META_KEYBINDING_COMMAND_16 "run_command_16"
+#define META_KEYBINDING_COMMAND_17 "run_command_17"
+#define META_KEYBINDING_COMMAND_18 "run_command_18"
+#define META_KEYBINDING_COMMAND_19 "run_command_19"
+#define META_KEYBINDING_COMMAND_20 "run_command_20"
+#define META_KEYBINDING_COMMAND_21 "run_command_21"
+#define META_KEYBINDING_COMMAND_22 "run_command_22"
+#define META_KEYBINDING_COMMAND_23 "run_command_23"
+#define META_KEYBINDING_COMMAND_24 "run_command_24"
+#define META_KEYBINDING_COMMAND_25 "run_command_25"
+#define META_KEYBINDING_COMMAND_26 "run_command_26"
+#define META_KEYBINDING_COMMAND_27 "run_command_27"
+#define META_KEYBINDING_COMMAND_28 "run_command_28"
+#define META_KEYBINDING_COMMAND_29 "run_command_29"
+#define META_KEYBINDING_COMMAND_30 "run_command_30"
+#define META_KEYBINDING_COMMAND_31 "run_command_31"
+#define META_KEYBINDING_COMMAND_32 "run_command_32"
+#define META_KEYBINDING_COMMAND_SCREENSHOT "run_command_screenshot"
+#define META_KEYBINDING_COMMAND_WIN_SCREENSHOT "run_command_window_screenshot"
+#define META_KEYBINDING_RUN_COMMAND_TERMINAL "run_command_terminal"
+#define META_KEYBINDING_SET_SPEW_MARK "set_spew_mark"
+
+/* Window bindings */
+#define META_KEYBINDING_WINDOW_MENU "activate_window_menu"
+#define META_KEYBINDING_TOGGLE_FULLSCREEN "toggle_fullscreen"
+#define META_KEYBINDING_TOGGLE_MAXIMIZE "toggle_maximized"
+#define META_KEYBINDING_TOGGLE_ABOVE "toggle_above"
+#define META_KEYBINDING_MAXIMIZE "maximize"
+#define META_KEYBINDING_UNMAXIMIZE "unmaximize"
+#define META_KEYBINDING_TOGGLE_SHADE "toggle_shaded"
+#define META_KEYBINDING_MINIMIZE "minimize"
+#define META_KEYBINDING_CLOSE "close"
+#define META_KEYBINDING_BEGIN_MOVE "begin_move"
+#define META_KEYBINDING_BEGIN_RESIZE "begin_resize"
+#define META_KEYBINDING_TOGGLE_STICKY "toggle_on_all_workspaces"
+#define META_KEYBINDING_MOVE_WORKSPACE_1 "move_to_workspace_1"
+#define META_KEYBINDING_MOVE_WORKSPACE_2 "move_to_workspace_2"
+#define META_KEYBINDING_MOVE_WORKSPACE_3 "move_to_workspace_3"
+#define META_KEYBINDING_MOVE_WORKSPACE_4 "move_to_workspace_4"
+#define META_KEYBINDING_MOVE_WORKSPACE_5 "move_to_workspace_5"
+#define META_KEYBINDING_MOVE_WORKSPACE_6 "move_to_workspace_6"
+#define META_KEYBINDING_MOVE_WORKSPACE_7 "move_to_workspace_7"
+#define META_KEYBINDING_MOVE_WORKSPACE_8 "move_to_workspace_8"
+#define META_KEYBINDING_MOVE_WORKSPACE_9 "move_to_workspace_9"
+#define META_KEYBINDING_MOVE_WORKSPACE_10 "move_to_workspace_10"
+#define META_KEYBINDING_MOVE_WORKSPACE_11 "move_to_workspace_11"
+#define META_KEYBINDING_MOVE_WORKSPACE_12 "move_to_workspace_12"
+#define META_KEYBINDING_MOVE_WORKSPACE_LEFT "move_to_workspace_left"
+#define META_KEYBINDING_MOVE_WORKSPACE_RIGHT "move_to_workspace_right"
+#define META_KEYBINDING_MOVE_WORKSPACE_UP "move_to_workspace_up"
+#define META_KEYBINDING_MOVE_WORKSPACE_DOWN "move_to_workspace_down"
+#define META_KEYBINDING_RAISE_OR_LOWER "raise_or_lower"
+#define META_KEYBINDING_RAISE "raise"
+#define META_KEYBINDING_LOWER "lower"
+#define META_KEYBINDING_MAXIMIZE_VERTICALLY "maximize_vertically"
+#define META_KEYBINDING_MAXIMIZE_HORIZONTALLY "maximize_horizontally"
+#define META_KEYBINDING_MOVE_TO_CORNER_NW "move_to_corner_nw"
+#define META_KEYBINDING_MOVE_TO_CORNER_NE "move_to_corner_ne"
+#define META_KEYBINDING_MOVE_TO_CORNER_SW "move_to_corner_sw"
+#define META_KEYBINDING_MOVE_TO_CORNER_SE "move_to_corner_se"
+#define META_KEYBINDING_MOVE_TO_SIDE_N "move_to_side_n"
+#define META_KEYBINDING_MOVE_TO_SIDE_S "move_to_side_s"
+#define META_KEYBINDING_MOVE_TO_SIDE_E "move_to_side_e"
+#define META_KEYBINDING_MOVE_TO_SIDE_W "move_to_side_w"
+
+typedef enum _MetaKeyBindingAction
+{
+ META_KEYBINDING_ACTION_NONE = -1,
+ META_KEYBINDING_ACTION_WORKSPACE_1,
+ META_KEYBINDING_ACTION_WORKSPACE_2,
+ META_KEYBINDING_ACTION_WORKSPACE_3,
+ META_KEYBINDING_ACTION_WORKSPACE_4,
+ META_KEYBINDING_ACTION_WORKSPACE_5,
+ META_KEYBINDING_ACTION_WORKSPACE_6,
+ META_KEYBINDING_ACTION_WORKSPACE_7,
+ META_KEYBINDING_ACTION_WORKSPACE_8,
+ META_KEYBINDING_ACTION_WORKSPACE_9,
+ META_KEYBINDING_ACTION_WORKSPACE_10,
+ META_KEYBINDING_ACTION_WORKSPACE_11,
+ META_KEYBINDING_ACTION_WORKSPACE_12,
+ META_KEYBINDING_ACTION_WORKSPACE_LEFT,
+ META_KEYBINDING_ACTION_WORKSPACE_RIGHT,
+ META_KEYBINDING_ACTION_WORKSPACE_UP,
+ META_KEYBINDING_ACTION_WORKSPACE_DOWN,
+ META_KEYBINDING_ACTION_SWITCH_GROUP,
+ META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD,
+ META_KEYBINDING_ACTION_SWITCH_WINDOWS,
+ META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD,
+ META_KEYBINDING_ACTION_SWITCH_PANELS,
+ META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD,
+ META_KEYBINDING_ACTION_CYCLE_GROUP,
+ META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD,
+ META_KEYBINDING_ACTION_CYCLE_WINDOWS,
+ META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD,
+ META_KEYBINDING_ACTION_CYCLE_PANELS,
+ META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD,
+ META_KEYBINDING_ACTION_SHOW_DESKTOP,
+ META_KEYBINDING_ACTION_PANEL_MAIN_MENU,
+ META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
+ META_KEYBINDING_ACTION_COMMAND_1,
+ META_KEYBINDING_ACTION_COMMAND_2,
+ META_KEYBINDING_ACTION_COMMAND_3,
+ META_KEYBINDING_ACTION_COMMAND_4,
+ META_KEYBINDING_ACTION_COMMAND_5,
+ META_KEYBINDING_ACTION_COMMAND_6,
+ META_KEYBINDING_ACTION_COMMAND_7,
+ META_KEYBINDING_ACTION_COMMAND_8,
+ META_KEYBINDING_ACTION_COMMAND_9,
+ META_KEYBINDING_ACTION_COMMAND_10,
+ META_KEYBINDING_ACTION_COMMAND_11,
+ META_KEYBINDING_ACTION_COMMAND_12
+} MetaKeyBindingAction;
+
+typedef struct
+{
+ unsigned int keysym;
+ unsigned int keycode;
+ MetaVirtualModifier modifiers;
+} MetaKeyCombo;
+
+typedef struct
+{
+ const char *name;
+ /* a list of MetaKeyCombos. Each of them is bound to
+ * this keypref. If one has keysym==modifiers==0, it is
+ * ignored. For historical reasons, the first entry is
+ * governed by the pref FOO and the remainder are
+ * governed by the pref FOO_list.
+ */
+ GSList *bindings;
+
+ /* for keybindings that can have shift or not like Alt+Tab */
+ gboolean add_shift;
+} MetaKeyPref;
+
+void meta_prefs_get_screen_bindings (const MetaKeyPref **bindings,
+ int *n_bindings);
+void meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
+ int *n_bindings);
+
+MetaKeyBindingAction meta_prefs_get_keybinding_action (const char *name);
+
+void meta_prefs_get_window_binding (const char *name,
+ unsigned int *keysym,
+ MetaVirtualModifier *modifiers);
+
+typedef enum
+{
+ META_VISUAL_BELL_INVALID = 0,
+ META_VISUAL_BELL_FULLSCREEN_FLASH,
+ META_VISUAL_BELL_FRAME_FLASH
+
+} MetaVisualBellType;
+
+gboolean meta_prefs_get_visual_bell (void);
+gboolean meta_prefs_bell_is_audible (void);
+MetaVisualBellType meta_prefs_get_visual_bell_type (void);
+
+#endif
+
+
+
+
diff --git a/src/include/resizepopup.h b/src/include/resizepopup.h
new file mode 100644
index 00000000..a861ff38
--- /dev/null
+++ b/src/include/resizepopup.h
@@ -0,0 +1,47 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity resizing-terminal-window feedback */
+
+/*
+ * 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.
+ */
+
+#ifndef META_RESIZEPOPUP_H
+#define META_RESIZEPOPUP_H
+
+/* Don't include gtk.h or gdk.h here */
+#include "boxes.h"
+#include "common.h"
+#include <X11/Xlib.h>
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+MetaResizePopup* meta_ui_resize_popup_new (Display *display,
+ int screen_number);
+void meta_ui_resize_popup_free (MetaResizePopup *popup);
+void meta_ui_resize_popup_set (MetaResizePopup *popup,
+ MetaRectangle rect,
+ int base_width,
+ int base_height,
+ int width_inc,
+ int height_inc);
+void meta_ui_resize_popup_set_showing (MetaResizePopup *popup,
+ gboolean showing);
+
+#endif
+
diff --git a/src/include/tabpopup.h b/src/include/tabpopup.h
new file mode 100644
index 00000000..c210a191
--- /dev/null
+++ b/src/include/tabpopup.h
@@ -0,0 +1,67 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity tab popup window */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2005 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_TABPOPUP_H
+#define META_TABPOPUP_H
+
+/* Don't include gtk.h or gdk.h here */
+#include "common.h"
+#include "boxes.h"
+#include <X11/Xlib.h>
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+typedef struct _MetaTabEntry MetaTabEntry;
+typedef struct _MetaTabPopup MetaTabPopup;
+typedef void *MetaTabEntryKey;
+
+struct _MetaTabEntry
+{
+ MetaTabEntryKey key;
+ const char *title;
+ GdkPixbuf *icon;
+ MetaRectangle rect;
+ MetaRectangle inner_rect;
+ guint blank : 1;
+ guint hidden : 1;
+ guint demands_attention : 1;
+};
+
+MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries,
+ int screen_number,
+ int entry_count,
+ int width,
+ gboolean outline);
+void meta_ui_tab_popup_free (MetaTabPopup *popup);
+void meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
+ gboolean showing);
+void meta_ui_tab_popup_forward (MetaTabPopup *popup);
+void meta_ui_tab_popup_backward (MetaTabPopup *popup);
+MetaTabEntryKey meta_ui_tab_popup_get_selected (MetaTabPopup *popup);
+void meta_ui_tab_popup_select (MetaTabPopup *popup,
+ MetaTabEntryKey key);
+
+
+#endif
+
diff --git a/src/include/ui.h b/src/include/ui.h
new file mode 100644
index 00000000..a4d7fea7
--- /dev/null
+++ b/src/include/ui.h
@@ -0,0 +1,209 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity interface for talking to GTK+ UI module */
+
+/*
+ * 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.
+ */
+
+#ifndef META_UI_H
+#define META_UI_H
+
+/* Don't include gtk.h or gdk.h here */
+#include "common.h"
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+/* This is between GTK_PRIORITY_RESIZE (+10) and GTK_PRIORITY_REDRAW (+20) */
+#define META_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 15)
+
+typedef struct _MetaUI MetaUI;
+
+typedef struct _MetaImageWindow MetaImageWindow;
+
+typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
+
+typedef enum
+{
+ META_UI_DIRECTION_LTR,
+ META_UI_DIRECTION_RTL
+} MetaUIDirection;
+
+void meta_ui_init (int *argc, char ***argv);
+
+Display* meta_ui_get_display (void);
+
+void meta_ui_add_event_func (Display *xdisplay,
+ MetaEventFunc func,
+ gpointer data);
+void meta_ui_remove_event_func (Display *xdisplay,
+ MetaEventFunc func,
+ gpointer data);
+
+MetaUI* meta_ui_new (Display *xdisplay,
+ Screen *screen);
+void meta_ui_free (MetaUI *ui);
+
+void meta_ui_theme_get_frame_borders (MetaUI *ui,
+ MetaFrameType type,
+ MetaFrameFlags flags,
+ int *top_height,
+ int *bottom_height,
+ int *left_width,
+ int *right_width);
+void meta_ui_get_frame_geometry (MetaUI *ui,
+ Window frame_xwindow,
+ int *top_height, int *bottom_height,
+ int *left_width, int *right_width);
+Window meta_ui_create_frame_window (MetaUI *ui,
+ Display *xdisplay,
+ Visual *xvisual,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gint screen_no);
+void meta_ui_destroy_frame_window (MetaUI *ui,
+ Window xwindow);
+void meta_ui_move_resize_frame (MetaUI *ui,
+ Window frame,
+ int x,
+ int y,
+ int width,
+ int height);
+
+/* GDK insists on tracking map/unmap */
+void meta_ui_map_frame (MetaUI *ui,
+ Window xwindow);
+void meta_ui_unmap_frame (MetaUI *ui,
+ Window xwindow);
+
+void meta_ui_unflicker_frame_bg (MetaUI *ui,
+ Window xwindow,
+ int target_width,
+ int target_height);
+void meta_ui_reset_frame_bg (MetaUI *ui,
+ Window xwindow);
+
+void meta_ui_apply_frame_shape (MetaUI *ui,
+ Window xwindow,
+ int new_window_width,
+ int new_window_height,
+ gboolean window_has_shape);
+
+void meta_ui_queue_frame_draw (MetaUI *ui,
+ Window xwindow);
+
+void meta_ui_set_frame_title (MetaUI *ui,
+ Window xwindow,
+ const char *title);
+
+void meta_ui_repaint_frame (MetaUI *ui,
+ Window xwindow);
+
+MetaWindowMenu* meta_ui_window_menu_new (MetaUI *ui,
+ Window client_xwindow,
+ MetaMenuOp ops,
+ MetaMenuOp insensitive,
+ unsigned long active_workspace,
+ int n_workspaces,
+ MetaWindowMenuFunc func,
+ gpointer data);
+void meta_ui_window_menu_popup (MetaWindowMenu *menu,
+ int root_x,
+ int root_y,
+ int button,
+ guint32 timestamp);
+void meta_ui_window_menu_free (MetaWindowMenu *menu);
+
+
+MetaImageWindow* meta_image_window_new (Display *xdisplay,
+ int screen_number,
+ int max_width,
+ int max_height);
+void meta_image_window_free (MetaImageWindow *iw);
+void meta_image_window_set_showing (MetaImageWindow *iw,
+ gboolean showing);
+void meta_image_window_set (MetaImageWindow *iw,
+ GdkPixbuf *pixbuf,
+ int x,
+ int y);
+
+/* FIXME these lack a display arg */
+GdkPixbuf* meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
+ Window xwindow,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ int width,
+ int height);
+
+GdkPixbuf* meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
+ Pixmap xpixmap,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ int width,
+ int height);
+
+/* Used when we have a server grab and draw all over everything,
+ * then we need to handle exposes after doing that, instead of
+ * during it
+ */
+void meta_ui_push_delay_exposes (MetaUI *ui);
+void meta_ui_pop_delay_exposes (MetaUI *ui);
+
+GdkPixbuf* meta_ui_get_default_window_icon (MetaUI *ui);
+GdkPixbuf* meta_ui_get_default_mini_icon (MetaUI *ui);
+
+gboolean meta_ui_window_should_not_cause_focus (Display *xdisplay,
+ Window xwindow);
+
+char* meta_text_property_to_utf8 (Display *xdisplay,
+ const XTextProperty *prop);
+
+void meta_ui_set_current_theme (const char *name,
+ gboolean force_reload);
+gboolean meta_ui_have_a_theme (void);
+
+gboolean meta_ui_parse_accelerator (const char *accel,
+ unsigned int *keysym,
+ unsigned int *keycode,
+ MetaVirtualModifier *mask);
+gboolean meta_ui_parse_modifier (const char *accel,
+ MetaVirtualModifier *mask);
+
+/* Caller responsible for freeing return string of meta_ui_accelerator_name! */
+gchar* meta_ui_accelerator_name (unsigned int keysym,
+ MetaVirtualModifier mask);
+gboolean meta_ui_window_is_widget (MetaUI *ui,
+ Window xwindow);
+
+int meta_ui_get_drag_threshold (MetaUI *ui);
+
+MetaUIDirection meta_ui_get_direction (void);
+
+GdkPixbuf *meta_ui_get_pixbuf_from_pixmap (Pixmap pmap);
+
+#include "tabpopup.h"
+
+#endif
diff --git a/src/include/util.h b/src/include/util.h
new file mode 100644
index 00000000..161ae938
--- /dev/null
+++ b/src/include/util.h
@@ -0,0 +1,125 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity utilities */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2005 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_UTIL_H
+#define META_UTIL_H
+
+#include <glib.h>
+
+gboolean meta_is_verbose (void);
+void meta_set_verbose (gboolean setting);
+gboolean meta_is_debugging (void);
+void meta_set_debugging (gboolean setting);
+gboolean meta_is_syncing (void);
+void meta_set_syncing (gboolean setting);
+gboolean meta_get_replace_current_wm (void);
+void meta_set_replace_current_wm (gboolean setting);
+
+void meta_debug_spew_real (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void meta_verbose_real (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+
+void meta_bug (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void meta_warning (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+void meta_fatal (const char *format,
+ ...) G_GNUC_PRINTF (1, 2);
+
+typedef enum
+{
+ META_DEBUG_FOCUS = 1 << 0,
+ META_DEBUG_WORKAREA = 1 << 1,
+ META_DEBUG_STACK = 1 << 2,
+ META_DEBUG_THEMES = 1 << 3,
+ META_DEBUG_SM = 1 << 4,
+ META_DEBUG_EVENTS = 1 << 5,
+ META_DEBUG_WINDOW_STATE = 1 << 6,
+ META_DEBUG_WINDOW_OPS = 1 << 7,
+ META_DEBUG_GEOMETRY = 1 << 8,
+ META_DEBUG_PLACEMENT = 1 << 9,
+ META_DEBUG_PING = 1 << 10,
+ META_DEBUG_XINERAMA = 1 << 11,
+ META_DEBUG_KEYBINDINGS = 1 << 12,
+ META_DEBUG_SYNC = 1 << 13,
+ META_DEBUG_ERRORS = 1 << 14,
+ META_DEBUG_STARTUP = 1 << 15,
+ META_DEBUG_PREFS = 1 << 16,
+ META_DEBUG_GROUPS = 1 << 17,
+ META_DEBUG_RESIZING = 1 << 18,
+ META_DEBUG_SHAPES = 1 << 19,
+ META_DEBUG_COMPOSITOR = 1 << 20,
+ META_DEBUG_EDGE_RESISTANCE = 1 << 21
+} MetaDebugTopic;
+
+void meta_topic_real (MetaDebugTopic topic,
+ const char *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+void meta_push_no_msg_prefix (void);
+void meta_pop_no_msg_prefix (void);
+
+gint meta_unsigned_long_equal (gconstpointer v1,
+ gconstpointer v2);
+guint meta_unsigned_long_hash (gconstpointer v);
+
+void meta_print_backtrace (void);
+
+const char* meta_gravity_to_string (int gravity);
+
+#include <libintl.h>
+#define _(x) dgettext (GETTEXT_PACKAGE, x)
+#define N_(x) x
+
+char* meta_g_utf8_strndup (const gchar *src, gsize n);
+
+void meta_free_gslist_and_elements (GSList *list_to_deep_free);
+
+/* To disable verbose mode, we make these functions into no-ops */
+#ifdef WITH_VERBOSE_MODE
+
+#define meta_debug_spew meta_debug_spew_real
+#define meta_verbose meta_verbose_real
+#define meta_topic meta_topic_real
+
+#else
+
+# ifdef G_HAVE_ISO_VARARGS
+# define meta_debug_spew(...)
+# define meta_verbose(...)
+# define meta_topic(...)
+# elif defined(G_HAVE_GNUC_VARARGS)
+# define meta_debug_spew(format...)
+# define meta_verbose(format...)
+# define meta_topic(format...)
+# else
+# error "This compiler does not support varargs macros and thus verbose mode can't be disabled meaningfully"
+# endif
+
+#endif /* !WITH_VERBOSE_MODE */
+
+#endif /* META_UTIL_H */
+
+