mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
fix: make xcb-cursor optional for now
This commit is contained in:
parent
65edba3321
commit
1dc111c0fa
8 changed files with 33 additions and 13 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:")
|
||||
|
|
|
@ -28,7 +28,11 @@ class tray_manager;
|
|||
class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::property_notify, evt::enter_notify,
|
||||
evt::leave_notify, evt::motion_notify, evt::destroy_notify, evt::client_message>,
|
||||
public signal_receiver<SIGN_PRIORITY_BAR, signals::eventqueue::start, signals::ui::tick,
|
||||
signals::ui::shade_window, signals::ui::unshade_window, signals::ui::dim_window, signals::ui::cursor_change> {
|
||||
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<bar>;
|
||||
static make_type make(bool only_initialize_values = false);
|
||||
|
@ -66,7 +70,9 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
bool on(const signals::ui::shade_window&);
|
||||
bool on(const signals::ui::tick&);
|
||||
bool on(const signals::ui::dim_window&);
|
||||
#if WITH_XCURSOR
|
||||
bool on(const signals::ui::cursor_change&);
|
||||
#endif
|
||||
|
||||
private:
|
||||
connection& m_connection;
|
||||
|
@ -87,7 +93,9 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
|
||||
mousebtn m_buttonpress_btn{mousebtn::NONE};
|
||||
int m_buttonpress_pos{0};
|
||||
#if WITH_XCURSOR
|
||||
int m_motion_pos{0};
|
||||
#endif
|
||||
|
||||
event_timer m_buttonpress{0L, 5L};
|
||||
event_timer m_doubleclick{0L, 150L};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#cmakedefine01 WITH_XCOMPOSITE
|
||||
#cmakedefine01 WITH_XKB
|
||||
#cmakedefine01 WITH_XRM
|
||||
#cmakedefine01 WITH_XCURSOR
|
||||
|
||||
#if WITH_XRANDR
|
||||
#cmakedefine01 WITH_XRANDR_MONITORS
|
||||
|
@ -106,7 +107,7 @@ const auto print_build_info = [](bool extended = false) {
|
|||
(ENABLE_NETWORK ? '+' : '-'));
|
||||
if (extended) {
|
||||
printf("\n");
|
||||
printf("X extensions: %crandr (%cmonitors) %crender %cdamage %csync %ccomposite %cxkb %cxrm\n",
|
||||
printf("X extensions: %crandr (%cmonitors) %crender %cdamage %csync %ccomposite %cxkb %cxrm %cxcursor\n",
|
||||
(WITH_XRANDR ? '+' : '-'),
|
||||
(WITH_XRANDR_MONITORS ? '+' : '-'),
|
||||
(WITH_XRENDER ? '+' : '-'),
|
||||
|
@ -114,7 +115,8 @@ const auto print_build_info = [](bool extended = false) {
|
|||
(WITH_XSYNC ? '+' : '-'),
|
||||
(WITH_XCOMPOSITE ? '+' : '-'),
|
||||
(WITH_XKB ? '+' : '-'),
|
||||
(WITH_XRM ? '+' : '-'));
|
||||
(WITH_XRM ? '+' : '-'),
|
||||
(WITH_XCURSOR ? '+' : '-'));
|
||||
printf("\n");
|
||||
printf("Build type: @CMAKE_BUILD_TYPE@\n");
|
||||
printf("Compiler: @CMAKE_CXX_COMPILER@\n");
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
//#if not WITH_CURSOR
|
||||
//#error "Not built with support for xcb-cursor..."
|
||||
//#endif
|
||||
#include "settings.hpp"
|
||||
|
||||
#if not WITH_XCURSOR
|
||||
#error "Not built with support for xcb-cursor..."
|
||||
#endif
|
||||
|
||||
#include <xcb/xcb_cursor.h>
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
# }}}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue