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
This commit is contained in:
Iain Holmes 2008-05-19 00:00:09 +00:00 committed by Iain Holmes
parent fe292078fe
commit f141692ca2
47 changed files with 1222 additions and 502 deletions

View File

@ -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> 2008-05-13 Robert Escriva <me@robescriva.com>
* src/ui/theme.h (struct): remove color_set flag * src/ui/theme.h (struct): remove color_set flag

View File

@ -12,14 +12,17 @@ metacity_SOURCES= \
core/bell.h \ core/bell.h \
core/boxes.c \ core/boxes.c \
include/boxes.h \ include/boxes.h \
core/compositor.c \ compositor/compositor.c \
core/compositor.h \ compositor/compositor-private.h \
compositor/compositor-xrender.c \
include/compositor.h \
core/constraints.c \ core/constraints.c \
core/constraints.h \ core/constraints.h \
core/core.c \ core/core.c \
core/delete.c \ core/delete.c \
core/display.c \ core/display.c \
core/display.h \ core/display-private.h \
include/display.h \
ui/draw-workspace.c \ ui/draw-workspace.c \
ui/draw-workspace.h \ ui/draw-workspace.h \
core/edge-resistance.c \ core/edge-resistance.c \
@ -27,11 +30,12 @@ metacity_SOURCES= \
core/effects.c \ core/effects.c \
core/effects.h \ core/effects.h \
core/errors.c \ core/errors.c \
core/errors.h \ include/errors.h \
core/eventqueue.c \ core/eventqueue.c \
core/eventqueue.h \ core/eventqueue.h \
core/frame.c \ core/frame.c \
core/frame.h \ core/frame-private.h \
include/frame.h \
ui/gradient.c \ ui/gradient.c \
ui/gradient.h \ ui/gradient.h \
core/group-private.h \ core/group-private.h \
@ -51,7 +55,8 @@ metacity_SOURCES= \
core/prefs.c \ core/prefs.c \
include/prefs.h \ include/prefs.h \
core/screen.c \ core/screen.c \
core/screen.h \ core/screen-private.h \
include/screen.h \
core/session.c \ core/session.c \
core/session.h \ core/session.h \
core/stack.c \ core/stack.c \
@ -61,11 +66,12 @@ metacity_SOURCES= \
core/window-props.c \ core/window-props.c \
core/window-props.h \ core/window-props.h \
core/window.c \ core/window.c \
core/window.h \ core/window-private.h \
include/window.h \
core/workspace.c \ core/workspace.c \
core/workspace.h \ core/workspace.h \
core/xprops.c \ core/xprops.c \
core/xprops.h \ include/xprops.h \
include/common.h \ include/common.h \
include/core.h \ include/core.h \
include/ui.h \ include/ui.h \

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

158
src/compositor/compositor.c Normal file
View File

@ -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)
{
}

View File

