summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorIain Holmes <iain@gnome.org>2008-05-19 00:00:09 +0000
committerIain Holmes <iain@src.gnome.org>2008-05-19 00:00:09 +0000
commitf141692ca241441ddf6b243782ac94a95c861cd3 (patch)
treeb7ee1c400b5fface1a09c85e93bae7ef65fe9147 /src/include
parentfe292078fec8836dc6dd5e38829449e01c749714 (diff)
downloadmetacity-f141692ca241441ddf6b243782ac94a95c861cd3.tar.gz
metacity-f141692ca241441ddf6b243782ac94a95c861cd3.tar.bz2
src/include/frame.h src/include/display.h src/include/xprops.h
2008-05-19 Iain Holmes <iain@gnome.org> * src/include/frame.h * src/include/display.h * src/include/xprops.h * src/include/compositor.h * src/include/types.h * src/include/window.h * src/include/errors.h * src/include/screen.h: New basic public API for compositor. * src/compositor/*: Separate the compositor out into its own separate directory and set it up for backends. Initial XRender backend. * src/core/compositor.[ch]: Remove * src/core/frame.h * src/core/screen.h * src/core/display.h * src/core/window.h: Rename to -private.h so as not to clash with the new files in include * src/core/delete.c * src/core/workspace.h * src/core/stack.[ch] * src/core/keybindings.[ch] * src/core/errors.c * src/core/effects.[ch] * src/core/core.c * src/core/group.h * src/core/edge-resistance.[ch] * src/core/window-props.[ch] * src/core/constraints.h * src/core/bell.[ch] * src/core/iconcache.h * src/core/session.[ch] * src/core/main.c * src/core/place.h * src/core/xprops.c * src/ui/tabpopup.c: Use the new -private headers * src/core/display.c * src/core/frame.c * src/core/window.c * src/core/screen.c: Add the API functions required by the compositor * src/Makefile.am: Relocate the new files svn path=/trunk/; revision=3715
Diffstat (limited to 'src/include')
-rw-r--r--src/include/compositor.h76
-rw-r--r--src/include/display.h48
-rw-r--r--src/include/errors.h51
-rw-r--r--src/include/frame.h31
-rw-r--r--src/include/screen.h48
-rw-r--r--src/include/types.h31
-rw-r--r--src/include/window.h39
-rw-r--r--src/include/xprops.h227
8 files changed, 551 insertions, 0 deletions
diff --git a/src/include/compositor.h b/src/include/compositor.h
new file mode 100644
index 0000000..a7f9bf1
--- /dev/null
+++ b/src/include/compositor.h
@@ -0,0 +1,76 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_COMPOSITOR_H
+#define META_COMPOSITOR_H
+
+#include <glib.h>
+#include <X11/Xlib.h>
+
+#include "types.h"
+#include "boxes.h"
+
+MetaCompositor *meta_compositor_new (MetaDisplay *display);
+void meta_compositor_destroy (MetaCompositor *compositor);
+
+void meta_compositor_manage_screen (MetaCompositor *compositor,
+ MetaScreen *screen);
+void meta_compositor_unmanage_screen (MetaCompositor *compositor,
+ MetaScreen *screen);
+
+void meta_compositor_add_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ Window xwindow,
+ XWindowAttributes *attrs);
+void meta_compositor_remove_window (MetaCompositor *compositor,
+ Window xwindow);
+
+void meta_compositor_set_updates (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates);
+
+void meta_compositor_process_event (MetaCompositor *compositor,
+ XEvent *event,
+ MetaWindow *window);
+Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor,
+ MetaWindow *window);
+void meta_compositor_set_active_window (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window);
+
+void meta_compositor_begin_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *initial,
+ int grab_x, int grab_y);
+void meta_compositor_update_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ int x, int y);
+void meta_compositor_end_move (MetaCompositor *compositor,
+ MetaWindow *window);
+void meta_compositor_free_window (MetaCompositor *compositor,
+ MetaWindow *window);
+
+#endif
+
+
+
+
+
diff --git a/src/include/display.h b/src/include/display.h
new file mode 100644
index 0000000..53dd9d7
--- /dev/null
+++ b/src/include/display.h
@@ -0,0 +1,48 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_DISPLAY_H
+#define META_DISPLAY_H
+
+#include <glib.h>
+#include <X11/Xlib.h>
+
+#include "types.h"
+
+#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
+
+void meta_display_get_compositor_version (MetaDisplay *display,
+ int *major,
+ int *minor);
+Display *meta_display_get_xdisplay (MetaDisplay *display);
+MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
+GSList *meta_display_get_screens (MetaDisplay *display);
+
+gboolean meta_display_has_shape (MetaDisplay *display);
+
+MetaScreen *meta_display_screen_for_root (MetaDisplay *display,
+ Window xroot);
+MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
+
+int meta_display_get_damage_event_base (MetaDisplay *display);
+int meta_display_get_shape_event_base (MetaDisplay *display);
+
+#endif
diff --git a/src/include/errors.h b/src/include/errors.h
new file mode 100644
index 0000000..8278948
--- /dev/null
+++ b/src/include/errors.h
@@ -0,0 +1,51 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity X error handling */
+
+/*
+ * 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_ERRORS_H
+#define META_ERRORS_H
+
+#include <X11/Xlib.h>
+
+#include "util.h"
+#include "display.h"
+
+typedef void (* ErrorHandler) (Display *dpy,
+ XErrorEvent *error,
+ gpointer data);
+
+void meta_errors_init (void);
+void meta_errors_register_foreign_display (Display *foreign_dpy,
+ ErrorHandler handler,
+ gpointer data);
+
+void meta_error_trap_push (MetaDisplay *display);
+void meta_error_trap_pop (MetaDisplay *display,
+ gboolean last_request_was_roundtrip);
+
+void meta_error_trap_push_with_return (MetaDisplay *display);
+/* returns X error code, or 0 for no error */
+int meta_error_trap_pop_with_return (MetaDisplay *display,
+ gboolean last_request_was_roundtrip);
+
+
+#endif
diff --git a/src/include/frame.h b/src/include/frame.h
new file mode 100644
index 0000000..eeb5726
--- /dev/null
+++ b/src/include/frame.h
@@ -0,0 +1,31 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_FRAME_H
+#define META_FRAME_H
+
+#include <X11/Xlib.h>
+
+#include "types.h"
+
+Window meta_frame_get_xwindow (MetaFrame *frame);
+
+#endif
diff --git a/src/include/screen.h b/src/include/screen.h
new file mode 100644
index 0000000..9f84231
--- /dev/null
+++ b/src/include/screen.h
@@ -0,0 +1,48 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_SCREEN_H
+#define META_SCREEN_H
+
+#include <X11/Xlib.h>
+#include <glib.h>
+#include "types.h"
+
+int meta_screen_get_screen_number (MetaScreen *screen);
+MetaDisplay *meta_screen_get_display (MetaScreen *screen);
+
+Window meta_screen_get_xroot (MetaScreen *screen);
+void meta_screen_get_size (MetaScreen *screen,
+ int *width,
+ int *height);
+
+gpointer meta_screen_get_compositor_data (MetaScreen *screen);
+void meta_screen_set_compositor_data (MetaScreen *screen,
+ gpointer info);
+
+MetaScreen *meta_screen_for_x_screen (Screen *xscreen);
+
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+void meta_screen_set_cm_selection (MetaScreen *screen);
+void meta_screen_unset_cm_selection (MetaScreen *screen);
+#endif
+
+#endif
diff --git a/src/include/types.h b/src/include/types.h
new file mode 100644
index 0000000..045b102
--- /dev/null
+++ b/src/include/types.h
@@ -0,0 +1,31 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_TYPES_H
+#define META_TYPES_H
+
+typedef struct _MetaCompositor MetaCompositor;
+typedef struct _MetaDisplay MetaDisplay;
+typedef struct _MetaFrame MetaFrame;
+typedef struct _MetaScreen MetaScreen;
+typedef struct _MetaWindow MetaWindow;
+
+#endif
diff --git a/src/include/window.h b/src/include/window.h
new file mode 100644
index 0000000..8a33866
--- /dev/null
+++ b/src/include/window.h
@@ -0,0 +1,39 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Iain Holmes
+ *
+ * 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_WINDOW_H
+#define META_WINDOW_H
+
+#include <glib.h>
+#include <X11/Xlib.h>
+
+#include "boxes.h"
+#include "types.h"
+
+MetaFrame *meta_window_get_frame (MetaWindow *window);
+gboolean meta_window_has_focus (MetaWindow *window);
+gboolean meta_window_is_shaded (MetaWindow *window);
+MetaRectangle *meta_window_get_rect (MetaWindow *window);
+MetaScreen *meta_window_get_screen (MetaWindow *window);
+MetaDisplay *meta_window_get_display (MetaWindow *window);
+Window meta_window_get_xwindow (MetaWindow *window);
+
+#endif
diff --git a/src/include/xprops.h b/src/include/xprops.h
new file mode 100644
index 0000000..f5ecb6a
--- /dev/null
+++ b/src/include/xprops.h
@@ -0,0 +1,227 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity X property convenience routines */
+
+/*
+ * 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_XPROPS_H
+#define META_XPROPS_H
+
+#include <config.h>
+
+#include "display.h"
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSYNC
+#include <X11/extensions/sync.h>
+#endif
+
+/* Copied from Lesstif by way of GTK. Rudimentary docs can be
+ * found in some Motif reference guides online.
+ */
+typedef struct {
+ unsigned long flags;
+ unsigned long functions;
+ unsigned long decorations;
+ long input_mode;
+ unsigned long status;
+} MotifWmHints, MwmHints;
+
+#define MWM_HINTS_FUNCTIONS (1L << 0)
+#define MWM_HINTS_DECORATIONS (1L << 1)
+#define MWM_HINTS_INPUT_MODE (1L << 2)
+#define MWM_HINTS_STATUS (1L << 3)
+
+#define MWM_FUNC_ALL (1L << 0)
+#define MWM_FUNC_RESIZE (1L << 1)
+#define MWM_FUNC_MOVE (1L << 2)
+#define MWM_FUNC_MINIMIZE (1L << 3)
+#define MWM_FUNC_MAXIMIZE (1L << 4)
+#define MWM_FUNC_CLOSE (1L << 5)
+
+#define MWM_DECOR_ALL (1L << 0)
+#define MWM_DECOR_BORDER (1L << 1)
+#define MWM_DECOR_RESIZEH (1L << 2)
+#define MWM_DECOR_TITLE (1L << 3)
+#define MWM_DECOR_MENU (1L << 4)
+#define MWM_DECOR_MINIMIZE (1L << 5)
+#define MWM_DECOR_MAXIMIZE (1L << 6)
+
+#define MWM_INPUT_MODELESS 0
+#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
+#define MWM_INPUT_SYSTEM_MODAL 2
+#define MWM_INPUT_FULL_APPLICATION_MODAL 3
+#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
+
+#define MWM_TEAROFF_WINDOW (1L<<0)
+
+/* These all return the memory from Xlib, so require an XFree()
+ * when they return TRUE. They return TRUE on success.
+ */
+gboolean meta_prop_get_atom_list (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ Atom **atoms_p,
+ int *n_atoms_p);
+gboolean meta_prop_get_motif_hints (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ MotifWmHints **hints_p);
+gboolean meta_prop_get_cardinal_list (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ gulong **cardinals_p,
+ int *n_cardinals_p);
+gboolean meta_prop_get_latin1_string (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ char **str_p);
+gboolean meta_prop_get_utf8_string (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ char **str_p);
+gboolean meta_prop_get_utf8_list (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ char ***str_p,
+ int *n_str_p);
+void meta_prop_set_utf8_string_hint
+ (MetaDisplay *display,
+ Window xwindow,
+ Atom atom,
+ const char *val);
+gboolean meta_prop_get_window (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ Window *window_p);
+gboolean meta_prop_get_cardinal (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ gulong *cardinal_p);
+gboolean meta_prop_get_cardinal_with_atom_type (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ Atom prop_type,
+ gulong *cardinal_p);
+gboolean meta_prop_get_text_property (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ char **utf8_str_p);
+
+gboolean meta_prop_get_wm_hints (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ XWMHints **hints_p);
+
+gboolean meta_prop_get_class_hint (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ XClassHint *class_hint);
+
+gboolean meta_prop_get_size_hints (MetaDisplay *display,
+ Window xwindow,
+ Atom xatom,
+ XSizeHints **hints_p,
+ gulong *flags_p);
+
+typedef enum
+{
+ META_PROP_VALUE_INVALID,
+ META_PROP_VALUE_UTF8,
+ META_PROP_VALUE_STRING,
+ META_PROP_VALUE_STRING_AS_UTF8,
+ META_PROP_VALUE_MOTIF_HINTS,
+ META_PROP_VALUE_CARDINAL,
+ META_PROP_VALUE_WINDOW,
+ META_PROP_VALUE_CARDINAL_LIST,
+ META_PROP_VALUE_UTF8_LIST,
+ META_PROP_VALUE_ATOM_LIST,
+ META_PROP_VALUE_TEXT_PROPERTY, /* comes back as UTF-8 string */
+ META_PROP_VALUE_WM_HINTS,
+ META_PROP_VALUE_CLASS_HINT,
+ META_PROP_VALUE_SIZE_HINTS,
+ META_PROP_VALUE_SYNC_COUNTER /* comes back as CARDINAL */
+} MetaPropValueType;
+
+/* used to request/return/store property values */
+typedef struct
+{
+ MetaPropValueType type;
+ Atom atom;
+ Atom required_type; /* autofilled if None */
+
+ union
+ {
+ char *str;
+ MotifWmHints *motif_hints;
+ Window xwindow;
+ gulong cardinal;
+ XWMHints *wm_hints;
+ XClassHint class_hint;
+#ifdef HAVE_XSYNC
+ XSyncCounter xcounter;
+#endif
+
+ struct
+ {
+ XSizeHints *hints;
+ unsigned long flags;
+ } size_hints;
+
+ struct
+ {
+ gulong *cardinals;
+ int n_cardinals;
+ } cardinal_list;
+
+ struct
+ {
+ char **strings;
+ int n_strings;
+ } string_list;
+
+ struct
+ {
+ Atom *atoms;
+ int n_atoms;
+ } atom_list;
+
+ } v;
+
+} MetaPropValue;
+
+/* Each value has type and atom initialized. If there's an error,
+ * or property is unset, type comes back as INVALID;
+ * else type comes back as it originated, and the data
+ * is filled in.
+ */
+void meta_prop_get_values (MetaDisplay *display,
+ Window xwindow,
+ MetaPropValue *values,
+ int n_values);
+
+void meta_prop_free_values (MetaPropValue *values,
+ int n_values);
+
+#endif
+
+
+
+