Add composite.[ch] files. Enable composite based on a new config variable 'config_comp'.
authorDana Jansens <danakj@orodu.net>
Mon, 7 Jun 2010 17:26:43 +0000 (13:26 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jun 2010 23:30:46 +0000 (01:30 +0200)
If composite cannot be enabled, the config var is set back to FALSE.

Makefile.am
openbox/composite.c [new file with mode: 0644]
openbox/composite.h [new file with mode: 0644]
openbox/config.c
openbox/config.h
openbox/openbox.c

index 1065da012a139de7f546fed81dbc5e2d39727dc6..9e8ed5f7c6ab237203a28e8e14854dfe4deb5493 100644 (file)
@@ -284,6 +284,8 @@ openbox_openbox_SOURCES = \
        openbox/client_list_combined_menu.h \
        openbox/client_menu.c \
        openbox/client_menu.h \
+       openbox/composite.c \
+       openbox/composite.h \
        openbox/config.c \
        openbox/config.h \
        openbox/debug.c \
diff --git a/openbox/composite.c b/openbox/composite.c
new file mode 100644 (file)
index 0000000..d33dc3a
--- /dev/null
@@ -0,0 +1,59 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   composite.c for the Openbox window manager
+   Copyright (c) 2010        Dana Jansens
+   Copyright (c) 2010        Derek Foreman
+
+   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.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#include "composite.h"
+#include "config.h"
+#include "obt/display.h"
+
+#include <X11/Xlib.h>
+#include <glib.h>
+
+void composite_startup(gboolean reconfig)
+{
+    /* This function will try enable composite if config_comp is TRUE.  At the
+       end of this process, config_comp will be set to TRUE only if composite
+       is enabled, and FALSE otherwise. */
+#ifdef USE_COMPOSITING
+    gboolean try;
+
+    if (reconfig) return;
+    if (!(try = config_comp)) return;
+
+    config_comp = FALSE;
+
+    /* XXX test GL things we need also */
+    if (!obt_display_extension_composite ||
+        !obt_display_extension_damage ||
+        !obt_display_extension_fixes)
+    {
+        try = FALSE;
+    }
+
+    config_comp = try;
+    if (!config_comp)
+        g_message("Failed to enable composite.  A better explanation why would be nice");
+#endif
+}
+
+void composite_shutdown(gboolean reconfig)
+{
+#ifdef USE_COMPOSITING
+    if (reconfig) return;
+#endif
+}
diff --git a/openbox/composite.h b/openbox/composite.h
new file mode 100644 (file)
index 0000000..6b03cad
--- /dev/null
@@ -0,0 +1,28 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   composite.h for the Openbox window manager
+   Copyright (c) 2010        Dana Jansens
+   Copyright (c) 2010        Derek Foreman
+
+   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.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
+#ifndef __composite_h
+#define __composite_h
+
+#include <glib.h>
+
+void composite_startup(gboolean reconfig);
+void composite_shutdown(gboolean reconfig);
+
+#endif
index 656ad3c9d8da82536fbee5f6f1d5fafca301a453..9c134ed6ad076cf77b609fa52286d53615fb80a6 100644 (file)
@@ -27,6 +27,7 @@
 #include "openbox.h"
 #include "gettext.h"
 #include "obt/paths.h"
+#include "obt/display.h"
 
 gboolean config_focus_new;
 gboolean config_focus_follow;
@@ -49,6 +50,8 @@ gchar   *config_theme;
 gboolean config_theme_keepborder;
 guint    config_theme_window_list_icon_size;
 
+gboolean config_comp;
+
 gchar   *config_title_layout;
 
 gboolean config_animate_iconify;
@@ -1010,6 +1013,8 @@ void config_startup(ObtXmlInst *i)
 
     config_theme = NULL;
 
+    config_comp = TRUE;
+
     config_animate_iconify = TRUE;
     config_title_layout = g_strdup("NLIMC");
     config_theme_keepborder = TRUE;
index 890b002a8ec95d9ff169f1f336ea860612b90107..7b161436f48cf73587135a7b761033ea3ccaabaf 100644 (file)
@@ -135,6 +135,8 @@ extern guint config_dock_app_move_modifiers;
 
 /*! The name of the theme */
 extern gchar *config_theme;
+/*! Whether to act as a compositing manager or not */
+extern gboolean config_comp;
 
 /*! Show the one-pixel border after toggleDecor */
 extern gboolean config_theme_keepborder;
index b2cdc8efded4e8cb9d465af61042828c077c0912..2a0717ddc052c084c25ee5e6d414b968e1c8fec4 100644 (file)
@@ -316,6 +316,7 @@ gint main(gint argc, gchar **argv)
             menu_frame_startup(reconfigure);
             menu_startup(reconfigure);
             prompt_startup(reconfigure);
+            composite_startup(reconfigure);
 
             /* do this after everything is started so no events will get
                missed */
@@ -384,6 +385,7 @@ gint main(gint argc, gchar **argv)
             if (!reconfigure)
                 window_unmanage_all();
 
+            composite_shutdown(reconfigure);
             prompt_shutdown(reconfigure);
             menu_shutdown(reconfigure);
             menu_frame_shutdown(reconfigure);