build: Optional X extensions
This commit is contained in:
parent
ad772edc39
commit
4fb7c98455
@ -51,9 +51,11 @@ option(ENABLE_I3 "Enable i3 support" ON)
|
|||||||
option(ENABLE_MPD "Enable mpd support" ON)
|
option(ENABLE_MPD "Enable mpd support" ON)
|
||||||
option(ENABLE_NETWORK "Enable network support" ON)
|
option(ENABLE_NETWORK "Enable network support" ON)
|
||||||
|
|
||||||
option(ENABLE_RANDR_EXT "Enable RandR X extension" ON)
|
option(ENABLE_RANDR_EXT "Enable RandR X extension" ON)
|
||||||
option(ENABLE_RENDER_EXT "Enable Render X extension" OFF)
|
option(ENABLE_RENDER_EXT "Enable Render X extension" OFF)
|
||||||
option(ENABLE_DAMAGE_EXT "Enable Damage 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)
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
# Set cache vars {{{
|
# Set cache vars {{{
|
||||||
|
@ -58,4 +58,6 @@ message(STATUS "--------------------------")
|
|||||||
colored_option(STATUS " Enable X RandR ${ENABLE_RANDR_EXT}" ENABLE_RANDR_EXT "32;1" "37;2")
|
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 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 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")
|
||||||
message(STATUS "--------------------------")
|
message(STATUS "--------------------------")
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#cmakedefine01 ENABLE_NETWORK
|
#cmakedefine01 ENABLE_NETWORK
|
||||||
#cmakedefine01 ENABLE_I3
|
#cmakedefine01 ENABLE_I3
|
||||||
|
|
||||||
#cmakedefine ENABLE_RANDR_EXT
|
#cmakedefine01 ENABLE_RANDR_EXT
|
||||||
#cmakedefine ENABLE_RENDER_EXT
|
#cmakedefine01 ENABLE_RENDER_EXT
|
||||||
#cmakedefine ENABLE_DAMAGE_EXT
|
#cmakedefine01 ENABLE_DAMAGE_EXT
|
||||||
|
#cmakedefine01 ENABLE_SYNC_EXT
|
||||||
|
#cmakedefine01 ENABLE_COMPOSITE_EXT
|
||||||
|
|
||||||
#cmakedefine DEBUG_LOGGER
|
#cmakedefine DEBUG_LOGGER
|
||||||
#cmakedefine VERBOSE_TRACELOG
|
#cmakedefine VERBOSE_TRACELOG
|
||||||
|
10
include/x11/composite.hpp
Normal file
10
include/x11/composite.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.hpp"
|
||||||
|
|
||||||
|
#if not ENABLE_COMPOSITE_EXT
|
||||||
|
#error "X Composite extension is disabled..."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/composite.h>
|
||||||
|
#include <xpp/proto/composite.hpp>
|
@ -10,33 +10,51 @@
|
|||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "x11/types.hpp"
|
#include "x11/types.hpp"
|
||||||
|
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
#include "x11/damage.hpp"
|
#include "x11/damage.hpp"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RENDER_EXT
|
#if ENABLE_RENDER_EXT
|
||||||
#include "x11/render.hpp"
|
#include "x11/render.hpp"
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if ENABLE_RANDR_EXT
|
||||||
#include "x11/randr.hpp"
|
#include "x11/randr.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLE_SYNC_EXT
|
||||||
|
#include "x11/sync.hpp"
|
||||||
|
#endif
|
||||||
|
#if ENABLE_COMPOSITE_EXT
|
||||||
|
#include "x11/composite.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
using xpp_connection = xpp::connection<
|
using xpp_connection = xpp::connection<
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
xpp::damage::extension
|
xpp::damage::extension
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if ENABLE_RANDR_EXT
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
xpp::randr::extension
|
xpp::randr::extension
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RENDER_EXT
|
#if ENABLE_RENDER_EXT
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT)
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
xpp::render::extension
|
xpp::render::extension
|
||||||
|
#endif
|
||||||
|
#if ENABLE_SYNC_EXT
|
||||||
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT || ENABLE_RENDER_EXT)
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
xpp::sync::extension
|
||||||
|
#endif
|
||||||
|
#if ENABLE_COMPOSITE_EXT
|
||||||
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT || ENABLE_RENDER_EXT || ENABLE_SYNC_EXT)
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
xpp::composite::extension
|
||||||
#endif
|
#endif
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
|
||||||
#ifndef ENABLE_DAMAGE_EXT
|
#if not ENABLE_DAMAGE_EXT
|
||||||
#error "X Damage extension is disabled..."
|
#error "X Damage extension is disabled..."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/damage.h>
|
||||||
#include <xpp/proto/damage.hpp>
|
#include <xpp/proto/damage.hpp>
|
||||||
|
@ -9,8 +9,8 @@ POLYBAR_NS
|
|||||||
class connection;
|
class connection;
|
||||||
|
|
||||||
namespace draw_util {
|
namespace draw_util {
|
||||||
void fill(connection& conn, xcb_drawable_t d, xcb_gcontext_t g, const xcb_rectangle_t rect);
|
void fill(xcb_connection_t* c, xcb_drawable_t d, xcb_gcontext_t g, const xcb_rectangle_t rect);
|
||||||
void fill(connection& conn, xcb_drawable_t d, xcb_gcontext_t g, int16_t x, int16_t y, uint16_t w, uint16_t h);
|
void fill(xcb_connection_t* c, xcb_drawable_t d, xcb_gcontext_t g, int16_t x, int16_t y, uint16_t w, uint16_t h);
|
||||||
|
|
||||||
xcb_void_cookie_t xcb_poly_text_16_patched(
|
xcb_void_cookie_t xcb_poly_text_16_patched(
|
||||||
xcb_connection_t* conn, xcb_drawable_t d, xcb_gcontext_t gc, int16_t x, int16_t y, uint8_t len, uint16_t* str);
|
xcb_connection_t* conn, xcb_drawable_t d, xcb_gcontext_t gc, int16_t x, int16_t y, uint8_t len, uint16_t* str);
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
|
||||||
#ifndef ENABLE_RANDR_EXT
|
#if not ENABLE_RANDR_EXT
|
||||||
#error "X RandR extension is disabled..."
|
#error "X RandR extension is disabled..."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/randr.h>
|
||||||
#include <xpp/proto/randr.hpp>
|
#include <xpp/proto/randr.hpp>
|
||||||
#include <xpp/xpp.hpp>
|
#include <xpp/xpp.hpp>
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
|
|
||||||
#ifndef ENABLE_RENDER_EXT
|
#if not ENABLE_RENDER_EXT
|
||||||
#error "X Render extension is disabled..."
|
#error "X Render extension is disabled..."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/render.h>
|
||||||
#include <xpp/proto/render.hpp>
|
#include <xpp/proto/render.hpp>
|
||||||
|
10
include/x11/sync.hpp
Normal file
10
include/x11/sync.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config.hpp"
|
||||||
|
|
||||||
|
#if not ENABLE_SYNC_EXT
|
||||||
|
#error "X Sync extension is disabled..."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xcb/sync.h>
|
||||||
|
#include <xpp/proto/sync.hpp>
|
@ -4,21 +4,31 @@
|
|||||||
|
|
||||||
// fwd
|
// fwd
|
||||||
namespace xpp {
|
namespace xpp {
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
namespace damage {
|
namespace damage {
|
||||||
class extension;
|
class extension;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if ENABLE_RANDR_EXT
|
||||||
namespace randr {
|
namespace randr {
|
||||||
class extension;
|
class extension;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RENDER_EXT
|
#if ENABLE_SYNC_EXT
|
||||||
|
namespace sync {
|
||||||
|
class extension;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLE_RENDER_EXT
|
||||||
namespace render {
|
namespace render {
|
||||||
class extension;
|
class extension;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLE_COMPOSITE_EXT
|
||||||
|
namespace composite {
|
||||||
|
class extension;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <xpp/xpp.hpp>
|
#include <xpp/xpp.hpp>
|
||||||
@ -38,20 +48,32 @@ using font = xpp::font<connection&>;
|
|||||||
using cursor = xpp::cursor<connection&>;
|
using cursor = xpp::cursor<connection&>;
|
||||||
|
|
||||||
using registry = xpp::event::registry<connection&,
|
using registry = xpp::event::registry<connection&,
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
xpp::damage::extension
|
xpp::damage::extension
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if ENABLE_RANDR_EXT
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
xpp::randr::extension
|
xpp::randr::extension
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RENDER_EXT
|
#if ENABLE_RENDER_EXT
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT)
|
||||||
,
|
,
|
||||||
#endif
|
#endif
|
||||||
xpp::render::extension
|
xpp::render::extension
|
||||||
|
#endif
|
||||||
|
#if ENABLE_SYNC_EXT
|
||||||
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT || ENABLE_RENDER_EXT)
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
xpp::sync::extension
|
||||||
|
#endif
|
||||||
|
#if ENABLE_COMPOSITE_EXT
|
||||||
|
#if (ENABLE_RANDR_EXT || ENABLE_DAMAGE_EXT || ENABLE_RENDER_EXT || ENABLE_COMPOSITE_EXT)
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
xpp::composite::extension
|
||||||
#endif
|
#endif
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
@ -62,6 +62,12 @@ endif()
|
|||||||
if(ENABLE_DAMAGE_EXT)
|
if(ENABLE_DAMAGE_EXT)
|
||||||
set(XCB_PROTOS "${XCB_PROTOS}" damage)
|
set(XCB_PROTOS "${XCB_PROTOS}" damage)
|
||||||
endif()
|
endif()
|
||||||
|
if(ENABLE_SYNC_EXT)
|
||||||
|
set(XCB_PROTOS "${XCB_PROTOS}" sync)
|
||||||
|
endif()
|
||||||
|
if(ENABLE_COMPOSITE_EXT)
|
||||||
|
set(XCB_PROTOS "${XCB_PROTOS}" composite)
|
||||||
|
endif()
|
||||||
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/xpp ${PROJECT_BINARY_DIR}/lib/xpp)
|
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/xpp ${PROJECT_BINARY_DIR}/lib/xpp)
|
||||||
set(APP_LIBRARIES ${APP_LIBRARIES} ${XPP_LIBRARIES})
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${XPP_LIBRARIES})
|
||||||
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${XPP_INCLUDE_DIRS})
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${XPP_INCLUDE_DIRS})
|
||||||
|
@ -53,22 +53,33 @@ void connection::query_extensions() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DAMAGE_EXT
|
#if ENABLE_DAMAGE_EXT
|
||||||
damage().query_version(XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION);
|
damage().query_version(XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION);
|
||||||
if (!extension<xpp::damage::extension>()->present)
|
if (!extension<xpp::damage::extension>()->present)
|
||||||
throw application_error("Missing X extension: Damage");
|
throw application_error("Missing X extension: Damage");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RENDER_EXT
|
#if ENABLE_RENDER_EXT
|
||||||
render().query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
|
render().query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
|
||||||
if (!extension<xpp::render::extension>()->present)
|
if (!extension<xpp::render::extension>()->present)
|
||||||
throw application_error("Missing X extension: Render");
|
throw application_error("Missing X extension: Render");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_RANDR_EXT
|
#if ENABLE_RANDR_EXT
|
||||||
randr().query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
|
randr().query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
|
||||||
if (!extension<xpp::randr::extension>()->present) {
|
if (!extension<xpp::randr::extension>()->present) {
|
||||||
throw application_error("Missing X extension: RandR");
|
throw application_error("Missing X extension: RandR");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLE_SYNC_EXT
|
||||||
|
if (!extension<xpp::sync::extension>()->present) {
|
||||||
|
throw application_error("Missing X extension: Sync");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLE_COMPOSITE_EXT
|
||||||
|
composite().query_version(XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
|
||||||
|
if (!extension<xpp::composite::extension>()->present) {
|
||||||
|
throw application_error("Missing X extension: RandR");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
s_extensions_loaded = true;
|
s_extensions_loaded = true;
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,15 @@ namespace draw_util {
|
|||||||
/**
|
/**
|
||||||
* Fill region of drawable with color defined by gcontext
|
* Fill region of drawable with color defined by gcontext
|
||||||
*/
|
*/
|
||||||
void fill(connection& conn, xcb_drawable_t d, xcb_gcontext_t g, const xcb_rectangle_t rect) {
|
void fill(xcb_connection_t* c, xcb_drawable_t d, xcb_gcontext_t g, const xcb_rectangle_t rect) {
|
||||||
conn.poly_fill_rectangle(d, g, 1, &rect);
|
xcb_poly_fill_rectangle(c, d, g, 1, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill region of drawable with color defined by gcontext
|
* Fill region of drawable with color defined by gcontext
|
||||||
*/
|
*/
|
||||||
void fill(connection& conn, xcb_drawable_t d, xcb_gcontext_t g, int16_t x, int16_t y, uint16_t w, uint16_t h) {
|
void fill(xcb_connection_t* c, xcb_drawable_t d, xcb_gcontext_t g, int16_t x, int16_t y, uint16_t w, uint16_t h) {
|
||||||
fill(conn, d, g, {x, y, w, h});
|
fill(c, d, g, {x, y, w, h});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,21 @@
|
|||||||
#include "x11/xembed.hpp"
|
#include "x11/xembed.hpp"
|
||||||
#include "x11/xutils.hpp"
|
#include "x11/xutils.hpp"
|
||||||
|
|
||||||
|
// ====================================================================================================
|
||||||
|
//
|
||||||
|
// TODO: 32-bit visual
|
||||||
|
//
|
||||||
|
// _NET_SYSTEM_TRAY_VISUAL visual_id VISUALID/32
|
||||||
|
//
|
||||||
|
// The property should be set by the tray manager to indicate the preferred visual for icon windows.
|
||||||
|
//
|
||||||
|
// To avoid ambiguity about the colormap to use this visual must either be the default visual for
|
||||||
|
// the screen or it must be a TrueColor visual. If this property is set to a visual with an alpha
|
||||||
|
// channel, the tray manager must use the Composite extension to composite the icon against the
|
||||||
|
// background using PictOpOver.
|
||||||
|
//
|
||||||
|
// ====================================================================================================
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
// implementation : tray_client {{{
|
// implementation : tray_client {{{
|
||||||
|
Loading…
Reference in New Issue
Block a user