@ -52,7 +52,7 @@
#include <config.h> #include <config.h>
#include "bell.h" #include "bell.h"
#include "screen.h" #include "screen-private.h"
#include "prefs.h" #include "prefs.h"
/** /**

View File

@ -24,8 +24,8 @@
#ifdef HAVE_XKB #ifdef HAVE_XKB
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#endif #endif
#include "display.h" #include "display-private.h"
#include "frame.h" #include "frame-private.h"
#ifdef HAVE_XKB #ifdef HAVE_XKB
void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev); void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev);

View File

@ -26,8 +26,8 @@
#define META_CONSTRAINTS_H #define META_CONSTRAINTS_H
#include "util.h" #include "util.h"
#include "window.h" #include "window-private.h"
#include "frame.h" #include "frame-private.h"
typedef enum typedef enum
{ {

View File

@ -25,7 +25,7 @@
#include <config.h> #include <config.h>
#include "core.h" #include "core.h"
#include "frame.h" #include "frame-private.h"
#include "workspace.h" #include "workspace.h"
#include "prefs.h" #include "prefs.h"

View File

@ -27,7 +27,7 @@
#include <config.h> #include <config.h>
#include "util.h" #include "util.h"
#include "window.h" #include "window-private.h"
#include "errors.h" #include "errors.h"
#include "workspace.h" #include "workspace.h"

View File

@ -24,8 +24,8 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef META_DISPLAY_H #ifndef META_DISPLAY_PRIVATE_H
#define META_DISPLAY_H #define META_DISPLAY_PRIVATE_H
#ifndef PACKAGE #ifndef PACKAGE
#error "config.h not included" #error "config.h not included"
@ -36,6 +36,7 @@
#include "eventqueue.h" #include "eventqueue.h"
#include "common.h" #include "common.h"
#include "boxes.h" #include "boxes.h"
#include "display.h"
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
#include <libsn/sn.h> #include <libsn/sn.h>
@ -45,16 +46,9 @@
#include <X11/extensions/sync.h> #include <X11/extensions/sync.h>
#endif #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 _MetaKeyBinding MetaKeyBinding;
typedef struct _MetaScreen MetaScreen;
typedef struct _MetaStack MetaStack; typedef struct _MetaStack MetaStack;
typedef struct _MetaUISlave MetaUISlave; typedef struct _MetaUISlave MetaUISlave;
typedef struct _MetaWindow MetaWindow;
typedef struct _MetaWorkspace MetaWorkspace; typedef struct _MetaWorkspace MetaWorkspace;
typedef struct _MetaWindowPropHooks MetaWindowPropHooks; typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
@ -330,8 +324,6 @@ struct _MetaDisplay
gboolean meta_display_open (void); gboolean meta_display_open (void);
void meta_display_close (MetaDisplay *display, void meta_display_close (MetaDisplay *display,
guint32 timestamp); guint32 timestamp);
MetaScreen* meta_display_screen_for_root (MetaDisplay *display,
Window xroot);
MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display, MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display,
Screen *screen); Screen *screen);
MetaScreen* meta_display_screen_for_xwindow (MetaDisplay *display, MetaScreen* meta_display_screen_for_xwindow (MetaDisplay *display,

View File

@ -31,14 +31,14 @@
*/ */
#include <config.h> #include <config.h>
#include "display.h" #include "display-private.h"
#include "util.h" #include "util.h"
#include "main.h" #include "main.h"
#include "screen.h" #include "screen-private.h"
#include "window.h" #include "window-private.h"
#include "window-props.h" #include "window-props.h"
#include "group-props.h" #include "group-props.h"
#include "frame.h" #include "frame-private.h"
#include "errors.h" #include "errors.h"
#include "keybindings.h" #include "keybindings.h"
#include "prefs.h" #include "prefs.h"
@ -5115,3 +5115,54 @@ meta_display_remove_autoraise_callback (MetaDisplay *display)
display->autoraise_window = NULL; 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;
}

View File

@ -21,9 +21,10 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#include <config.h>
#include "edge-resistance.h" #include "edge-resistance.h"
#include "boxes.h" #include "boxes.h"
#include "display.h" #include "display-private.h"
#include "workspace.h" #include "workspace.h"
/* A simple macro for whether a given window's edges are potentially /* A simple macro for whether a given window's edges are potentially

View File

@ -24,7 +24,7 @@
#ifndef META_EDGE_RESISTANCE_H #ifndef META_EDGE_RESISTANCE_H
#define 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, void meta_window_edge_resistance_for_move (MetaWindow *window,
int old_x, int old_x,

View File

@ -33,9 +33,9 @@
#include <config.h> #include <config.h>
#include "effects.h" #include "effects.h"
#include "display.h" #include "display-private.h"
#include "ui.h" #include "ui.h"
#include "window.h" #include "window-private.h"
#ifdef HAVE_SHAPE #ifdef HAVE_SHAPE
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>

View File

@ -25,7 +25,7 @@
#define META_EFFECTS_H #define META_EFFECTS_H
#include "util.h" #include "util.h"
#include "screen.h" #include "screen-private.h"
typedef struct MetaEffect MetaEffect; typedef struct MetaEffect MetaEffect;
typedef struct MetaEffectPriv MetaEffectPriv; typedef struct MetaEffectPriv MetaEffectPriv;

View File

@ -24,6 +24,7 @@
#include <config.h> #include <config.h>
#include "errors.h" #include "errors.h"
#include "display-private.h"
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <gdk/gdk.h> #include <gdk/gdk.h>

View File

@ -21,10 +21,11 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef META_FRAME_H #ifndef META_FRAME_PRIVATE_H
#define META_FRAME_H #define META_FRAME_PRIVATE_H
#include "window.h" #include "frame.h"
#include "window-private.h"
typedef struct _MetaFrameGeometry MetaFrameGeometry; typedef struct _MetaFrameGeometry MetaFrameGeometry;

View File

@ -24,7 +24,7 @@
*/ */
#include <config.h> #include <config.h>
#include "frame.h" #include "frame-private.h"
#include "bell.h" #include "bell.h"
#include "errors.h" #include "errors.h"
#include "keybindings.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;
}

