2017-05-23 19:32:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "events/signal_fwd.hpp"
|
2017-08-31 16:26:38 +00:00
|
|
|
#include "events/signal_receiver.hpp"
|
|
|
|
#include "events/types.hpp"
|
2017-05-23 19:32:34 +00:00
|
|
|
#include "x11/extensions/fwd.hpp"
|
|
|
|
#include "x11/types.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
class logger;
|
|
|
|
|
|
|
|
namespace cairo {
|
|
|
|
class surface;
|
|
|
|
class xcb_surface;
|
|
|
|
}
|
|
|
|
|
2017-08-31 16:26:38 +00:00
|
|
|
class background_manager : public signal_receiver<SIGN_PRIORITY_SCREEN, signals::ui::update_geometry>,
|
|
|
|
public xpp::event::sink<evt::property_notify>
|
|
|
|
{
|
2017-05-23 19:32:34 +00:00
|
|
|
public:
|
|
|
|
using make_type = background_manager&;
|
|
|
|
static make_type make();
|
|
|
|
|
|
|
|
explicit background_manager(connection& conn, signal_emitter& sig, const logger& log);
|
|
|
|
~background_manager();
|
|
|
|
|
|
|
|
void activate(xcb_window_t window, xcb_rectangle_t rect);
|
|
|
|
void deactivate();
|
|
|
|
|
|
|
|
cairo::surface* get_surface() const;
|
|
|
|
|
|
|
|
void handle(const evt::property_notify& evt);
|
2017-08-31 16:26:38 +00:00
|
|
|
bool on(const signals::ui::update_geometry&);
|
2017-05-23 19:32:34 +00:00
|
|
|
private:
|
|
|
|
connection& m_connection;
|
|
|
|
signal_emitter& m_sig;
|
|
|
|
const logger& m_log;
|
|
|
|
xcb_window_t m_window;
|
|
|
|
|
|
|
|
xcb_rectangle_t m_rect{0, 0, 0U, 0U};
|
|
|
|
|
2017-12-21 21:48:02 +00:00
|
|
|
xcb_visualtype_t* m_visual{nullptr};
|
|
|
|
xcb_gcontext_t m_gcontext{XCB_NONE};
|
|
|
|
xcb_pixmap_t m_pixmap{XCB_NONE};
|
2017-05-23 19:32:34 +00:00
|
|
|
unique_ptr<cairo::xcb_surface> m_surface;
|
|
|
|
|
2017-12-21 21:48:02 +00:00
|
|
|
bool m_attached{false};
|
2018-07-05 19:06:05 +00:00
|
|
|
bool m_pseudo_transparency{false};
|
2017-05-23 19:32:34 +00:00
|
|
|
|
2018-07-05 19:06:05 +00:00
|
|
|
void allocate_resources(bool use_root_depth);
|
2017-05-23 19:32:34 +00:00
|
|
|
void free_resources();
|
2018-07-05 19:06:05 +00:00
|
|
|
void make_transparent_pixmap();
|
2017-05-23 19:32:34 +00:00
|
|
|
void fetch_root_pixmap();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|