refactor: Integral types
This commit is contained in:
parent
5e1886a312
commit
452afcdc68
@ -51,13 +51,13 @@ namespace cairo {
|
||||
return *this;
|
||||
}
|
||||
|
||||
context& operator<<(const uint32_t& c) {
|
||||
context& operator<<(const unsigned int& c) {
|
||||
// clang-format off
|
||||
cairo_set_source_rgba(m_c,
|
||||
color_util::red_channel<uint8_t>(c) / 255.0,
|
||||
color_util::green_channel<uint8_t>(c) / 255.0,
|
||||
color_util::blue_channel<uint8_t>(c) / 255.0,
|
||||
color_util::alpha_channel<uint8_t>(c) / 255.0);
|
||||
color_util::red_channel<unsigned char>(c) / 255.0,
|
||||
color_util::green_channel<unsigned char>(c) / 255.0,
|
||||
color_util::blue_channel<unsigned char>(c) / 255.0,
|
||||
color_util::alpha_channel<unsigned char>(c) / 255.0);
|
||||
// clang-format on
|
||||
return *this;
|
||||
}
|
||||
@ -105,10 +105,10 @@ namespace cairo {
|
||||
for (auto&& color : l.steps) {
|
||||
// clang-format off
|
||||
cairo_pattern_add_color_stop_rgba(pattern, offset,
|
||||
color_util::red_channel<uint8_t>(color) / 255.0,
|
||||
color_util::green_channel<uint8_t>(color) / 255.0,
|
||||
color_util::blue_channel<uint8_t>(color) / 255.0,
|
||||
color_util::alpha_channel<uint8_t>(color) / 255.0);
|
||||
color_util::red_channel<unsigned char>(color) / 255.0,
|
||||
color_util::green_channel<unsigned char>(color) / 255.0,
|
||||
color_util::blue_channel<unsigned char>(color) / 255.0,
|
||||
color_util::alpha_channel<unsigned char>(color) / 255.0);
|
||||
// clang-format on
|
||||
offset += step;
|
||||
}
|
||||
@ -130,7 +130,7 @@ namespace cairo {
|
||||
|
||||
string utf8 = string(t.contents);
|
||||
unicode_charlist chars;
|
||||
utils::utf8_to_ucs4((const uint8_t*)utf8.c_str(), chars);
|
||||
utils::utf8_to_ucs4((const unsigned char*)utf8.c_str(), chars);
|
||||
|
||||
while (!chars.empty()) {
|
||||
auto remaining = chars.size();
|
||||
|
@ -34,12 +34,12 @@ namespace cairo {
|
||||
double y0;
|
||||
double x1;
|
||||
double y1;
|
||||
vector<uint32_t> steps;
|
||||
vector<unsigned int> steps;
|
||||
};
|
||||
|
||||
struct textblock {
|
||||
string contents;
|
||||
uint8_t fontindex;
|
||||
unsigned char fontindex;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace cairo {
|
||||
/**
|
||||
* @brief Convert a UCS-4 codepoint to a utf-8 encoded string
|
||||
*/
|
||||
size_t ucs4_to_utf8(char* utf8, uint32_t ucs) {
|
||||
size_t ucs4_to_utf8(char* utf8, unsigned int ucs) {
|
||||
if (ucs <= 0x7f) {
|
||||
*utf8 = ucs;
|
||||
return 1;
|
||||
|
@ -81,7 +81,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||
std::atomic<bool> m_dblclicks{false};
|
||||
|
||||
mousebtn m_buttonpress_btn{mousebtn::NONE};
|
||||
int16_t m_buttonpress_pos{0};
|
||||
int m_buttonpress_pos{0};
|
||||
|
||||
event_timer m_buttonpress{0L, 5L};
|
||||
event_timer m_doubleclick{0L, 150L};
|
||||
|
@ -71,8 +71,8 @@ class builder {
|
||||
map<syntaxtag, int> m_tags{};
|
||||
map<syntaxtag, string> m_colors{};
|
||||
|
||||
uint8_t m_attributes{0};
|
||||
uint8_t m_fontindex{0};
|
||||
int m_attributes{0};
|
||||
int m_fontindex{0};
|
||||
|
||||
string m_background{};
|
||||
string m_foreground{};
|
||||
|
@ -16,7 +16,7 @@ POLYBAR_NS
|
||||
|
||||
// fwd decl {{{
|
||||
|
||||
enum class alignment : uint8_t;
|
||||
enum class alignment;
|
||||
class bar;
|
||||
class command;
|
||||
class config;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
enum class loglevel : uint8_t {
|
||||
enum class loglevel {
|
||||
NONE = 0,
|
||||
ERROR,
|
||||
WARNING,
|
||||
|
@ -6,8 +6,8 @@
|
||||
POLYBAR_NS
|
||||
|
||||
class signal_emitter;
|
||||
enum class attribute : uint8_t;
|
||||
enum class mousebtn : uint8_t;
|
||||
enum class attribute;
|
||||
enum class mousebtn;
|
||||
struct bar_settings;
|
||||
|
||||
DEFINE_ERROR(parser_error);
|
||||
@ -28,8 +28,8 @@ class parser {
|
||||
void codeblock(string&& data, const bar_settings& bar);
|
||||
size_t text(string&& data);
|
||||
|
||||
uint32_t parse_color(const string& s, uint32_t fallback = 0);
|
||||
uint8_t parse_fontindex(const string& s);
|
||||
unsigned int parse_color(const string& s, unsigned int fallback = 0);
|
||||
int parse_fontindex(const string& s);
|
||||
attribute parse_attr(const char attr);
|
||||
mousebtn parse_action_btn(const string& data);
|
||||
string parse_action_cmd(string&& data);
|
||||
|
@ -42,7 +42,7 @@ class renderer
|
||||
void end();
|
||||
void flush();
|
||||
|
||||
void reserve_space(edge side, uint16_t w);
|
||||
void reserve_space(edge side, unsigned int w);
|
||||
void fill_background();
|
||||
void fill_overline(double x, double w);
|
||||
void fill_underline(double x, double w);
|
||||
@ -70,7 +70,7 @@ class renderer
|
||||
protected:
|
||||
struct reserve_area {
|
||||
edge side{edge::NONE};
|
||||
uint16_t size{0U};
|
||||
unsigned int size{0U};
|
||||
};
|
||||
|
||||
private:
|
||||
@ -83,7 +83,7 @@ class renderer
|
||||
xcb_rectangle_t m_rect{0, 0, 0U, 0U};
|
||||
reserve_area m_cleararea{};
|
||||
|
||||
uint8_t m_depth{32};
|
||||
int m_depth{32};
|
||||
xcb_window_t m_window;
|
||||
xcb_colormap_t m_colormap;
|
||||
xcb_visualtype_t* m_visual;
|
||||
@ -106,12 +106,12 @@ class renderer
|
||||
alignment m_alignment{alignment::NONE};
|
||||
std::bitset<2> m_attributes;
|
||||
|
||||
uint8_t m_fontindex;
|
||||
int m_fontindex;
|
||||
|
||||
uint32_t m_color_background;
|
||||
uint32_t m_color_foreground;
|
||||
uint32_t m_color_overline;
|
||||
uint32_t m_color_underline;
|
||||
unsigned int m_color_background;
|
||||
unsigned int m_color_foreground;
|
||||
unsigned int m_color_overline;
|
||||
unsigned int m_color_underline;
|
||||
|
||||
double m_x{0.0};
|
||||
double m_y{0.0};
|
||||
|
@ -21,14 +21,14 @@ struct enum_hash {
|
||||
}
|
||||
};
|
||||
|
||||
enum class edge : uint8_t { NONE = 0U, TOP, BOTTOM, LEFT, RIGHT, ALL };
|
||||
enum class edge { NONE = 0, TOP, BOTTOM, LEFT, RIGHT, ALL };
|
||||
|
||||
enum class alignment : uint8_t { NONE = 0U, LEFT, CENTER, RIGHT };
|
||||
enum class alignment { NONE = 0, LEFT, CENTER, RIGHT };
|
||||
|
||||
enum class attribute : uint8_t { NONE = 0U, UNDERLINE, OVERLINE };
|
||||
enum class attribute { NONE = 0, UNDERLINE, OVERLINE };
|
||||
|
||||
enum class syntaxtag : uint8_t {
|
||||
NONE = 0U,
|
||||
enum class syntaxtag {
|
||||
NONE = 0,
|
||||
A, // mouse action
|
||||
B, // background color
|
||||
F, // foreground color
|
||||
@ -39,8 +39,8 @@ enum class syntaxtag : uint8_t {
|
||||
u, // underline color
|
||||
};
|
||||
|
||||
enum class mousebtn : uint8_t {
|
||||
NONE = 0U,
|
||||
enum class mousebtn {
|
||||
NONE = 0,
|
||||
LEFT,
|
||||
MIDDLE,
|
||||
RIGHT,
|
||||
@ -51,8 +51,8 @@ enum class mousebtn : uint8_t {
|
||||
DOUBLE_RIGHT
|
||||
};
|
||||
|
||||
enum class strut : uint16_t {
|
||||
LEFT = 0U,
|
||||
enum class strut {
|
||||
LEFT = 0,
|
||||
RIGHT,
|
||||
TOP,
|
||||
BOTTOM,
|
||||
@ -67,35 +67,35 @@ enum class strut : uint16_t {
|
||||
};
|
||||
|
||||
struct position {
|
||||
int16_t x{0};
|
||||
int16_t y{0};
|
||||
int x{0};
|
||||
int y{0};
|
||||
};
|
||||
|
||||
struct size {
|
||||
uint16_t w{1U};
|
||||
uint16_t h{1U};
|
||||
unsigned int w{1U};
|
||||
unsigned int h{1U};
|
||||
};
|
||||
|
||||
struct side_values {
|
||||
uint16_t left{0U};
|
||||
uint16_t right{0U};
|
||||
unsigned int left{0U};
|
||||
unsigned int right{0U};
|
||||
};
|
||||
|
||||
struct edge_values {
|
||||
uint16_t left{0U};
|
||||
uint16_t right{0U};
|
||||
uint16_t top{0U};
|
||||
uint16_t bottom{0U};
|
||||
unsigned int left{0U};
|
||||
unsigned int right{0U};
|
||||
unsigned int top{0U};
|
||||
unsigned int bottom{0U};
|
||||
};
|
||||
|
||||
struct border_settings {
|
||||
uint32_t color{0xFF000000};
|
||||
uint16_t size{0U};
|
||||
unsigned int color{0xFF000000};
|
||||
unsigned int size{0U};
|
||||
};
|
||||
|
||||
struct line_settings {
|
||||
uint32_t color{0xFF000000};
|
||||
uint16_t size{0U};
|
||||
unsigned int color{0xFF000000};
|
||||
unsigned int size{0U};
|
||||
};
|
||||
|
||||
struct action {
|
||||
@ -109,12 +109,12 @@ struct action_block : public action {
|
||||
double end_x{0.0};
|
||||
bool active{true};
|
||||
|
||||
uint16_t width() const {
|
||||
return static_cast<uint16_t>(end_x - start_x + 0.5);
|
||||
unsigned int width() const {
|
||||
return static_cast<unsigned int>(end_x - start_x + 0.5);
|
||||
}
|
||||
|
||||
bool test(int16_t point) const {
|
||||
return static_cast<int16_t>(start_x) < point && static_cast<int16_t>(end_x) >= point;
|
||||
bool test(int point) const {
|
||||
return static_cast<int>(start_x) < point && static_cast<int>(end_x) >= point;
|
||||
}
|
||||
};
|
||||
|
||||
@ -136,16 +136,16 @@ struct bar_settings {
|
||||
side_values module_margin{0U, 0U};
|
||||
edge_values strut{0U, 0U, 0U, 0U};
|
||||
|
||||
uint32_t background{0xFF000000};
|
||||
uint32_t foreground{0xFFFFFFFF};
|
||||
vector<uint32_t> background_steps;
|
||||
unsigned int background{0xFF000000};
|
||||
unsigned int foreground{0xFFFFFFFF};
|
||||
vector<unsigned int> background_steps;
|
||||
|
||||
line_settings underline{};
|
||||
line_settings overline{};
|
||||
|
||||
std::unordered_map<edge, border_settings, enum_hash> borders{};
|
||||
|
||||
uint8_t spacing{0};
|
||||
int spacing{0};
|
||||
string separator{};
|
||||
|
||||
string wmname{};
|
||||
@ -165,7 +165,9 @@ struct bar_settings {
|
||||
position shade_pos{1U, 1U};
|
||||
|
||||
const xcb_rectangle_t inner_area(bool abspos = false) const {
|
||||
xcb_rectangle_t rect{0, 0, size.w, size.h};
|
||||
xcb_rectangle_t rect{0, 0, 0, 0};
|
||||
rect.width += size.w;
|
||||
rect.height += size.h;
|
||||
|
||||
if (abspos) {
|
||||
rect.x = pos.x;
|
||||
|
@ -10,10 +10,10 @@
|
||||
POLYBAR_NS
|
||||
|
||||
// fwd
|
||||
enum class mousebtn : uint8_t;
|
||||
enum class syntaxtag : uint8_t;
|
||||
enum class alignment : uint8_t;
|
||||
enum class attribute : uint8_t;
|
||||
enum class mousebtn;
|
||||
enum class syntaxtag;
|
||||
enum class alignment;
|
||||
enum class attribute;
|
||||
|
||||
namespace signals {
|
||||
namespace detail {
|
||||
@ -120,25 +120,25 @@ namespace signals {
|
||||
}
|
||||
|
||||
namespace parser {
|
||||
struct change_background : public detail::value_signal<change_background, uint32_t> {
|
||||
struct change_background : public detail::value_signal<change_background, unsigned int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct change_foreground : public detail::value_signal<change_foreground, uint32_t> {
|
||||
struct change_foreground : public detail::value_signal<change_foreground, unsigned int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct change_underline : public detail::value_signal<change_underline, uint32_t> {
|
||||
struct change_underline : public detail::value_signal<change_underline, unsigned int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct change_overline : public detail::value_signal<change_overline, uint32_t> {
|
||||
struct change_overline : public detail::value_signal<change_overline, unsigned int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct change_font : public detail::value_signal<change_font, uint8_t> {
|
||||
struct change_font : public detail::value_signal<change_font, int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct change_alignment : public detail::value_signal<change_alignment, alignment> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct offset_pixel : public detail::value_signal<offset_pixel, int16_t> {
|
||||
struct offset_pixel : public detail::value_signal<offset_pixel, int> {
|
||||
using base_type::base_type;
|
||||
};
|
||||
struct attribute_set : public detail::value_signal<attribute_set, attribute> {
|
||||
|
@ -41,12 +41,12 @@ class signal_emitter {
|
||||
return emit<Signal>(sig) || emit<Next, Signals...>(sig);
|
||||
}
|
||||
|
||||
template <uint8_t Priority, typename Signal, typename... Signals>
|
||||
template <int Priority, typename Signal, typename... Signals>
|
||||
void attach(signal_receiver<Priority, Signal, Signals...>* s) {
|
||||
attach<signal_receiver<Priority, Signal, Signals...>, Signal, Signals...>(s);
|
||||
}
|
||||
|
||||
template <uint8_t Priority, typename Signal, typename... Signals>
|
||||
template <int Priority, typename Signal, typename... Signals>
|
||||
void detach(signal_receiver<Priority, Signal, Signals...>* s) {
|
||||
detach<signal_receiver<Priority, Signal, Signals...>, Signal, Signals...>(s);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ POLYBAR_NS
|
||||
|
||||
class signal_emitter;
|
||||
class signal_receiver_interface;
|
||||
template <uint8_t Priority, typename Signal, typename... Signals>
|
||||
template <int Priority, typename Signal, typename... Signals>
|
||||
class signal_receiver;
|
||||
|
||||
namespace signals {
|
||||
|
@ -11,7 +11,7 @@ POLYBAR_NS
|
||||
|
||||
class signal_receiver_interface {
|
||||
public:
|
||||
using prio = unsigned int;
|
||||
using prio = int;
|
||||
using prio_map = std::multimap<prio, signal_receiver_interface*>;
|
||||
virtual ~signal_receiver_interface() {}
|
||||
virtual prio priority() const = 0;
|
||||
@ -37,7 +37,7 @@ bool signal_receiver_interface::on(const Signal& s) {
|
||||
}
|
||||
}
|
||||
|
||||
template <uint8_t Priority, typename Signal, typename... Signals>
|
||||
template <int Priority, typename Signal, typename... Signals>
|
||||
class signal_receiver : public signal_receiver_interface,
|
||||
public signal_receiver_impl<Signal>,
|
||||
public signal_receiver_impl<Signals>... {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
enum class event_type : uint8_t {
|
||||
enum class event_type {
|
||||
NONE = 0,
|
||||
UPDATE,
|
||||
CHECK,
|
||||
@ -15,44 +15,44 @@ enum class event_type : uint8_t {
|
||||
};
|
||||
|
||||
struct event {
|
||||
uint8_t type{0};
|
||||
int type{0};
|
||||
bool flag{false};
|
||||
};
|
||||
|
||||
namespace {
|
||||
inline bool operator==(uint8_t id, event_type type) {
|
||||
return id == static_cast<uint8_t>(type);
|
||||
inline bool operator==(int id, event_type type) {
|
||||
return id == static_cast<int>(type);
|
||||
}
|
||||
inline bool operator!=(uint8_t id, event_type type) {
|
||||
return !(id == static_cast<uint8_t>(type));
|
||||
inline bool operator!=(int id, event_type type) {
|
||||
return !(id == static_cast<int>(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create QUIT event
|
||||
*/
|
||||
inline event make_quit_evt(bool reload = false) {
|
||||
return event{static_cast<uint8_t>(event_type::QUIT), reload};
|
||||
return event{static_cast<int>(event_type::QUIT), reload};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create UPDATE event
|
||||
*/
|
||||
inline event make_update_evt(bool force = false) {
|
||||
return event{static_cast<uint8_t>(event_type::UPDATE), force};
|
||||
return event{static_cast<int>(event_type::UPDATE), force};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create INPUT event
|
||||
*/
|
||||
inline event make_input_evt() {
|
||||
return event{static_cast<uint8_t>(event_type::INPUT)};
|
||||
return event{static_cast<int>(event_type::INPUT)};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CHECK event
|
||||
*/
|
||||
inline event make_check_evt() {
|
||||
return event{static_cast<uint8_t>(event_type::CHECK)};
|
||||
return event{static_cast<int>(event_type::CHECK)};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace modules {
|
||||
};
|
||||
|
||||
struct bspwm_monitor {
|
||||
vector<pair<uint32_t, label_t>> workspaces;
|
||||
vector<pair<unsigned int, label_t>> workspaces;
|
||||
vector<label_t> modes;
|
||||
label_t label;
|
||||
string name;
|
||||
@ -69,7 +69,7 @@ namespace modules {
|
||||
vector<unique_ptr<bspwm_monitor>> m_monitors;
|
||||
|
||||
map<mode, label_t> m_modelabels;
|
||||
map<uint32_t, label_t> m_statelabels;
|
||||
map<unsigned int, label_t> m_statelabels;
|
||||
label_t m_monitorlabel;
|
||||
iconset_t m_icons;
|
||||
|
||||
|
@ -5,50 +5,50 @@
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
static cache<string, uint32_t> g_cache_hex;
|
||||
static cache<uint32_t, string> g_cache_colors;
|
||||
static cache<string, unsigned int> g_cache_hex;
|
||||
static cache<unsigned int, string> g_cache_colors;
|
||||
|
||||
struct rgba;
|
||||
|
||||
namespace color_util {
|
||||
template <typename T = uint8_t>
|
||||
T alpha_channel(const uint32_t value) {
|
||||
uint8_t a = value >> 24;
|
||||
if (std::is_same<T, uint8_t>::value)
|
||||
template <typename T = unsigned char>
|
||||
T alpha_channel(const unsigned int value) {
|
||||
unsigned char a = value >> 24;
|
||||
if (std::is_same<T, unsigned char>::value)
|
||||
return a << 8 / 0xff;
|
||||
else if (std::is_same<T, uint16_t>::value)
|
||||
else if (std::is_same<T, unsigned short int>::value)
|
||||
return a << 8 | a << 8 / 0xff;
|
||||
}
|
||||
|
||||
template <typename T = uint8_t>
|
||||
T red_channel(const uint32_t value) {
|
||||
uint8_t r = value >> 16;
|
||||
if (std::is_same<T, uint8_t>::value)
|
||||
template <typename T = unsigned char>
|
||||
T red_channel(const unsigned int value) {
|
||||
unsigned char r = value >> 16;
|
||||
if (std::is_same<T, unsigned char>::value)
|
||||
return r << 8 / 0xff;
|
||||
else if (std::is_same<T, uint16_t>::value)
|
||||
else if (std::is_same<T, unsigned short int>::value)
|
||||
return r << 8 | r << 8 / 0xff;
|
||||
}
|
||||
|
||||
template <typename T = uint8_t>
|
||||
T green_channel(const uint32_t value) {
|
||||
uint8_t g = value >> 8;
|
||||
if (std::is_same<T, uint8_t>::value)
|
||||
template <typename T = unsigned char>
|
||||
T green_channel(const unsigned int value) {
|
||||
unsigned char g = value >> 8;
|
||||
if (std::is_same<T, unsigned char>::value)
|
||||
return g << 8 / 0xff;
|
||||
else if (std::is_same<T, uint16_t>::value)
|
||||
else if (std::is_same<T, unsigned short int>::value)
|
||||
return g << 8 | g << 8 / 0xff;
|
||||
}
|
||||
|
||||
template <typename T = uint8_t>
|
||||
T blue_channel(const uint32_t value) {
|
||||
uint8_t b = value;
|
||||
if (std::is_same<T, uint8_t>::value)
|
||||
template <typename T = unsigned char>
|
||||
T blue_channel(const unsigned int value) {
|
||||
unsigned char b = value;
|
||||
if (std::is_same<T, unsigned char>::value)
|
||||
return b << 8 / 0xff;
|
||||
else if (std::is_same<T, uint16_t>::value)
|
||||
else if (std::is_same<T, unsigned short int>::value)
|
||||
return b << 8 | b << 8 / 0xff;
|
||||
}
|
||||
|
||||
template <typename T = uint32_t>
|
||||
uint32_t premultiply_alpha(const T value) {
|
||||
template <typename T = unsigned int>
|
||||
unsigned int premultiply_alpha(const T value) {
|
||||
auto a = color_util::alpha_channel(value);
|
||||
auto r = color_util::red_channel(value) * a / 255;
|
||||
auto g = color_util::green_channel(value) * a / 255;
|
||||
@ -57,21 +57,21 @@ namespace color_util {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
string hex(uint32_t color) {
|
||||
string hex(unsigned int color) {
|
||||
string hex;
|
||||
|
||||
if (!g_cache_hex.check(color)) {
|
||||
char s[12];
|
||||
size_t len = 0;
|
||||
|
||||
uint8_t a = alpha_channel<T>(color);
|
||||
uint8_t r = red_channel<T>(color);
|
||||
uint8_t g = green_channel<T>(color);
|
||||
uint8_t b = blue_channel<T>(color);
|
||||
unsigned char a = alpha_channel<T>(color);
|
||||
unsigned char r = red_channel<T>(color);
|
||||
unsigned char g = green_channel<T>(color);
|
||||
unsigned char b = blue_channel<T>(color);
|
||||
|
||||
if (std::is_same<T, uint16_t>::value) {
|
||||
if (std::is_same<T, unsigned short int>::value) {
|
||||
len = snprintf(s, sizeof(s), "#%02x%02x%02x%02x", a, r, g, b);
|
||||
} else if (std::is_same<T, uint8_t>::value) {
|
||||
} else if (std::is_same<T, unsigned char>::value) {
|
||||
len = snprintf(s, sizeof(s), "#%02x%02x%02x", r, g, b);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace color_util {
|
||||
return hex;
|
||||
}
|
||||
|
||||
inline uint32_t parse(string hex, uint32_t fallback = 0) {
|
||||
inline unsigned int parse(string hex, unsigned int fallback = 0) {
|
||||
if ((hex = parse_hex(hex)).empty())
|
||||
return fallback;
|
||||
return strtoul(&hex[1], nullptr, 16);
|
||||
@ -123,10 +123,10 @@ struct rgb {
|
||||
|
||||
// clang-format off
|
||||
explicit rgb(double r, double g, double b) : r(r), g(g), b(b) {}
|
||||
explicit rgb(uint32_t color) : rgb(
|
||||
color_util::red_channel<uint8_t>(color_util::premultiply_alpha(color) / 255.0),
|
||||
color_util::green_channel<uint8_t>(color_util::premultiply_alpha(color) / 255.0),
|
||||
color_util::blue_channel<uint8_t>(color_util::premultiply_alpha(color) / 255.0)) {}
|
||||
explicit rgb(unsigned int color) : rgb(
|
||||
color_util::red_channel<unsigned char>(color_util::premultiply_alpha(color) / 255.0),
|
||||
color_util::green_channel<unsigned char>(color_util::premultiply_alpha(color) / 255.0),
|
||||
color_util::blue_channel<unsigned char>(color_util::premultiply_alpha(color) / 255.0)) {}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@ -138,14 +138,14 @@ struct rgba {
|
||||
|
||||
// clang-format off
|
||||
explicit rgba(double r, double g, double b, double a) : r(r), g(g), b(b), a(a) {}
|
||||
explicit rgba(uint32_t color) : rgba(
|
||||
color_util::red_channel<uint8_t>(color) / 255.0,
|
||||
color_util::green_channel<uint8_t>(color) / 255.0,
|
||||
color_util::blue_channel<uint8_t>(color) / 255.0,
|
||||
color_util::alpha_channel<uint8_t>(color) / 255.0) {}
|
||||
explicit rgba(unsigned int color) : rgba(
|
||||
color_util::red_channel<unsigned char>(color) / 255.0,
|
||||
color_util::green_channel<unsigned char>(color) / 255.0,
|
||||
color_util::blue_channel<unsigned char>(color) / 255.0,
|
||||
color_util::alpha_channel<unsigned char>(color) / 255.0) {}
|
||||
// clang-format on
|
||||
|
||||
operator uint32_t() {
|
||||
operator unsigned int() {
|
||||
// clang-format off
|
||||
return static_cast<int>(a * 255) << 24
|
||||
| static_cast<int>(r * 255) << 16
|
||||
|
@ -125,23 +125,23 @@ class connection : public detail::connection_base<connection&, XPP_EXTENSION_LIS
|
||||
return o;
|
||||
}
|
||||
|
||||
static void pack_values(uint32_t mask, const uint32_t* src, uint32_t* dest);
|
||||
static void pack_values(uint32_t mask, const xcb_params_cw_t* src, uint32_t* dest);
|
||||
static void pack_values(uint32_t mask, const xcb_params_gc_t* src, uint32_t* dest);
|
||||
static void pack_values(uint32_t mask, const xcb_params_configure_window_t* src, uint32_t* dest);
|
||||
static void pack_values(unsigned int mask, const unsigned int* src, unsigned int* dest);
|
||||
static void pack_values(unsigned int mask, const xcb_params_cw_t* src, unsigned int* dest);
|
||||
static void pack_values(unsigned int mask, const xcb_params_gc_t* src, unsigned int* dest);
|
||||
static void pack_values(unsigned int mask, const xcb_params_configure_window_t* src, unsigned int* dest);
|
||||
|
||||
operator Display*() const;
|
||||
Visual* visual(uint8_t depth = 32U);
|
||||
Visual* visual(unsigned char depth = 32U);
|
||||
xcb_screen_t* screen(bool realloc = false);
|
||||
|
||||
string id(xcb_window_t w) const;
|
||||
|
||||
void ensure_event_mask(xcb_window_t win, uint32_t event);
|
||||
void ensure_event_mask(xcb_window_t win, unsigned int event);
|
||||
void clear_event_mask(xcb_window_t win);
|
||||
|
||||
shared_ptr<xcb_client_message_event_t> make_client_message(xcb_atom_t type, xcb_window_t target) const;
|
||||
void send_client_message(const shared_ptr<xcb_client_message_event_t>& message, xcb_window_t target,
|
||||
uint32_t event_mask = 0xFFFFFF, bool propagate = false) const;
|
||||
unsigned int event_mask = 0xFFFFFF, bool propagate = false) const;
|
||||
|
||||
xcb_visualtype_t* visual_type(xcb_screen_t* screen, int match_depth = 32);
|
||||
|
||||
@ -149,7 +149,7 @@ class connection : public detail::connection_base<connection&, XPP_EXTENSION_LIS
|
||||
|
||||
void dispatch_event(const shared_ptr<xcb_generic_event_t>& evt) const;
|
||||
|
||||
template <typename Event, uint32_t ResponseType>
|
||||
template <typename Event, unsigned int ResponseType>
|
||||
void wait_for_response(function<bool(const Event*)> check_event) {
|
||||
int fd = get_file_descriptor();
|
||||
shared_ptr<xcb_generic_event_t> evt{};
|
||||
@ -182,7 +182,7 @@ class connection : public detail::connection_base<connection&, XPP_EXTENSION_LIS
|
||||
|
||||
protected:
|
||||
Display* m_display{nullptr};
|
||||
map<uint8_t, Visual*> m_visual;
|
||||
map<unsigned char, Visual*> m_visual;
|
||||
registry m_registry{*this};
|
||||
xcb_screen_t* m_screen{nullptr};
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ POLYBAR_NS
|
||||
|
||||
namespace draw_util {
|
||||
void fill(xcb_connection_t* c, 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, 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, short int x, short int y, unsigned short int w, unsigned short int h);
|
||||
}
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
@ -23,10 +23,10 @@ namespace ewmh_util {
|
||||
|
||||
vector<position> get_desktop_viewports(xcb_ewmh_connection_t* conn, int screen = 0);
|
||||
vector<string> get_desktop_names(xcb_ewmh_connection_t* conn, int screen = 0);
|
||||
uint32_t get_current_desktop(xcb_ewmh_connection_t* conn, int screen = 0);
|
||||
unsigned int get_current_desktop(xcb_ewmh_connection_t* conn, int screen = 0);
|
||||
xcb_window_t get_active_window(xcb_ewmh_connection_t* conn, int screen = 0);
|
||||
|
||||
void change_current_desktop(xcb_ewmh_connection_t* conn, uint32_t desktop);
|
||||
void change_current_desktop(xcb_ewmh_connection_t* conn, unsigned int desktop);
|
||||
}
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
@ -22,7 +22,7 @@ namespace evt {
|
||||
}
|
||||
|
||||
struct backlight_values {
|
||||
uint32_t atom{0};
|
||||
unsigned int atom{0};
|
||||
double min{0.0};
|
||||
double max{0.0};
|
||||
double val{0.0};
|
||||
@ -30,10 +30,10 @@ struct backlight_values {
|
||||
|
||||
struct randr_output {
|
||||
string name;
|
||||
uint16_t w{0U};
|
||||
uint16_t h{0U};
|
||||
int16_t x{0};
|
||||
int16_t y{0};
|
||||
unsigned short int w{0U};
|
||||
unsigned short int h{0U};
|
||||
short int x{0};
|
||||
short int y{0};
|
||||
xcb_randr_output_t output;
|
||||
backlight_values backlight;
|
||||
|
||||
@ -48,7 +48,7 @@ namespace randr_util {
|
||||
|
||||
bool check_monitor_support();
|
||||
|
||||
monitor_t make_monitor(xcb_randr_output_t randr, string name, uint16_t w, uint16_t h, int16_t x, int16_t y);
|
||||
monitor_t make_monitor(xcb_randr_output_t randr, string name, unsigned short int w, unsigned short int h, short int x, short int y);
|
||||
vector<monitor_t> get_monitors(connection& conn, xcb_window_t root, bool connected_only = false, bool realloc = false);
|
||||
|
||||
void get_backlight_range(connection& conn, const monitor_t& mon, backlight_values& dst);
|
||||
|
@ -51,7 +51,7 @@ class keyboard {
|
||||
struct indicator {
|
||||
enum class type { NONE = 0U, CAPS_LOCK, NUM_LOCK };
|
||||
xcb_atom_t atom{};
|
||||
uint8_t mask{0};
|
||||
unsigned char mask{0};
|
||||
string name{};
|
||||
bool enabled{false};
|
||||
};
|
||||
@ -61,14 +61,14 @@ class keyboard {
|
||||
vector<string> symbols{};
|
||||
};
|
||||
|
||||
explicit keyboard(vector<layout>&& layouts_, map<indicator::type, indicator>&& indicators_, uint8_t group)
|
||||
explicit keyboard(vector<layout>&& layouts_, map<indicator::type, indicator>&& indicators_, unsigned char group)
|
||||
: layouts(forward<decltype(layouts)>(layouts_)), indicators(forward<decltype(indicators)>(indicators_)), current_group(group) {}
|
||||
|
||||
const indicator& get(const indicator::type& i) const;
|
||||
void set(uint32_t state);
|
||||
void set(unsigned int state);
|
||||
bool on(const indicator::type&) const;
|
||||
void current(uint8_t group);
|
||||
uint8_t current() const;
|
||||
void current(unsigned char group);
|
||||
unsigned char current() const;
|
||||
const string group_name(size_t index = 0) const;
|
||||
const string layout_name(size_t index = 0) const;
|
||||
const string indicator_name(const indicator::type&) const;
|
||||
@ -77,7 +77,7 @@ class keyboard {
|
||||
private:
|
||||
vector<layout> layouts;
|
||||
map<indicator::type, indicator> indicators;
|
||||
uint8_t current_group{0};
|
||||
unsigned char current_group{0};
|
||||
};
|
||||
|
||||
namespace xkb_util {
|
||||
@ -85,8 +85,8 @@ namespace xkb_util {
|
||||
|
||||
void query_extension(connection& conn);
|
||||
|
||||
void switch_layout(connection& conn, xcb_xkb_device_spec_t device, uint8_t index);
|
||||
uint8_t get_current_group(connection& conn, xcb_xkb_device_spec_t device);
|
||||
void switch_layout(connection& conn, xcb_xkb_device_spec_t device, unsigned char index);
|
||||
unsigned char get_current_group(connection& conn, xcb_xkb_device_spec_t device);
|
||||
vector<keyboard::layout> get_layouts(connection& conn, xcb_xkb_device_spec_t device);
|
||||
map<keyboard::indicator::type, keyboard::indicator> get_indicators(connection& conn, xcb_xkb_device_spec_t device);
|
||||
string parse_layout_symbol(string&& name);
|
||||
|
@ -9,18 +9,18 @@ POLYBAR_NS
|
||||
|
||||
namespace graphics_util {
|
||||
struct root_pixmap {
|
||||
uint8_t depth{0};
|
||||
uint16_t width{0};
|
||||
uint16_t height{0};
|
||||
int16_t x{0};
|
||||
int16_t y{0};
|
||||
unsigned char depth{0};
|
||||
unsigned short int width{0};
|
||||
unsigned short int height{0};
|
||||
short int x{0};
|
||||
short int y{0};
|
||||
xcb_pixmap_t pixmap{0};
|
||||
};
|
||||
|
||||
bool create_window(connection& conn, xcb_window_t* win, int16_t x = 0, int16_t y = 0, uint16_t w = 1, uint16_t h = 1,
|
||||
bool create_window(connection& conn, xcb_window_t* win, short int x = 0, short int y = 0, unsigned short int w = 1, unsigned short int h = 1,
|
||||
xcb_window_t root = 0);
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, uint16_t w, uint16_t h, xcb_pixmap_t* pixmap);
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, uint16_t w, uint16_t h, uint8_t d, xcb_pixmap_t* pixmap);
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, unsigned short int w, unsigned short int h, xcb_pixmap_t* pixmap);
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, unsigned short int w, unsigned short int h, unsigned char d, xcb_pixmap_t* pixmap);
|
||||
bool create_gc(connection& conn, xcb_drawable_t drawable, xcb_gcontext_t* gc);
|
||||
|
||||
bool get_root_pixmap(connection& conn, root_pixmap* rpix);
|
||||
|
@ -13,14 +13,14 @@ struct xembed_data;
|
||||
|
||||
class tray_client {
|
||||
public:
|
||||
explicit tray_client(connection& conn, xcb_window_t win, uint16_t w, uint16_t h);
|
||||
explicit tray_client(connection& conn, xcb_window_t win, unsigned int w, unsigned int h);
|
||||
tray_client(const tray_client& c) = default;
|
||||
tray_client& operator=(tray_client& c) = default;
|
||||
|
||||
~tray_client();
|
||||
|
||||
uint16_t width() const;
|
||||
uint16_t height() const;
|
||||
unsigned int width() const;
|
||||
unsigned int height() const;
|
||||
void clear_window() const;
|
||||
|
||||
bool match(const xcb_window_t& win) const;
|
||||
@ -31,8 +31,8 @@ class tray_client {
|
||||
xembed_data* xembed() const;
|
||||
|
||||
void ensure_state() const;
|
||||
void reconfigure(int16_t x, int16_t y) const;
|
||||
void configure_notify(int16_t x, int16_t y) const;
|
||||
void reconfigure(int x, int y) const;
|
||||
void configure_notify(int x, int y) const;
|
||||
|
||||
protected:
|
||||
connection& m_connection;
|
||||
@ -41,8 +41,8 @@ class tray_client {
|
||||
shared_ptr<xembed_data> m_xembed;
|
||||
bool m_mapped{false};
|
||||
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
unsigned int m_width;
|
||||
unsigned int m_height;
|
||||
};
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
@ -43,21 +43,21 @@ struct tray_settings {
|
||||
tray_settings& operator=(const tray_settings& o) = default;
|
||||
|
||||
alignment align{alignment::NONE};
|
||||
int16_t running{false};
|
||||
int16_t orig_x{0};
|
||||
int16_t orig_y{0};
|
||||
int16_t configured_x{0};
|
||||
int16_t configured_y{0};
|
||||
uint16_t configured_w{0};
|
||||
uint16_t configured_h{0};
|
||||
uint16_t configured_slots{0};
|
||||
uint16_t width{0};
|
||||
uint16_t width_max{0};
|
||||
uint16_t height{0};
|
||||
uint16_t height_fill{0};
|
||||
uint16_t spacing{0};
|
||||
uint32_t sibling{0};
|
||||
uint32_t background{0};
|
||||
bool running{false};
|
||||
int orig_x{0};
|
||||
int orig_y{0};
|
||||
int configured_x{0};
|
||||
int configured_y{0};
|
||||
unsigned int configured_w{0};
|
||||
unsigned int configured_h{0};
|
||||
unsigned int configured_slots{0};
|
||||
unsigned int width{0};
|
||||
unsigned int width_max{0};
|
||||
unsigned int height{0};
|
||||
unsigned int height_fill{0};
|
||||
unsigned int spacing{0};
|
||||
unsigned int sibling{0};
|
||||
unsigned int background{0};
|
||||
bool transparent{false};
|
||||
bool detached{false};
|
||||
};
|
||||
@ -103,13 +103,13 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
|
||||
void track_selection_owner(xcb_window_t owner);
|
||||
void process_docking_request(xcb_window_t win);
|
||||
|
||||
int16_t calculate_x(uint16_t width) const;
|
||||
int16_t calculate_y() const;
|
||||
uint16_t calculate_w() const;
|
||||
uint16_t calculate_h() const;
|
||||
int calculate_x(unsigned width) const;
|
||||
int calculate_y() const;
|
||||
unsigned int calculate_w() const;
|
||||
unsigned int calculate_h() const;
|
||||
|
||||
int16_t calculate_client_x(const xcb_window_t& win);
|
||||
int16_t calculate_client_y();
|
||||
int calculate_client_x(const xcb_window_t& win);
|
||||
int calculate_client_y();
|
||||
|
||||
bool is_embedded(const xcb_window_t& win) const;
|
||||
shared_ptr<tray_client> find_client(const xcb_window_t& win) const;
|
||||
@ -143,8 +143,8 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
|
||||
xcb_gcontext_t m_gc{0};
|
||||
xcb_pixmap_t m_pixmap{0};
|
||||
graphics_util::root_pixmap m_rootpixmap{};
|
||||
uint16_t m_prevwidth{0};
|
||||
uint16_t m_prevheight{0};
|
||||
unsigned int m_prevwidth{0};
|
||||
unsigned int m_prevheight{0};
|
||||
|
||||
xcb_atom_t m_atom{0};
|
||||
xcb_window_t m_tray{0};
|
||||
|
@ -17,14 +17,14 @@ class window : public xpp::window<connection&> {
|
||||
window& operator=(const xcb_window_t win);
|
||||
|
||||
window create_checked(
|
||||
int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t mask = 0, const xcb_params_cw_t* p = nullptr);
|
||||
short int x, short int y, unsigned short int w, unsigned short int h, unsigned int mask = 0, const xcb_params_cw_t* p = nullptr);
|
||||
|
||||
window change_event_mask(uint32_t mask);
|
||||
window ensure_event_mask(uint32_t event);
|
||||
window change_event_mask(unsigned int mask);
|
||||
window ensure_event_mask(unsigned int event);
|
||||
|
||||
window reconfigure_geom(uint16_t w, uint16_t h, int16_t x = 0, int16_t y = 0);
|
||||
window reconfigure_pos(int16_t x, int16_t y);
|
||||
window reconfigure_struts(uint16_t w, uint16_t h, int16_t x, bool bottom = false);
|
||||
window reconfigure_geom(unsigned short int w, unsigned short int h, short int x = 0, short int y = 0);
|
||||
window reconfigure_pos(short int x, short int y);
|
||||
window reconfigure_struts(unsigned short int w, unsigned short int h, short int x, bool bottom = false);
|
||||
|
||||
void redraw();
|
||||
|
||||
|
@ -9,104 +9,104 @@
|
||||
POLYBAR_NS
|
||||
|
||||
struct cw_size {
|
||||
explicit cw_size(uint16_t w, uint16_t h) : w(w), h(h) {}
|
||||
explicit cw_size(unsigned short int w, unsigned short int h) : w(w), h(h) {}
|
||||
explicit cw_size(struct size size) : w(size.w), h(size.h) {}
|
||||
uint16_t w{1};
|
||||
uint16_t h{1};
|
||||
unsigned short int w{1};
|
||||
unsigned short int h{1};
|
||||
};
|
||||
struct cw_pos {
|
||||
explicit cw_pos(int16_t x, int16_t y) : x(x), y(y) {}
|
||||
explicit cw_pos(short int x, short int y) : x(x), y(y) {}
|
||||
explicit cw_pos(struct position pos) : x(pos.x), y(pos.y) {}
|
||||
int16_t x{0};
|
||||
int16_t y{0};
|
||||
short int x{0};
|
||||
short int y{0};
|
||||
};
|
||||
struct cw_border {
|
||||
explicit cw_border(uint16_t border_width) : border_width(border_width) {}
|
||||
uint16_t border_width{0};
|
||||
explicit cw_border(unsigned short int border_width) : border_width(border_width) {}
|
||||
unsigned short int border_width{0};
|
||||
};
|
||||
struct cw_class {
|
||||
explicit cw_class(uint16_t class_) : class_(class_) {}
|
||||
uint16_t class_{XCB_COPY_FROM_PARENT};
|
||||
explicit cw_class(unsigned short int class_) : class_(class_) {}
|
||||
unsigned short int class_{XCB_COPY_FROM_PARENT};
|
||||
};
|
||||
struct cw_parent {
|
||||
explicit cw_parent(xcb_window_t parent) : parent(parent) {}
|
||||
xcb_window_t parent{XCB_NONE};
|
||||
};
|
||||
struct cw_depth {
|
||||
explicit cw_depth(uint8_t depth) : depth(depth) {}
|
||||
uint8_t depth{XCB_COPY_FROM_PARENT};
|
||||
explicit cw_depth(unsigned char depth) : depth(depth) {}
|
||||
unsigned char depth{XCB_COPY_FROM_PARENT};
|
||||
};
|
||||
struct cw_visual {
|
||||
explicit cw_visual(xcb_visualid_t visualid) : visualid(visualid) {}
|
||||
xcb_visualid_t visualid{XCB_COPY_FROM_PARENT};
|
||||
};
|
||||
struct cw_mask {
|
||||
explicit cw_mask(uint32_t mask) : mask(mask) {}
|
||||
const uint32_t mask{0};
|
||||
explicit cw_mask(unsigned int mask) : mask(mask) {}
|
||||
const unsigned int mask{0};
|
||||
};
|
||||
struct cw_params {
|
||||
explicit cw_params(const xcb_params_cw_t* params) : params(params) {}
|
||||
const xcb_params_cw_t* params{nullptr};
|
||||
};
|
||||
struct cw_params_back_pixel {
|
||||
explicit cw_params_back_pixel(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_back_pixel(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_back_pixmap {
|
||||
explicit cw_params_back_pixmap(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_back_pixmap(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_backing_pixel {
|
||||
explicit cw_params_backing_pixel(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_backing_pixel(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_backing_planes {
|
||||
explicit cw_params_backing_planes(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_backing_planes(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_backing_store {
|
||||
explicit cw_params_backing_store(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_backing_store(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_bit_gravity {
|
||||
explicit cw_params_bit_gravity(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_bit_gravity(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_border_pixel {
|
||||
explicit cw_params_border_pixel(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_border_pixel(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_border_pixmap {
|
||||
explicit cw_params_border_pixmap(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_border_pixmap(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_colormap {
|
||||
explicit cw_params_colormap(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_colormap(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_cursor {
|
||||
explicit cw_params_cursor(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_cursor(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_dont_propagate {
|
||||
explicit cw_params_dont_propagate(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_dont_propagate(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_event_mask {
|
||||
explicit cw_params_event_mask(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_event_mask(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_override_redirect {
|
||||
explicit cw_params_override_redirect(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_override_redirect(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_save_under {
|
||||
explicit cw_params_save_under(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_save_under(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_params_win_gravity {
|
||||
explicit cw_params_win_gravity(uint32_t value) : value(value) {}
|
||||
uint32_t value{0};
|
||||
explicit cw_params_win_gravity(unsigned int value) : value(value) {}
|
||||
unsigned int value{0};
|
||||
};
|
||||
struct cw_flush {
|
||||
explicit cw_flush(bool checked = false) : checked(checked) {}
|
||||
@ -164,16 +164,16 @@ class winspec {
|
||||
connection& m_connection;
|
||||
|
||||
xcb_window_t m_window{XCB_NONE};
|
||||
uint32_t m_parent{XCB_NONE};
|
||||
uint8_t m_depth{XCB_COPY_FROM_PARENT};
|
||||
uint16_t m_class{XCB_COPY_FROM_PARENT};
|
||||
unsigned int m_parent{XCB_NONE};
|
||||
unsigned char m_depth{XCB_COPY_FROM_PARENT};
|
||||
unsigned short int m_class{XCB_COPY_FROM_PARENT};
|
||||
xcb_visualid_t m_visual{XCB_COPY_FROM_PARENT};
|
||||
int16_t m_x{0};
|
||||
int16_t m_y{0};
|
||||
uint16_t m_width{1U};
|
||||
uint16_t m_height{1U};
|
||||
uint16_t m_border{0};
|
||||
uint32_t m_mask{0};
|
||||
short int m_x{0};
|
||||
short int m_y{0};
|
||||
unsigned short int m_width{1U};
|
||||
unsigned short int m_height{1U};
|
||||
unsigned short int m_border{0};
|
||||
unsigned int m_mask{0};
|
||||
xcb_params_cw_t m_params{};
|
||||
};
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace wm_util {
|
||||
void set_wm_window_type(xcb_connection_t* conn, xcb_window_t win, vector<xcb_atom_t> types);
|
||||
void set_wm_state(xcb_connection_t* conn, xcb_window_t win, vector<xcb_atom_t> states);
|
||||
void set_wm_pid(xcb_connection_t* conn, xcb_window_t win, pid_t pid);
|
||||
void set_wm_desktop(xcb_connection_t* conn, xcb_window_t win, uint32_t desktop = -1u);
|
||||
void set_wm_window_opacity(xcb_connection_t* conn, xcb_window_t win, uint64_t values);
|
||||
void set_wm_desktop(xcb_connection_t* conn, xcb_window_t win, unsigned int desktop = -1u);
|
||||
void set_wm_window_opacity(xcb_connection_t* conn, xcb_window_t win, unsigned long int values);
|
||||
}
|
||||
|
||||
POLYBAR_NS_END
|
||||
|
@ -349,12 +349,12 @@ void bar::parse(string&& data, bool force) {
|
||||
|
||||
const auto check_dblclicks = [&]() -> bool {
|
||||
for (auto&& action : m_renderer->actions()) {
|
||||
if (static_cast<uint8_t>(action.button) >= static_cast<uint8_t>(mousebtn::DOUBLE_LEFT)) {
|
||||
if (static_cast<int>(action.button) >= static_cast<int>(mousebtn::DOUBLE_LEFT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (auto&& action : m_opts.actions) {
|
||||
if (static_cast<uint8_t>(action.button) >= static_cast<uint8_t>(mousebtn::DOUBLE_LEFT)) {
|
||||
if (static_cast<int>(action.button) >= static_cast<int>(mousebtn::DOUBLE_LEFT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -568,7 +568,7 @@ void bar::handle(const evt::button_press& evt) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_log.warn("No matching input area found (btn=%i)", static_cast<uint8_t>(m_buttonpress_btn));
|
||||
m_log.warn("No matching input area found (btn=%i)", static_cast<int>(m_buttonpress_btn));
|
||||
};
|
||||
|
||||
const auto check_double = [&](string&& id, mousebtn&& btn) {
|
||||
@ -586,11 +586,11 @@ void bar::handle(const evt::button_press& evt) {
|
||||
// just by-pass the click timer handling
|
||||
if (!m_dblclicks) {
|
||||
deferred_fn(0);
|
||||
} else if (evt->detail == static_cast<uint8_t>(mousebtn::LEFT)) {
|
||||
} else if (evt->detail == static_cast<int>(mousebtn::LEFT)) {
|
||||
check_double("buttonpress-left", mousebtn::DOUBLE_LEFT);
|
||||
} else if (evt->detail == static_cast<uint8_t>(mousebtn::MIDDLE)) {
|
||||
} else if (evt->detail == static_cast<int>(mousebtn::MIDDLE)) {
|
||||
check_double("buttonpress-middle", mousebtn::DOUBLE_MIDDLE);
|
||||
} else if (evt->detail == static_cast<uint8_t>(mousebtn::RIGHT)) {
|
||||
} else if (evt->detail == static_cast<int>(mousebtn::RIGHT)) {
|
||||
check_double("buttonpress-right", mousebtn::DOUBLE_RIGHT);
|
||||
} else {
|
||||
deferred_fn(0);
|
||||
@ -750,24 +750,24 @@ bool bar::on(const signals::ui::tick&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t mask{0};
|
||||
uint32_t values[7]{0};
|
||||
unsigned int mask{0};
|
||||
unsigned int values[7]{0};
|
||||
xcb_params_configure_window_t params{};
|
||||
|
||||
if (m_opts.shade_size.h > geom->height) {
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, height, static_cast<uint16_t>(geom->height + m_anim_step));
|
||||
params.height = std::max(1U, std::min(params.height, static_cast<uint32_t>(m_opts.shade_size.h)));
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, height, static_cast<unsigned int>(geom->height + m_anim_step));
|
||||
params.height = std::max(1U, std::min(params.height, static_cast<unsigned int>(m_opts.shade_size.h)));
|
||||
} else if (m_opts.shade_size.h < geom->height) {
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, height, static_cast<uint16_t>(geom->height - m_anim_step));
|
||||
params.height = std::max(1U, std::max(params.height, static_cast<uint32_t>(m_opts.shade_size.h)));
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, height, static_cast<unsigned int>(geom->height - m_anim_step));
|
||||
params.height = std::max(1U, std::max(params.height, static_cast<unsigned int>(m_opts.shade_size.h)));
|
||||
}
|
||||
|
||||
if (m_opts.shade_pos.y > geom->y) {
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, y, static_cast<int16_t>(geom->y + m_anim_step));
|
||||
params.y = std::min(params.y, static_cast<int32_t>(m_opts.shade_pos.y));
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, y, static_cast<int>(geom->y + m_anim_step));
|
||||
params.y = std::min(params.y, static_cast<int>(m_opts.shade_pos.y));
|
||||
} else if (m_opts.shade_pos.y < geom->y) {
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, y, static_cast<int16_t>(geom->y - m_anim_step));
|
||||
params.y = std::max(params.y, static_cast<int32_t>(m_opts.shade_pos.y));
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, y, static_cast<int>(geom->y - m_anim_step));
|
||||
params.y = std::max(params.y, static_cast<int>(m_opts.shade_pos.y));
|
||||
}
|
||||
|
||||
connection::pack_values(mask, ¶ms, values);
|
||||
|
@ -47,10 +47,10 @@ string builder::flush() {
|
||||
if (m_tags[syntaxtag::u]) {
|
||||
underline_color_close();
|
||||
}
|
||||
if ((m_attributes >> static_cast<uint8_t>(attribute::UNDERLINE)) & 1U) {
|
||||
if ((m_attributes >> static_cast<int>(attribute::UNDERLINE)) & 1U) {
|
||||
underline_close();
|
||||
}
|
||||
if ((m_attributes >> static_cast<uint8_t>(attribute::OVERLINE)) & 1U) {
|
||||
if ((m_attributes >> static_cast<int>(attribute::OVERLINE)) & 1U) {
|
||||
overline_close();
|
||||
}
|
||||
|
||||
@ -542,7 +542,7 @@ void builder::cmd_close(bool condition) {
|
||||
*/
|
||||
string builder::background_hex() {
|
||||
if (m_background.empty()) {
|
||||
m_background = color_util::hex<uint16_t>(m_bar.background);
|
||||
m_background = color_util::hex<unsigned short int>(m_bar.background);
|
||||
}
|
||||
return m_background;
|
||||
}
|
||||
@ -552,7 +552,7 @@ string builder::background_hex() {
|
||||
*/
|
||||
string builder::foreground_hex() {
|
||||
if (m_foreground.empty()) {
|
||||
m_foreground = color_util::hex<uint16_t>(m_bar.foreground);
|
||||
m_foreground = color_util::hex<unsigned short int>(m_bar.foreground);
|
||||
}
|
||||
return m_foreground;
|
||||
}
|
||||
@ -601,11 +601,11 @@ void builder::tag_open(syntaxtag tag, const string& value) {
|
||||
* Insert directive to use given attribute unless already set
|
||||
*/
|
||||
void builder::tag_open(attribute attr) {
|
||||
if ((m_attributes >> static_cast<uint8_t>(attr)) & 1U) {
|
||||
if ((m_attributes >> static_cast<int>(attr)) & 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_attributes |= 1U << static_cast<uint8_t>(attr);
|
||||
m_attributes |= 1 << static_cast<int>(attr);
|
||||
|
||||
switch (attr) {
|
||||
case attribute::NONE:
|
||||
@ -661,11 +661,11 @@ void builder::tag_close(syntaxtag tag) {
|
||||
* Insert directive to remove given attribute if set
|
||||
*/
|
||||
void builder::tag_close(attribute attr) {
|
||||
if (!((m_attributes >> static_cast<uint8_t>(attr)) & 1U)) {
|
||||
if (!((m_attributes >> static_cast<int>(attr)) & 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_attributes &= ~(1U << static_cast<uint8_t>(attr));
|
||||
m_attributes &= ~(1 << static_cast<int>(attr));
|
||||
|
||||
switch (attr) {
|
||||
case attribute::NONE:
|
||||
|
@ -79,7 +79,7 @@ void config::parse_file() {
|
||||
std::ifstream in(m_file);
|
||||
string line;
|
||||
string section;
|
||||
uint32_t lineno{0};
|
||||
unsigned int lineno{0};
|
||||
|
||||
while (std::getline(in, line)) {
|
||||
lineno++;
|
||||
@ -279,10 +279,10 @@ rgba config::convert(string&& value) const {
|
||||
auto color = color_util::parse(value, 0);
|
||||
// clang-format off
|
||||
return rgba{
|
||||
color_util::red_channel<uint8_t>(color) / 255.0,
|
||||
color_util::green_channel<uint8_t>(color) / 255.0,
|
||||
color_util::blue_channel<uint8_t>(color) / 255.0,
|
||||
color_util::alpha_channel<uint8_t>(color) / 255.0};
|
||||
color_util::red_channel<unsigned char>(color) / 255.0,
|
||||
color_util::green_channel<unsigned char>(color) / 255.0,
|
||||
color_util::blue_channel<unsigned char>(color) / 255.0,
|
||||
color_util::alpha_channel<unsigned char>(color) / 255.0};
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ void parser::codeblock(string&& data, const bar_settings& bar) {
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
m_sig.emit(offset_pixel{static_cast<int16_t>(std::atoi(value.c_str()))});
|
||||
m_sig.emit(offset_pixel{static_cast<int>(std::atoi(value.c_str()))});
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@ -180,8 +180,8 @@ size_t parser::text(string&& data) {
|
||||
/**
|
||||
* Process color hex string and convert it to the correct value
|
||||
*/
|
||||
uint32_t parser::parse_color(const string& s, uint32_t fallback) {
|
||||
uint32_t color{0};
|
||||
unsigned int parser::parse_color(const string& s, unsigned int fallback) {
|
||||
unsigned int color{0};
|
||||
if (s.empty() || s[0] == '-' || (color = color_util::parse(s, fallback)) == fallback) {
|
||||
return fallback;
|
||||
}
|
||||
@ -191,7 +191,7 @@ uint32_t parser::parse_color(const string& s, uint32_t fallback) {
|
||||
/**
|
||||
* Process font index and convert it to the correct value
|
||||
*/
|
||||
uint8_t parser::parse_fontindex(const string& s) {
|
||||
int parser::parse_fontindex(const string& s) {
|
||||
if (s.empty() || s[0] == '-') {
|
||||
return 0;
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ renderer::renderer(
|
||||
|
||||
m_log.trace("renderer: Allocate graphic context");
|
||||
{
|
||||
uint32_t mask{0};
|
||||
uint32_t value_list[32]{0};
|
||||
unsigned int mask{0};
|
||||
unsigned int value_list[32]{0};
|
||||
xcb_params_gc_t params{};
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, foreground, m_bar.foreground);
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, graphics_exposures, 0);
|
||||
@ -256,8 +256,8 @@ void renderer::flush() {
|
||||
/**
|
||||
* Reserve space at given edge
|
||||
*/
|
||||
void renderer::reserve_space(edge side, uint16_t w) {
|
||||
m_log.trace_x("renderer: reserve_space(%i, %i)", static_cast<uint8_t>(side), w);
|
||||
void renderer::reserve_space(edge side, unsigned short int w) {
|
||||
m_log.trace_x("renderer: reserve_space(%i, %i)", static_cast<unsigned char>(side), w);
|
||||
|
||||
m_cleararea.side = side;
|
||||
m_cleararea.size = w;
|
||||
@ -311,7 +311,7 @@ void renderer::fill_background() {
|
||||
* Fill overline color
|
||||
*/
|
||||
void renderer::fill_overline(double x, double w) {
|
||||
if (m_bar.overline.size && m_attributes.test(static_cast<uint8_t>(attribute::OVERLINE))) {
|
||||
if (m_bar.overline.size && m_attributes.test(static_cast<unsigned char>(attribute::OVERLINE))) {
|
||||
m_log.trace_x("renderer: overline(x=%i, w=%i)", x, w);
|
||||
m_context->save();
|
||||
*m_context << m_compositing_overline;
|
||||
@ -326,7 +326,7 @@ void renderer::fill_overline(double x, double w) {
|
||||
* Fill underline color
|
||||
*/
|
||||
void renderer::fill_underline(double x, double w) {
|
||||
if (m_bar.underline.size && m_attributes.test(static_cast<uint8_t>(attribute::UNDERLINE))) {
|
||||
if (m_bar.underline.size && m_attributes.test(static_cast<unsigned char>(attribute::UNDERLINE))) {
|
||||
m_log.trace_x("renderer: underline(x=%i, w=%i)", x, w);
|
||||
m_context->save();
|
||||
*m_context << m_compositing_underline;
|
||||
@ -450,7 +450,7 @@ void renderer::highlight_clickable_areas() {
|
||||
map<alignment, int> hint_num{};
|
||||
for (auto&& action : m_actions) {
|
||||
if (!action.active) {
|
||||
uint8_t n = hint_num.find(action.align)->second++;
|
||||
unsigned char n = hint_num.find(action.align)->second++;
|
||||
double x = action.start_x + n * DEBUG_HINTS_OFFSET_X;
|
||||
double y = m_bar.pos.y + m_rect.y + n * DEBUG_HINTS_OFFSET_Y;
|
||||
double w = action.width();
|
||||
@ -467,7 +467,7 @@ void renderer::highlight_clickable_areas() {
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::change_background& evt) {
|
||||
const uint32_t color{evt.cast()};
|
||||
const unsigned int color{evt.cast()};
|
||||
if (color != m_color_background) {
|
||||
m_color_background = color;
|
||||
}
|
||||
@ -475,7 +475,7 @@ bool renderer::on(const signals::parser::change_background& evt) {
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::change_foreground& evt) {
|
||||
const uint32_t color{evt.cast()};
|
||||
const unsigned int color{evt.cast()};
|
||||
if (color != m_color_foreground) {
|
||||
m_color_foreground = color;
|
||||
}
|
||||
@ -483,7 +483,7 @@ bool renderer::on(const signals::parser::change_foreground& evt) {
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::change_underline& evt) {
|
||||
const uint32_t color{evt.cast()};
|
||||
const unsigned int color{evt.cast()};
|
||||
if (color != m_color_underline) {
|
||||
m_color_underline = color;
|
||||
}
|
||||
@ -491,7 +491,7 @@ bool renderer::on(const signals::parser::change_underline& evt) {
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::change_overline& evt) {
|
||||
const uint32_t color{evt.cast()};
|
||||
const unsigned int color{evt.cast()};
|
||||
if (color != m_color_overline) {
|
||||
m_color_overline = color;
|
||||
}
|
||||
@ -518,17 +518,17 @@ bool renderer::on(const signals::parser::offset_pixel& evt) {
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::attribute_set& evt) {
|
||||
m_attributes.set(static_cast<uint8_t>(evt.cast()), true);
|
||||
m_attributes.set(static_cast<unsigned char>(evt.cast()), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::attribute_unset& evt) {
|
||||
m_attributes.set(static_cast<uint8_t>(evt.cast()), false);
|
||||
m_attributes.set(static_cast<unsigned char>(evt.cast()), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool renderer::on(const signals::parser::attribute_toggle& evt) {
|
||||
m_attributes.flip(static_cast<uint8_t>(evt.cast()));
|
||||
m_attributes.flip(static_cast<unsigned char>(evt.cast()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ bool renderer::on(const signals::parser::action_begin& evt) {
|
||||
bool renderer::on(const signals::parser::action_end& evt) {
|
||||
(void) evt;
|
||||
// auto btn = evt.cast();
|
||||
// int16_t clickable_width = 0;
|
||||
// short int clickable_width = 0;
|
||||
// for (auto action = m_actions.rbegin(); action != m_actions.rend(); action++) {
|
||||
// if (action->active && action->align == m_alignment && action->button == btn) {
|
||||
// switch (action->align) {
|
||||
|
@ -157,7 +157,7 @@ namespace drawtypes {
|
||||
auto value = conf.get(section, key, 0U);
|
||||
auto left = conf.get(section, key + "-left", value);
|
||||
auto right = conf.get(section, key + "-right", value);
|
||||
return side_values{static_cast<uint16_t>(left), static_cast<uint16_t>(right)};
|
||||
return side_values{static_cast<unsigned short int>(left), static_cast<unsigned short int>(right)};
|
||||
};
|
||||
|
||||
padding = get_left_right(name + "-padding");
|
||||
|
@ -123,10 +123,10 @@ namespace drawtypes {
|
||||
// avoid color bleed
|
||||
if (icon_empty && icon_indicator) {
|
||||
if (!icon_indicator->m_background.empty() && icon_empty->m_background.empty()) {
|
||||
icon_empty->m_background = color_util::hex<uint16_t>(bar.background);
|
||||
icon_empty->m_background = color_util::hex<unsigned short int>(bar.background);
|
||||
}
|
||||
if (!icon_indicator->m_foreground.empty() && icon_empty->m_foreground.empty()) {
|
||||
icon_empty->m_foreground = color_util::hex<uint16_t>(bar.foreground);
|
||||
icon_empty->m_foreground = color_util::hex<unsigned short int>(bar.foreground);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ int main(int argc, char** argv) {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
uint8_t exit_code{EXIT_SUCCESS};
|
||||
unsigned char exit_code{EXIT_SUCCESS};
|
||||
bool reload{false};
|
||||
|
||||
logger& logger{const_cast<decltype(logger)>(logger::make(loglevel::WARNING))};
|
||||
|
@ -14,24 +14,24 @@ POLYBAR_NS
|
||||
namespace {
|
||||
using bspwm_state = modules::bspwm_module::state;
|
||||
|
||||
uint32_t make_mask(bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) {
|
||||
uint32_t mask{0U};
|
||||
if (static_cast<uint32_t>(s1)) {
|
||||
mask |= 1U << (static_cast<uint32_t>(s1) - 1U);
|
||||
unsigned int make_mask(bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) {
|
||||
unsigned int mask{0U};
|
||||
if (static_cast<unsigned int>(s1)) {
|
||||
mask |= 1U << (static_cast<unsigned int>(s1) - 1U);
|
||||
}
|
||||
if (static_cast<uint32_t>(s2)) {
|
||||
mask |= 1U << (static_cast<uint32_t>(s2) - 1U);
|
||||
if (static_cast<unsigned int>(s2)) {
|
||||
mask |= 1U << (static_cast<unsigned int>(s2) - 1U);
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
uint32_t check_mask(uint32_t base, bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) {
|
||||
uint32_t mask{0U};
|
||||
if (static_cast<uint32_t>(s1)) {
|
||||
mask |= 1U << (static_cast<uint32_t>(s1) - 1U);
|
||||
unsigned int check_mask(unsigned int base, bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) {
|
||||
unsigned int mask{0U};
|
||||
if (static_cast<unsigned int>(s1)) {
|
||||
mask |= 1U << (static_cast<unsigned int>(s1) - 1U);
|
||||
}
|
||||
if (static_cast<uint32_t>(s2)) {
|
||||
mask |= 1U << (static_cast<uint32_t>(s2) - 1U);
|
||||
if (static_cast<unsigned int>(s2)) {
|
||||
mask |= 1U << (static_cast<unsigned int>(s2) - 1U);
|
||||
}
|
||||
return (base & mask) == mask;
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace modules {
|
||||
{state::EMPTY, "label-focused-empty"}};
|
||||
|
||||
for (auto&& os : focused_overrides) {
|
||||
uint32_t mask{make_mask(state::FOCUSED, os.first)};
|
||||
unsigned int mask{make_mask(state::FOCUSED, os.first)};
|
||||
try {
|
||||
m_statelabels.emplace(mask, load_label(m_conf, name(), os.second));
|
||||
} catch (const key_error& err) {
|
||||
@ -219,7 +219,7 @@ namespace modules {
|
||||
|
||||
auto value = !tag.empty() ? tag.substr(1) : "";
|
||||
auto mode_flag = mode::NONE;
|
||||
uint32_t workspace_mask{0U};
|
||||
unsigned int workspace_mask{0U};
|
||||
|
||||
if (tag[0] == 'm' || tag[0] == 'M') {
|
||||
m_monitors.emplace_back(factory_util::unique<bspwm_monitor>());
|
||||
|
@ -18,7 +18,7 @@ namespace modules {
|
||||
*/
|
||||
active_window::active_window(xcb_connection_t* conn, xcb_window_t win) : m_connection(conn), m_window(win) {
|
||||
if (m_window != XCB_NONE) {
|
||||
const uint32_t mask{XCB_EVENT_MASK_PROPERTY_CHANGE};
|
||||
const unsigned int mask{XCB_EVENT_MASK_PROPERTY_CHANGE};
|
||||
xcb_change_window_attributes(m_connection, m_window, XCB_CW_EVENT_MASK, &mask);
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ namespace modules {
|
||||
*/
|
||||
active_window::~active_window() {
|
||||
if (m_window != XCB_NONE) {
|
||||
const uint32_t mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
const unsigned int mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
xcb_change_window_attributes(m_connection, m_window, XCB_CW_EVENT_MASK, &mask);
|
||||
}
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ namespace modules {
|
||||
for (auto&& monitor : m_monitors) {
|
||||
if (monitor->match(viewports[n])) {
|
||||
m_viewports.back()->name = monitor->name;
|
||||
m_viewports.back()->pos.x = static_cast<int16_t>(monitor->x);
|
||||
m_viewports.back()->pos.y = static_cast<int16_t>(monitor->y);
|
||||
m_viewports.back()->pos.x = static_cast<short int>(monitor->x);
|
||||
m_viewports.back()->pos.y = static_cast<short int>(monitor->y);
|
||||
m_viewports.back()->state = viewport_state::FOCUSED;
|
||||
m_viewports.back()->label = m_monitorlabel->clone();
|
||||
m_viewports.back()->label->replace_token("%name%", monitor->name);
|
||||
@ -212,19 +212,19 @@ namespace modules {
|
||||
}
|
||||
cmd.erase(0, len);
|
||||
|
||||
uint32_t new_desktop{0};
|
||||
uint32_t min_desktop{0};
|
||||
uint32_t max_desktop{0};
|
||||
uint32_t current_desktop{ewmh_util::get_current_desktop(m_ewmh.get())};
|
||||
unsigned int new_desktop{0};
|
||||
unsigned int min_desktop{0};
|
||||
unsigned int max_desktop{0};
|
||||
unsigned int current_desktop{ewmh_util::get_current_desktop(m_ewmh.get())};
|
||||
|
||||
for (auto&& viewport : m_viewports) {
|
||||
for (auto&& desktop : viewport->desktops) {
|
||||
if (min_desktop == 0) {
|
||||
min_desktop = desktop->index;
|
||||
max_desktop = math_util::max<uint16_t>(max_desktop, desktop->index);
|
||||
max_desktop = math_util::max<unsigned short int>(max_desktop, desktop->index);
|
||||
} else {
|
||||
min_desktop = math_util::min<uint16_t>(min_desktop, desktop->index);
|
||||
max_desktop = math_util::max<uint16_t>(max_desktop, desktop->index);
|
||||
min_desktop = math_util::min<unsigned short int>(min_desktop, desktop->index);
|
||||
max_desktop = math_util::max<unsigned short int>(max_desktop, desktop->index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,12 +232,12 @@ namespace modules {
|
||||
if ((len = strlen(EVENT_CLICK)) && cmd.compare(0, len, EVENT_CLICK) == 0) {
|
||||
new_desktop = std::strtoul(cmd.substr(len).c_str(), nullptr, 10);
|
||||
} else if ((len = strlen(EVENT_SCROLL_UP)) && cmd.compare(0, len, EVENT_SCROLL_UP) == 0) {
|
||||
new_desktop = math_util::min<uint32_t>(max_desktop, current_desktop + 1);
|
||||
new_desktop = math_util::min<unsigned int>(max_desktop, current_desktop + 1);
|
||||
if (new_desktop == current_desktop) {
|
||||
new_desktop = min_desktop;
|
||||
}
|
||||
} else if ((len = strlen(EVENT_SCROLL_DOWN)) && cmd.compare(0, len, EVENT_SCROLL_DOWN) == 0) {
|
||||
new_desktop = math_util::max<uint32_t>(min_desktop, std::max(0U, current_desktop - 1));
|
||||
new_desktop = math_util::max<unsigned int>(min_desktop, std::max(0U, current_desktop - 1));
|
||||
if (new_desktop == current_desktop) {
|
||||
new_desktop = max_desktop;
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ namespace bspwm_util {
|
||||
continue;
|
||||
}
|
||||
|
||||
const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
|
||||
const uint32_t value_list[2]{root, XCB_STACK_MODE_ABOVE};
|
||||
const unsigned int value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
|
||||
const unsigned int value_list[2]{root, XCB_STACK_MODE_ABOVE};
|
||||
|
||||
conn.configure_window_checked(win, value_mask, value_list);
|
||||
conn.flush();
|
||||
|
@ -72,8 +72,8 @@ namespace i3_util {
|
||||
* Fixes the issue with always-on-top window's
|
||||
*/
|
||||
bool restack_to_root(connection& conn, const xcb_window_t win) {
|
||||
const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
|
||||
const uint32_t value_list[2]{root_window(conn), XCB_STACK_MODE_ABOVE};
|
||||
const unsigned int value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
|
||||
const unsigned int value_list[2]{root_window(conn), XCB_STACK_MODE_ABOVE};
|
||||
if (value_list[0] != XCB_NONE) {
|
||||
conn.configure_window_checked(win, value_mask, value_list);
|
||||
return true;
|
||||
|
@ -66,33 +66,33 @@ connection::~connection() {
|
||||
XCloseDisplay(m_display);
|
||||
} else {
|
||||
disconnect();
|
||||
std::for_each(m_visual.begin(), m_visual.end(), [=](pair<uint8_t, Visual*> p) { XFree(p.second); });
|
||||
std::for_each(m_visual.begin(), m_visual.end(), [=](pair<unsigned char, Visual*> p) { XFree(p.second); });
|
||||
m_visual.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void connection::pack_values(uint32_t mask, const uint32_t* src, uint32_t* dest) {
|
||||
void connection::pack_values(unsigned int mask, const unsigned int* src, unsigned int* dest) {
|
||||
for (; mask; mask >>= 1, src++) {
|
||||
if (mask & 1) {
|
||||
*dest++ = *src;
|
||||
}
|
||||
}
|
||||
}
|
||||
void connection::pack_values(uint32_t mask, const xcb_params_cw_t* src, uint32_t* dest) {
|
||||
pack_values(mask, reinterpret_cast<const uint32_t*>(src), dest);
|
||||
void connection::pack_values(unsigned int mask, const xcb_params_cw_t* src, unsigned int* dest) {
|
||||
pack_values(mask, reinterpret_cast<const unsigned int*>(src), dest);
|
||||
}
|
||||
void connection::pack_values(uint32_t mask, const xcb_params_gc_t* src, uint32_t* dest) {
|
||||
pack_values(mask, reinterpret_cast<const uint32_t*>(src), dest);
|
||||
void connection::pack_values(unsigned int mask, const xcb_params_gc_t* src, unsigned int* dest) {
|
||||
pack_values(mask, reinterpret_cast<const unsigned int*>(src), dest);
|
||||
}
|
||||
void connection::pack_values(uint32_t mask, const xcb_params_configure_window_t* src, uint32_t* dest) {
|
||||
pack_values(mask, reinterpret_cast<const uint32_t*>(src), dest);
|
||||
void connection::pack_values(unsigned int mask, const xcb_params_configure_window_t* src, unsigned int* dest) {
|
||||
pack_values(mask, reinterpret_cast<const unsigned int*>(src), dest);
|
||||
}
|
||||
|
||||
connection::operator Display*() const {
|
||||
return m_display;
|
||||
}
|
||||
|
||||
Visual* connection::visual(uint8_t depth) {
|
||||
Visual* connection::visual(unsigned char depth) {
|
||||
auto visual_it = m_visual.find(depth);
|
||||
if (visual_it == m_visual.end()) {
|
||||
XVisualInfo info{};
|
||||
@ -123,7 +123,7 @@ xcb_screen_t* connection::screen(bool realloc) {
|
||||
/**
|
||||
* Add given event to the event mask unless already added
|
||||
*/
|
||||
void connection::ensure_event_mask(xcb_window_t win, uint32_t event) {
|
||||
void connection::ensure_event_mask(xcb_window_t win, unsigned int event) {
|
||||
auto attributes = get_window_attributes(win);
|
||||
attributes->your_event_mask = attributes->your_event_mask | event;
|
||||
change_window_attributes(win, XCB_CW_EVENT_MASK, &attributes->your_event_mask);
|
||||
@ -133,7 +133,7 @@ void connection::ensure_event_mask(xcb_window_t win, uint32_t event) {
|
||||
* Clear event mask for the given window
|
||||
*/
|
||||
void connection::clear_event_mask(xcb_window_t win) {
|
||||
uint32_t mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
unsigned int mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
change_window_attributes(win, XCB_CW_EVENT_MASK, &mask);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ shared_ptr<xcb_client_message_event_t> connection::make_client_message(xcb_atom_
|
||||
* Send client message event
|
||||
*/
|
||||
void connection::send_client_message(const shared_ptr<xcb_client_message_event_t>& message, xcb_window_t target,
|
||||
uint32_t event_mask, bool propagate) const {
|
||||
unsigned int event_mask, bool propagate) const {
|
||||
send_event(propagate, target, event_mask, reinterpret_cast<const char*>(&*message));
|
||||
flush();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace draw_util {
|
||||
/**
|
||||
* Fill region of drawable with color defined by gcontext
|
||||
*/
|
||||
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) {
|
||||
void fill(xcb_connection_t* c, xcb_drawable_t d, xcb_gcontext_t g, short int x, short int y, unsigned short int w, unsigned short int h) {
|
||||
fill(c, d, g, {x, y, w, h});
|
||||
}
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ namespace ewmh_util {
|
||||
return str;
|
||||
}
|
||||
|
||||
uint32_t get_current_desktop(xcb_ewmh_connection_t* conn, int screen) {
|
||||
uint32_t desktop{0};
|
||||
unsigned int get_current_desktop(xcb_ewmh_connection_t* conn, int screen) {
|
||||
unsigned int desktop{0};
|
||||
if (xcb_ewmh_get_current_desktop_reply(conn, xcb_ewmh_get_current_desktop(conn, screen), &desktop, nullptr)) {
|
||||
return desktop;
|
||||
}
|
||||
@ -90,7 +90,7 @@ namespace ewmh_util {
|
||||
|
||||
for (size_t n = 0; n < reply.desktop_viewport_len; n++) {
|
||||
viewports.emplace_back(position{
|
||||
static_cast<int16_t>(reply.desktop_viewport[n].x), static_cast<int16_t>(reply.desktop_viewport[n].y)});
|
||||
static_cast<short int>(reply.desktop_viewport[n].x), static_cast<short int>(reply.desktop_viewport[n].y)});
|
||||
}
|
||||
|
||||
return viewports;
|
||||
@ -131,7 +131,7 @@ namespace ewmh_util {
|
||||
return win;
|
||||
}
|
||||
|
||||
void change_current_desktop(xcb_ewmh_connection_t* conn, uint32_t desktop) {
|
||||
void change_current_desktop(xcb_ewmh_connection_t* conn, unsigned int desktop) {
|
||||
xcb_ewmh_request_change_current_desktop(conn, 0, desktop, XCB_CURRENT_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ namespace randr_util {
|
||||
/**
|
||||
* XRandR version
|
||||
*/
|
||||
static uint32_t g_major_version = 0;
|
||||
static uint32_t g_minor_version = 0;
|
||||
static unsigned int g_major_version = 0;
|
||||
static unsigned int g_minor_version = 0;
|
||||
|
||||
/**
|
||||
* Query for the XRandR extension
|
||||
@ -61,7 +61,7 @@ namespace randr_util {
|
||||
/**
|
||||
* Define monitor
|
||||
*/
|
||||
monitor_t make_monitor(xcb_randr_output_t randr, string name, uint16_t w, uint16_t h, int16_t x, int16_t y) {
|
||||
monitor_t make_monitor(xcb_randr_output_t randr, string name, unsigned short int w, unsigned short int h, short int x, short int y) {
|
||||
monitor_t mon{new monitor_t::element_type{}};
|
||||
mon->output = randr;
|
||||
mon->name = move(name);
|
||||
@ -208,7 +208,7 @@ namespace randr_util {
|
||||
|
||||
auto reply = conn.get_output_property(mon->output, dst.atom, XCB_ATOM_NONE, 0, 4, 0, 0);
|
||||
if (reply->num_items == 1 && reply->format == 32 && reply->type == XCB_ATOM_INTEGER) {
|
||||
int32_t value = *reinterpret_cast<int32_t*>(xcb_randr_get_output_property_data(reply.get().get()));
|
||||
int value = *reinterpret_cast<int*>(xcb_randr_get_output_property_data(reply.get().get()));
|
||||
dst.val = static_cast<double>(value);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ const keyboard::indicator& keyboard::get(const indicator::type& i) const {
|
||||
/**
|
||||
* Update indicator states
|
||||
*/
|
||||
void keyboard::set(uint32_t state) {
|
||||
void keyboard::set(unsigned int state) {
|
||||
for (auto& i : indicators) {
|
||||
i.second.enabled = state & i.second.mask;
|
||||
}
|
||||
@ -33,14 +33,14 @@ bool keyboard::on(const indicator::type& i) const {
|
||||
/**
|
||||
* Set current group number
|
||||
*/
|
||||
void keyboard::current(uint8_t group) {
|
||||
void keyboard::current(unsigned char group) {
|
||||
current_group = group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current group number
|
||||
*/
|
||||
uint8_t keyboard::current() const {
|
||||
unsigned char keyboard::current() const {
|
||||
return current_group;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ namespace xkb_util {
|
||||
/**
|
||||
* Get current group number
|
||||
*/
|
||||
void switch_layout(connection& conn, xcb_xkb_device_spec_t device, uint8_t index) {
|
||||
void switch_layout(connection& conn, xcb_xkb_device_spec_t device, unsigned char index) {
|
||||
xcb_xkb_latch_lock_state(conn, device, 0, 0, true, index, 0, 0, 0);
|
||||
xcb_flush(conn);
|
||||
}
|
||||
@ -98,8 +98,8 @@ namespace xkb_util {
|
||||
/**
|
||||
* Get current group number
|
||||
*/
|
||||
uint8_t get_current_group(connection& conn, xcb_xkb_device_spec_t device) {
|
||||
uint8_t result{0};
|
||||
unsigned char get_current_group(connection& conn, xcb_xkb_device_spec_t device) {
|
||||
unsigned char result{0};
|
||||
auto reply = xcb_xkb_get_state_reply(conn, xcb_xkb_get_state(conn, device), nullptr);
|
||||
if (reply != nullptr) {
|
||||
result = reply->group;
|
||||
@ -114,7 +114,7 @@ namespace xkb_util {
|
||||
vector<keyboard::layout> get_layouts(connection& conn, xcb_xkb_device_spec_t device) {
|
||||
vector<keyboard::layout> results;
|
||||
|
||||
uint32_t mask{XCB_XKB_NAME_DETAIL_GROUP_NAMES | XCB_XKB_NAME_DETAIL_SYMBOLS};
|
||||
unsigned int mask{XCB_XKB_NAME_DETAIL_GROUP_NAMES | XCB_XKB_NAME_DETAIL_SYMBOLS};
|
||||
auto reply = xcb_xkb_get_names_reply(conn, xcb_xkb_get_names(conn, device, mask), nullptr);
|
||||
|
||||
if (reply == nullptr) {
|
||||
@ -155,7 +155,7 @@ namespace xkb_util {
|
||||
map<keyboard::indicator::type, keyboard::indicator> get_indicators(connection& conn, xcb_xkb_device_spec_t device) {
|
||||
map<keyboard::indicator::type, keyboard::indicator> results;
|
||||
|
||||
uint32_t mask{XCB_XKB_NAME_DETAIL_INDICATOR_NAMES};
|
||||
unsigned int mask{XCB_XKB_NAME_DETAIL_INDICATOR_NAMES};
|
||||
auto reply = xcb_xkb_get_names_reply(conn, xcb_xkb_get_names(conn, device, mask), nullptr);
|
||||
|
||||
if (reply == nullptr) {
|
||||
|
@ -14,7 +14,7 @@ namespace graphics_util {
|
||||
* Create a basic window
|
||||
*/
|
||||
bool create_window(
|
||||
connection& conn, xcb_window_t* win, int16_t x, int16_t y, uint16_t w, uint16_t h, xcb_window_t root) {
|
||||
connection& conn, xcb_window_t* win, short int x, short int y, unsigned short int w, unsigned short int h, xcb_window_t root) {
|
||||
if (!root) {
|
||||
root = conn.screen()->root;
|
||||
}
|
||||
@ -35,14 +35,14 @@ namespace graphics_util {
|
||||
* Create a basic pixmap with the same depth as the
|
||||
* root depth of the default screen
|
||||
*/
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, uint16_t w, uint16_t h, xcb_pixmap_t* pixmap) {
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, unsigned short int w, unsigned short int h, xcb_pixmap_t* pixmap) {
|
||||
return graphics_util::create_pixmap(conn, dst, w, h, conn.screen()->root_depth, pixmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a basic pixmap with specific depth
|
||||
*/
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, uint16_t w, uint16_t h, uint8_t d, xcb_pixmap_t* pixmap) {
|
||||
bool create_pixmap(connection& conn, xcb_drawable_t dst, unsigned short int w, unsigned short int h, unsigned char d, xcb_pixmap_t* pixmap) {
|
||||
try {
|
||||
*pixmap = conn.generate_id();
|
||||
conn.create_pixmap_checked(d, *pixmap, dst, w, h);
|
||||
@ -61,8 +61,8 @@ namespace graphics_util {
|
||||
try {
|
||||
xcb_params_gc_t params{};
|
||||
|
||||
uint32_t mask = 0;
|
||||
uint32_t values[32];
|
||||
unsigned int mask = 0;
|
||||
unsigned int values[32];
|
||||
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, graphics_exposures, 1);
|
||||
connection::pack_values(mask, ¶ms, values);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
POLYBAR_NS
|
||||
|
||||
tray_client::tray_client(connection& conn, xcb_window_t win, uint16_t w, uint16_t h)
|
||||
tray_client::tray_client(connection& conn, xcb_window_t win, unsigned int w, unsigned int h)
|
||||
: m_connection(conn), m_window(win), m_width(w), m_height(h) {
|
||||
m_xembed = memory_util::make_malloc_ptr<xembed_data>();
|
||||
m_xembed->version = XEMBED_VERSION;
|
||||
@ -19,11 +19,11 @@ tray_client::~tray_client() {
|
||||
xembed::unembed(m_connection, window(), m_connection.root());
|
||||
}
|
||||
|
||||
uint16_t tray_client::width() const {
|
||||
unsigned int tray_client::width() const {
|
||||
return m_width;
|
||||
}
|
||||
|
||||
uint16_t tray_client::height() const {
|
||||
unsigned int tray_client::height() const {
|
||||
return m_height;
|
||||
}
|
||||
|
||||
@ -84,9 +84,9 @@ void tray_client::ensure_state() const {
|
||||
/**
|
||||
* Configure window size
|
||||
*/
|
||||
void tray_client::reconfigure(int16_t x, int16_t y) const {
|
||||
uint32_t configure_mask = 0;
|
||||
uint32_t configure_values[7];
|
||||
void tray_client::reconfigure(int x, int y) const {
|
||||
unsigned int configure_mask = 0;
|
||||
unsigned int configure_values[7];
|
||||
xcb_params_configure_window_t configure_params{};
|
||||
|
||||
XCB_AUX_ADD_PARAM(&configure_mask, &configure_params, width, m_width);
|
||||
@ -101,7 +101,7 @@ void tray_client::reconfigure(int16_t x, int16_t y) const {
|
||||
/**
|
||||
* Respond to client resize requests
|
||||
*/
|
||||
void tray_client::configure_notify(int16_t x, int16_t y) const {
|
||||
void tray_client::configure_notify(short int x, short int y) const {
|
||||
auto notify = memory_util::make_malloc_ptr<xcb_configure_notify_event_t, 32_z>();
|
||||
notify->response_type = XCB_CONFIGURE_NOTIFY;
|
||||
notify->event = m_window;
|
||||
@ -114,7 +114,7 @@ void tray_client::configure_notify(int16_t x, int16_t y) const {
|
||||
notify->height = m_height;
|
||||
notify->border_width = 0;
|
||||
|
||||
uint32_t mask{XCB_EVENT_MASK_STRUCTURE_NOTIFY};
|
||||
unsigned int mask{XCB_EVENT_MASK_STRUCTURE_NOTIFY};
|
||||
m_connection.send_event_checked(false, m_window, mask, reinterpret_cast<const char*>(notify.get()));
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void tray_manager::setup(const bar_settings& bar_opts) {
|
||||
m_opts.height--;
|
||||
}
|
||||
|
||||
auto maxsize = conf.get(bs, "tray-maxsize", 16);
|
||||
auto maxsize = conf.get<unsigned int>(bs, "tray-maxsize", 16);
|
||||
if (m_opts.height > maxsize) {
|
||||
m_opts.spacing += (m_opts.height - maxsize) / 2;
|
||||
m_opts.height = maxsize;
|
||||
@ -103,7 +103,7 @@ void tray_manager::setup(const bar_settings& bar_opts) {
|
||||
m_opts.orig_y = bar_opts.pos.y + bar_opts.borders.at(edge::TOP).size;
|
||||
|
||||
// Apply user-defined scaling
|
||||
auto scale = conf.get(bs, "tray-scale", 1.0f);
|
||||
auto scale = conf.get(bs, "tray-scale", 1.0);
|
||||
m_opts.width *= scale;
|
||||
m_opts.height_fill *= scale;
|
||||
|
||||
@ -144,7 +144,7 @@ void tray_manager::setup(const bar_settings& bar_opts) {
|
||||
}
|
||||
|
||||
// Add user-defined padding
|
||||
m_opts.spacing += conf.get(bs, "tray-padding", 0);
|
||||
m_opts.spacing += conf.get<unsigned int>(bs, "tray-padding", 0);
|
||||
|
||||
// Add user-defiend offset
|
||||
auto offset_x_def = conf.get(bs, "tray-offset-x", ""s);
|
||||
@ -359,8 +359,8 @@ void tray_manager::reconfigure_window() {
|
||||
if (width > 0) {
|
||||
m_log.trace("tray: New window values, width=%d, x=%d", width, x);
|
||||
|
||||
uint32_t mask = 0;
|
||||
uint32_t values[7];
|
||||
unsigned int mask = 0;
|
||||
unsigned int values[7];
|
||||
xcb_params_configure_window_t params{};
|
||||
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, width, width);
|
||||
@ -379,7 +379,7 @@ void tray_manager::reconfigure_window() {
|
||||
void tray_manager::reconfigure_clients() {
|
||||
m_log.trace("tray: Reconfigure clients");
|
||||
|
||||
uint32_t x = m_opts.spacing;
|
||||
int x = m_opts.spacing;
|
||||
|
||||
for (auto it = m_clients.rbegin(); it != m_clients.rend(); it++) {
|
||||
auto client = *it;
|
||||
@ -447,8 +447,8 @@ void tray_manager::reconfigure_bg(bool realloc) {
|
||||
}
|
||||
|
||||
if (realloc) {
|
||||
vector<uint8_t> image_data;
|
||||
uint8_t image_depth;
|
||||
vector<unsigned char> image_data;
|
||||
unsigned char image_depth;
|
||||
|
||||
try {
|
||||
auto image_reply =
|
||||
@ -560,7 +560,7 @@ void tray_manager::create_window() {
|
||||
m_tray = win << cw_flush(true);
|
||||
m_log.info("Tray window: %s", m_connection.id(m_tray));
|
||||
|
||||
const uint32_t shadow{0};
|
||||
const unsigned int shadow{0};
|
||||
m_connection.change_property(XCB_PROP_MODE_REPLACE, m_tray, _COMPTON_SHADOW, XCB_ATOM_CARDINAL, 32, 1, &shadow);
|
||||
}
|
||||
|
||||
@ -610,8 +610,8 @@ void tray_manager::restack_window() {
|
||||
try {
|
||||
m_log.trace("tray: Restacking tray window");
|
||||
|
||||
uint32_t mask = 0;
|
||||
uint32_t values[7];
|
||||
unsigned int mask = 0;
|
||||
unsigned int values[7];
|
||||
xcb_params_configure_window_t params{};
|
||||
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, sibling, m_opts.sibling);
|
||||
@ -629,8 +629,8 @@ void tray_manager::restack_window() {
|
||||
* Set window WM hints
|
||||
*/
|
||||
void tray_manager::set_wm_hints() {
|
||||
const uint32_t visual{m_connection.screen()->root_visual};
|
||||
const uint32_t orientation{_NET_SYSTEM_TRAY_ORIENTATION_HORZ};
|
||||
const unsigned int visual{m_connection.screen()->root_visual};
|
||||
const unsigned int orientation{_NET_SYSTEM_TRAY_ORIENTATION_HORZ};
|
||||
|
||||
m_log.trace("tray: Set window WM_NAME / WM_CLASS", m_connection.id(m_tray));
|
||||
xcb_icccm_set_wm_name(m_connection, m_tray, XCB_ATOM_STRING, 8, 19, TRAY_WM_NAME);
|
||||
@ -667,7 +667,7 @@ void tray_manager::set_tray_colors() {
|
||||
auto g = color_util::green_channel(m_opts.background);
|
||||
auto b = color_util::blue_channel(m_opts.background);
|
||||
|
||||
const uint32_t colors[12] = {
|
||||
const unsigned int colors[12] = {
|
||||
r, g, b, // normal
|
||||
r, g, b, // error
|
||||
r, g, b, // warning
|
||||
@ -741,8 +741,8 @@ void tray_manager::notify_clients_delayed() {
|
||||
void tray_manager::track_selection_owner(xcb_window_t owner) {
|
||||
if (owner != XCB_NONE) {
|
||||
m_log.trace("tray: Listen for events on the new selection window");
|
||||
const uint32_t mask{XCB_CW_EVENT_MASK};
|
||||
const uint32_t values[]{XCB_EVENT_MASK_STRUCTURE_NOTIFY};
|
||||
const unsigned int mask{XCB_CW_EVENT_MASK};
|
||||
const unsigned int values[]{XCB_EVENT_MASK_STRUCTURE_NOTIFY};
|
||||
m_connection.change_window_attributes(owner, mask, values);
|
||||
}
|
||||
}
|
||||
@ -768,8 +768,8 @@ void tray_manager::process_docking_request(xcb_window_t win) {
|
||||
}
|
||||
|
||||
try {
|
||||
const uint32_t mask{XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK};
|
||||
const uint32_t values[]{
|
||||
const unsigned int mask{XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK};
|
||||
const unsigned int values[]{
|
||||
XCB_BACK_PIXMAP_PARENT_RELATIVE, XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY};
|
||||
|
||||
m_log.trace("tray: Update client window");
|
||||
@ -801,7 +801,7 @@ void tray_manager::process_docking_request(xcb_window_t win) {
|
||||
/**
|
||||
* Calculate x position of tray window
|
||||
*/
|
||||
int16_t tray_manager::calculate_x(uint16_t width) const {
|
||||
int tray_manager::calculate_x(unsigned int width) const {
|
||||
auto x = m_opts.orig_x;
|
||||
if (m_opts.align == alignment::RIGHT) {
|
||||
x -= ((m_opts.width + m_opts.spacing) * m_clients.size() + m_opts.spacing);
|
||||
@ -814,15 +814,15 @@ int16_t tray_manager::calculate_x(uint16_t width) const {
|
||||
/**
|
||||
* Calculate y position of tray window
|
||||
*/
|
||||
int16_t tray_manager::calculate_y() const {
|
||||
int tray_manager::calculate_y() const {
|
||||
return m_opts.orig_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate width of tray window
|
||||
*/
|
||||
uint16_t tray_manager::calculate_w() const {
|
||||
uint16_t width = m_opts.spacing;
|
||||
unsigned int tray_manager::calculate_w() const {
|
||||
unsigned int width = m_opts.spacing;
|
||||
size_t count{0};
|
||||
for (auto&& client : m_clients) {
|
||||
if (client->mapped()) {
|
||||
@ -836,14 +836,14 @@ uint16_t tray_manager::calculate_w() const {
|
||||
/**
|
||||
* Calculate height of tray window
|
||||
*/
|
||||
uint16_t tray_manager::calculate_h() const {
|
||||
unsigned int tray_manager::calculate_h() const {
|
||||
return m_opts.height_fill;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate x position of client window
|
||||
*/
|
||||
int16_t tray_manager::calculate_client_x(const xcb_window_t& win) {
|
||||
int tray_manager::calculate_client_x(const xcb_window_t& win) {
|
||||
for (size_t i = 0; i < m_clients.size(); i++) {
|
||||
if (m_clients[i]->match(win)) {
|
||||
return m_opts.spacing + m_opts.width * i;
|
||||
@ -855,7 +855,7 @@ int16_t tray_manager::calculate_client_x(const xcb_window_t& win) {
|
||||
/**
|
||||
* Calculate y position of client window
|
||||
*/
|
||||
int16_t tray_manager::calculate_client_y() {
|
||||
int tray_manager::calculate_client_y() {
|
||||
return (m_opts.height_fill - m_opts.height) / 2;
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,14 @@ window& window::operator=(const xcb_window_t win) {
|
||||
/**
|
||||
* Create window and check for errors
|
||||
*/
|
||||
window window::create_checked(int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t mask, const xcb_params_cw_t* p) {
|
||||
window window::create_checked(short int x, short int y, unsigned short int w, unsigned short int h, unsigned int mask, const xcb_params_cw_t* p) {
|
||||
if (*this == XCB_NONE) {
|
||||
*this = connection().generate_id();
|
||||
}
|
||||
|
||||
auto root = connection().screen()->root;
|
||||
auto copy = XCB_COPY_FROM_PARENT;
|
||||
uint32_t values[16]{0};
|
||||
unsigned int values[16]{0};
|
||||
connection::pack_values(mask, p, values);
|
||||
connection().create_window_checked(copy, *this, root, x, y, w, h, 0, copy, copy, mask, values);
|
||||
|
||||
@ -34,7 +34,7 @@ window window::create_checked(int16_t x, int16_t y, uint16_t w, uint16_t h, uint
|
||||
/**
|
||||
* Change the window event mask
|
||||
*/
|
||||
window window::change_event_mask(uint32_t mask) {
|
||||
window window::change_event_mask(unsigned int mask) {
|
||||
change_attributes_checked(XCB_CW_EVENT_MASK, &mask);
|
||||
return *this;
|
||||
}
|
||||
@ -42,7 +42,7 @@ window window::change_event_mask(uint32_t mask) {
|
||||
/**
|
||||
* Add given event to the event mask unless already added
|
||||
*/
|
||||
window window::ensure_event_mask(uint32_t event) {
|
||||
window window::ensure_event_mask(unsigned int event) {
|
||||
connection().ensure_event_mask(*this, event);
|
||||
return *this;
|
||||
}
|
||||
@ -50,9 +50,9 @@ window window::ensure_event_mask(uint32_t event) {
|
||||
/**
|
||||
* Reconfigure the window geometry
|
||||
*/
|
||||
window window::reconfigure_geom(uint16_t w, uint16_t h, int16_t x, int16_t y) {
|
||||
uint32_t mask{0};
|
||||
uint32_t values[7]{0};
|
||||
window window::reconfigure_geom(unsigned short int w, unsigned short int h, short int x, short int y) {
|
||||
unsigned int mask{0};
|
||||
unsigned int values[7]{0};
|
||||
|
||||
xcb_params_configure_window_t params{};
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, width, w);
|
||||
@ -69,9 +69,9 @@ window window::reconfigure_geom(uint16_t w, uint16_t h, int16_t x, int16_t y) {
|
||||
/**
|
||||
* Reconfigure the window position
|
||||
*/
|
||||
window window::reconfigure_pos(int16_t x, int16_t y) {
|
||||
uint32_t mask{0};
|
||||
uint32_t values[2]{0};
|
||||
window window::reconfigure_pos(short int x, short int y) {
|
||||
unsigned int mask{0};
|
||||
unsigned int values[2]{0};
|
||||
|
||||
xcb_params_configure_window_t params{};
|
||||
XCB_AUX_ADD_PARAM(&mask, ¶ms, x, x);
|
||||
@ -86,9 +86,9 @@ window window::reconfigure_pos(int16_t x, int16_t y) {
|
||||
/**
|
||||
* Reconfigure the windows ewmh strut
|
||||
*/
|
||||
window window::reconfigure_struts(uint16_t w, uint16_t h, int16_t x, bool bottom) {
|
||||
uint32_t none{0};
|
||||
uint32_t values[12]{none};
|
||||
window window::reconfigure_struts(unsigned short int w, unsigned short int h, short int x, bool bottom) {
|
||||
unsigned int none{0};
|
||||
unsigned int values[12]{none};
|
||||
|
||||
if (bottom) {
|
||||
values[static_cast<int>(strut::BOTTOM)] = h;
|
||||
@ -125,7 +125,7 @@ void window::visibility_notify(xcb_visibility_t state) {
|
||||
notify->window = *this;
|
||||
notify->state = state;
|
||||
|
||||
uint32_t mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
unsigned int mask{XCB_EVENT_MASK_NO_EVENT};
|
||||
connection().send_event(false, *this, mask, reinterpret_cast<const char*>(notify.get()));
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ winspec::operator xcb_rectangle_t() const {
|
||||
}
|
||||
|
||||
xcb_window_t winspec::operator<<(const cw_flush& f) {
|
||||
uint32_t values[16]{0};
|
||||
unsigned int values[16]{0};
|
||||
|
||||
if (m_window == XCB_NONE) {
|
||||
m_window = m_connection.generate_id();
|
||||
|
@ -32,12 +32,12 @@ namespace wm_util {
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, _NET_WM_PID, XCB_ATOM_CARDINAL, 32, 1, &pid);
|
||||
}
|
||||
|
||||
void set_wm_desktop(xcb_connection_t* conn, xcb_window_t win, uint32_t desktop) {
|
||||
const uint32_t value_list[1]{desktop};
|
||||
void set_wm_desktop(xcb_connection_t* conn, xcb_window_t win, unsigned int desktop) {
|
||||
const unsigned int value_list[1]{desktop};
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, _NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, value_list);
|
||||
}
|
||||
|
||||
void set_wm_window_opacity(xcb_connection_t* conn, xcb_window_t win, uint64_t values) {
|
||||
void set_wm_window_opacity(xcb_connection_t* conn, xcb_window_t win, unsigned long int values) {
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, _NET_WM_WINDOW_OPACITY, XCB_ATOM_CARDINAL, 32, 1, &values);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace xembed {
|
||||
throw application_error("Invalid _XEMBED_INFO for window " + conn.id(win));
|
||||
}
|
||||
|
||||
std::vector<uint32_t> xembed_data{info.value<uint32_t>().begin(), info.value<uint32_t>().end()};
|
||||
std::vector<unsigned int> xembed_data{info.value<unsigned int>().begin(), info.value<unsigned int>().end()};
|
||||
|
||||
data->xembed = _XEMBED;
|
||||
data->xembed_info = _XEMBED_INFO;
|
||||
|
@ -5,30 +5,30 @@ int main() {
|
||||
using namespace polybar;
|
||||
|
||||
"rgb"_test = []{
|
||||
uint32_t color{0x123456};
|
||||
expect(color_util::alpha_channel<uint8_t>(color) == 0);
|
||||
expect(color_util::red_channel<uint8_t>(color) == 0x12);
|
||||
expect(color_util::green_channel<uint8_t>(color) == 0x34);
|
||||
expect(color_util::green_channel<uint16_t>(color) == 0x3434);
|
||||
expect(color_util::blue_channel<uint8_t>(color) == 0x56);
|
||||
unsigned int color{0x123456};
|
||||
expect(color_util::alpha_channel<unsigned char>(color) == 0);
|
||||
expect(color_util::red_channel<unsigned char>(color) == 0x12);
|
||||
expect(color_util::green_channel<unsigned char>(color) == 0x34);
|
||||
expect(color_util::green_channel<unsigned short int>(color) == 0x3434);
|
||||
expect(color_util::blue_channel<unsigned char>(color) == 0x56);
|
||||
};
|
||||
|
||||
"rgba"_test = []{
|
||||
uint32_t color{0xCC123456};
|
||||
expect(color_util::alpha_channel<uint16_t>(color) == 0xCCCC);
|
||||
expect(color_util::red_channel<uint16_t>(color) == 0x1212);
|
||||
expect(color_util::red_channel<uint8_t>(color) == 0x12);
|
||||
expect(color_util::green_channel<uint16_t>(color) == 0x3434);
|
||||
expect(color_util::blue_channel<uint16_t>(color) == 0x5656);
|
||||
unsigned int color{0xCC123456};
|
||||
expect(color_util::alpha_channel<unsigned short int>(color) == 0xCCCC);
|
||||
expect(color_util::red_channel<unsigned short int>(color) == 0x1212);
|
||||
expect(color_util::red_channel<unsigned char>(color) == 0x12);
|
||||
expect(color_util::green_channel<unsigned short int>(color) == 0x3434);
|
||||
expect(color_util::blue_channel<unsigned short int>(color) == 0x5656);
|
||||
};
|
||||
|
||||
"hex"_test = [] {
|
||||
uint32_t colorA{0x123456};
|
||||
expect(color_util::hex<uint8_t>(colorA).compare("#123456") == 0);
|
||||
uint32_t colorB{0xCC123456};
|
||||
expect(color_util::hex<uint16_t>(colorB).compare("#cc123456") == 0);
|
||||
uint32_t colorC{0x00ffffff};
|
||||
expect(color_util::hex<uint16_t>(colorC).compare("#00ffffff") == 0);
|
||||
unsigned int colorA{0x123456};
|
||||
expect(color_util::hex<unsigned char>(colorA).compare("#123456") == 0);
|
||||
unsigned int colorB{0xCC123456};
|
||||
expect(color_util::hex<unsigned short int>(colorB).compare("#cc123456") == 0);
|
||||
unsigned int colorC{0x00ffffff};
|
||||
expect(color_util::hex<unsigned short int>(colorC).compare("#00ffffff") == 0);
|
||||
};
|
||||
|
||||
"simplify"_test = [] {
|
||||
|
@ -6,13 +6,13 @@ int main() {
|
||||
"min"_test = [] {
|
||||
expect(math_util::min<int>(2, 5) == 2);
|
||||
expect(math_util::min<int>(-8, -50) == -50);
|
||||
expect(math_util::min<uint8_t>(0, -5) == 0);
|
||||
expect(math_util::min<unsigned char>(0, -5) == 0);
|
||||
};
|
||||
|
||||
"min"_test = [] {
|
||||
expect(math_util::max<int>(2, 5) == 5);
|
||||
expect(math_util::max<int>(-8, -50) == -8);
|
||||
expect(math_util::max<uint8_t>(0, (1 << 8) - 5));
|
||||
expect(math_util::max<unsigned char>(0, (1 << 8) - 5));
|
||||
};
|
||||
|
||||
"cap"_test = [] {
|
||||
|
@ -8,21 +8,21 @@ int main() {
|
||||
|
||||
"color"_test = [] {
|
||||
color test{"#33990022"};
|
||||
expect(color_util::hex<uint8_t>(test) == "#1E0006");
|
||||
expect(color_util::hex<uint16_t>(test) == "#33990022");
|
||||
expect(color_util::hex<unsigned char>(test) == "#1E0006");
|
||||
expect(color_util::hex<unsigned short int>(test) == "#33990022");
|
||||
};
|
||||
|
||||
"channels"_test = [] {
|
||||
color test{"#eefb9281"};
|
||||
expect(color_util::alpha_channel<uint8_t>(test) == 0xee);
|
||||
expect(color_util::red_channel<uint8_t>(test) == 0xfb);
|
||||
expect(color_util::green_channel<uint8_t>(test) == 0x92);
|
||||
expect(color_util::blue_channel<uint8_t>(test) == 0x81);
|
||||
expect(color_util::alpha_channel<unsigned char>(test) == 0xee);
|
||||
expect(color_util::red_channel<unsigned char>(test) == 0xfb);
|
||||
expect(color_util::green_channel<unsigned char>(test) == 0x92);
|
||||
expect(color_util::blue_channel<unsigned char>(test) == 0x81);
|
||||
};
|
||||
|
||||
"base"_test = [] {
|
||||
color test{"#eefb9281"};
|
||||
auto hex = color_util::hex<uint8_t>(test);
|
||||
auto hex = color_util::hex<unsigned char>(test);
|
||||
expect(std::strtoul(&hex[0], 0, 16) == 0x0);
|
||||
};
|
||||
|
||||
@ -34,17 +34,17 @@ int main() {
|
||||
expect(g_colorstore.size() == size_t{2});
|
||||
auto c3 = color::parse("#200");
|
||||
expect(g_colorstore.size() == size_t{2});
|
||||
expect((uint32_t)g_colorstore.find("#100")->second == (uint32_t)c1);
|
||||
expect((unsigned int)g_colorstore.find("#100")->second == (unsigned int)c1);
|
||||
};
|
||||
|
||||
"predefined"_test = [] {
|
||||
expect(color_util::hex<uint16_t>(g_colorblack) == "#FF000000");
|
||||
expect(color_util::hex<uint16_t>(g_colorwhite) == "#FFFFFFFF");
|
||||
expect(color_util::hex<unsigned short int>(g_colorblack) == "#FF000000");
|
||||
expect(color_util::hex<unsigned short int>(g_colorwhite) == "#FFFFFFFF");
|
||||
};
|
||||
|
||||
"parse"_test = [] {
|
||||
expect(color_util::hex<uint16_t>(color::parse("#ff9900", g_colorblack)) == "#FFFF9900");
|
||||
expect(color_util::hex<uint16_t>(color::parse("invalid", g_colorwhite)) == "#FFFFFFFF");
|
||||
expect(color_util::hex<uint8_t>(color::parse("33990022", g_colorwhite)) == "#1E0006");
|
||||
expect(color_util::hex<unsigned short int>(color::parse("#ff9900", g_colorblack)) == "#FFFF9900");
|
||||
expect(color_util::hex<unsigned short int>(color::parse("invalid", g_colorwhite)) == "#FFFFFFFF");
|
||||
expect(color_util::hex<unsigned char>(color::parse("33990022", g_colorwhite)) == "#1E0006");
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user