View File

@ -24,7 +24,7 @@
#ifndef META_GROUP_H #ifndef META_GROUP_H
#define META_GROUP_H #define META_GROUP_H
#include "window.h" #include "window-private.h"
/* note, can return NULL */ /* note, can return NULL */
MetaGroup* meta_window_get_group (MetaWindow *window); MetaGroup* meta_window_get_group (MetaWindow *window);

View File

@ -24,7 +24,7 @@
#ifndef META_ICON_CACHE_H #ifndef META_ICON_CACHE_H
#define META_ICON_CACHE_H #define META_ICON_CACHE_H
#include "screen.h" #include "screen-private.h"
typedef struct _MetaIconCache MetaIconCache; typedef struct _MetaIconCache MetaIconCache;

View File

@ -32,7 +32,7 @@
#include "errors.h" #include "errors.h"
#include "edge-resistance.h" #include "edge-resistance.h"
#include "ui.h" #include "ui.h"
#include "frame.h" #include "frame-private.h"
#include "place.h" #include "place.h"
#include "prefs.h" #include "prefs.h"
#include "effects.h" #include "effects.h"

View File

@ -24,7 +24,7 @@
#ifndef META_KEYBINDINGS_H #ifndef META_KEYBINDINGS_H
#define META_KEYBINDINGS_H #define META_KEYBINDINGS_H
#include "display.h" #include "display-private.h"
#include "window.h" #include "window.h"
void meta_display_init_keys (MetaDisplay *display); void meta_display_init_keys (MetaDisplay *display);

View File

@ -46,7 +46,7 @@
#include <config.h> #include <config.h>
#include "main.h" #include "main.h"
#include "util.h" #include "util.h"
#include "display.h" #include "display-private.h"
#include "errors.h" #include "errors.h"
#include "ui.h" #include "ui.h"
#include "session.h" #include "session.h"

View File

