Separate source and header files for MutterWindow

compositor.c: Move MutterWindow code to mutter-window.c;
 rename map_win() to mutter_window_map(), etc.

mutter-window-private.h: New private header file for
 MutterWindow functions used internally to the compositor.

compositor-mutter.h: Move MutterWindow declarations to
 mutter-window.h; move a couple of private functions to
 compositor-private.h

compositor-private.h: Move MetaCompScreen declaration to here:
 Conceptually it's private to compositor.c, but MutterWindow
 manipulates some of the lists directly for now.

mutter-plugin.c compositor.c: Don't call mutter_window_effect_completed()
 for MUTTER_PLUGIN_SWITCH_WORKSPACE, but use a new
 mutter_switch_workspace_completed(), since the window is
 just used to identify a screen.

http://bugzilla.gnome.org/show_bug.cgi?id=587251
This commit is contained in:
Owen W. Taylor 2009-06-26 15:33:20 -04:00
parent f0d22e18c4
commit c60d4c2bc4
8 changed files with 1726 additions and 1591 deletions

View File

@ -29,6 +29,8 @@ mutter_SOURCES= \
compositor/mutter-plugin-manager.c \
compositor/mutter-plugin-manager.h \
compositor/mutter-shaped-texture.c \
compositor/mutter-window.c \
compositor/mutter-window-private.h \
compositor/shadow.c \
compositor/shadow.h \
compositor/mutter-shaped-texture.h \
@ -36,6 +38,7 @@ mutter_SOURCES= \
compositor/tidy/tidy-texture-frame.h \
include/compositor.h \
include/mutter-plugin.h \
include/mutter-window.h \
include/compositor-mutter.h \
core/constraints.c \
core/constraints.h \
@ -162,7 +165,8 @@ libmutterinclude_base_headers = \
include/display.h \
include/group.h \
include/keybindings.h \
include/mutter-plugin.h
include/mutter-plugin.h \
include/mutter-window.h
# Excluded from scanning for introspection but installed
libmutterinclude_extra_headers = \

View File

@ -3,10 +3,15 @@
#ifndef META_COMPOSITOR_PRIVATE_H
#define META_COMPOSITOR_PRIVATE_H
#include <X11/extensions/Xfixes.h>
#include "compositor.h"
#include "display.h"
#include "mutter-plugin-manager.h"
#include <clutter/clutter.h>
typedef struct _MetaCompScreen MetaCompScreen;
struct _MetaCompositor
{
MetaDisplay *display;
@ -22,4 +27,29 @@ struct _MetaCompositor
gboolean no_mipmaps : 1;
};
struct _MetaCompScreen
{
MetaScreen *screen;
ClutterActor *stage, *window_group, *overlay_group;
ClutterActor *hidden_group;
GList *windows;
GHashTable *windows_by_xid;
MetaWindow *focus_window;
Window output;
GSList *dock_windows;
/* Before we create the output window */
XserverRegion pending_input_region;
gint switch_workspace_in_progress;
MutterPluginManager *plugin_mgr;
};
void mutter_switch_workspace_completed (MetaScreen *screen);
void mutter_set_stage_input_region (MetaScreen *screen,
XserverRegion region);
void mutter_empty_stage_input_region (MetaScreen *screen);
#endif /* META_COMPOSITOR_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,9 @@
#include <X11/extensions/shape.h>
#include <clutter/x11/clutter-x11.h>
#include "compositor-private.h"
#include "mutter-window-private.h"
G_DEFINE_ABSTRACT_TYPE (MutterPlugin, mutter_plugin, G_TYPE_OBJECT);
#define MUTTER_PLUGIN_GET_PRIVATE(obj) \
@ -389,7 +392,17 @@ mutter_plugin_effect_completed (MutterPlugin *plugin,
name ? name : "unknown");
}
mutter_window_effect_completed (actor, event);
if (event == MUTTER_PLUGIN_SWITCH_WORKSPACE)
{
/* The window is just used to identify the screen */
MetaWindow *window = mutter_window_get_meta_window (actor);
MetaScreen *screen = meta_window_get_screen (window);
mutter_switch_workspace_completed (screen);
}
else
{
mutter_window_effect_completed (actor, event);
}
}
void

View File

