From 6aba583c3eaa86b6b764dc14f66e50cfb59facd7 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Wed, 30 Nov 2016 12:46:26 +0100 Subject: [PATCH] refactor(build): Rename X extension flags --- cmake/build/options.cmake | 12 ++++++------ cmake/build/summary.cmake | 12 ++++++------ examples/CMakeLists.txt | 7 ++----- include/adapters/alsa.hpp | 13 +++++++++++-- include/config.hpp.cmake | 12 ++++++------ include/x11/composite.hpp | 2 +- include/x11/damage.hpp | 2 +- include/x11/extensions.hpp | 12 ++++++------ include/x11/extensions_fwd.hpp | 12 ++++++------ include/x11/randr.hpp | 2 +- include/x11/render.hpp | 2 +- include/x11/sync.hpp | 2 +- include/x11/xkb.hpp | 2 +- src/CMakeLists.txt | 12 ++++++------ src/x11/connection.cpp | 12 ++++++------ 15 files changed, 61 insertions(+), 55 deletions(-) diff --git a/cmake/build/options.cmake b/cmake/build/options.cmake index 511d3d52..aedc759c 100644 --- a/cmake/build/options.cmake +++ b/cmake/build/options.cmake @@ -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 {{{ diff --git a/cmake/build/summary.cmake b/cmake/build/summary.cmake index a6a8b8f7..2e19976b 100644 --- a/cmake/build/summary.cmake +++ b/cmake/build/summary.cmake @@ -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 "--------------------------") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 25c4b39b..7a0720ea 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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() diff --git a/include/adapters/alsa.hpp b/include/adapters/alsa.hpp index 9bcf17da..ac506924 100644 --- a/include/adapters/alsa.hpp +++ b/include/adapters/alsa.hpp @@ -1,12 +1,21 @@ #pragma once +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include -#include - #include "common.hpp" #include "config.hpp" #include "errors.hpp" diff --git a/include/config.hpp.cmake b/include/config.hpp.cmake index c7d11ccc..cab5223d 100644 --- a/include/config.hpp.cmake +++ b/include/config.hpp.cmake @@ -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 diff --git a/include/x11/composite.hpp b/include/x11/composite.hpp index 67b4ab44..a4de96fe 100644 --- a/include/x11/composite.hpp +++ b/include/x11/composite.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_COMPOSITE_EXT +#if not WITH_XCOMPOSITE #error "X Composite extension is disabled..." #endif diff --git a/include/x11/damage.hpp b/include/x11/damage.hpp index f51037b4..2ae5cbfb 100644 --- a/include/x11/damage.hpp +++ b/include/x11/damage.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_DAMAGE_EXT +#if not WITH_XDAMAGE #error "X Damage extension is disabled..." #endif diff --git a/include/x11/extensions.hpp b/include/x11/extensions.hpp index ce7ce3d6..ac46b7c4 100644 --- a/include/x11/extensions.hpp +++ b/include/x11/extensions.hpp @@ -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 diff --git a/include/x11/extensions_fwd.hpp b/include/x11/extensions_fwd.hpp index 666b6be6..8ce408fa 100644 --- a/include/x11/extensions_fwd.hpp +++ b/include/x11/extensions_fwd.hpp @@ -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; } diff --git a/include/x11/randr.hpp b/include/x11/randr.hpp index 7587f361..73323749 100644 --- a/include/x11/randr.hpp +++ b/include/x11/randr.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_RANDR_EXT +#if not WITH_XRANDR #error "X RandR extension is disabled..." #endif diff --git a/include/x11/render.hpp b/include/x11/render.hpp index fdd064d9..56727428 100644 --- a/include/x11/render.hpp +++ b/include/x11/render.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_RENDER_EXT +#if not WITH_XRENDER #error "X Render extension is disabled..." #endif diff --git a/include/x11/sync.hpp b/include/x11/sync.hpp index d77c827c..e24a2784 100644 --- a/include/x11/sync.hpp +++ b/include/x11/sync.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_SYNC_EXT +#if not WITH_XSYNC #error "X Sync extension is disabled..." #endif diff --git a/include/x11/xkb.hpp b/include/x11/xkb.hpp index eacbb56b..2ae9623d 100644 --- a/include/x11/xkb.hpp +++ b/include/x11/xkb.hpp @@ -2,7 +2,7 @@ #include "config.hpp" -#if not ENABLE_XKB_EXT +#if not WITH_XKB #error "X xkb extension is disabled..." #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bd536e77..821b84e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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() diff --git a/src/x11/connection.cpp b/src/x11/connection.cpp index d9001f53..41c930ec 100644 --- a/src/x11/connection.cpp +++ b/src/x11/connection.cpp @@ -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()->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()->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()->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()->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()->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()->present) { throw application_error("Missing X extension: Xkb");