aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac152
-rw-r--r--managers/clutter/Makefile.am22
-rw-r--r--managers/clutter/matchbox-window-manager-2-clutter.c155
-rw-r--r--managers/clutter/mb-wm-comp-mgr-clutter.c (renamed from matchbox/mb-wm-comp-mgr-clutter.c)0
-rw-r--r--managers/clutter/mb-wm-comp-mgr-clutter.h (renamed from matchbox/mb-wm-comp-mgr-clutter.h)2
-rw-r--r--managers/clutter/tidy/tidy-texture-frame.c (renamed from matchbox/tidy/tidy-texture-frame.c)0
-rw-r--r--managers/clutter/tidy/tidy-texture-frame.h (renamed from matchbox/tidy/tidy-texture-frame.h)0
-rw-r--r--managers/simple/matchbox-window-manager-2-simple.c28
-rw-r--r--matchbox/Makefile.am13
-rw-r--r--matchbox/mb-window-manager.c78
-rw-r--r--matchbox/mb-window-manager.h7
-rw-r--r--matchbox/mb-wm-comp-mgr.c2
12 files changed, 281 insertions, 178 deletions
diff --git a/configure.ac b/configure.ac
index 8ed5c26..2184dec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,17 +66,9 @@ AC_ARG_WITH(gtk,
[ --with-gtk With GTK integration support],
[use_gtk=$withval], [use_gtk=no])
-dnl due to an autoconf bug, commas in the first arg to
-dnl AC_HELP_STRING cause problems.
-dnl AC_HELP_STRING([--with-composite-managers=MANAGER1 MANAGER2 ...],
-dnl [build the specified composite managers])
-AC_ARG_ENABLE(composite_managers,
-[ --enable-composite-managers=MANAGER1,MANAGER2,...
- Build the specified composite managers. Available managers are:
- * framework-only
- * xrender
- * clutter],
- [composite_managers=$enableval], [composite_managers=no])
+AC_ARG_ENABLE(compositing,
+ [ --enable-compositing Enable support for compositing],
+ [compositing=$enableval], [compositing=no])
AC_ARG_ENABLE(glib-main-loop,
[ --enable-glib-main-loop Enable use of glib main loop],
@@ -86,6 +78,17 @@ AC_ARG_ENABLE(matchbox-remote,
[ --enable-matchbox-remote Enable matchbox remote control utility],
[matchbox_remote=$enableval], [matchbox_remote=no])
+dnl due to an autoconf bug, commas in the first arg to
+dnl AC_HELP_STRING cause problems.
+dnl AC_HELP_STRING([--with-managers=MANAGER1 MANAGER2 ...],
+dnl [build the specified composite managers])
+AC_ARG_ENABLE(managers,
+[ --enable-managers=MANAGER1,MANAGER2,...
+ Build the specified managers. Available managers are:
+ * simple
+ * maemo
+ * clutter],
+ [managers=$enableval], [managers=no])
if test "x$use_pango" = "xyes"; then
needed_pkgs="$needed_pkgs pangoxft "
@@ -103,43 +106,33 @@ if test "x$png_theme" = "xyes"; then
needed_pkgs="$needed_pkgs libpng12 "
fi
-if test "x$composite_managers" != xno -a \
- "x$composite_managers" != "xframework-only"; then
+if test "x$compositing" != xno; then
needed_pkgs="$needed_pkgs xcomposite xdamage "
fi
-all_composite_managers="xrender,clutter"
+all_managers="simple,maemo,clutter"
-included_composite_managers=""
-# If no composite managers specified, include all
-if test "x$composite_managers" = xyes ; then
- included_composite_managers="$all_composite_managers"
+included_managers=""
+# If no managers specified, include all
+if test "x$managers" = xyes ; then
+ included_managers="$all_composite_managers"
else
- if test "x$composite_managers" != xno ; then
- included_composite_managers="$composite_managers"
+ if test "x$managers" != xno ; then
+ included_managers="$managers"
fi
fi
-comp_mgr="no"
-if test "x$composite_managers" != xno ; then
- comp_mgr="yes ($included_composite_managers)"
-fi
-
-AC_MSG_RESULT($included_composite_managers)
-
-COMPOSITE_MANAGER_DEFINE=
+MANAGER_DEFINE=
IFS="${IFS= }"; save_ifs="$IFS"; IFS=","
-for composite_manager in $included_composite_managers; do
- if echo "framework-only,$all_composite_managers" | egrep "(^|,)$composite_manager(\$|,)" > /dev/null; then
- :
- else
- AC_MSG_ERROR([the specified composite_manager $composite_manager does not exist])
+for manager in $included_managers; do
+ if ! echo "$all_managers" | egrep -q "(^|,)$manager(\$|,)"; then
+ AC_MSG_ERROR([the specified manager $manager does not exist])
fi
- case $composite_manager in
- xrender )
- needed_pkgs="$needed_pkgs xcomposite xdamage "
- MBWM_EXTRA_LIBS="$MBWM_EXTRA_LIBS -lm"
+ case $manager in
+ simple )
+ ;;
+ maemo )
;;
clutter )
needed_pkgs="$needed_pkgs $clutter_package xcomposite xdamage "
@@ -147,13 +140,12 @@ for composite_manager in $included_composite_managers; do
;;
esac
- COMPOSITE_MANAGER_DEFINE="$COMPOSITE_MANAGER_DEFINE \
- -DCOMPOSITE_MANAGER_`echo $composite_manager|tr 'a-z' 'A-Z'`"
- eval COMPOSITE_MANAGER_$composite_manager=yes
+ MANAGER_DEFINE="$MANAGER_DEFINE -DMANAGER_`echo $manager|tr 'a-z' 'A-Z'`"
+ eval MANAGER_$manager=yes
done
IFS="$save_ifs"
-AC_SUBST(COMPOSITE_MANAGER_DEFINE)
+AC_SUBST(MANAGER_DEFINE)
MBWM_WANT_DEBUG=0
@@ -202,19 +194,33 @@ PKG_CHECK_MODULES(MBWM, $needed_pkgs)
MBWM_PKGREQUIRES="$MBWM_PKGREQUIRES $needed_pkgs"
AC_SUBST(MBWM_PKGREQUIRES)
-COMP_MGR_BACKEND=0
ENABLE_COMPOSITE=0
-AM_CONDITIONAL(ENABLE_COMPOSITE, [test "x$comp_mgr" != "xno"])
-if test x"$comp_mgr" != xno; then
+AM_CONDITIONAL(ENABLE_COMPOSITE, [test "x$compositing" != "xno"])
+if test x"$compositing" != xno; then
ENABLE_COMPOSITE=1
fi
AC_SUBST(ENABLE_COMPOSITE)
-ENABLE_CLUTTER_COMPOSITE_MANAGER=0
-AM_CONDITIONAL(ENABLE_CLUTTER_COMPOSITE_MANAGER, [test x"$COMPOSITE_MANAGER_clutter" = xyes])
-if test x"$COMPOSITE_MANAGER_clutter" = xyes; then
- ENABLE_CLUTTER_COMPOSITE_MANAGER=1
- COMP_MGR_BACKEND=1
+AM_CONDITIONAL(ENABLE_MATCHBOX_REMOTE, [test "x$matchbox_remote" = "xyes"])
+
+AM_CONDITIONAL(ENABLE_SIMPLE_MANAGER, [test x"$MANAGER_simple" = xyes])
+if test x"$MANAGER_simple" = xyes; then
+ ENABLE_SIMPLE_MANAGER=1
+ MANAGERS="$MANAGERS simple"
+fi
+AC_SUBST(ENABLE_SIMPLE_MANAGER)
+
+AM_CONDITIONAL(ENABLE_MAEMO_MANAGER, [test x"$MANAGER_maemo" = xyes])
+if test x"$MANAGER_maemo" = xyes; then
+ ENABLE_MAEMO_MANAGER=1
+ MANAGERS="$MANAGERS maemo"
+fi
+AC_SUBST(ENABLE_MAEMO_MANAGER)
+
+AM_CONDITIONAL(ENABLE_CLUTTER_MANAGER, [test x"$MANAGER_clutter" = xyes])
+if test x"$MANAGER_clutter" = xyes; then
+ ENABLE_CLUTTER_MANAGER=1
+ MANAGERS="$MANAGERS clutter"
clutter_backend=$($PKG_CONFIG $clutter_package --variable=backend)
if test x"$clutter_backend" = xglx; then
@@ -223,42 +229,7 @@ if test x"$COMPOSITE_MANAGER_clutter" = xyes; then
AC_DEFINE(HAVE_CLUTTER_EGLX, [1], [Using clutter eglx backend])
fi
fi
-AC_SUBST(ENABLE_CLUTTER_COMPOSITE_MANAGER)
-
-ENABLE_XRENDER_COMPOSITE_MANAGER=0
-AM_CONDITIONAL(ENABLE_XRENDER_COMPOSITE_MANAGER, [test x"$COMPOSITE_MANAGER_xrender" = xyes])
-if test x"$COMPOSITE_MANAGER_xrender" = xyes; then
- ENABLE_XRENDER_COMPOSITE_MANAGER=1
- COMP_MGR_BACKEND=1
-fi
-AC_SUBST(ENABLE_XRENDER_COMPOSITE_MANAGER)
-
-AM_CONDITIONAL(COMP_MGR_BACKEND, [test "x$COMP_MGR_BACKEND" = "x1"])
-AC_SUBST(COMP_MGR_BACKEND)
-
-AM_CONDITIONAL(ENABLE_MATCHBOX_REMOTE, [test "x$matchbox_remote" = "xyes"])
-
-AC_ARG_ENABLE(simple-manager,
- [ --disable-simple-manager Do not build simple window manager],
- [simple_manager=$enableval],
- [
- if test "x$libmatchbox" = "xyes"; then
- simple_manager=no
- else
- simple_manager=yes
- fi])
-
-AC_ARG_ENABLE(maemo-manager,
- [ --enable-maemo-manager Build maemo window manager],
- [maemo_manager=$enableval], [maemo_manager=no])
-
-if test $simple_manager = yes; then
- MANAGERS="$MANAGERS simple"
-fi
-
-if test $maemo_manager = yes; then
- MANAGERS="$MANAGERS maemo"
-fi
+AC_SUBST(ENABLE_CLUTTER_MANAGER)
AC_SUBST(MANAGERS)
@@ -283,7 +254,7 @@ if test x$have_xcursor = xyes; then
fi
MBWM_INCS='-I$(top_srcdir) -I$(top_srcdir)/matchbox -I$(top_builddir)'
-MBWM_CFLAGS="$MBWM_CFLAGS $MBWM_DEBUG_CFLAGS $XFIXES_CFLAGS $XEXT_CFLAGS $XCURSOR_CFLAGS"
+MBWM_CFLAGS="$MBWM_CFLAGS $MBWM_DEBUG_CFLAGS $XFIXES_CFLAGS $XEXT_CFLAGS $XCURSOR_CFLAGS $MANAGER_DEFINE"
MBWM_LIBS="$MBWM_LIBS $XFIXES_LIBS $XEXT_LIBS $XCURSOR_LIBS $MBWM_EXTRA_LIBS"
AC_SUBST([MBWM_CFLAGS])
@@ -301,6 +272,7 @@ managers/Makefile
managers/simple/Makefile
managers/maemo/Makefile
managers/maemo/theme/Makefile
+managers/clutter/Makefile
data/Makefile
data/themes/Makefile
data/themes/Default/Makefile
@@ -334,12 +306,12 @@ echo "
Pango integration : ${use_pango}
Managers:
- Simple manager : ${simple_manager}
- Maemo manager : ${maemo_manager}
-
- Compositing managers : ${comp_mgr}
+ Simple manager : ${MANAGER_simple}
+ Maemo manager : ${MANAGER_maemo}
+ Clutter manager : ${MANAGER_clutter}
Miscel:
+ Compositing support : ${compositing}
Glib main loop : ${gmloop}
Build matchbox-remote : ${matchbox_remote}
Debugging output : ${want_debug}
diff --git a/managers/clutter/Makefile.am b/managers/clutter/Makefile.am
new file mode 100644
index 0000000..e207df5
--- /dev/null
+++ b/managers/clutter/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = \
+ $(MBWM_INCS) \
+ $(MBWM_CFLAGS)
+
+bin_PROGRAMS = matchbox-window-manager-2-clutter
+
+matchbox_window_manager_2_clutter_SOURCES = \
+ matchbox-window-manager-2-clutter.c \
+ mb-wm-comp-mgr-clutter.h \
+ mb-wm-comp-mgr-clutter.c \
+ tidy/tidy-texture-frame.h \
+ tidy/tidy-texture-frame.c
+
+
+matchbox_window_manager_2_clutter_LDFLAGS = \
+ $(MBWM_DEBUG_LDFLAGS) \
+ $(LDFLAGS)
+
+matchbox_window_manager_2_clutter_LDADD = \
+ $(top_builddir)/matchbox/libmatchbox-@MBWM_API_VERSION@.la \
+ $(MBWM_LIBS)
+
diff --git a/managers/clutter/matchbox-window-manager-2-clutter.c b/managers/clutter/matchbox-window-manager-2-clutter.c
new file mode 100644
index 0000000..ab3b227
--- /dev/null
+++ b/managers/clutter/matchbox-window-manager-2-clutter.c
@@ -0,0 +1,155 @@
+#include "mb-wm-comp-mgr-clutter.h"
+#include <clutter/x11/clutter-x11.h>
+
+#include <matchbox/matchbox.h>
+#include <signal.h>
+
+#if USE_GTK
+#include <gdk/gdkx.h>
+#endif
+
+enum {
+ KEY_ACTION_PAGE_NEXT,
+ KEY_ACTION_PAGE_PREV,
+ KEY_ACTION_TOGGLE_FULLSCREEN,
+ KEY_ACTION_TOGGLE_DESKTOP,
+};
+
+static MBWMManager *wm = NULL;
+
+#if MBWM_WANT_DEBUG
+/*
+ * The Idea behind this is quite simple: when all managed windows are closed
+ * and the WM exits, there should have been an unref call for each ref call. To
+ * test do something like
+ *
+ * export DISPLAY=:whatever;
+ * export MB_DEBUG=obj-ref,obj-unref
+ * matchbox-window-manager-2-simple &
+ * gedit
+ * kill -TERM $(pidof gedit)
+ * kill -TERM $(pidof matchbox-window-manager-2-simple)
+ *
+ * If you see '=== object count at exit x ===' then we either have a leak
+ * (x > 0) or are unrefing a dangling pointer (x < 0).
+ */
+static void
+signal_handler (int sig)
+{
+ if (sig == SIGTERM)
+ {
+ int count;
+
+ mb_wm_object_unref (MB_WM_OBJECT (wm));
+ mb_wm_object_dump ();
+
+ exit (sig);
+ }
+}
+#endif
+
+void
+key_binding_func (MBWMManager *wm,
+ MBWMKeyBinding *binding,
+ void *userdata)
+{
+ printf(" ### got key press ### \n");
+ int action;
+
+ action = (int)(userdata);
+
+ switch (action)
+ {
+ case KEY_ACTION_PAGE_NEXT:
+ mb_wm_manager_cycle_apps (wm, False);
+ break;
+ case KEY_ACTION_PAGE_PREV:
+ mb_wm_manager_cycle_apps (wm, True);
+ break;
+ case KEY_ACTION_TOGGLE_FULLSCREEN:
+ printf(" ### KEY_ACTION_TOGGLE_FULLSCREEN ### \n");
+ break;
+ case KEY_ACTION_TOGGLE_DESKTOP:
+ printf(" ### KEY_ACTION_TOGGLE_DESKTOP ### \n");
+ mb_wm_manager_toggle_desktop (wm);
+ break;
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ Display * dpy = NULL;
+ MBWMCompMgr *compositor;
+
+#if MBWM_WANT_DEBUG
+ struct sigaction sa;
+ sigfillset(&sa.sa_mask);
+ sa.sa_handler = signal_handler;
+ sigaction(SIGTERM, &sa, NULL);
+#endif
+
+ mb_wm_object_init();
+
+#if USE_GTK
+ printf ("initializing gtk\n");
+
+ gtk_init (&argc, &argv);
+ dpy = GDK_DISPLAY();
+#endif
+
+ /*
+ * If using clutter, we share the display connection, and hook
+ * our xevent handler into the clutter main loop.
+ *
+ * If we are also doing gtk integration, we need to make clutter to
+ * use the gtk display connection.
+ */
+ if (dpy)
+ clutter_x11_set_display (dpy);
+
+#if USE_GTK
+ clutter_x11_disable_event_retrieval ();
+#endif
+
+ clutter_init (&argc, &argv);
+
+ if (!dpy)
+ dpy = clutter_x11_get_default_display ();
+
+ wm = mb_wm_manager_new_with_dpy (argc, argv, dpy);
+ compositor = mb_wm_comp_mgr_clutter_new (wm);
+ mb_wm_manager_run_with_compositor (wm, compositor);
+ mb_wm_object_unref (MB_WM_OBJECT (compositor));
+
+ if (wm == NULL)
+ mb_wm_util_fatal_error("OOM?");
+
+ mb_wm_keys_binding_add_with_spec (wm,
+ "<alt>d",
+ key_binding_func,
+ NULL,
+ (void*)KEY_ACTION_TOGGLE_DESKTOP);
+
+ mb_wm_keys_binding_add_with_spec (wm,
+ "<alt>n",
+ key_binding_func,
+ NULL,
+ (void*)KEY_ACTION_PAGE_NEXT);
+
+ mb_wm_keys_binding_add_with_spec (wm,
+ "<alt>p",
+ key_binding_func,
+ NULL,
+ (void*)KEY_ACTION_PAGE_PREV);
+
+ mb_wm_manager_main_loop(wm);
+
+ mb_wm_object_unref (MB_WM_OBJECT (wm));
+
+#if MBWM_WANT_DEBUG
+ mb_wm_object_dump ();
+#endif
+
+ return 1;
+}
diff --git a/matchbox/mb-wm-comp-mgr-clutter.c b/managers/clutter/mb-wm-comp-mgr-clutter.c
index 91163df..91163df 100644
--- a/matchbox/mb-wm-comp-mgr-clutter.c
+++ b/managers/clutter/mb-wm-comp-mgr-clutter.c
diff --git a/matchbox/mb-wm-comp-mgr-clutter.h b/managers/clutter/mb-wm-comp-mgr-clutter.h
index f67f46c..c18fcbf 100644
--- a/matchbox/mb-wm-comp-mgr-clutter.h
+++ b/managers/clutter/mb-wm-comp-mgr-clutter.h
@@ -21,7 +21,7 @@
#ifndef _HAVE_MB_WM_COMP_MGR_CLUTTER_H
#define _HAVE_MB_WM_COMP_MGR_CLUTTER_H
-#include <matchbox/mb-wm-config.h>
+#include <matchbox/matchbox.h>
#include <clutter/clutter.h>
#define MB_WM_COMP_MGR_CLUTTER(c) ((MBWMCompMgrClutter*)(c))
diff --git a/matchbox/tidy/tidy-texture-frame.c b/managers/clutter/tidy/tidy-texture-frame.c
index 7ba4671..7ba4671 100644
--- a/matchbox/tidy/tidy-texture-frame.c
+++ b/managers/clutter/tidy/tidy-texture-frame.c
diff --git a/matchbox/tidy/tidy-texture-frame.h b/managers/clutter/tidy/tidy-texture-frame.h
index 71dd40c..71dd40c 100644
--- a/matchbox/tidy/tidy-texture-frame.h
+++ b/managers/clutter/tidy/tidy-texture-frame.h
diff --git a/managers/simple/matchbox-window-manager-2-simple.c b/managers/simple/matchbox-window-manager-2-simple.c
index 5b68cde..5a3472a 100644
--- a/managers/simple/matchbox-window-manager-2-simple.c
+++ b/managers/simple/matchbox-window-manager-2-simple.c
@@ -1,10 +1,6 @@
#include <matchbox/matchbox.h>
#include <signal.h>
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
-# include <clutter/x11/clutter-x11.h>
-#endif
-
#if USE_GTK
#include <gdk/gdkx.h>
#endif
@@ -98,31 +94,9 @@ main(int argc, char **argv)
dpy = GDK_DISPLAY();
#endif
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
- /*
- * If using clutter, we share the display connection, and hook
- * our xevent handler into the clutter main loop.
- *
- * If we are also doing gtk integration, we need to make clutter to
- * use the gtk display connection.
- */
- if (dpy)
- clutter_x11_set_display (dpy);
-
-#if USE_GTK
- clutter_x11_disable_event_retrieval ();
-#endif
-
- clutter_init (&argc, &argv);
-
- if (!dpy)
- dpy = clutter_x11_get_default_display ();
-
-#endif
-
wm = mb_wm_new_with_dpy (argc, argv, dpy);
mb_wm_init (wm);
-
+
if (wm == NULL)
mb_wm_util_fatal_error("OOM?");
diff --git a/matchbox/Makefile.am b/matchbox/Makefile.am
index b0098f6..acc64f3 100644
--- a/matchbox/Makefile.am
+++ b/matchbox/Makefile.am
@@ -66,19 +66,6 @@ source += \
if ENABLE_COMPOSITE
source += mb-wm-comp-mgr.h
source += mb-wm-comp-mgr.c
-
-if COMP_MGR_BACKEND
-if ENABLE_CLUTTER_COMPOSITE_MANAGER
-source += mb-wm-comp-mgr-clutter.h
-source += mb-wm-comp-mgr-clutter.c
-source += tidy/tidy-texture-frame.h
-source += tidy/tidy-texture-frame.c
-else
-source += mb-wm-comp-mgr-xrender.h
-source += mb-wm-comp-mgr-xrender.c
-endif
-endif
-
endif #ENABLE_COMPOSITE
# Theming...
diff --git a/matchbox/mb-window-manager.c b/matchbox/mb-window-manager.c
index 7d1a201..fcc2bee 100644
--- a/matchbox/mb-window-manager.c
+++ b/matchbox/mb-window-manager.c
@@ -30,18 +30,17 @@
#if ENABLE_COMPOSITE
# include "mb-wm-comp-mgr.h"
-# if ENABLE_CLUTTER_COMPOSITE_MANAGER
-# include <clutter/x11/clutter-x11.h>
-# include "mb-wm-comp-mgr-clutter.h"
-# else
-# include "mb-wm-comp-mgr-xrender.h"
-# endif
# include "mb-wm-client-override.h"
# include <X11/extensions/Xdamage.h>
# include <X11/extensions/Xrender.h>
# include <X11/extensions/Xcomposite.h>
#endif
+/* FIXME: libmatchbox shouldn't know anything about clutter */
+#ifdef MANAGER_CLUTTER
+#include <clutter/x11/clutter-x11.h>
+#endif
+
#if USE_GTK
# include <gdk/gdk.h>
#endif
@@ -156,18 +155,6 @@ mb_wm_real_theme_new (MBWindowManager * wm, const char * path)
return mb_wm_theme_new (wm, path);
}
-#if ENABLE_COMPOSITE && COMP_MGR_BACKEND
-static MBWMCompMgr *
-mb_wm_real_comp_mgr_new (MBWindowManager *wm)
-{
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
- return mb_wm_comp_mgr_clutter_new (wm);
-#else
- return mb_wm_comp_mgr_xrender_new (wm);
-#endif
-}
-#endif
-
static MBWMLayout *
mb_wm_layout_new_real (MBWindowManager *wm)
{
@@ -195,7 +182,8 @@ mb_wm_gdk_xevent_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
}
#endif
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
+/* FIXME: libmatchbox shouldn't know anything about clutter! */
+#ifdef MANAGER_CLUTTER
#if USE_GTK
static GdkFilterReturn
mb_wm_clutter_gdk_xevent_filter (GdkXEvent *xevent, GdkEvent *event,
@@ -230,14 +218,14 @@ mb_wm_clutter_xevent_filter (XEvent *xev, ClutterEvent *cev, gpointer data)
#endif
#endif
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER || USE_GTK
+#if MANAGER_CLUTTER || USE_GTK
static void
mb_wm_main_real (MBWindowManager *wm)
{
#if USE_GTK
gdk_window_add_filter (NULL, mb_wm_gdk_xevent_filter, wm);
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
+#if MANAGER_CLUTTER
gdk_window_add_filter (NULL, mb_wm_clutter_gdk_xevent_filter, NULL);
#endif
gtk_main ();
@@ -264,14 +252,10 @@ mb_wm_class_init (MBWMObjectClass *klass)
wm_class->layout_new = mb_wm_layout_new_real;
wm_class->get_desktop_geometry = mb_wm_real_get_desktop_geometry;
-#if ENABLE_CLUTTER_COMPOSITE_MANAGER
+#if MANAGER_CLUTTER
wm_class->main = mb_wm_main_real;
#endif
-#if ENABLE_COMPOSITE && COMP_MGR_BACKEND
- wm_class->comp_mgr_new = mb_wm_real_comp_mgr_new;
-#endif
-
#if MBWM_WANT_DEBUG
klass->klass_name = "MBWindowManager";
#endif
@@ -1255,7 +1239,7 @@ mb_wm_main_loop(MBWindowManager *wm)
MBWindowManagerClass * wm_class =
MB_WINDOW_MANAGER_CLASS (MB_WM_OBJECT_GET_CLASS (wm));
-#if !ENABLE_CLUTTER_COMPOSITE_MANAGER
+#if !MANAGER_CLUTTER
if (!wm_class->main)
{
GMainLoop * loop = g_main_loop_new (NULL, FALSE);
@@ -1517,8 +1501,8 @@ mb_wm_init_comp_extensions (MBWindowManager *wm)
* This function must be called before the MBWindowManager object can be
* used.
*/
-void
-mb_wm_init (MBWindowManager * wm)
+static void
+_mb_wm_init (MBWindowManager * wm, MBWMCompMgr *compositor)
{
MBWindowManagerClass *wm_class;
@@ -1531,8 +1515,13 @@ mb_wm_init (MBWindowManager * wm)
mb_wm_set_layout (wm, wm_class->layout_new (wm));
#if ENABLE_COMPOSITE
- if (wm_class->comp_mgr_new && mb_wm_theme_use_compositing_mgr (wm->theme))
- mb_wm_compositing_on (wm);
+ if (compositor)
+ {
+ wm->comp_mgr = mb_wm_object_ref (MB_WM_OBJECT (compositor));
+
+ if (mb_wm_theme_use_compositing_mgr (wm->theme))
+ mb_wm_compositing_on (wm);
+ }
#endif
mb_wm_manage_preexistsing_wins (wm);
@@ -1547,6 +1536,19 @@ mb_wm_init (MBWindowManager * wm)
wm->sync_type |= MBWMSyncStacking;
}
+void
+mb_wm_init (MBWindowManager *window_manager)
+{
+ _mb_wm_init (window_manager, NULL);
+}
+
+void
+mb_wm_init_with_compositor (MBWindowManager *window_manager,
+ MBWMCompMgr *compositor)
+{
+ _mb_wm_init (window_manager, compositor);
+}
+
static int
mb_window_manager_init (MBWMObject *this, va_list vap)
@@ -2158,24 +2160,14 @@ mb_wm_set_cursor (MBWindowManager * wm, MBWindowManagerCursor cursor)
}
void
-mb_wm_compositing_on (MBWindowManager * wm)
+mb_wm_compositing_on (MBWindowManager *wm)
{
#if ENABLE_COMPOSITE
- MBWindowManagerClass *wm_class =
- MB_WINDOW_MANAGER_CLASS (MB_WM_OBJECT_GET_CLASS (wm));
-
- if (!wm->comp_mgr && wm_class->comp_mgr_new)
- wm->comp_mgr = wm_class->comp_mgr_new (wm);
-
if (wm->comp_mgr && !mb_wm_comp_mgr_enabled (wm->comp_mgr))
- {
- mb_wm_comp_mgr_turn_on (wm->comp_mgr);
- XSync (wm->xdpy, False);
- }
+ mb_wm_comp_mgr_turn_on (wm->comp_mgr);
#endif
}
-
void
mb_wm_compositing_off (MBWindowManager * wm)
{
diff --git a/matchbox/mb-window-manager.h b/matchbox/mb-window-manager.h
index 5c72845..da9ddde 100644
--- a/matchbox/mb-window-manager.h
+++ b/matchbox/mb-window-manager.h
@@ -135,10 +135,6 @@ struct MBWindowManagerClass
MBWMTheme * (*theme_new) (MBWindowManager *wm, const char * path);
-#if ENABLE_COMPOSITE
- MBWMCompMgr * (*comp_mgr_new) (MBWindowManager *wm);
-#endif
-
void (*get_desktop_geometry) (MBWindowManager *wm, MBGeometry *geom);
void (*main) (MBWindowManager *wm);
@@ -164,6 +160,9 @@ void
mb_wm_init (MBWindowManager * wm);
void
+mb_wm_init_with_compositor (MBWindowManager * wm, MBWMCompMgr *compositor);
+
+void
mb_wm_set_layout (MBWindowManager *wm, MBWMLayout *layout);
int
diff --git a/matchbox/mb-wm-comp-mgr.c b/matchbox/mb-wm-comp-mgr.c
index 5aa6d6b..fe5afcc 100644
--- a/matchbox/mb-wm-comp-mgr.c
+++ b/matchbox/mb-wm-comp-mgr.c
@@ -444,6 +444,8 @@ mb_wm_comp_mgr_turn_on (MBWMCompMgr *mgr)
wm->damage_event_base + XDamageNotify,
(MBWMXEventFunc)klass->handle_damage,
mgr);
+
+ XSync (wm->xdpy, False);
}
void