refactor(build): Rename X extension flags

This commit is contained in:
Michael Carlberg 2016-11-30 12:46:26 +01:00
parent 2f3c2e952e
commit 6aba583c3e
15 changed files with 61 additions and 55 deletions

View File

@ -51,12 +51,12 @@ option(ENABLE_I3 "Enable i3 support" ON)
option(ENABLE_MPD "Enable mpd support" ON)
option(ENABLE_NETWORK "Enable network support" ON)
option(ENABLE_RANDR_EXT "Enable RandR X extension" ON)
option(ENABLE_RENDER_EXT "Enable Render X extension" OFF)
option(ENABLE_DAMAGE_EXT "Enable Damage X extension" OFF)
option(ENABLE_SYNC_EXT "Enable Sync X extension" OFF)
option(ENABLE_COMPOSITE_EXT "Enable Sync X extension" OFF)
option(ENABLE_XKB_EXT "Enable Sync X extension" ON)
option(WITH_XRANDR "XRANDR support" ON)
option(WITH_XRENDER "XRENDER support" OFF)
option(WITH_XDAMAGE "XDAMAGE support" OFF)
option(WITH_XSYNC "XSYNC support" OFF)
option(WITH_XCOMPOSITE "XCOMPOSITE support" OFF)
option(WITH_XKB "XKB support" ON)
# }}}
# Set cache vars {{{

View File

@ -55,10 +55,10 @@ colored_option(STATUS " Enable i3 ${ENABLE_I3}" ENABLE_I3 "32;1" "37;
colored_option(STATUS " Enable mpd ${ENABLE_MPD}" ENABLE_MPD "32;1" "37;2")
colored_option(STATUS " Enable network ${ENABLE_NETWORK}" ENABLE_NETWORK "32;1" "37;2")
message(STATUS "--------------------------")
colored_option(STATUS " Enable X RandR ${ENABLE_RANDR_EXT}" ENABLE_RANDR_EXT "32;1" "37;2")
colored_option(STATUS " Enable X Render ${ENABLE_RENDER_EXT}" ENABLE_RENDER_EXT "32;1" "37;2")
colored_option(STATUS " Enable X Damage ${ENABLE_DAMAGE_EXT}" ENABLE_DAMAGE_EXT "32;1" "37;2")
colored_option(STATUS " Enable X Sync ${ENABLE_SYNC_EXT}" ENABLE_SYNC_EXT "32;1" "37;2")
colored_option(STATUS " Enable X Composite ${ENABLE_COMPOSITE_EXT}" ENABLE_COMPOSITE_EXT "32;1" "37;2")
colored_option(STATUS " Enable X Xkb ${ENABLE_XKB_EXT}" ENABLE_XKB_EXT "32;1" "37;2")
colored_option(STATUS " XRANDR support ${WITH_XRANDR}" WITH_XRANDR "32;1" "37;2")
colored_option(STATUS " XRENDER support ${WITH_XRENDER}" WITH_XRENDER "32;1" "37;2")
colored_option(STATUS " XDAMAGE support ${WITH_XDAMAGE}" WITH_XDAMAGE "32;1" "37;2")
colored_option(STATUS " XSYNC support ${WITH_XSYNC}" WITH_XSYNC "32;1" "37;2")
colored_option(STATUS " XCOMPOSITE support ${WITH_XCOMPOSITE}" WITH_XCOMPOSITE "32;1" "37;2")
colored_option(STATUS " XKB support ${WITH_XKB}" WITH_XKB "32;1" "37;2")
message(STATUS "--------------------------")

View File

@ -2,7 +2,7 @@
# Generate configuration file
#
set(MODULES_LEFT "bspwm i3 mpd")
set(MODULES_LEFT "bspwm i3")
set(MODULES_CENTER "xwindow")
set(MODULES_RIGHT "backlight volume memory cpu wlan eth battery temperature date powermenu")
@ -14,13 +14,10 @@ endif()
if(NOT ENABLE_I3)
string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT})
endif()
if(NOT ENABLE_MPD)
string(REPLACE " mpd" "" MODULES_LEFT ${MODULES_LEFT})
endif()
if(NOT ENABLE_NETWORK)
string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT})
endif()
if(NOT ENABLE_RANDR_EXT)
if(NOT WITH_XRANDR)
string(REPLACE "backlight " "" MODULES_RIGHT ${MODULES_RIGHT})
endif()

View File

@ -1,12 +1,21 @@
#pragma once
#include <assert.h>
#include <poll.h>
#include <stdio.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
#include <alsa/pcm.h>
#include <alsa/control.h>
#include <alsa/mixer.h>
#include <cmath>
#include <functional>
#include <string>
#include <alsa/asoundlib.h>
#include "common.hpp"
#include "config.hpp"
#include "errors.hpp"

View File

