From: Dana Jansens Date: Mon, 7 Jun 2010 17:26:43 +0000 (-0400) Subject: Add composite.[ch] files. Enable composite based on a new config variable 'config_comp'. X-Git-Tag: cgl~68 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=9f133b524ee429786e892275eab950fd1ed6da3a;p=dana%2Fopenbox.git Add composite.[ch] files. Enable composite based on a new config variable 'config_comp'. If composite cannot be enabled, the config var is set back to FALSE. --- diff --git a/Makefile.am b/Makefile.am index 1065da01..9e8ed5f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 00000000..d33dc3ac --- /dev/null +++ b/openbox/composite.c @@ -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 +#include + +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 index 00000000..6b03cadc --- /dev/null +++ b/openbox/composite.h @@ -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 + +void composite_startup(gboolean reconfig); +void composite_shutdown(gboolean reconfig); + +#endif diff --git a/openbox/config.c b/openbox/config.c index 656ad3c9..9c134ed6 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -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; diff --git a/openbox/config.h b/openbox/config.h index 890b002a..7b161436 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -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; diff --git a/openbox/openbox.c b/openbox/openbox.c index b2cdc8ef..2a0717dd 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -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);