summaryrefslogtreecommitdiff
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
parentfe292078fec8836dc6dd5e38829449e01c749714 (diff)
downloadmetacity-f141692ca241441ddf6b243782ac94a95c861cd3.tar.gz
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
-rw-r--r--ChangeLog48
-rw-r--r--src/Makefile.am22
-rw-r--r--src/compositor/compositor-private.h54
-rw-r--r--src/compositor/compositor-xrender.c (renamed from src/core/compositor.c)869
-rw-r--r--src/compositor/compositor-xrender.h31
-rw-r--r--src/compositor/compositor.c158
-rw-r--r--src/core/bell.c2
-rw-r--r--src/core/bell.h4
-rw-r--r--src/core/constraints.h4
-rw-r--r--src/core/core.c2
-rw-r--r--src/core/delete.c2
-rw-r--r--src/core/display-private.h (renamed from src/core/display.h)14
-rw-r--r--src/core/display.c59
-rw-r--r--src/core/edge-resistance.c3
-rw-r--r--src/core/edge-resistance.h2
-rw-r--r--src/core/effects.c4
-rw-r--r--src/core/effects.h2
-rw-r--r--src/core/errors.c1
-rw-r--r--src/core/frame-private.h (renamed from src/core/frame.h)7
-rw-r--r--src/core/frame.c7
-rw-r--r--src/core/group.h2
-rw-r--r--src/core/iconcache.h2
-rw-r--r--src/core/keybindings.c2
-rw-r--r--src/core/keybindings.h2
-rw-r--r--src/core/main.c2
-rw-r--r--src/core/place.h4
-rw-r--r--src/core/screen-private.h (renamed from src/core/screen.h)13
-rw-r--r--src/core/screen.c46
-rw-r--r--src/core/session.c2
-rw-r--r--src/core/session.h2
-rw-r--r--src/core/stack.c4
-rw-r--r--src/core/stack.h2
-rw-r--r--src/core/window-private.h (renamed from src/core/window.h)7
-rw-r--r--src/core/window-props.c2
-rw-r--r--src/core/window-props.h2
-rw-r--r--src/core/window.c46
-rw-r--r--src/core/workspace.h2
-rw-r--r--src/core/xprops.c2
-rw-r--r--src/include/compositor.h (renamed from src/core/compositor.h)81
-rw-r--r--src/include/display.h48
-rw-r--r--src/include/errors.h (renamed from src/core/errors.h)2
-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.h (renamed from src/core/xprops.h)5
-rw-r--r--src/ui/tabpopup.c2
47 files changed, 1223 insertions, 503 deletions
diff --git a/ChangeLog b/ChangeLog
index d66798d5..48705973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+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
+
2008-05-13 Robert Escriva <me@robescriva.com>
* src/ui/theme.h (struct): remove color_set flag
diff --git a/src/Makefile.am b/src/Makefile.am
index e5f9e131..ae4bcffb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,14 +12,17 @@ metacity_SOURCES= \
core/bell.h \
core/boxes.c \
include/boxes.h \
- core/compositor.c \
- core/compositor.h \
+ compositor/compositor.c \
+ compositor/compositor-private.h \
+ compositor/compositor-xrender.c \
+ include/compositor.h \
core/constraints.c \
core/constraints.h \
core/core.c \
core/delete.c \
core/display.c \
- core/display.h \
+ core/display-private.h \
+ include/display.h \
ui/draw-workspace.c \
ui/draw-workspace.h \
core/edge-resistance.c \
@@ -27,11 +30,12 @@ metacity_SOURCES= \
core/effects.c \
core/effects.h \
core/errors.c \
- core/errors.h \
+ include/errors.h \
core/eventqueue.c \
core/eventqueue.h \
core/frame.c \
- core/frame.h \
+ core/frame-private.h \
+ include/frame.h \
ui/gradient.c \
ui/gradient.h \
core/group-private.h \
@@ -51,7 +55,8 @@ metacity_SOURCES= \
core/prefs.c \
include/prefs.h \
core/screen.c \
- core/screen.h \
+ core/screen-private.h \
+ include/screen.h \
core/session.c \
core/session.h \
core/stack.c \
@@ -61,11 +66,12 @@ metacity_SOURCES= \
core/window-props.c \
core/window-props.h \
core/window.c \
- core/window.h \
+ core/window-private.h \
+ include/window.h \
core/workspace.c \
core/workspace.h \
core/xprops.c \
- core/xprops.h \
+ include/xprops.h \
include/common.h \
include/core.h \
include/ui.h \
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
new file mode 100644
index 00000000..ef9f8023
--- /dev/null
+++ b/src/compositor/compositor-private.h
@@ -0,0 +1,54 @@
+/* -*- 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_PRIVATE_H
+#define META_COMPOSITOR_PRIVATE_H
+
+#include "compositor.h"
+
+struct _MetaCompositor
+{
+ void (* destroy) (MetaCompositor *compositor);
+
+ void (*manage_screen) (MetaCompositor *compositor,
+ MetaScreen *screen);
+ void (*unmanage_screen) (MetaCompositor *compositor,
+ MetaScreen *screen);
+ void (*add_window) (MetaCompositor *compositor,
+ MetaWindow *window,
+ Window xwindow,
+ XWindowAttributes *attrs);
+ void (*remove_window) (MetaCompositor *compositor,
+ Window xwindow);
+ void (*set_updates) (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean update);
+ void (*process_event) (MetaCompositor *compositor,
+ XEvent *event,
+ MetaWindow *window);
+ Pixmap (*get_window_pixmap) (MetaCompositor *compositor,
+ MetaWindow *window);
+ void (*set_active_window) (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window);
+};
+
+#endif
diff --git a/src/core/compositor.c b/src/compositor/compositor-xrender.c
index f3f19a9a..381ff3ea 100644
--- a/src/core/compositor.c
+++ b/src/compositor/compositor-xrender.c
@@ -37,7 +37,9 @@
#include "screen.h"
#include "frame.h"
#include "errors.h"
-#include "compositor.h"
+#include "window.h"
+#include "compositor-private.h"
+#include "compositor-xrender.h"
#include "xprops.h"
#include <X11/Xatom.h>
#include <X11/extensions/shape.h>
@@ -61,11 +63,15 @@
#ifdef HAVE_COMPOSITE_EXTENSIONS
static inline gboolean
composite_at_least_version (MetaDisplay *display,
- int maj, int minor)
+ int maj, int min)
{
- return (display->composite_major_version > maj
- || (display->composite_major_version == maj
- && display->composite_minor_version >= minor));
+ static int major = -1;
+ static int minor = -1;
+
+ if (major == -1)
+ meta_display_get_compositor_version (display, &major, &minor);
+
+ return (major > maj || (major == maj && minor >= min));
}
#define have_name_window_pixmap(display) \
@@ -91,8 +97,10 @@ typedef enum _MetaShadowType
LAST_SHADOW_TYPE
} MetaShadowType;
-struct _MetaCompositor
+typedef struct _MetaCompositorXRender
{
+ MetaCompositor compositor;
+
MetaDisplay *display;
Atom atom_x_root_pixmap;
@@ -100,13 +108,23 @@ struct _MetaCompositor
Atom atom_net_wm_window_opacity;
Atom atom_net_wm_window_type_dnd;
+ Atom atom_net_wm_window_type;
+ Atom atom_net_wm_window_type_desktop;
+ Atom atom_net_wm_window_type_dock;
+ Atom atom_net_wm_window_type_menu;
+ Atom atom_net_wm_window_type_dialog;
+ Atom atom_net_wm_window_type_normal;
+ Atom atom_net_wm_window_type_utility;
+ Atom atom_net_wm_window_type_splash;
+ Atom atom_net_wm_window_type_toolbar;
+
#ifdef USE_IDLE_REPAINT
guint repaint_id;
#endif
guint enabled : 1;
guint show_redraw : 1;
guint debug : 1;
-};
+} MetaCompositorXRender;
typedef struct _conv
{
@@ -217,6 +235,8 @@ typedef struct _MetaCompWindow
#define TRANS_OPACITY 0.75
+#define DISPLAY_COMPOSITOR(display) ((MetaCompositorXRender *) meta_display_get_compositor (display))
+
/* Gaussian stuff for creating the shadows */
static double
gaussian (double r,
@@ -268,8 +288,8 @@ dump_xserver_region (const char *location,
MetaDisplay *display,
XserverRegion region)
{
- MetaCompositor *compositor = display->compositor;
- Display *dpy = display->xdisplay;
+ MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display);
+ Display *xdisplay = meta_display_get_xdisplay (display);
int nrects;
XRectangle *rects;
XRectangle bounds;
@@ -279,7 +299,7 @@ dump_xserver_region (const char *location,
if (region)
{
- rects = XFixesFetchRegionAndBounds (dpy, region, &nrects, &bounds);
+ rects = XFixesFetchRegionAndBounds (xdisplay, region, &nrects, &bounds);
if (nrects > 0)
{
int i;
@@ -449,7 +469,8 @@ make_shadow (MetaDisplay *display,
int width,
int height)
{
- MetaCompScreen *info = screen->compositor_data;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XImage *ximage;
guchar *data;
shadow *shad = info->shadows[shadow_type];
@@ -462,11 +483,11 @@ make_shadow (MetaDisplay *display,
guchar d;
int x_diff;
int opacity_int = (int)(opacity * 25);
+ int screen_number = meta_screen_get_screen_number (screen);
data = g_malloc (swidth * sheight * sizeof (guchar));
- ximage = XCreateImage (display->xdisplay,
- DefaultVisual (display->xdisplay, screen->number),
+ ximage = XCreateImage (xdisplay, DefaultVisual (xdisplay, screen_number),
8, ZPixmap, 0, (char *) data,
swidth, sheight, 8, swidth * sizeof (guchar));
if (!ximage)
@@ -567,9 +588,11 @@ shadow_picture (MetaDisplay *display,
int *wp,
int *hp)
{
+ Display *xdisplay = meta_display_get_xdisplay (display);
XImage *shadow_image;
Pixmap shadow_pixmap;
Picture shadow_picture;
+ Window xroot = meta_screen_get_xroot (screen);
GC gc;
shadow_image = make_shadow (display, screen, shadow_type,
@@ -577,7 +600,7 @@ shadow_picture (MetaDisplay *display,
if (!shadow_image)
return None;
- shadow_pixmap = XCreatePixmap (display->xdisplay, screen->xroot,
+ shadow_pixmap = XCreatePixmap (xdisplay, xroot,
shadow_image->width, shadow_image->height, 8);
if (!shadow_pixmap)
{
@@ -585,33 +608,34 @@ shadow_picture (MetaDisplay *display,
return None;
}
- shadow_picture = XRenderCreatePicture (display->xdisplay, shadow_pixmap,
- XRenderFindStandardFormat (display->xdisplay, PictStandardA8),
+ shadow_picture = XRenderCreatePicture (xdisplay, shadow_pixmap,
+ XRenderFindStandardFormat (xdisplay,
+PictStandardA8),
0, 0);
if (!shadow_picture)
{
XDestroyImage (shadow_image);
- XFreePixmap (display->xdisplay, shadow_pixmap);
+ XFreePixmap (xdisplay, shadow_pixmap);
return None;
}
- gc = XCreateGC (display->xdisplay, shadow_pixmap, 0, 0);
+ gc = XCreateGC (xdisplay, shadow_pixmap, 0, 0);
if (!gc)
{
XDestroyImage (shadow_image);
- XFreePixmap (display->xdisplay, shadow_pixmap);
- XRenderFreePicture (display->xdisplay, shadow_picture);
+ XFreePixmap (xdisplay, shadow_pixmap);
+ XRenderFreePicture (xdisplay, shadow_picture);
return None;
}
- XPutImage (display->xdisplay, shadow_pixmap, gc, shadow_image, 0, 0, 0, 0,
+ XPutImage (xdisplay, shadow_pixmap, gc, shadow_image, 0, 0, 0, 0,
shadow_image->width, shadow_image->height);
*wp = shadow_image->width;
*hp = shadow_image->height;
- XFreeGC (display->xdisplay, gc);
+ XFreeGC (xdisplay, gc);
XDestroyImage (shadow_image);
- XFreePixmap (display->xdisplay, shadow_pixmap);
+ XFreePixmap (xdisplay, shadow_pixmap);
return shadow_picture;
}
@@ -620,7 +644,7 @@ static MetaCompWindow *
find_window_for_screen (MetaScreen *screen,
Window xwindow)
{
- MetaCompScreen *info = screen->compositor_data;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (info == NULL)
return NULL;
@@ -634,7 +658,7 @@ find_window_in_display (MetaDisplay *display,
{
GSList *index;
- for (index = display->screens; index; index = index->next)
+ for (index = meta_display_get_screens (display); index; index = index->next)
{
MetaCompWindow *cw = find_window_for_screen (index->data, xwindow);
@@ -653,10 +677,9 @@ find_window_for_child_window_in_display (MetaDisplay *display,
Window parent;
guint ignored_children;
- XQueryTree (display->xdisplay,
- xwindow, &ignored1, &parent,
- &ignored2, &ignored_children);
-
+ XQueryTree (meta_display_get_xdisplay (display), xwindow, &ignored1,
+ &parent, &ignored2, &ignored_children);
+
if (parent != None)
return find_window_in_display (display, parent);
@@ -672,25 +695,26 @@ solid_picture (MetaDisplay *display,
double g,
double b)
{
+ Display *xdisplay = meta_display_get_xdisplay (display);
Pixmap pixmap;
Picture picture;
XRenderPictureAttributes pa;
XRenderPictFormat *render_format;
XRenderColor c;
+ Window xroot = meta_screen_get_xroot (screen);
- render_format = XRenderFindStandardFormat (display->xdisplay,
+ render_format = XRenderFindStandardFormat (xdisplay,
argb ? PictStandardARGB32 : PictStandardA8);
- pixmap = XCreatePixmap (display->xdisplay, screen->xroot,
- 1, 1, argb ? 32 : 8);
+ pixmap = XCreatePixmap (xdisplay, xroot, 1, 1, argb ? 32 : 8);
g_return_val_if_fail (pixmap != None, None);
pa.repeat = TRUE;
- picture = XRenderCreatePicture (display->xdisplay, pixmap, render_format,
+ picture = XRenderCreatePicture (xdisplay, pixmap, render_format,
CPRepeat, &pa);
if (picture == None)
{
- XFreePixmap (display->xdisplay, pixmap);
+ XFreePixmap (xdisplay, pixmap);
g_warning ("(picture != None) failed");
return None;
}
@@ -700,8 +724,8 @@ solid_picture (MetaDisplay *display,
c.green = g * 0xffff;
c.blue = b * 0xffff;
- XRenderFillRectangle (display->xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1);
- XFreePixmap (display->xdisplay, pixmap);
+ XRenderFillRectangle (xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1);
+ XFreePixmap (xdisplay, pixmap);
return picture;
}
@@ -709,7 +733,8 @@ solid_picture (MetaDisplay *display,
static Picture
root_tile (MetaScreen *screen)
{
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
Picture picture;
Pixmap pixmap;
gboolean fill = FALSE;
@@ -718,12 +743,14 @@ root_tile (MetaScreen *screen)
int p;
Atom background_atoms[2];
Atom pixmap_atom;
+ int screen_number = meta_screen_get_screen_number (screen);
+ Window xroot = meta_screen_get_xroot (screen);
pixmap = None;
- background_atoms[0] = display->compositor->atom_x_root_pixmap;
- background_atoms[1] = display->compositor->atom_x_set_root;
+ background_atoms[0] = DISPLAY_COMPOSITOR (display)->atom_x_root_pixmap;
+ background_atoms[1] = DISPLAY_COMPOSITOR (display)->atom_x_set_root;
- pixmap_atom = XInternAtom (display->xdisplay, "PIXMAP", False);
+ pixmap_atom = XInternAtom (xdisplay, "PIXMAP", False);
for (p = 0; p < 2; p++)
{
Atom actual_type;
@@ -731,7 +758,7 @@ root_tile (MetaScreen *screen)
gulong nitems, bytes_after;
guchar *prop;
- if (XGetWindowProperty (display->xdisplay, screen->xroot,
+ if (XGetWindowProperty (xdisplay, xroot,
background_atoms[p],
0, 4, FALSE, AnyPropertyType,
&actual_type, &actual_format,
@@ -751,20 +778,18 @@ root_tile (MetaScreen *screen)
if (!pixmap)
{
- pixmap = XCreatePixmap (display->xdisplay, screen->xroot, 1, 1,
- DefaultDepth (display->xdisplay, screen->number));
+ pixmap = XCreatePixmap (xdisplay, xroot, 1, 1,
+ DefaultDepth (xdisplay, screen_number));
g_return_val_if_fail (pixmap != None, None);
fill = TRUE;
}
pa.repeat = TRUE;
- format = XRenderFindVisualFormat (display->xdisplay,
- DefaultVisual (display->xdisplay,
- screen->number));
+ format = XRenderFindVisualFormat (xdisplay, DefaultVisual (xdisplay,
+ screen_number));
g_return_val_if_fail (format != NULL, None);
- picture = XRenderCreatePicture (display->xdisplay, pixmap, format,
- CPRepeat, &pa);
+ picture = XRenderCreatePicture (xdisplay, pixmap, format, CPRepeat, &pa);
if ((picture != None) && (fill))
{
XRenderColor c;
@@ -775,9 +800,8 @@ root_tile (MetaScreen *screen)
c.blue = 0x8080;
c.alpha = 0xffff;
- XRenderFillRectangle (display->xdisplay, PictOpSrc, picture,
- &c, 0, 0, 1, 1);
- XFreePixmap (display->xdisplay, pixmap);
+ XRenderFillRectangle (xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1);
+ XFreePixmap (xdisplay, pixmap);
}
return picture;
@@ -786,30 +810,29 @@ root_tile (MetaScreen *screen)
static Picture
create_root_buffer (MetaScreen *screen)
{
- MetaDisplay *display = screen->display;
- MetaCompScreen *info = screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
Picture pict;
XRenderPictFormat *format;
Pixmap root_pixmap;
Visual *visual;
int depth, screen_width, screen_height, screen_number;
- screen_width = screen->rect.width;
- screen_height = screen->rect.height;
- screen_number = screen->number;
- visual = DefaultVisual (display->xdisplay, screen_number);
- depth = DefaultDepth (display->xdisplay, screen_number);
+ meta_screen_get_size (screen, &screen_width, &screen_height);
+ screen_number = meta_screen_get_screen_number (screen);
+ visual = DefaultVisual (xdisplay, screen_number);
+ depth = DefaultDepth (xdisplay, screen_number);
- format = XRenderFindVisualFormat (display->xdisplay, visual);
+ format = XRenderFindVisualFormat (xdisplay, visual);
g_return_val_if_fail (format != NULL, None);
- root_pixmap = XCreatePixmap (display->xdisplay,
- info->output,
+ root_pixmap = XCreatePixmap (xdisplay, info->output,
screen_width, screen_height, depth);
g_return_val_if_fail (root_pixmap != None, None);
- pict = XRenderCreatePicture (display->xdisplay, root_pixmap, format, 0, NULL);
- XFreePixmap (display->xdisplay, root_pixmap);
+ pict = XRenderCreatePicture (xdisplay, root_pixmap, format, 0, NULL);
+ XFreePixmap (xdisplay, root_pixmap);
return pict;
}
@@ -818,8 +841,10 @@ static void
paint_root (MetaScreen *screen,
Picture root_buffer)
{
- MetaDisplay *display = screen->display;
- MetaCompScreen *info = screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ int width, height;
g_return_if_fail (root_buffer != None);
@@ -829,16 +854,17 @@ paint_root (MetaScreen *screen,
g_return_if_fail (info->root_tile != None);
}
- XRenderComposite (display->xdisplay, PictOpSrc,
- info->root_tile, None, root_buffer,
- 0, 0, 0, 0, 0, 0,
- screen->rect.width, screen->rect.height);
+ meta_screen_get_size (screen, &width, &height);
+ XRenderComposite (xdisplay, PictOpSrc, info->root_tile, None, root_buffer,
+ 0, 0, 0, 0, 0, 0, width, height);
}
static gboolean
window_has_shadow (MetaCompWindow *cw)
{
- if (((MetaCompScreen *)cw->screen->compositor_data)->have_shadows == FALSE)
+ MetaCompScreen *info = meta_screen_get_compositor_data (cw->screen);
+
+ if (info->have_shadows == FALSE)
return FALSE;
/* Always put a shadow around windows with a frame - This should override
@@ -846,7 +872,7 @@ window_has_shadow (MetaCompWindow *cw)
as the frame might be the reason the window is shaped */
if (cw->window)
{
- if (cw->window->frame) {
+ if (meta_window_get_frame (cw->window)) {
meta_verbose ("Window has shadow because it has a frame\n");
return TRUE;
}
@@ -883,15 +909,11 @@ double shadow_offsets_y[LAST_SHADOW_TYPE] = {SHADOW_SMALL_OFFSET_Y,
static XserverRegion
win_extents (MetaCompWindow *cw)
{
- MetaDisplay *display;
- MetaScreen *screen;
- MetaCompScreen *info;
+ MetaScreen *screen = cw->screen;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XRectangle r;
- screen = cw->screen;
- display = screen->display;
- info = screen->compositor_data;
-
r.x = cw->attrs.x;
r.y = cw->attrs.y;
r.width = cw->attrs.width + cw->attrs.border_width * 2;
@@ -941,23 +963,24 @@ win_extents (MetaCompWindow *cw)
r.height = sr.y + sr.height - r.y;
}
- return XFixesCreateRegion (display->xdisplay, &r, 1);
+ return XFixesCreateRegion (xdisplay, &r, 1);
}
static XserverRegion
border_size (MetaCompWindow *cw)
{
MetaScreen *screen = cw->screen;
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion border;
meta_error_trap_push (display);
- border = XFixesCreateRegionFromWindow (display->xdisplay, cw->id,
+ border = XFixesCreateRegionFromWindow (xdisplay, cw->id,
WindowRegionBounding);
meta_error_trap_pop (display, FALSE);
g_return_val_if_fail (border != None, None);
- XFixesTranslateRegion (display->xdisplay, border,
+ XFixesTranslateRegion (xdisplay, border,
cw->attrs.x + cw->attrs.border_width,
cw->attrs.y + cw->attrs.border_width);
return border;
@@ -967,14 +990,15 @@ static XRenderPictFormat *
get_window_format (MetaCompWindow *cw)
{
MetaScreen *screen = cw->screen;
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictFormat *format;
+ int screen_number = meta_screen_get_screen_number (screen);
- format = XRenderFindVisualFormat (display->xdisplay, cw->attrs.visual);
+ format = XRenderFindVisualFormat (xdisplay, cw->attrs.visual);
if (!format)
- format = XRenderFindVisualFormat (display->xdisplay,
- DefaultVisual (display->xdisplay,
- screen->number));
+ format = XRenderFindVisualFormat (xdisplay,
+ DefaultVisual (xdisplay, screen_number));
return format;
}
@@ -982,7 +1006,8 @@ static Picture
get_window_picture (MetaCompWindow *cw)
{
MetaScreen *screen = cw->screen;
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictureAttributes pa;
XRenderPictFormat *format;
Drawable draw;
@@ -995,7 +1020,7 @@ get_window_picture (MetaCompWindow *cw)
if (have_name_window_pixmap (display))
{
if (cw->back_pixmap == None)
- cw->back_pixmap = XCompositeNameWindowPixmap (display->xdisplay, cw->id);
+ cw->back_pixmap = XCompositeNameWindowPixmap (xdisplay, cw->id);
if (cw->back_pixmap != None)
draw = cw->back_pixmap;
@@ -1009,8 +1034,7 @@ get_window_picture (MetaCompWindow *cw)
pa.subwindow_mode = IncludeInferiors;
- pict = XRenderCreatePicture (display->xdisplay, draw,
- format, CPSubwindowMode, &pa);
+ pict = XRenderCreatePicture (xdisplay, draw, format, CPSubwindowMode, &pa);
meta_error_trap_pop (display, FALSE);
return pict;
@@ -1025,9 +1049,9 @@ paint_dock_shadows (MetaScreen *screen,
Picture root_buffer,
XserverRegion region)
{
- MetaDisplay *display = screen->display;
- Display *xdisplay = display->xdisplay;
- MetaCompScreen *info = screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
GSList *d;
for (d = info->dock_windows; d; d = d->next)
@@ -1060,19 +1084,18 @@ paint_windows (MetaScreen *screen,
Picture root_buffer,
XserverRegion region)
{
- MetaDisplay *display = screen->display;
- MetaCompScreen *info = screen->compositor_data;
- Display *xdisplay = display->xdisplay;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
GList *index, *last;
int screen_width, screen_height, screen_number;
Window xroot;
MetaCompWindow *cw;
XserverRegion paint_region, desktop_region;
- screen_width = screen->rect.width;
- screen_height = screen->rect.height;
- screen_number = screen->number;
- xroot = screen->xroot;
+ meta_screen_get_size (screen, &screen_width, &screen_height);
+ screen_number = meta_screen_get_screen_number (screen);
+ xroot = meta_screen_get_xroot (screen);
if (region == None)
{
@@ -1278,24 +1301,24 @@ static void
paint_all (MetaScreen *screen,
XserverRegion region)
{
- MetaCompScreen *info = screen->compositor_data;
- Display *xdisplay = screen->display->xdisplay;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
int screen_width, screen_height;
/* Set clipping to the given region */
XFixesSetPictureClipRegion (xdisplay, info->root_picture, 0, 0, region);
- screen_width = screen->rect.width;
- screen_height = screen->rect.height;
+ meta_screen_get_size (screen, &screen_width, &screen_height);
- if (screen->display->compositor->show_redraw)
+ if (DISPLAY_COMPOSITOR (display)->show_redraw)
{
Picture overlay;
- dump_xserver_region ("paint_all", screen->display, region);
+ dump_xserver_region ("paint_all", display, region);
/* Make a random colour overlay */
- overlay = solid_picture (screen->display, screen, TRUE, 1, /* 0.3, alpha */
+ overlay = solid_picture (display, screen, TRUE, 1, /* 0.3, alpha */
((double) (rand () % 100)) / 100.0,
((double) (rand () % 100)) / 100.0,
((double) (rand () % 100)) / 100.0);
@@ -1321,14 +1344,15 @@ paint_all (MetaScreen *screen,
static void
repair_screen (MetaScreen *screen)
{
- MetaCompScreen *info = screen->compositor_data;
- MetaDisplay *display = screen->display;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
if (info->all_damage != None)
{
meta_error_trap_push (display);
paint_all (screen, info->all_damage);
- XFixesDestroyRegion (display->xdisplay, info->all_damage);
+ XFixesDestroyRegion (xdisplay, info->all_damage);
info->all_damage = None;
info->clip_changed = FALSE;
meta_error_trap_pop (display, FALSE);
@@ -1338,17 +1362,18 @@ repair_screen (MetaScreen *screen)
static void
repair_display (MetaDisplay *display)
{
- GSList *screens;
-
+ GSList *screens = meta_display_get_screens (display);
+ MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display);
+
#ifdef USE_IDLE_REPAINT
- if (display->compositor->repaint_id > 0)
+ if (compositor->repaint_id > 0)
{
- g_source_remove (display->compositor->repaint_id);
- display->compositor->repaint_id = 0;
+ g_source_remove (compositor->repaint_id);
+ compositor->repaint_id = 0;
}
#endif
- for (screens = display->screens; screens; screens = screens->next)
+ for (; screens; screens = screens->next)
repair_screen ((MetaScreen *) screens->data);
}
@@ -1356,7 +1381,7 @@ repair_display (MetaDisplay *display)
static gboolean
compositor_idle_cb (gpointer data)
{
- MetaCompositor *compositor = (MetaCompositor *) data;
+ MetaCompositorXRender *compositor = (MetaCompositorXRender *) data;
compositor->repaint_id = 0;
repair_display (compositor->display);
@@ -1367,7 +1392,7 @@ compositor_idle_cb (gpointer data)
static void
add_repair (MetaDisplay *display)
{
- MetaCompositor *compositor = display->compositor;
+ MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display);
if (compositor->repaint_id > 0)
return;
@@ -1389,16 +1414,16 @@ static void
add_damage (MetaScreen *screen,
XserverRegion damage)
{
- MetaDisplay *display = screen->display;
- MetaCompScreen *info = screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
/* dump_xserver_region ("add_damage", display, damage); */
if (info->all_damage)
{
- XFixesUnionRegion (display->xdisplay, info->all_damage,
- info->all_damage, damage);
- XFixesDestroyRegion (display->xdisplay, damage);
+ XFixesUnionRegion (xdisplay, info->all_damage, info->all_damage, damage);
+ XFixesDestroyRegion (xdisplay, damage);
}
else
info->all_damage = damage;
@@ -1411,16 +1436,19 @@ add_damage (MetaScreen *screen,
static void
damage_screen (MetaScreen *screen)
{
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion region;
+ int width, height;
XRectangle r;
r.x = 0;
r.y = 0;
- r.width = screen->rect.width;
- r.height = screen->rect.height;
+ meta_screen_get_size (screen, &width, &height);
+ r.width = width;
+ r.height = height;
- region = XFixesCreateRegion (display->xdisplay, &r, 1);
+ region = XFixesCreateRegion (xdisplay, &r, 1);
dump_xserver_region ("damage_screen", display, region);
add_damage (screen, region);
}
@@ -1429,20 +1457,21 @@ static void
repair_win (MetaCompWindow *cw)
{
MetaScreen *screen = cw->screen;
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion parts;
meta_error_trap_push (display);
if (!cw->damaged)
{
parts = win_extents (cw);
- XDamageSubtract (display->xdisplay, cw->damage, None, None);
+ XDamageSubtract (xdisplay, cw->damage, None, None);
}
else
{
- parts = XFixesCreateRegion (display->xdisplay, 0, 0);
- XDamageSubtract (display->xdisplay, cw->damage, None, parts);
- XFixesTranslateRegion (display->xdisplay, parts,
+ parts = XFixesCreateRegion (xdisplay, 0, 0);
+ XDamageSubtract (xdisplay, cw->damage, None, parts);
+ XFixesTranslateRegion (xdisplay, parts,
cw->attrs.x + cw->attrs.border_width,
cw->attrs.y + cw->attrs.border_width);
}
@@ -1458,8 +1487,9 @@ static void
free_win (MetaCompWindow *cw,
gboolean destroy)
{
- MetaDisplay *display = cw->screen->display;
- MetaCompScreen *info = cw->screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (cw->screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (cw->screen);
#ifdef HAVE_NAME_WINDOW_PIXMAP
if (have_name_window_pixmap (display))
@@ -1467,13 +1497,13 @@ free_win (MetaCompWindow *cw,
/* See comment in map_win */
if (cw->back_pixmap && destroy)
{
- XFreePixmap (display->xdisplay, cw->back_pixmap);
+ XFreePixmap (xdisplay, cw->back_pixmap);
cw->back_pixmap = None;
}
if (cw->shaded_back_pixmap && destroy)
{
- XFreePixmap (display->xdisplay, cw->shaded_back_pixmap);
+ XFreePixmap (xdisplay, cw->shaded_back_pixmap);
cw->shaded_back_pixmap = None;
}
}
@@ -1481,43 +1511,43 @@ free_win (MetaCompWindow *cw,
if (cw->picture)
{
- XRenderFreePicture (display->xdisplay, cw->picture);
+ XRenderFreePicture (xdisplay, cw->picture);
cw->picture = None;
}
if (cw->shadow)
{
- XRenderFreePicture (display->xdisplay, cw->shadow);
+ XRenderFreePicture (xdisplay, cw->shadow);
cw->shadow = None;
}
if (cw->alpha_pict)
{
- XRenderFreePicture (display->xdisplay, cw->alpha_pict);
+ XRenderFreePicture (xdisplay, cw->alpha_pict);
cw->alpha_pict = None;
}
if (cw->shadow_pict)
{
- XRenderFreePicture (display->xdisplay, cw->shadow_pict);
+ XRenderFreePicture (xdisplay, cw->shadow_pict);
cw->shadow_pict = None;
}
if (cw->border_size)
{
- XFixesDestroyRegion (display->xdisplay, cw->border_size);
+ XFixesDestroyRegion (xdisplay, cw->border_size);
cw->border_size = None;
}
if (cw->border_clip)
{
- XFixesDestroyRegion (display->xdisplay, cw->border_clip);
+ XFixesDestroyRegion (xdisplay, cw->border_clip);
cw->border_clip = None;
}
if (cw->extents)
{
- XFixesDestroyRegion (display->xdisplay, cw->extents);
+ XFixesDestroyRegion (xdisplay, cw->extents);
cw->extents = None;
}
@@ -1525,7 +1555,7 @@ free_win (MetaCompWindow *cw,
{
if (cw->damage != None) {
meta_error_trap_push (display);
- XDamageDestroy (display->xdisplay, cw->damage);
+ XDamageDestroy (xdisplay, cw->damage);
meta_error_trap_pop (display, FALSE);
cw->damage = None;
@@ -1546,6 +1576,7 @@ map_win (MetaDisplay *display,
Window id)
{
MetaCompWindow *cw = find_window_for_screen (screen, id);
+ Display *xdisplay = meta_display_get_xdisplay (display);
if (cw == NULL)
return;
@@ -1556,13 +1587,13 @@ map_win (MetaDisplay *display,
whenever the window is unmapped */
if (cw->back_pixmap)
{
- XFreePixmap (display->xdisplay, cw->back_pixmap);
+ XFreePixmap (xdisplay, cw->back_pixmap);
cw->back_pixmap = None;
}
if (cw->shaded_back_pixmap)
{
- XFreePixmap (display->xdisplay, cw->shaded_back_pixmap);
+ XFreePixmap (xdisplay, cw->shaded_back_pixmap);
cw->shaded_back_pixmap = None;
}
#endif
@@ -1577,7 +1608,7 @@ unmap_win (MetaDisplay *display,
Window id)
{
MetaCompWindow *cw = find_window_for_screen (screen, id);
- MetaCompScreen *info = screen->compositor_data;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (cw == NULL)
{
@@ -1607,23 +1638,24 @@ determine_mode (MetaDisplay *display,
MetaCompWindow *cw)
{
XRenderPictFormat *format;
+ Display *xdisplay = meta_display_get_xdisplay (display);
if (cw->alpha_pict)
{
- XRenderFreePicture (display->xdisplay, cw->alpha_pict);
+ XRenderFreePicture (xdisplay, cw->alpha_pict);
cw->alpha_pict = None;
}
if (cw->shadow_pict)
{
- XRenderFreePicture (display->xdisplay, cw->shadow_pict);
+ XRenderFreePicture (xdisplay, cw->shadow_pict);
cw->shadow_pict = None;
}
if (cw->attrs.class == InputOnly)
format = NULL;
else
- format = XRenderFindVisualFormat (display->xdisplay, cw->attrs.visual);
+ format = XRenderFindVisualFormat (xdisplay, cw->attrs.visual);
if ((format && format->type == PictTypeDirect && format->direct.alphaMask)
|| cw->opacity != (guint) OPAQUE)
@@ -1634,8 +1666,8 @@ determine_mode (MetaDisplay *display,
if (cw->extents)
{
XserverRegion damage;
- damage = XFixesCreateRegion (display->xdisplay, NULL, 0);
- XFixesCopyRegion (display->xdisplay, damage, cw->extents);
+ damage = XFixesCreateRegion (xdisplay, NULL, 0);
+ XFixesCopyRegion (xdisplay, damage, cw->extents);
dump_xserver_region ("determine_mode", display, damage);
add_damage (screen, damage);
@@ -1646,13 +1678,14 @@ static gboolean
is_shaped (MetaDisplay *display,
Window xwindow)
{
+ Display *xdisplay = meta_display_get_xdisplay (display);
int xws, yws, xbs, ybs;
unsigned wws, hws, wbs, hbs;
int bounding_shaped, clip_shaped;
- if (META_DISPLAY_HAS_SHAPE (display))
+ if (meta_display_has_shape (display))
{
- XShapeQueryExtents (display->xdisplay, xwindow, &bounding_shaped,
+ XShapeQueryExtents (xdisplay, xwindow, &bounding_shaped,
&xws, &yws, &wws, &hws, &clip_shaped,
&xbs, &ybs, &wbs, &hbs);
return (bounding_shaped != 0);
@@ -1665,7 +1698,7 @@ static void
get_window_type (MetaDisplay *display,
MetaCompWindow *cw)
{
- MetaCompositor *compositor = display->compositor;
+ MetaCompositorXRender *compositor = DISPLAY_COMPOSITOR (display);
int n_atoms;
Atom *atoms, type_atom;
int i;
@@ -1675,20 +1708,20 @@ get_window_type (MetaDisplay *display,
atoms = NULL;
meta_prop_get_atom_list (display, cw->id,
- display->atom__NET_WM_WINDOW_TYPE,
+ compositor->atom_net_wm_window_type,
&atoms, &n_atoms);
for (i = 0; i < n_atoms; i++)
{
if (atoms[i] == compositor->atom_net_wm_window_type_dnd ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DESKTOP ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DOCK ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_TOOLBAR ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_MENU ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_DIALOG ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_NORMAL ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_UTILITY ||
- atoms[i] == display->atom__NET_WM_WINDOW_TYPE_SPLASH)
+ atoms[i] == compositor->atom_net_wm_window_type_desktop ||
+ atoms[i] == compositor->atom_net_wm_window_type_dock ||
+ atoms[i] == compositor->atom_net_wm_window_type_toolbar ||
+ atoms[i] == compositor->atom_net_wm_window_type_menu ||
+ atoms[i] == compositor->atom_net_wm_window_type_dialog ||
+ atoms[i] == compositor->atom_net_wm_window_type_normal ||
+ atoms[i] == compositor->atom_net_wm_window_type_utility ||
+ atoms[i] == compositor->atom_net_wm_window_type_splash)
{
type_atom = atoms[i];
break;
@@ -1699,9 +1732,9 @@ get_window_type (MetaDisplay *display,
if (type_atom == compositor->atom_net_wm_window_type_dnd)
cw->type = META_COMP_WINDOW_DND;
- else if (type_atom == display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
+ else if (type_atom == compositor->atom_net_wm_window_type_desktop)
cw->type = META_COMP_WINDOW_DESKTOP;
- else if (type_atom == display->atom__NET_WM_WINDOW_TYPE_DOCK)
+ else if (type_atom == compositor->atom_net_wm_window_type_dock)
cw->type = META_COMP_WINDOW_DOCK;
else
cw->type = META_COMP_WINDOW_NORMAL;
@@ -1715,8 +1748,9 @@ add_win (MetaScreen *screen,
MetaWindow *window,
Window xwindow)
{
- MetaDisplay *display = screen->display;
- MetaCompScreen *info = screen->compositor_data;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaCompWindow *cw;
gulong event_mask;
@@ -1731,7 +1765,7 @@ add_win (MetaScreen *screen,
cw->window = window;
cw->id = xwindow;
- if (!XGetWindowAttributes (display->xdisplay, xwindow, &cw->attrs))
+ if (!XGetWindowAttributes (xdisplay, xwindow, &cw->attrs))
{
g_free (cw);
return;
@@ -1742,7 +1776,7 @@ add_win (MetaScreen *screen,
won't have been set on the window */
event_mask = cw->attrs.your_event_mask | PropertyChangeMask;
- XSelectInput (display->xdisplay, xwindow, event_mask);
+ XSelectInput (xdisplay, xwindow, event_mask);
#ifdef HAVE_NAME_WINDOW_PIXMAP
@@ -1756,8 +1790,7 @@ add_win (MetaScreen *screen,
if (cw->attrs.class == InputOnly)
cw->damage = None;
else
- cw->damage = XDamageCreate (display->xdisplay, xwindow,
- XDamageReportNonEmpty);
+ cw->damage = XDamageCreate (xdisplay, xwindow, XDamageReportNonEmpty);
cw->alpha_pict = None;
cw->shadow_pict = None;
@@ -1769,7 +1802,7 @@ add_win (MetaScreen *screen,
cw->shadow_width = 0;
cw->shadow_height = 0;
- if (window && window->has_focus)
+ if (window && meta_window_has_focus (window))
cw->shadow_type = META_SHADOW_LARGE;
else
cw->shadow_type = META_SHADOW_MEDIUM;
@@ -1820,7 +1853,7 @@ destroy_win (MetaDisplay *display,
cw->extents = None;
}
- info = screen->compositor_data;
+ info = meta_screen_get_compositor_data (screen);
info->windows = g_list_remove (info->windows, (gconstpointer) cw);
g_hash_table_remove (info->windows_by_xid, (gpointer) xwindow);
@@ -1837,7 +1870,7 @@ restack_win (MetaCompWindow *cw,
GList *sibling, *next;
screen = cw->screen;
- info = screen->compositor_data;
+ info = meta_screen_get_compositor_data (screen);
sibling = g_list_find (info->windows, (gconstpointer) cw);
next = g_list_next (sibling);
@@ -1885,19 +1918,14 @@ resize_win (MetaCompWindow *cw,
int border_width,
gboolean override_redirect)
{
- MetaScreen *screen;
- MetaDisplay *display;
- MetaCompScreen *info;
- Display *xdisplay;
+ MetaScreen *screen = cw->screen;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
XserverRegion damage;
gboolean debug;
- screen = cw->screen;
- display = screen->display;
- xdisplay = display->xdisplay;
- info = screen->compositor_data;
-
- debug = ((MetaCompositor *) display->compositor)->debug;
+ debug = DISPLAY_COMPOSITOR (display)->debug;
if (cw->extents)
{
@@ -1916,12 +1944,11 @@ resize_win (MetaCompWindow *cw,
r.x = 0;
r.y = 0;
- r.width = screen->rect.width;
- r.height = screen->rect.height;
+ meta_screen_get_size (screen, &r.width, &r.height);
fprintf (stderr, "Damage whole screen %d,%d (%d %d)\n",
r.x, r.y, r.width, r.height);
- damage = XFixesCreateRegion (display->xdisplay, &r, 1);
+ damage = XFixesCreateRegion (xdisplay, &r, 1);
} */
cw->attrs.x = x;
@@ -1942,7 +1969,7 @@ resize_win (MetaCompWindow *cw,
{
/* If the window is shaded, we store the old backing pixmap
so we can return a proper image of the window */
- if (cw->window && cw->window->shaded)
+ if (cw->window && meta_window_is_shaded (cw->window))
{
cw->shaded_back_pixmap = cw->back_pixmap;
cw->back_pixmap = None;
@@ -1999,8 +2026,8 @@ resize_win (MetaCompWindow *cw,
/* event processors must all be called with an error trap in place */
static void
-process_circulate_notify (MetaCompositor *compositor,
- XCirculateEvent *event)
+process_circulate_notify (MetaCompositorXRender *compositor,
+ XCirculateEvent *event)
{
MetaCompWindow *cw = find_window_in_display (compositor->display,
event->window);
@@ -2014,7 +2041,7 @@ process_circulate_notify (MetaCompositor *compositor,
return;
screen = cw->screen;
- info = screen->compositor_data;
+ info = meta_screen_get_compositor_data (screen);
first = info->windows;
top = (MetaCompWindow *) first->data;
@@ -2032,10 +2059,11 @@ process_circulate_notify (MetaCompositor *compositor,
}
static void
-process_configure_notify (MetaCompositor *compositor,
- XConfigureEvent *event)
+process_configure_notify (MetaCompositorXRender *compositor,
+ XConfigureEvent *event)
{
MetaDisplay *display = compositor->display;
+ Display *xdisplay = meta_display_get_xdisplay (display);
MetaCompWindow *cw = find_window_in_display (display, event->window);
if (cw)
@@ -2043,11 +2071,14 @@ process_configure_notify (MetaCompositor *compositor,
#if 0
int x = -1, y = -1, width = -1, height = -1;
int ex = -1, ey = -1, ewidth = -1, eheight = -1;
+ MetaRectangle *rect;
+
if (cw->window) {
- x = cw->window->rect.x;
- y = cw->window->rect.y;
- width = cw->window->rect.width;
- height = cw->window->rect.height;
+ rect = meta_window_get_rect (cw->window);
+ x = rect->x;
+ y = rect->y;
+ width = rect->width;
+ height = rect->height;
}
fprintf (stderr, "configure notify xy (%d %d) -> (%d %d), wh (%d %d) -> (%d %d)\n",
x, y, event->x, event->y,
@@ -2077,10 +2108,10 @@ process_configure_notify (MetaCompositor *compositor,
if (screen == NULL)
return;
- info = screen->compositor_data;
+ info = meta_screen_get_compositor_data (screen);
if (info->root_buffer)
{
- XRenderFreePicture (display->xdisplay, info->root_buffer);
+ XRenderFreePicture (xdisplay, info->root_buffer);
info->root_buffer = None;
}
@@ -2089,10 +2120,11 @@ process_configure_notify (MetaCompositor *compositor,
}
static void
-process_property_notify (MetaCompositor *compositor,
- XPropertyEvent *event)
+process_property_notify (MetaCompositorXRender *compositor,
+ XPropertyEvent *event)
{
MetaDisplay *display = compositor->display;
+ Display *xdisplay = meta_display_get_xdisplay (display);
MetaScreen *screen;
int p;
Atom background_atoms[2];
@@ -2108,12 +2140,13 @@ process_property_notify (MetaCompositor *compositor,
screen = meta_display_screen_for_root (display, event->window);
if (screen)
{
- MetaCompScreen *info = screen->compositor_data;
+ MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+ Window xroot = meta_screen_get_xroot (screen);
+
if (info->root_tile)
{
- XClearArea (display->xdisplay, screen->xroot,
- 0, 0, 0, 0, TRUE);
- XRenderFreePicture (display->xdisplay, info->root_tile);
+ XClearArea (xdisplay, xroot, 0, 0, 0, 0, TRUE);
+ XRenderFreePicture (xdisplay, info->root_tile);
info->root_tile = None;
/* Damage the whole screen as we may need to redraw the
@@ -2135,14 +2168,14 @@ process_property_notify (MetaCompositor *compositor,
MetaCompWindow *cw = find_window_in_display (display, event->window);
gulong value;
- if (!cw)
+ if (!cw)
{
- /* Applications can set this property for their toplevel windows, so
+ /* Applications can set this for their toplevel windows, so
* this must be propagated to the window managed by the compositor
*/
cw = find_window_for_child_window_in_display (display, event->window);
}
-
+
if (!cw)
return;
@@ -2157,12 +2190,12 @@ process_property_notify (MetaCompositor *compositor,
if (cw->shadow)
{
- XRenderFreePicture (display->xdisplay, cw->shadow);
+ XRenderFreePicture (xdisplay, cw->shadow);
cw->shadow = None;
}
if (cw->extents)
- XFixesDestroyRegion (display->xdisplay, cw->extents);
+ XFixesDestroyRegion (xdisplay, cw->extents);
cw->extents = win_extents (cw);
cw->damaged = TRUE;
@@ -2173,7 +2206,7 @@ process_property_notify (MetaCompositor *compositor,
return;
}
- if (event->atom == display->atom__NET_WM_WINDOW_TYPE) {
+ if (event->atom == compositor->atom_net_wm_window_type) {
MetaCompWindow *cw = find_window_in_display (display, event->window);
if (!cw)
@@ -2190,19 +2223,19 @@ expose_area (MetaScreen *screen,
XRectangle *rects,
int nrects)
{
- MetaDisplay *display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion region;
- display = screen->display;
- region = XFixesCreateRegion (display->xdisplay, rects, nrects);
+ region = XFixesCreateRegion (xdisplay, rects, nrects);
dump_xserver_region ("expose_area", display, region);
add_damage (screen, region);
}
static void
-process_expose (MetaCompositor *compositor,
- XExposeEvent *event)
+process_expose (MetaCompositorXRender *compositor,
+ XExposeEvent *event)
{
MetaCompWindow *cw = find_window_in_display (compositor->display,
event->window);
@@ -2233,8 +2266,8 @@ process_expose (MetaCompositor *compositor,
}
static void
-process_unmap (MetaCompositor *compositor,
- XUnmapEvent *event)
+process_unmap (MetaCompositorXRender *compositor,
+ XUnmapEvent *event)
{
MetaCompWindow *cw;
@@ -2251,8 +2284,8 @@ process_unmap (MetaCompositor *compositor,
}
static void
-process_map (MetaCompositor *compositor,
- XMapEvent *event)
+process_map (MetaCompositorXRender *compositor,
+ XMapEvent *event)
{
MetaCompWindow *cw = find_window_in_display (compositor->display,
event->window);
@@ -2262,9 +2295,9 @@ process_map (MetaCompositor *compositor,
}
static void
-process_reparent (MetaCompositor *compositor,
- XReparentEvent *event,
- MetaWindow *window)
+process_reparent (MetaCompositorXRender *compositor,
+ XReparentEvent *event,
+ MetaWindow *window)
{
MetaScreen *screen;
@@ -2276,9 +2309,9 @@ process_reparent (MetaCompositor *compositor,
}
static void
-process_create (MetaCompositor *compositor,
- XCreateWindowEvent *event,
- MetaWindow *window)
+process_create (MetaCompositorXRender *compositor,
+ XCreateWindowEvent *event,
+ MetaWindow *window)
{
MetaScreen *screen;
/* We are only interested in top level windows, others will
@@ -2293,15 +2326,15 @@ process_create (MetaCompositor *compositor,
}
static void
-process_destroy (MetaCompositor *compositor,
- XDestroyWindowEvent *event)
+process_destroy (MetaCompositorXRender *compositor,
+ XDestroyWindowEvent *event)
{
destroy_win (compositor->display, event->window, FALSE);
}
static void
-process_damage (MetaCompositor *compositor,
- XDamageNotifyEvent *event)
+process_damage (MetaCompositorXRender *compositor,
+ XDamageNotifyEvent *event)
{
MetaCompWindow *cw = find_window_in_display (compositor->display,
event->drawable);
@@ -2317,8 +2350,8 @@ process_damage (MetaCompositor *compositor,
}
static void
-process_shape (MetaCompositor *compositor,
- XShapeEvent *event)
+process_shape (MetaCompositorXRender *compositor,
+ XShapeEvent *event)
{
MetaCompWindow *cw = find_window_in_display (compositor->display,
event->window);
@@ -2341,7 +2374,7 @@ process_shape (MetaCompositor *compositor,
}
static int
-timeout_debug (MetaCompositor *compositor)
+timeout_debug (MetaCompositorXRender *compositor)
{
compositor->show_redraw = (g_getenv ("METACITY_DEBUG_REDRAWS") != NULL);
compositor->debug = (g_getenv ("METACITY_DEBUG_COMPOSITOR") != NULL);
@@ -2349,62 +2382,25 @@ timeout_debug (MetaCompositor *compositor)
return FALSE;
}
-MetaCompositor *
-meta_compositor_new (MetaDisplay *display)
-{
-#ifdef HAVE_COMPOSITE_EXTENSIONS
- char *atom_names[] = {
- "_XROOTPMAP_ID",
- "_XSETROOT_ID",
- "_NET_WM_WINDOW_OPACITY",
- "_NET_WM_WINDOW_TYPE_DND",
- };
- Atom atoms[G_N_ELEMENTS(atom_names)];
- MetaCompositor *compositor;
-
- compositor = g_new (MetaCompositor, 1);
- compositor->display = display;
-
- meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
- XInternAtoms (display->xdisplay, atom_names, G_N_ELEMENTS (atom_names),
- False, atoms);
- compositor->atom_x_root_pixmap = atoms[0];
- compositor->atom_x_set_root = atoms[1];
- compositor->atom_net_wm_window_opacity = atoms[2];
- compositor->atom_net_wm_window_type_dnd = atoms[3];
-
-#ifdef USE_IDLE_REPAINT
- meta_verbose ("Using idle repaint\n");
- compositor->repaint_id = 0;
-#endif
-
- compositor->enabled = TRUE;
- g_timeout_add (2000, (GSourceFunc) timeout_debug, compositor);
-
- return compositor;
-#else
- return NULL;
-#endif
-}
-
-void
-meta_compositor_add_window (MetaCompositor *compositor,
- MetaWindow *window,
- Window xwindow,
- XWindowAttributes *attrs)
+static void
+xrender_add_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ Window xwindow,
+ XWindowAttributes *attrs)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
+ MetaCompositorXRender *xrc = (MetaCompositorXRender *) compositor;
MetaScreen *screen = meta_screen_for_x_screen (attrs->screen);
- meta_error_trap_push (compositor->display);
+ meta_error_trap_push (xrc->display);
add_win (screen, window, xwindow);
- meta_error_trap_pop (compositor->display, FALSE);
+ meta_error_trap_pop (xrc->display, FALSE);
#endif
}
-void
-meta_compositor_remove_window (MetaCompositor *compositor,
- Window xwindow)
+static void
+xrender_remove_window (MetaCompositor *compositor,
+ Window xwindow)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
@@ -2414,19 +2410,20 @@ static void
show_overlay_window (MetaScreen *screen,
Window cow)
{
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
#ifdef HAVE_COW
if (have_cow (display))
{
XserverRegion region;
- region = XFixesCreateRegion (display->xdisplay, NULL, 0);
+ region = XFixesCreateRegion (xdisplay, NULL, 0);
- XFixesSetWindowShapeRegion (display->xdisplay, cow, ShapeBounding, 0, 0, 0);
- XFixesSetWindowShapeRegion (display->xdisplay, cow, ShapeInput, 0, 0, region);
+ XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, 0);
+ XFixesSetWindowShapeRegion (xdisplay, cow, ShapeInput, 0, 0, region);
- XFixesDestroyRegion (display->xdisplay, region);
+ XFixesDestroyRegion (xdisplay, region);
damage_screen (screen);
}
@@ -2438,87 +2435,90 @@ hide_overlay_window (MetaScreen *screen,
Window cow)
{
#ifdef HAVE_COW
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XserverRegion region;
- region = XFixesCreateRegion (display->xdisplay, NULL, 0);
- XFixesSetWindowShapeRegion (display->xdisplay,
- cow, ShapeBounding,
- 0, 0, region);
- XFixesDestroyRegion (display->xdisplay, region);
+ region = XFixesCreateRegion (xdisplay, NULL, 0);
+ XFixesSetWindowShapeRegion (xdisplay, cow, ShapeBounding, 0, 0, region);
+ XFixesDestroyRegion (xdisplay, region);
#endif
}
static Window
get_output_window (MetaScreen *screen)
{
- MetaDisplay *display = screen->display;
- Window output;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+ Window output, xroot;
+
+ xroot = meta_screen_get_xroot (screen);
#ifdef HAVE_COW
if (have_cow (display))
{
- output = XCompositeGetOverlayWindow (display->xdisplay, screen->xroot);
- XSelectInput (display->xdisplay, output, ExposureMask);
+ output = XCompositeGetOverlayWindow (xdisplay, xroot);
+ XSelectInput (xdisplay, output, ExposureMask);
}
else
#endif
{
- output = screen->xroot;
+ output = xroot;
}
return output;
}
-void
-meta_compositor_manage_screen (MetaCompositor *compositor,
- MetaScreen *screen)
+static void
+xrender_manage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
MetaCompScreen *info;
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictureAttributes pa;
XRenderPictFormat *visual_format;
+ int screen_number = meta_screen_get_screen_number (screen);
+ Window xroot = meta_screen_get_xroot (screen);
/* Check if the screen is already managed */
- if (screen->compositor_data)
+ if (meta_screen_get_compositor_data (screen))
return;
gdk_error_trap_push ();
- XCompositeRedirectSubwindows (display->xdisplay, screen->xroot,
- CompositeRedirectManual);
- XSync (display->xdisplay, FALSE);
+ XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
+ XSync (xdisplay, FALSE);
if (gdk_error_trap_pop ())
{
g_warning ("Another compositing manager is running on screen %i",
- screen->number);
+ screen_number);
return;
}
info = g_new0 (MetaCompScreen, 1);
info->screen = screen;
- screen->compositor_data = info;
+ meta_screen_set_compositor_data (screen, info);
- visual_format = XRenderFindVisualFormat (display->xdisplay,
- DefaultVisual (display->xdisplay,
- screen->number));
+ visual_format = XRenderFindVisualFormat (xdisplay, DefaultVisual (xdisplay,
+ screen_number));
if (!visual_format)
{
- g_warning ("Cannot find visual format on screen %i", screen->number);
+ g_warning ("Cannot find visual format on screen %i", screen_number);
return;
}
info->output = get_output_window (screen);
pa.subwindow_mode = IncludeInferiors;
- info->root_picture = XRenderCreatePicture (display->xdisplay, info->output,
+ info->root_picture = XRenderCreatePicture (xdisplay, info->output,
visual_format,
CPSubwindowMode, &pa);
if (info->root_picture == None)
{
- g_warning ("Cannot create root picture on screen %i", screen->number);
+ g_warning ("Cannot create root picture on screen %i", screen_number);
return;
}
@@ -2531,7 +2531,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
info->windows = NULL;
info->windows_by_xid = g_hash_table_new (g_direct_hash, g_direct_equal);
- info->focus_window = display->focus_window;
+ info->focus_window = meta_display_get_focus_window (display);
info->compositor_active = TRUE;
info->overlays = 0;
@@ -2546,7 +2546,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
else
meta_verbose ("Disabling shadows\n");
- XClearArea (display->xdisplay, info->output, 0, 0, 0, 0, TRUE);
+ XClearArea (xdisplay, info->output, 0, 0, 0, 0, TRUE);
meta_screen_set_cm_selection (screen);
@@ -2555,21 +2555,23 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
#endif
}
-void
-meta_compositor_unmanage_screen (MetaCompositor *compositor,
- MetaScreen *screen)
+static void
+xrender_unmanage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
- MetaDisplay *display = screen->display;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
MetaCompScreen *info;
+ Window xroot = meta_screen_get_xroot (screen);
GList *index;
+ info = meta_screen_get_compositor_data (screen);
+
/* This screen isn't managed */
- if (screen->compositor_data == NULL)
+ if (info == NULL)
return;
- info = screen->compositor_data;
-
hide_overlay_window (screen, info->output);
/* Destroy the windows */
@@ -2582,10 +2584,10 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
g_hash_table_destroy (info->windows_by_xid);
if (info->root_picture)
- XRenderFreePicture (display->xdisplay, info->root_picture);
+ XRenderFreePicture (xdisplay, info->root_picture);
if (info->black_picture)
- XRenderFreePicture (display->xdisplay, info->black_picture);
+ XRenderFreePicture (xdisplay, info->black_picture);
if (info->have_shadows)
{
@@ -2595,69 +2597,70 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
g_free (info->shadows[i]->gaussian_map);
}
- XCompositeUnredirectSubwindows (display->xdisplay, screen->xroot,
+ XCompositeUnredirectSubwindows (xdisplay, xroot,
CompositeRedirectManual);
meta_screen_unset_cm_selection (screen);
#ifdef HAVE_COW
- XCompositeReleaseOverlayWindow (display->xdisplay, info->output);
+ XCompositeReleaseOverlayWindow (xdisplay, info->output);
#endif
g_free (info);
- screen->compositor_data = NULL;
+
+ meta_screen_set_compositor_data (screen, NULL);
#endif
}
-void
-meta_compositor_set_updates (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean updates)
+static void
+xrender_set_updates (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
-void
-meta_compositor_destroy (MetaCompositor *compositor)
+static void
+xrender_destroy (MetaCompositor *compositor)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
g_free (compositor);
#endif
}
-void
-meta_compositor_begin_move (MetaCompositor *compositor,
- MetaWindow *window,
- MetaRectangle *initial,
- int grab_x,
- int grab_y)
+static void
+xrender_begin_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *initial,
+ int grab_x,
+ int grab_y)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
-void
-meta_compositor_update_move (MetaCompositor *compositor,
- MetaWindow *window,
- int x,
- int y)
+static void
+xrender_update_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ int x,
+ int y)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
-void
-meta_compositor_end_move (MetaCompositor *compositor,
- MetaWindow *window)
+static void
+xrender_end_move (MetaCompositor *compositor,
+ MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
}
-void
-meta_compositor_free_window (MetaCompositor *compositor,
- MetaWindow *window)
+static void
+xrender_free_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
/* FIXME: When an undecorated window is hidden this is called,
@@ -2671,95 +2674,97 @@ meta_compositor_free_window (MetaCompositor *compositor,
#endif
}
-void
-meta_compositor_process_event (MetaCompositor *compositor,
- XEvent *event,
- MetaWindow *window)
+static void
+xrender_process_event (MetaCompositor *compositor,
+ XEvent *event,
+ MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
+ MetaCompositorXRender *xrc = (MetaCompositorXRender *) compositor;
/*
* This trap is so that none of the compositor functions cause
* X errors. This is really a hack, but I'm afraid I don't understand
* enough about Metacity/X to know how else you are supposed to do it
*/
- meta_error_trap_push (compositor->display);
+ meta_error_trap_push (xrc->display);
switch (event->type)
{
case CirculateNotify:
- process_circulate_notify (compositor, (XCirculateEvent *) event);
+ process_circulate_notify (xrc, (XCirculateEvent *) event);
break;
case ConfigureNotify:
- process_configure_notify (compositor, (XConfigureEvent *) event);
+ process_configure_notify (xrc, (XConfigureEvent *) event);
break;
case PropertyNotify:
- process_property_notify (compositor, (XPropertyEvent *) event);
+ process_property_notify (xrc, (XPropertyEvent *) event);
break;
case Expose:
- process_expose (compositor, (XExposeEvent *) event);
+ process_expose (xrc, (XExposeEvent *) event);
break;
case UnmapNotify:
- process_unmap (compositor, (XUnmapEvent *) event);
+ process_unmap (xrc, (XUnmapEvent *) event);
break;
case MapNotify:
- process_map (compositor, (XMapEvent *) event);
+ process_map (xrc, (XMapEvent *) event);
break;
case ReparentNotify:
- process_reparent (compositor, (XReparentEvent *) event, window);
+ process_reparent (xrc, (XReparentEvent *) event, window);
break;
case CreateNotify:
- process_create (compositor, (XCreateWindowEvent *) event, window);
+ process_create (xrc, (XCreateWindowEvent *) event, window);
break;
case DestroyNotify:
- process_destroy (compositor, (XDestroyWindowEvent *) event);
+ process_destroy (xrc, (XDestroyWindowEvent *) event);
break;
default:
- if (event->type == compositor->display->damage_event_base + XDamageNotify)
- process_damage (compositor, (XDamageNotifyEvent *) event);
- else if (event->type == compositor->display->shape_event_base + ShapeNotify)
- process_shape (compositor, (XShapeEvent *) event);
+ if (event->type == meta_display_get_damage_event_base (xrc->display) + XDamageNotify)
+ process_damage (xrc, (XDamageNotifyEvent *) event);
+ else if (event->type == meta_display_get_shape_event_base (xrc->display) + ShapeNotify)
+ process_shape (xrc, (XShapeEvent *) event);
else
{
- meta_error_trap_pop (compositor->display, FALSE);
+ meta_error_trap_pop (xrc->display, FALSE);
return;
}
break;
}
- meta_error_trap_pop (compositor->display, FALSE);
+ meta_error_trap_pop (xrc->display, FALSE);
#ifndef USE_IDLE_REPAINT
- repair_display (compositor->display);
+ repair_display (xrc->display);
#endif
return;
#endif
}
-Pixmap
-meta_compositor_get_window_pixmap (MetaCompositor *compositor,
- MetaWindow *window)
+static Pixmap
+xrender_get_window_pixmap (MetaCompositor *compositor,
+ MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
MetaCompWindow *cw = NULL;
+ MetaScreen *screen = meta_window_get_screen (window);
+ MetaFrame *frame = meta_window_get_frame (window);
- cw = find_window_for_screen (window->screen,
- window->frame ? window->frame->xwindow :
- window->xwindow);
+ cw = find_window_for_screen (screen, frame ? meta_frame_get_xwindow (frame) :
+ meta_window_get_xwindow (window));
if (cw == NULL)
return None;
#ifdef HAVE_NAME_WINDOW_PIXMAP
- if (have_name_window_pixmap (window->display))
+ if (have_name_window_pixmap (meta_window_get_display (window)))
{
- if (window->shaded)
+ if (meta_window_is_shaded (window))
return cw->shaded_back_pixmap;
else
return cw->back_pixmap;
@@ -2770,12 +2775,13 @@ meta_compositor_get_window_pixmap (MetaCompositor *compositor,
#endif
}
-void
-meta_compositor_set_active_window (MetaCompositor *compositor,
- MetaScreen *screen,
- MetaWindow *window)
+static void
+xrender_set_active_window (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window)
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
+ MetaCompositorXRender *xrc = (MetaCompositorXRender *) compositor;
MetaDisplay *display;
Display *xdisplay;
MetaCompWindow *old_focus = NULL, *new_focus = NULL;
@@ -2785,22 +2791,26 @@ meta_compositor_set_active_window (MetaCompositor *compositor,
if (compositor == NULL)
return;
- display = compositor->display;
- xdisplay = display->xdisplay;
- info = screen->compositor_data;
+ display = xrc->display;
+ xdisplay = meta_display_get_xdisplay (display);
+ info = meta_screen_get_compositor_data (screen);
old_focus_win = info->focus_window;
if (old_focus_win)
{
+ MetaFrame *f = meta_window_get_frame (old_focus_win);
+
old_focus = find_window_for_screen (screen,
- old_focus_win->frame ? old_focus_win->frame->xwindow :
- old_focus_win->xwindow);
+ f ? meta_frame_get_xwindow (f) :
+ meta_window_get_xwindow (old_focus_win));
}
+
if (window)
{
+ MetaFrame *f = meta_window_get_frame (window);
new_focus = find_window_for_screen (screen,
- window->frame ? window->frame->xwindow :
- window->xwindow);
+ f ? meta_frame_get_xwindow (f) :
+ meta_window_get_xwindow (window));
}
info->focus_window = window;
@@ -2892,3 +2902,78 @@ meta_compositor_set_active_window (MetaCompositor *compositor,
#endif
#endif
}
+
+static MetaCompositor comp_info = {
+ xrender_destroy,
+ xrender_manage_screen,
+ xrender_unmanage_screen,
+ xrender_add_window,
+ xrender_remove_window,
+ xrender_set_updates,
+ xrender_process_event,
+ xrender_get_window_pixmap,
+ xrender_set_active_window
+};
+
+MetaCompositor *
+meta_compositor_xrender_new (MetaDisplay *display)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ char *atom_names[] = {
+ "_XROOTPMAP_ID",
+ "_XSETROOT_ID",
+ "_NET_WM_WINDOW_OPACITY",
+ "_NET_WM_WINDOW_TYPE_DND",
+ "_NET_WM_WINDOW_TYPE",
+ "_NET_WM_WINDOW_TYPE_DESKTOP",
+ "_NET_WM_WINDOW_TYPE_DOCK",
+ "_NET_WM_WINDOW_TYPE_MENU",
+ "_NET_WM_WINDOW_TYPE_DIALOG",
+ "_NET_WM_WINDOW_TYPE_NORMAL",
+ "_NET_WM_WINDOW_TYPE_UTILITY",
+ "_NET_WM_WINDOW_TYPE_SPLASH",
+ "_NET_WM_WINDOW_TYPE_TOOLBAR"
+ };
+ Atom atoms[G_N_ELEMENTS(atom_names)];
+ MetaCompositorXRender *xrc;
+ MetaCompositor *compositor;
+ Display *xdisplay = meta_display_get_xdisplay (display);
+
+ xrc = g_new (MetaCompositorXRender, 1);
+ xrc->compositor = comp_info;
+
+ compositor = (MetaCompositor *) xrc;
+
+ xrc->display = display;
+
+ meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
+ XInternAtoms (xdisplay, atom_names, G_N_ELEMENTS (atom_names),
+ False, atoms);
+
+ xrc->atom_x_root_pixmap = atoms[0];
+ xrc->atom_x_set_root = atoms[1];
+ xrc->atom_net_wm_window_opacity = atoms[2];
+ xrc->atom_net_wm_window_type_dnd = atoms[3];
+ xrc->atom_net_wm_window_type = atoms[4];
+ xrc->atom_net_wm_window_type_desktop = atoms[5];
+ xrc->atom_net_wm_window_type_dock = atoms[6];
+ xrc->atom_net_wm_window_type_menu = atoms[7];
+ xrc->atom_net_wm_window_type_dialog = atoms[8];
+ xrc->atom_net_wm_window_type_normal = atoms[9];
+ xrc->atom_net_wm_window_type_utility = atoms[10];
+ xrc->atom_net_wm_window_type_splash = atoms[11];
+ xrc->atom_net_wm_window_type_toolbar = atoms[12];
+
+#ifdef USE_IDLE_REPAINT
+ meta_verbose ("Using idle repaint\n");
+ xrc->repaint_id = 0;
+#endif
+
+ xrc->enabled = TRUE;
+ g_timeout_add (2000, (GSourceFunc) timeout_debug, xrc);
+
+ return compositor;
+#else
+ return NULL;
+#endif
+}
diff --git a/src/compositor/compositor-xrender.h b/src/compositor/compositor-xrender.h
new file mode 100644
index 00000000..5c8a36c0
--- /dev/null
+++ b/src/compositor/compositor-xrender.h
@@ -0,0 +1,31 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2007 Iain Holmes
+ * Based on xcompmgr - (c) 2003 Keith Packard
+ * xfwm4 - (c) 2005-2007 Olivier Fourdan
+ *
+ * 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_XRENDER_H_
+#define META_COMPOSITOR_XRENDER_H_
+
+#include "types.h"
+
+MetaCompositor *meta_compositor_xrender_new (MetaDisplay *display);
+
+#endif
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
new file mode 100644
index 00000000..5cfc99e1
--- /dev/null
+++ b/src/compositor/compositor.c
@@ -0,0 +1,158 @@
+/* -*- 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.
+ */
+
+#include <config.h>
+#include "compositor-private.h"
+
+MetaCompositor *
+meta_compositor_new (MetaDisplay *display)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ /* At some point we would have a way to select between backends */
+ return meta_compositor_xrender_new (display);
+#else
+ return NULL;
+#endif
+}
+
+void
+meta_compositor_destroy (MetaCompositor *compositor)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->destroy)
+ compositor->destroy (compositor);
+#endif
+}
+
+void
+meta_compositor_add_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ Window xwindow,
+ XWindowAttributes *attrs)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->add_window)
+ compositor->add_window (compositor, window, xwindow, attrs);
+#endif
+}
+
+void
+meta_compositor_remove_window (MetaCompositor *compositor,
+ Window xwindow)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->remove_window)
+ compositor->remove_window (compositor, xwindow);
+#endif
+}
+
+void
+meta_compositor_manage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->manage_screen)
+ compositor->manage_screen (compositor, screen);
+#endif
+}
+
+void
+meta_compositor_unmanage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->unmanage_screen)
+ compositor->unmanage_screen (compositor, screen);
+#endif
+}
+
+void
+meta_compositor_set_updates (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->set_updates)
+ compositor->set_updates (compositor, window, updates);
+#endif
+}
+
+void
+meta_compositor_process_event (MetaCompositor *compositor,
+ XEvent *event,
+ MetaWindow *window)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->process_event)
+ compositor->process_event (compositor, event, window);
+#endif
+}
+
+Pixmap
+meta_compositor_get_window_pixmap (MetaCompositor *compositor,
+ MetaWindow *window)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->get_window_pixmap)
+ compositor->get_window_pixmap (compositor, window);
+ else
+ return None;
+#else
+ return None;
+#endif
+}
+
+void
+meta_compositor_set_active_window (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window)
+{
+#ifdef HAVE_COMPOSITE_EXTENSIONS
+ if (compositor->set_active_window)
+ compositor->set_active_window (compositor, screen, window);
+#endif
+}
+
+/* These functions are unused at the moment */
+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)
+{
+}
diff --git a/src/core/bell.c b/src/core/bell.c
index 936ae63b..43525bee 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -52,7 +52,7 @@
#include <config.h>
#include "bell.h"
-#include "screen.h"
+#include "screen-private.h"
#include "prefs.h"
/**
diff --git a/src/core/bell.h b/src/core/bell.h
index 7c1e3afc..d33c8d21 100644
--- a/src/core/bell.h
+++ b/src/core/bell.h
@@ -24,8 +24,8 @@
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#endif
-#include "display.h"
-#include "frame.h"
+#include "display-private.h"
+#include "frame-private.h"
#ifdef HAVE_XKB
void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev);
diff --git a/src/core/constraints.h b/src/core/constraints.h
index 8ce332e7..6ccad00e 100644
--- a/src/core/constraints.h
+++ b/src/core/constraints.h
@@ -26,8 +26,8 @@
#define META_CONSTRAINTS_H
#include "util.h"
-#include "window.h"
-#include "frame.h"
+#include "window-private.h"
+#include "frame-private.h"
typedef enum
{
diff --git a/src/core/core.c b/src/core/core.c
index a59b13a1..4207d8a5 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -25,7 +25,7 @@
#include <config.h>
#include "core.h"
-#include "frame.h"
+#include "frame-private.h"
#include "workspace.h"
#include "prefs.h"
diff --git a/src/core/delete.c b/src/core/delete.c
index 8e65f3d7..7078605c 100644
--- a/src/core/delete.c
+++ b/src/core/delete.c
@@ -27,7 +27,7 @@
#include <config.h>
#include "util.h"
-#include "window.h"
+#include "window-private.h"
#include "errors.h"
#include "workspace.h"
diff --git a/src/core/display.h b/src/core/display-private.h
index 659f79d2..add2e400 100644
--- a/src/core/display.h
+++ b/src/core/display-private.h
@@ -24,8 +24,8 @@
* 02111-1307, USA.
*/
-#ifndef META_DISPLAY_H
-#define META_DISPLAY_H
+#ifndef META_DISPLAY_PRIVATE_H
+#define META_DISPLAY_PRIVATE_H
#ifndef PACKAGE
#error "config.h not included"
@@ -36,6 +36,7 @@
#include "eventqueue.h"
#include "common.h"
#include "boxes.h"
+#include "display.h"
#ifdef HAVE_STARTUP_NOTIFICATION
#include <libsn/sn.h>
@@ -45,16 +46,9 @@
#include <X11/extensions/sync.h>
#endif
-#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
-
-typedef struct _MetaCompositor MetaCompositor;
-typedef struct _MetaDisplay MetaDisplay;
-typedef struct _MetaFrame MetaFrame;
typedef struct _MetaKeyBinding MetaKeyBinding;
-typedef struct _MetaScreen MetaScreen;
typedef struct _MetaStack MetaStack;
typedef struct _MetaUISlave MetaUISlave;
-typedef struct _MetaWindow MetaWindow;
typedef struct _MetaWorkspace MetaWorkspace;
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
@@ -330,8 +324,6 @@ struct _MetaDisplay
gboolean meta_display_open (void);
void meta_display_close (MetaDisplay *display,
guint32 timestamp);
-MetaScreen* meta_display_screen_for_root (MetaDisplay *display,
- Window xroot);
MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display,
Screen *screen);
MetaScreen* meta_display_screen_for_xwindow (MetaDisplay *display,
diff --git a/src/core/display.c b/src/core/display.c
index 045169dd..99c1aaed 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -31,14 +31,14 @@
*/
#include <config.h>
-#include "display.h"
+#include "display-private.h"
#include "util.h"
#include "main.h"
-#include "screen.h"
-#include "window.h"
+#include "screen-private.h"
+#include "window-private.h"
#include "window-props.h"
#include "group-props.h"
-#include "frame.h"
+#include "frame-private.h"
#include "errors.h"
#include "keybindings.h"
#include "prefs.h"
@@ -5115,3 +5115,54 @@ meta_display_remove_autoraise_callback (MetaDisplay *display)
display->autoraise_window = NULL;
}
}
+
+void
+meta_display_get_compositor_version (MetaDisplay *display,
+ int *major,
+ int *minor)
+{
+ *major = display->composite_major_version;
+ *minor = display->composite_minor_version;
+}
+
+Display *
+meta_display_get_xdisplay (MetaDisplay *display)
+{
+ return display->xdisplay;
+}
+
+MetaCompositor *
+meta_display_get_compositor (MetaDisplay *display)
+{
+ return display->compositor;
+}
+
+GSList *
+meta_display_get_screens (MetaDisplay *display)
+{
+ return display->screens;
+}
+
+gboolean
+meta_display_has_shape (MetaDisplay *display)
+{
+ return META_DISPLAY_HAS_SHAPE (display);
+}
+
+MetaWindow *
+meta_display_get_focus_window (MetaDisplay *display)
+{
+ return display->focus_window;
+}
+
+int
+meta_display_get_damage_event_base (MetaDisplay *display)
+{
+ return display->damage_event_base;
+}
+
+int
+meta_display_get_shape_event_base (MetaDisplay *display)
+{
+ return display->shape_event_base;
+}
diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c
index 409a4310..fb7c2d2e 100644
--- a/src/core/edge-resistance.c
+++ b/src/core/edge-resistance.c
@@ -21,9 +21,10 @@
* 02111-1307, USA.
*/
+#include <config.h>
#include "edge-resistance.h"
#include "boxes.h"
-#include "display.h"
+#include "display-private.h"
#include "workspace.h"
/* A simple macro for whether a given window's edges are potentially
diff --git a/src/core/edge-resistance.h b/src/core/edge-resistance.h
index 6d0dbe0b..14ba17a0 100644
--- a/src/core/edge-resistance.h
+++ b/src/core/edge-resistance.h
@@ -24,7 +24,7 @@
#ifndef META_EDGE_RESISTANCE_H
#define META_EDGE_RESISTANCE_H
-#include "window.h"
+#include "window-private.h"
void meta_window_edge_resistance_for_move (MetaWindow *window,
int old_x,
diff --git a/src/core/effects.c b/src/core/effects.c
index 830c51e9..05ccfe08 100644
--- a/src/core/effects.c
+++ b/src/core/effects.c
@@ -33,9 +33,9 @@
#include <config.h>
#include "effects.h"
-#include "display.h"
+#include "display-private.h"
#include "ui.h"
-#include "window.h"
+#include "window-private.h"
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
diff --git a/src/core/effects.h b/src/core/effects.h
index 5ae7bcb5..b72a7979 100644
--- a/src/core/effects.h
+++ b/src/core/effects.h
@@ -25,7 +25,7 @@
#define META_EFFECTS_H
#include "util.h"
-#include "screen.h"
+#include "screen-private.h"
typedef struct MetaEffect MetaEffect;
typedef struct MetaEffectPriv MetaEffectPriv;
diff --git a/src/core/errors.c b/src/core/errors.c
index 854ef46b..8de46080 100644
--- a/src/core/errors.c
+++ b/src/core/errors.c
@@ -24,6 +24,7 @@
#include <config.h>
#include "errors.h"
+#include "display-private.h"
#include <errno.h>
#include <stdlib.h>
#include <gdk/gdk.h>
diff --git a/src/core/frame.h b/src/core/frame-private.h
index 859e25af..cba9b52a 100644
--- a/src/core/frame.h
+++ b/src/core/frame-private.h
@@ -21,10 +21,11 @@
* 02111-1307, USA.
*/
-#ifndef META_FRAME_H
-#define META_FRAME_H
+#ifndef META_FRAME_PRIVATE_H
+#define META_FRAME_PRIVATE_H
-#include "window.h"
+#include "frame.h"
+#include "window-private.h"
typedef struct _MetaFrameGeometry MetaFrameGeometry;
diff --git a/src/core/frame.c b/src/core/frame.c
index f4f81892..d2bf62fc 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -24,7 +24,7 @@
*/
#include <config.h>
-#include "frame.h"
+#include "frame-private.h"
#include "bell.h"
#include "errors.h"
#include "keybindings.h"
@@ -413,3 +413,8 @@ meta_frame_set_screen_cursor (MetaFrame *frame,
}
}
+Window
+meta_frame_get_xwindow (MetaFrame *frame)
+{
+ return frame->xwindow;
+}
diff --git a/src/core/group.h b/src/core/group.h
index 84133827..562ac59b 100644
--- a/src/core/group.h
+++ b/src/core/group.h
@@ -24,7 +24,7 @@
#ifndef META_GROUP_H
#define META_GROUP_H
-#include "window.h"
+#include "window-private.h"
/* note, can return NULL */
MetaGroup* meta_window_get_group (MetaWindow *window);
diff --git a/src/core/iconcache.h b/src/core/iconcache.h
index 7a2ad7f3..ac3e40ca 100644
--- a/src/core/iconcache.h
+++ b/src/core/iconcache.h
@@ -24,7 +24,7 @@
#ifndef META_ICON_CACHE_H
#define META_ICON_CACHE_H
-#include "screen.h"
+#include "screen-private.h"
typedef struct _MetaIconCache MetaIconCache;
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index ab7545c3..3b71d5ed 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -32,7 +32,7 @@
#include "errors.h"
#include "edge-resistance.h"
#include "ui.h"
-#include "frame.h"
+#include "frame-private.h"
#include "place.h"
#include "prefs.h"
#include "effects.h"
diff --git a/src/core/keybindings.h b/src/core/keybindings.h
index 0f5e4d58..137fceae 100644
--- a/src/core/keybindings.h
+++ b/src/core/keybindings.h
@@ -24,7 +24,7 @@
#ifndef META_KEYBINDINGS_H
#define META_KEYBINDINGS_H
-#include "display.h"
+#include "display-private.h"
#include "window.h"
void meta_display_init_keys (MetaDisplay *display);
diff --git a/src/core/main.c b/src/core/main.c
index 47687157..23ab8e56 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -46,7 +46,7 @@
#include <config.h>
#include "main.h"
#include "util.h"
-#include "display.h"
+#include "display-private.h"
#include "errors.h"
#include "ui.h"
#include "session.h"
diff --git a/src/core/place.h b/src/core/place.h
index 2948fe7a..10bf4a1c 100644
--- a/src/core/place.h
+++ b/src/core/place.h
@@ -24,8 +24,8 @@
#ifndef META_PLACE_H
#define META_PLACE_H
-#include "window.h"
-#include "frame.h"
+#include "window-private.h"
+#include "frame-private.h"
void meta_window_place (MetaWindow *window,
MetaFrameGeometry *fgeom,
diff --git a/src/core/screen.h b/src/core/screen-private.h
index c4bc85a0..f03fd709 100644
--- a/src/core/screen.h
+++ b/src/core/screen-private.h
@@ -23,10 +23,11 @@
* 02111-1307, USA.
*/
-#ifndef META_SCREEN_H
-#define META_SCREEN_H
+#ifndef META_SCREEN_PRIVATE_H
+#define META_SCREEN_PRIVATE_H
-#include "display.h"
+#include "display-private.h"
+#include "screen.h"
#include <X11/Xutil.h>
#include "ui.h"
@@ -132,7 +133,6 @@ MetaScreen* meta_screen_new (MetaDisplay *displ
void meta_screen_free (MetaScreen *screen,
guint32 timestamp);
void meta_screen_manage_all_windows (MetaScreen *screen);
-MetaScreen* meta_screen_for_x_screen (Screen *xscreen);
void meta_screen_foreach_window (MetaScreen *screen,
MetaScreenWindowFunc func,
gpointer data);
@@ -215,9 +215,4 @@ gboolean meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window);
void meta_screen_composite_all_windows (MetaScreen *screen);
-#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/core/screen.c b/src/core/screen.c
index 406780ee..e82dd932 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -27,11 +27,11 @@
*/
#include <config.h>
-#include "screen.h"
+#include "screen-private.h"
#include "util.h"
#include "errors.h"
-#include "window.h"
-#include "frame.h"
+#include "window-private.h"
+#include "frame-private.h"
#include "prefs.h"
#include "workspace.h"
#include "keybindings.h"
@@ -2735,6 +2735,46 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
return FALSE;
}
+int
+meta_screen_get_screen_number (MetaScreen *screen)
+{
+ return screen->number;
+}
+
+MetaDisplay *
+meta_screen_get_display (MetaScreen *screen)
+{
+ return screen->display;
+}
+
+Window
+meta_screen_get_xroot (MetaScreen *screen)
+{
+ return screen->xroot;
+}
+
+void
+meta_screen_get_size (MetaScreen *screen,
+ int *width,
+ int *height)
+{
+ *width = screen->rect.width;
+ *height = screen->rect.height;
+}
+
+gpointer
+meta_screen_get_compositor_data (MetaScreen *screen)
+{
+ return screen->compositor_data;
+}
+
+void
+meta_screen_set_compositor_data (MetaScreen *screen,
+ gpointer compositor)
+{
+ screen->compositor_data = compositor;
+}
+
#ifdef HAVE_COMPOSITE_EXTENSIONS
void
meta_screen_set_cm_selection (MetaScreen *screen)
diff --git a/src/core/session.c b/src/core/session.c
index 746c09d8..0107b99c 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -70,7 +70,7 @@ meta_window_release_saved_state (const MetaWindowSessionInfo *info)
#include <stdio.h>
#include "main.h"
#include "util.h"
-#include "display.h"
+#include "display-private.h"
#include "workspace.h"
static void ice_io_error_handler (IceConn connection);
diff --git a/src/core/session.h b/src/core/session.h
index cc88fd50..c9a74252 100644
--- a/src/core/session.h
+++ b/src/core/session.h
@@ -24,7 +24,7 @@
#ifndef META_SESSION_H
#define META_SESSION_H
-#include "window.h"
+#include "window-private.h"
typedef struct _MetaWindowSessionInfo MetaWindowSessionInfo;
diff --git a/src/core/stack.c b/src/core/stack.c
index aa34f5a2..a29f31a9 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -26,9 +26,9 @@
#include <config.h>
#include "stack.h"
-#include "window.h"
+#include "window-private.h"
#include "errors.h"
-#include "frame.h"
+#include "frame-private.h"
#include "group.h"
#include "prefs.h"
#include "workspace.h"
diff --git a/src/core/stack.h b/src/core/stack.h
index 5760de24..f9a41618 100644
--- a/src/core/stack.h
+++ b/src/core/stack.h
@@ -25,7 +25,7 @@
#ifndef META_STACK_H
#define META_STACK_H
-#include "screen.h"
+#include "screen-private.h"
/* Layers vs. stack positions
* ==========================
diff --git a/src/core/window.h b/src/core/window-private.h
index 85f35c81..bfe950a8 100644
--- a/src/core/window.h
+++ b/src/core/window-private.h
@@ -24,11 +24,12 @@
* 02111-1307, USA.
*/
-#ifndef META_WINDOW_H
-#define META_WINDOW_H
+#ifndef META_WINDOW_PRIVATE_H
+#define META_WINDOW_PRIVATE_H
#include <config.h>
-#include "screen.h"
+#include "window.h"
+#include "screen-private.h"
#include "util.h"
#include "stack.h"
#include "iconcache.h"
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 044a4a72..64e26636 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -29,7 +29,7 @@
#include "window-props.h"
#include "errors.h"
#include "xprops.h"
-#include "frame.h"
+#include "frame-private.h"
#include "group.h"
#include <X11/Xatom.h>
#include <unistd.h>
diff --git a/src/core/window-props.h b/src/core/window-props.h
index de3aca94..533bcd7a 100644
--- a/src/core/window-props.h
+++ b/src/core/window-props.h
@@ -24,7 +24,7 @@
#ifndef META_WINDOW_PROPS_H
#define META_WINDOW_PROPS_H
-#include "window.h"
+#include "window-private.h"
void meta_window_reload_property (MetaWindow *window,
Atom property);
diff --git a/src/core/window.c b/src/core/window.c
index bd68bae0..188663ad 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -25,10 +25,10 @@
*/
#include <config.h>
-#include "window.h"
+#include "window-private.h"
#include "edge-resistance.h"
#include "util.h"
-#include "frame.h"
+#include "frame-private.h"
#include "errors.h"
#include "workspace.h"
#include "stack.h"
@@ -8132,3 +8132,45 @@ meta_window_unset_demands_attention (MetaWindow *window)
window->wm_state_demands_attention = FALSE;
set_net_wm_state (window);
}
+
+MetaFrame *
+meta_window_get_frame (MetaWindow *window)
+{
+ return window->frame;
+}
+
+gboolean
+meta_window_has_focus (MetaWindow *window)
+{
+ return window->has_focus;
+}
+
+gboolean
+meta_window_is_shaded (MetaWindow *window)
+{
+ return window->shaded;
+}
+
+MetaRectangle *
+meta_window_get_rect (MetaWindow *window)
+{
+ return &window->rect;
+}
+
+MetaScreen *
+meta_window_get_screen (MetaWindow *window)
+{
+ return window->screen;
+}
+
+MetaDisplay *
+meta_window_get_display (MetaWindow *window)
+{
+ return window->display;
+}
+
+Window
+meta_window_get_xwindow (MetaWindow *window)
+{
+ return window->xwindow;
+}
diff --git a/src/core/workspace.h b/src/core/workspace.h
index 61aa8e71..948af74a 100644
--- a/src/core/workspace.h
+++ b/src/core/workspace.h
@@ -25,7 +25,7 @@
#ifndef META_WORKSPACE_H
#define META_WORKSPACE_H
-#include "window.h"
+#include "window-private.h"
/* Negative to avoid conflicting with real workspace
* numbers
diff --git a/src/core/xprops.c b/src/core/xprops.c
index 55332d30..a3d7fcc0 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -89,7 +89,7 @@ from The Open Group.
#include "metacity-Xatomtype.h"
#include <X11/Xatom.h>
#include <string.h>
-#include "window.h"
+#include "window-private.h"
typedef struct
{
diff --git a/src/core/compositor.h b/src/include/compositor.h
index 7c6e7408..a7f9bf1f 100644
--- a/src/core/compositor.h
+++ b/src/include/compositor.h
@@ -1,10 +1,8 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-/* Metacity compositing manager */
-
-/*
- * Copyright (C) 2003 Red Hat, Inc.
- *
+/*
+ * 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
@@ -14,7 +12,7 @@
* 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
@@ -24,48 +22,55 @@
#ifndef META_COMPOSITOR_H
#define META_COMPOSITOR_H
-#include "util.h"
-#include "display.h"
-
-MetaCompositor* meta_compositor_new (MetaDisplay *display);
-void meta_compositor_process_event (MetaCompositor *compositor,
- XEvent *xevent,
- MetaWindow *window);
-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_debug_updates (MetaCompositor *compositor,
- gboolean debug_updates);
-
-void meta_compositor_manage_screen (MetaCompositor *compositor,
- MetaScreen *screen);
+#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_destroy (MetaCompositor *compositor);
-
-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);
+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);
-#endif /* META_COMPOSITOR_H */
+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 00000000..53dd9d75
--- /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/core/errors.h b/src/include/errors.h
index c18eaa72..8278948a 100644
--- a/src/core/errors.h
+++ b/src/include/errors.h
@@ -24,6 +24,8 @@
#ifndef META_ERRORS_H
#define META_ERRORS_H
+#include <X11/Xlib.h>
+
#include "util.h"
#include "display.h"
diff --git a/src/include/frame.h b/src/include/frame.h
new file mode 100644
index 00000000..eeb57263
--- /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 00000000..9f842317
--- /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 00000000..045b102f
--- /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 00000000..8a338660
--- /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/core/xprops.h b/src/include/xprops.h
index e5cb97bb..f5ecb6ac 100644
--- a/src/core/xprops.h
+++ b/src/include/xprops.h
@@ -25,9 +25,14 @@
#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.
*/
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index 3d4e863a..f38bb174 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -31,7 +31,7 @@
/* FIXME these two includes are 100% broken ...
*/
#include "../core/workspace.h"
-#include "../core/frame.h"
+#include "../core/frame-private.h"
#include "draw-workspace.h"
#include <gtk/gtk.h>
#include <math.h>