@ -0,0 +1,39 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#ifndef MUTTER_WINDOW_PRIVATE_H
#define MUTTER_WINDOW_PRIVATE_H
#include <X11/extensions/Xdamage.h>
#include "compositor-mutter.h"
MutterWindow *mutter_window_new (MetaWindow *window);
void mutter_window_map (MutterWindow *cw);
void mutter_window_unmap (MutterWindow *cw);
void mutter_window_minimize (MutterWindow *cw);
void mutter_window_destroy (MutterWindow *cw);
void mutter_window_maximize (MutterWindow *cw,
MetaRectangle *window_rect);
void mutter_window_unmaximize (MutterWindow *cw,
MetaRectangle *window_rect);
void mutter_window_process_damage (MutterWindow *cw,
XDamageNotifyEvent *event);
gboolean mutter_window_effect_in_progress (MutterWindow *cw,
gboolean include_destroy);
void mutter_window_sync_actor_position (MutterWindow *cw);
void mutter_window_finish_workspace_switch (MutterWindow *cw);
void mutter_window_update_window_type (MutterWindow *cw);
void mutter_window_update_shape (MutterWindow *cw,
gboolean shaped);
void mutter_window_update_opacity (MutterWindow *cw);
void mutter_window_set_hidden (MutterWindow *cw,
gboolean hidden);
void mutter_window_queue_map_change (MutterWindow *cw,
gboolean should_be_mapped);
void mutter_window_effect_completed (MutterWindow *actor,
gulong event);
#endif /* MUTTER_WINDOW_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -26,63 +26,17 @@
#define MUTTER_H_
#include <clutter/clutter.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xlib.h>
#include "types.h"
#include "compositor.h"
#include "mutter-window.h"
/*
* MutterWindow object (ClutterGroup sub-class)
*/
#define MUTTER_TYPE_COMP_WINDOW (mutter_window_get_type ())
#define MUTTER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTTER_TYPE_COMP_WINDOW, MutterWindow))
#define MUTTER_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTTER_TYPE_COMP_WINDOW, MutterWindowClass))
#define MUTTER_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUTTER_TYPE_COMP_WINDOW))
#define MUTTER_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUTTER_TYPE_COMP_WINDOW))
#define MUTTER_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUTTER_TYPE_COMP_WINDOW, MutterWindowClass))
typedef struct _MutterWindow MutterWindow;
typedef struct _MutterWindowClass MutterWindowClass;
typedef struct _MutterWindowPrivate MutterWindowPrivate;
struct _MutterWindowClass
{
ClutterGroupClass parent_class;
};
struct _MutterWindow
{
ClutterGroup parent;
MutterWindowPrivate *priv;
};
GType mutter_window_get_type (void);
Window mutter_window_get_x_window (MutterWindow *mcw);
MetaCompWindowType mutter_window_get_window_type (MutterWindow *mcw);
gint mutter_window_get_workspace (MutterWindow *mcw);
gboolean mutter_window_is_hidden (MutterWindow *mcw);
MetaWindow * mutter_window_get_meta_window (MutterWindow *mcw);
ClutterActor * mutter_window_get_texture (MutterWindow *mcw);
gboolean mutter_window_is_override_redirect (MutterWindow *mcw);
const char * mutter_window_get_description (MutterWindow *mcw);
gboolean mutter_window_showing_on_its_workspace (MutterWindow *mcw);
/* Compositor API */
MetaCompositor *mutter_new (MetaDisplay *display);
void mutter_window_effect_completed (MutterWindow *actor, gulong event);
/* Public compositor API */
ClutterActor * mutter_get_stage_for_screen (MetaScreen *screen);
ClutterActor * mutter_get_overlay_group_for_screen (MetaScreen *screen);
Window mutter_get_overlay_window (MetaScreen *screen);
GList * mutter_get_windows (MetaScreen *screen);
ClutterActor * mutter_get_window_group_for_screen (MetaScreen *screen);
void mutter_set_stage_input_region (MetaScreen *screen,
XserverRegion region);
void mutter_empty_stage_input_region (MetaScreen *screen);
#endif

View File

@ -0,0 +1,71 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2008 Matthew Allum
* 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 MUTTER_WINDOW_H_
#define MUTTER_WINDOW_H_
#include <clutter/clutter.h>
#include <X11/Xlib.h>
#include "compositor.h"
/*
* MutterWindow object (ClutterGroup sub-class)
*/
#define MUTTER_TYPE_COMP_WINDOW (mutter_window_get_type ())
#define MUTTER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTTER_TYPE_COMP_WINDOW, MutterWindow))
#define MUTTER_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTTER_TYPE_COMP_WINDOW, MutterWindowClass))
#define MUTTER_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUTTER_TYPE_COMP_WINDOW))
#define MUTTER_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUTTER_TYPE_COMP_WINDOW))
#define MUTTER_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUTTER_TYPE_COMP_WINDOW, MutterWindowClass))
typedef struct _MutterWindow MutterWindow;
typedef struct _MutterWindowClass MutterWindowClass;
typedef struct _MutterWindowPrivate MutterWindowPrivate;
struct _MutterWindowClass
{
ClutterGroupClass parent_class;
};
struct _MutterWindow
{
ClutterGroup parent;
MutterWindowPrivate *priv;
};
GType mutter_window_get_type (void);
Window mutter_window_get_x_window (MutterWindow *mcw);
MetaCompWindowType mutter_window_get_window_type (MutterWindow *mcw);
gint mutter_window_get_workspace (MutterWindow *mcw);
gboolean mutter_window_is_hidden (MutterWindow *mcw);
MetaWindow * mutter_window_get_meta_window (MutterWindow *mcw);
ClutterActor * mutter_window_get_texture (MutterWindow *mcw);
gboolean mutter_window_is_override_redirect (MutterWindow *mcw);
const char * mutter_window_get_description (MutterWindow *mcw);
gboolean mutter_window_showing_on_its_workspace (MutterWindow *mcw);
#endif /* MUTTER_WINDOW_H */