@ -24,8 +24,8 @@
#ifndef META_PLACE_H #ifndef META_PLACE_H
#define META_PLACE_H #define META_PLACE_H
#include "window.h" #include "window-private.h"
#include "frame.h" #include "frame-private.h"
void meta_window_place (MetaWindow *window, void meta_window_place (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameGeometry *fgeom,

View File

@ -23,10 +23,11 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef META_SCREEN_H #ifndef META_SCREEN_PRIVATE_H
#define META_SCREEN_H #define META_SCREEN_PRIVATE_H
#include "display.h" #include "display-private.h"
#include "screen.h"
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "ui.h" #include "ui.h"
@ -132,7 +133,6 @@ MetaScreen* meta_screen_new (MetaDisplay *displ
void meta_screen_free (MetaScreen *screen, void meta_screen_free (MetaScreen *screen,
guint32 timestamp); guint32 timestamp);
void meta_screen_manage_all_windows (MetaScreen *screen); void meta_screen_manage_all_windows (MetaScreen *screen);
MetaScreen* meta_screen_for_x_screen (Screen *xscreen);
void meta_screen_foreach_window (MetaScreen *screen, void meta_screen_foreach_window (MetaScreen *screen,
MetaScreenWindowFunc func, MetaScreenWindowFunc func,
gpointer data); gpointer data);
@ -215,9 +215,4 @@ gboolean meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window); MetaWindow *window);
void meta_screen_composite_all_windows (MetaScreen *screen); 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 #endif

View File

@ -27,11 +27,11 @@
*/ */
#include <config.h> #include <config.h>
#include "screen.h" #include "screen-private.h"
#include "util.h" #include "util.h"
#include "errors.h" #include "errors.h"
#include "window.h" #include "window-private.h"
#include "frame.h" #include "frame-private.h"
#include "prefs.h" #include "prefs.h"
#include "workspace.h" #include "workspace.h"
#include "keybindings.h" #include "keybindings.h"
@ -2735,6 +2735,46 @@ meta_screen_apply_startup_properties (MetaScreen *screen,
return FALSE; 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 #ifdef HAVE_COMPOSITE_EXTENSIONS
void void
meta_screen_set_cm_selection (MetaScreen *screen) meta_screen_set_cm_selection (MetaScreen *screen)

View File

@ -70,7 +70,7 @@ meta_window_release_saved_state (const MetaWindowSessionInfo *info)
#include <stdio.h> #include <stdio.h>
#include "main.h" #include "main.h"
#include "util.h" #include "util.h"
#include "display.h" #include "display-private.h"
#include "workspace.h" #include "workspace.h"
static void ice_io_error_handler (IceConn connection); static void ice_io_error_handler (IceConn connection);

View File

@ -24,7 +24,7 @@
#ifndef META_SESSION_H #ifndef META_SESSION_H
#define META_SESSION_H #define META_SESSION_H
#include "window.h" #include "window-private.h"
typedef struct _MetaWindowSessionInfo MetaWindowSessionInfo; typedef struct _MetaWindowSessionInfo MetaWindowSessionInfo;

View File

@ -26,9 +26,9 @@
#include <config.h> #include <config.h>
#include "stack.h" #include "stack.h"
#include "window.h" #include "window-private.h"
#include "errors.h" #include "errors.h"
#include "frame.h" #include "frame-private.h"
#include "group.h" #include "group.h"
#include "prefs.h" #include "prefs.h"
#include "workspace.h" #include "workspace.h"

View File

@ -25,7 +25,7 @@
#ifndef META_STACK_H #ifndef META_STACK_H
#define META_STACK_H #define META_STACK_H
#include "screen.h" #include "screen-private.h"
/* Layers vs. stack positions /* Layers vs. stack positions
* ========================== * ==========================

View File

@ -24,11 +24,12 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#ifndef META_WINDOW_H #ifndef META_WINDOW_PRIVATE_H
#define META_WINDOW_H #define META_WINDOW_PRIVATE_H
#include <config.h> #include <config.h>
#include "screen.h" #include "window.h"
#include "screen-private.h"
#include "util.h" #include "util.h"
#include "stack.h" #include "stack.h"
#include "iconcache.h" #include "iconcache.h"

View File

@ -29,7 +29,7 @@
#include "window-props.h" #include "window-props.h"
#include "errors.h" #include "errors.h"
#include "xprops.h" #include "xprops.h"
#include "frame.h" #include "frame-private.h"
#include "group.h" #include "group.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <unistd.h> #include <unistd.h>

View File

@ -24,7 +24,7 @@
#ifndef META_WINDOW_PROPS_H #ifndef META_WINDOW_PROPS_H
#define META_WINDOW_PROPS_H #define META_WINDOW_PROPS_H
#include "window.h" #include "window-private.h"
void meta_window_reload_property (MetaWindow *window, void meta_window_reload_property (MetaWindow *window,
Atom property); Atom property);

View File

@ -25,10 +25,10 @@
*/ */
#include <config.h> #include <config.h>
#include "window.h" #include "window-private.h"
#include "edge-resistance.h" #include "edge-resistance.h"
#include "util.h" #include "util.h"
#include "frame.h" #include "frame-private.h"
#include "errors.h" #include "errors.h"
#include "workspace.h" #include "workspace.h"
#include "stack.h" #include "stack.h"
@ -8132,3 +8132,45 @@ meta_window_unset_demands_attention (MetaWindow *window)
window->wm_state_demands_attention = FALSE; window->wm_state_demands_attention = FALSE;
set_net_wm_state (window); 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;
}

View File

@ -25,7 +25,7 @@
#ifndef META_WORKSPACE_H #ifndef META_WORKSPACE_H
#define META_WORKSPACE_H #define META_WORKSPACE_H
#include "window.h" #include "window-private.h"
/* Negative to avoid conflicting with real workspace /* Negative to avoid conflicting with real workspace
* numbers * numbers

View File

@ -89,7 +89,7 @@ from The Open Group.
#include "metacity-Xatomtype.h" #include "metacity-Xatomtype.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <string.h> #include <string.h>
#include "window.h" #include "window-private.h"
typedef struct typedef struct
{ {

View File

@ -1,10 +1,8 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Metacity compositing manager */ /*
* Copyright (C) 2008 Iain Holmes
/* *
* Copyright (C) 2003 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -14,7 +12,7 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@ -24,48 +22,55 @@
#ifndef META_COMPOSITOR_H #ifndef META_COMPOSITOR_H
#define META_COMPOSITOR_H #define META_COMPOSITOR_H
#include "util.h" #include <glib.h>
#include "display.h" #include <X11/Xlib.h>
MetaCompositor* meta_compositor_new (MetaDisplay *display); #include "types.h"
void meta_compositor_process_event (MetaCompositor *compositor, #include "boxes.h"
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, MetaCompositor *meta_compositor_new (MetaDisplay *display);
MetaScreen *screen); void meta_compositor_destroy (MetaCompositor *compositor);
void meta_compositor_manage_screen (MetaCompositor *compositor,
MetaScreen *screen);
void meta_compositor_unmanage_screen (MetaCompositor *compositor, void meta_compositor_unmanage_screen (MetaCompositor *compositor,
MetaScreen *screen); 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, void meta_compositor_set_updates (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
gboolean updates); gboolean updates);
void meta_compositor_destroy (MetaCompositor *compositor); void meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
void meta_compositor_begin_move (MetaCompositor *compositor, MetaWindow *window);
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);
Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor, Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor,
MetaWindow *window); MetaWindow *window);
void meta_compositor_set_active_window (MetaCompositor *compositor, void meta_compositor_set_active_window (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
MetaWindow *window); 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

48
src/include/display.h Normal file
View File

@ -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

View File

@ -24,6 +24,8 @@
#ifndef META_ERRORS_H #ifndef META_ERRORS_H
#define META_ERRORS_H #define META_ERRORS_H
#include <X11/Xlib.h>
#include "util.h" #include "util.h"
#include "display.h" #include "display.h"

31
src/include/frame.h Normal file
View File

@ -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

48
src/include/screen.h Normal file
View File

@ -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

31
src/include/types.h Normal file
View File

@ -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

39
src/include/window.h Normal file
View File

@ -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

View File

@ -25,9 +25,14 @@
#define META_XPROPS_H #define META_XPROPS_H
#include <config.h> #include <config.h>
#include "display.h" #include "display.h"
#include <X11/Xutil.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 /* Copied from Lesstif by way of GTK. Rudimentary docs can be
* found in some Motif reference guides online. * found in some Motif reference guides online.
*/ */

View File

@ -31,7 +31,7 @@
/* FIXME these two includes are 100% broken ... /* FIXME these two includes are 100% broken ...
*/ */
#include "../core/workspace.h" #include "../core/workspace.h"
#include "../core/frame.h" #include "../core/frame-private.h"
#include "draw-workspace.h" #include "draw-workspace.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <math.h> #include <math.h>