refactor: Tray transparency and code cleaning
- Make pseudo-transparency work as intended, fixes #158 - Fill tray pixmap in case a root pixmap is not found - Split up bar bootstrap routine - Formatting (clang-format)
This commit is contained in:
parent
f2bbd301f2
commit
23996fdcdc
16 changed files with 1032 additions and 872 deletions
include/components
|
@ -20,13 +20,13 @@ LEMONBUDDY_NS
|
|||
|
||||
class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::property_notify> {
|
||||
public:
|
||||
explicit bar(connection& conn, const config& config, const logger& logger,
|
||||
unique_ptr<fontmanager> fontmanager, unique_ptr<traymanager> traymanager)
|
||||
explicit bar(connection& conn, const config& config, const logger& logger, unique_ptr<fontmanager> fontmanager,
|
||||
unique_ptr<tray_manager> tray_manager)
|
||||
: m_connection(conn)
|
||||
, m_conf(config)
|
||||
, m_log(logger)
|
||||
, m_fontmanager(forward<decltype(fontmanager)>(fontmanager))
|
||||
, m_traymanager(forward<decltype(traymanager)>(traymanager)) {}
|
||||
, m_tray(forward<decltype(tray_manager)>(tray_manager)) {}
|
||||
|
||||
~bar();
|
||||
|
||||
|
@ -35,20 +35,29 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
void activate_tray();
|
||||
|
||||
const bar_settings settings() const;
|
||||
const tray_settings tray() const;
|
||||
|
||||
void parse(string data, bool force = false);
|
||||
|
||||
protected:
|
||||
void flush();
|
||||
void refresh_window();
|
||||
void load_fonts();
|
||||
void configure_geom();
|
||||
void create_monitor();
|
||||
void create_window();
|
||||
void create_pixmap();
|
||||
void create_gcontexts();
|
||||
void create_rootpixmap();
|
||||
void restack_window();
|
||||
void set_wmhints();
|
||||
|
||||
int get_centerx();
|
||||
int get_innerwidth();
|
||||
|
||||
void handle(const evt::button_press& evt);
|
||||
void handle(const evt::expose& evt);
|
||||
void handle(const evt::property_notify& evt);
|
||||
|
||||
protected:
|
||||
int center_x();
|
||||
int width_inner();
|
||||
|
||||
void on_alignment_change(alignment align);
|
||||
void on_attribute_set(attribute attr);
|
||||
void on_attribute_unset(attribute attr);
|
||||
|
@ -72,7 +81,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
const config& m_conf;
|
||||
const logger& m_log;
|
||||
unique_ptr<fontmanager> m_fontmanager;
|
||||
unique_ptr<traymanager> m_traymanager;
|
||||
unique_ptr<tray_manager> m_tray;
|
||||
|
||||
threading_util::spin_lock m_lock;
|
||||
throttle_util::throttle_t m_throttler;
|
||||
|
@ -87,14 +96,16 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
|||
// xcb_gcontext_t m_root_gc{0};
|
||||
// graphics_util::root_pixmap m_rootpixmap;
|
||||
|
||||
bar_settings m_bar;
|
||||
tray_settings m_tray;
|
||||
bar_settings m_opts;
|
||||
map<border, border_settings> m_borders;
|
||||
map<gc, gcontext> m_gcontexts;
|
||||
vector<action_block> m_actions;
|
||||
|
||||
stateflag m_sinkattached{false};
|
||||
|
||||
alignment m_traypos{alignment::NONE};
|
||||
uint16_t m_trayclients{0};
|
||||
|
||||
string m_prevdata;
|
||||
int m_xpos{0};
|
||||
int m_attributes{0};
|
||||
|
@ -115,7 +126,7 @@ namespace {
|
|||
configure_config(),
|
||||
configure_logger(),
|
||||
configure_fontmanager(),
|
||||
configure_traymanager());
|
||||
configure_tray_manager());
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class config {
|
|||
* Get list of values for the current bar by name
|
||||
*/
|
||||
template <typename T>
|
||||
T get_list(string key) const {
|
||||
vector<T> get_list(string key) const {
|
||||
return get_list<T>(bar_section(), key);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,8 @@ LEMONBUDDY_NS
|
|||
|
||||
class controller {
|
||||
public:
|
||||
explicit controller(connection& conn, const logger& logger, const config& config,
|
||||
unique_ptr<eventloop> eventloop, unique_ptr<bar> bar,
|
||||
inotify_util::watch_t& confwatch)
|
||||
explicit controller(connection& conn, const logger& logger, const config& config, unique_ptr<eventloop> eventloop,
|
||||
unique_ptr<bar> bar, inotify_util::watch_t& confwatch)
|
||||
: m_connection(conn)
|
||||
, m_log(logger)
|
||||
, m_conf(config)
|
||||
|
|
|
@ -59,28 +59,6 @@ struct bar_settings {
|
|||
}
|
||||
};
|
||||
|
||||
struct tray_settings {
|
||||
tray_settings() = default;
|
||||
tray_settings& operator=(const tray_settings& o) = default;
|
||||
|
||||
alignment align{alignment::NONE};
|
||||
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 height{0};
|
||||
uint16_t height_fill{0};
|
||||
uint16_t spacing{0};
|
||||
uint32_t sibling{0};
|
||||
uint32_t background{0};
|
||||
xcb_pixmap_t back_pixmap{0};
|
||||
bool transparent{false};
|
||||
};
|
||||
|
||||
struct border_settings {
|
||||
border_settings() = default;
|
||||
lemonbuddy::color color{g_colorblack};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue