From 1dc111c0fab1db7a9d1249f3934eb4730eff6dde Mon Sep 17 00:00:00 2001 From: NBonaparte Date: Tue, 5 Sep 2017 23:35:29 -0700 Subject: [PATCH] fix: make xcb-cursor optional for now --- cmake/02-opts.cmake | 4 ++-- cmake/03-libs.cmake | 2 +- cmake/05-summary.cmake | 2 +- include/components/bar.hpp | 10 +++++++++- include/settings.hpp.cmake | 6 ++++-- include/x11/cursor.hpp | 8 +++++--- src/CMakeLists.txt | 3 +++ src/components/bar.cpp | 11 ++++++++--- 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/cmake/02-opts.cmake b/cmake/02-opts.cmake index 70ec1fbf..adefa582 100644 --- a/cmake/02-opts.cmake +++ b/cmake/02-opts.cmake @@ -9,7 +9,7 @@ checklib(ENABLE_MPD "pkg-config" libmpdclient) checklib(ENABLE_NETWORK "cmake" Libiw) checklib(WITH_XRM "pkg-config" xcb-xrm) checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12") -checklib(WITH_CURSOR "pkg-config" "xcb-cursor") +checklib(WITH_XCURSOR "pkg-config" "xcb-cursor") if(NOT DEFINED ENABLE_CCACHE AND CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) set(ENABLE_CCACHE ON) @@ -37,7 +37,7 @@ option(WITH_XSYNC "xcb-sync support" OFF) option(WITH_XCOMPOSITE "xcb-composite support" OFF) option(WITH_XKB "xcb-xkb support" ON) option(WITH_XRM "xcb-xrm support" ON) -option(WITH_CURSOR "xcb-cursor support" ON) +option(WITH_XCURSOR "xcb-cursor support" ON) if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) option(DEBUG_LOGGER "Debug logging" ON) diff --git a/cmake/03-libs.cmake b/cmake/03-libs.cmake index e7cea39c..44ddf098 100644 --- a/cmake/03-libs.cmake +++ b/cmake/03-libs.cmake @@ -20,4 +20,4 @@ querylib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12" libs dirs) querylib(WITH_XRENDER "pkg-config" xcb-render libs dirs) querylib(WITH_XRM "pkg-config" xcb-xrm libs dirs) querylib(WITH_XSYNC "pkg-config" xcb-sync libs dirs) -querylib(WITH_CURSOR "pkg-config" xcb-cursor libs dirs) +querylib(WITH_XCURSOR "pkg-config" xcb-cursor libs dirs) diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake index f56b13ee..0e3924c9 100644 --- a/cmake/05-summary.cmake +++ b/cmake/05-summary.cmake @@ -28,7 +28,7 @@ colored_option(" xcb-sync" WITH_XSYNC) colored_option(" xcb-composite" WITH_XCOMPOSITE) colored_option(" xcb-xkb" WITH_XKB) colored_option(" xcb-xrm" WITH_XRM) -colored_option(" xcb-cursor" WITH_CURSOR) +colored_option(" xcb-cursor" WITH_XCURSOR) if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG) message(STATUS " Debug options:") diff --git a/include/components/bar.hpp b/include/components/bar.hpp index cf90c5b3..8e5d1762 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -28,7 +28,11 @@ class tray_manager; class bar : public xpp::event::sink, public signal_receiver { + signals::ui::shade_window, signals::ui::unshade_window, signals::ui::dim_window +#if WITH_XCURSOR + , signals::ui::cursor_change +#endif + > { public: using make_type = unique_ptr; static make_type make(bool only_initialize_values = false); @@ -66,7 +70,9 @@ class bar : public xpp::event::sink diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 04a8a490..d2ef77fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,6 +49,9 @@ endif() if(NOT WITH_XRM) list(REMOVE_ITEM files x11/xresources.cpp) endif() +if(NOT WITH_XCURSOR) + list(REMOVE_ITEM files x11/cursor.cpp) +endif() # }}} diff --git a/src/components/bar.cpp b/src/components/bar.cpp index 6274a5bb..616f7ac3 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -16,12 +16,15 @@ #include "utils/string.hpp" #include "x11/atoms.hpp" #include "x11/connection.hpp" -#include "x11/cursor.hpp" #include "x11/ewmh.hpp" #include "x11/extensions/all.hpp" #include "x11/icccm.hpp" #include "x11/tray_manager.hpp" +#if WITH_XCURSOR +#include "x11/cursor.hpp" +#endif + #if ENABLE_I3 #include "utils/i3.hpp" #endif @@ -597,7 +600,7 @@ void bar::handle(const evt::leave_notify&) { */ void bar::handle(const evt::motion_notify& evt) { m_log.trace("bar: Detected motion: %i at pos(%i, %i)", evt->detail, evt->event_x, evt->event_y); - +#if WITH_XCURSOR m_motion_pos = evt->event_x; // scroll cursor is less important than click cursor, so we shouldn't return until we are sure there is no click action bool found_scroll = false; @@ -651,7 +654,7 @@ void bar::handle(const evt::motion_notify& evt) { m_sig.emit(cursor_change{string{m_opts.cursor}}); return; } - +#endif } /** @@ -909,6 +912,7 @@ bool bar::on(const signals::ui::dim_window& sig) { return false; } +#if WITH_XCURSOR bool bar::on(const signals::ui::cursor_change& sig) { if(!cursor_util::set_cursor(m_connection, m_connection.screen(), m_opts.window, sig.cast())) { m_log.warn("Failed to create cursor context"); @@ -916,5 +920,6 @@ bool bar::on(const signals::ui::cursor_change& sig) { m_connection.flush(); return false; } +#endif POLYBAR_NS_END