@ -17,12 +17,12 @@
#cmakedefine01 ENABLE_NETWORK
#cmakedefine01 ENABLE_I3
#cmakedefine01 ENABLE_RANDR_EXT
#cmakedefine01 ENABLE_RENDER_EXT
#cmakedefine01 ENABLE_DAMAGE_EXT
#cmakedefine01 ENABLE_SYNC_EXT
#cmakedefine01 ENABLE_COMPOSITE_EXT
#cmakedefine01 ENABLE_XKB_EXT
#cmakedefine01 WITH_XRANDR
#cmakedefine01 WITH_XRENDER
#cmakedefine01 WITH_XDAMAGE
#cmakedefine01 WITH_XSYNC
#cmakedefine01 WITH_XCOMPOSITE
#cmakedefine01 WITH_XKB
#cmakedefine XPP_EXTENSION_LIST @XPP_EXTENSION_LIST@
#cmakedefine DEBUG_LOGGER

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_COMPOSITE_EXT
#if not WITH_XCOMPOSITE
#error "X Composite extension is disabled..."
#endif

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_DAMAGE_EXT
#if not WITH_XDAMAGE
#error "X Damage extension is disabled..."
#endif

View File

@ -2,21 +2,21 @@
#include "config.hpp"
#if ENABLE_DAMAGE_EXT
#if WITH_XDAMAGE
#include "x11/damage.hpp"
#endif
#if ENABLE_RENDER_EXT
#if WITH_XRENDER
#include "x11/render.hpp"
#endif
#if ENABLE_RANDR_EXT
#if WITH_XRANDR
#include "x11/randr.hpp"
#endif
#if ENABLE_SYNC_EXT
#if WITH_XSYNC
#include "x11/sync.hpp"
#endif
#if ENABLE_COMPOSITE_EXT
#if WITH_XCOMPOSITE
#include "x11/composite.hpp"
#endif
#if ENABLE_XKB_EXT
#if WITH_XKB
#include "x11/xkb.hpp"
#endif

View File

@ -3,32 +3,32 @@
#include "common.hpp"
namespace xpp {
#if ENABLE_DAMAGE_EXT
#if WITH_XDAMAGE
namespace damage {
class extension;
}
#endif
#if ENABLE_RANDR_EXT
#if WITH_XRANDR
namespace randr {
class extension;
}
#endif
#if ENABLE_SYNC_EXT
#if WITH_XSYNC
namespace sync {
class extension;
}
#endif
#if ENABLE_RENDER_EXT
#if WITH_XRENDER
namespace render {
class extension;
}
#endif
#if ENABLE_COMPOSITE_EXT
#if WITH_XCOMPOSITE
namespace composite {
class extension;
}
#endif
#if ENABLE_XKB_EXT
#if WITH_XKB
namespace xkb {
class extension;
}

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_RANDR_EXT
#if not WITH_XRANDR
#error "X RandR extension is disabled..."
#endif

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_RENDER_EXT
#if not WITH_XRENDER
#error "X Render extension is disabled..."
#endif

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_SYNC_EXT
#if not WITH_XSYNC
#error "X Sync extension is disabled..."
#endif

View File

@ -2,7 +2,7 @@
#include "config.hpp"
#if not ENABLE_XKB_EXT
#if not WITH_XKB
#error "X xkb extension is disabled..."
#endif

View File

@ -43,27 +43,27 @@ set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
# xpp library
set(XCB_PROTOS xproto)
if(ENABLE_RANDR_EXT)
if(WITH_XRANDR)
set(XCB_PROTOS "${XCB_PROTOS}" randr)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::randr::extension)
endif()
if(ENABLE_RENDER_EXT)
if(WITH_XRENDER)
set(XCB_PROTOS "${XCB_PROTOS}" render)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::render::extension)
endif()
if(ENABLE_DAMAGE_EXT)
if(WITH_XDAMAGE)
set(XCB_PROTOS "${XCB_PROTOS}" damage)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::damage::extension)
endif()
if(ENABLE_SYNC_EXT)
if(WITH_XSYNC)
set(XCB_PROTOS "${XCB_PROTOS}" sync)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::sync::extension)
endif()
if(ENABLE_COMPOSITE_EXT)
if(WITH_XCOMPOSITE)
set(XCB_PROTOS "${XCB_PROTOS}" composite)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::composite::extension)
endif()
if(ENABLE_XKB_EXT)
if(WITH_XKB)
set(XCB_PROTOS "${XCB_PROTOS}" xkb)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::xkb::extension)
endif()

View File

@ -53,35 +53,35 @@ void connection::query_extensions() {
return;
}
#if ENABLE_DAMAGE_EXT
#if WITH_XDAMAGE
damage().query_version(XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION);
if (!extension<xpp::damage::extension>()->present)
throw application_error("Missing X extension: Damage");
#endif
#if ENABLE_RENDER_EXT
#if WITH_XRENDER
render().query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
if (!extension<xpp::render::extension>()->present)
throw application_error("Missing X extension: Render");
#endif
#if ENABLE_RANDR_EXT
#if WITH_XRANDR
randr().query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
if (!extension<xpp::randr::extension>()->present) {
throw application_error("Missing X extension: RandR");
}
#endif
#if ENABLE_SYNC_EXT
#if WITH_XSYNC
sync().initialize(XCB_SYNC_MAJOR_VERSION, XCB_SYNC_MINOR_VERSION);
if (!extension<xpp::sync::extension>()->present) {
throw application_error("Missing X extension: Sync");
}
#endif
#if ENABLE_COMPOSITE_EXT
#if WITH_XCOMPOSITE
composite().query_version(XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
if (!extension<xpp::composite::extension>()->present) {
throw application_error("Missing X extension: Composite");
}
#endif
#if ENABLE_XKB_EXT
#if WITH_XKB
xkb().use_extension(XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
if (!extension<xpp::xkb::extension>()->present) {
throw application_error("Missing X extension: Xkb");