2016-11-26 18:46:41 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "components/types.hpp"
|
2016-12-05 14:41:00 -05:00
|
|
|
#include "events/signal_emitter.hpp"
|
2016-12-26 04:27:30 -05:00
|
|
|
#include "events/signal_fwd.hpp"
|
2016-12-26 22:58:41 -05:00
|
|
|
#include "x11/extensions/randr.hpp"
|
2016-12-26 04:27:30 -05:00
|
|
|
#include "x11/types.hpp"
|
2016-11-26 18:46:41 -05:00
|
|
|
#include "x11/window.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
// fwd
|
|
|
|
class config;
|
|
|
|
class logger;
|
|
|
|
class connection;
|
2016-12-05 14:41:00 -05:00
|
|
|
class signal_emitter;
|
2016-11-26 18:46:41 -05:00
|
|
|
|
2022-11-30 09:05:34 -05:00
|
|
|
class screen : public xpp::event::sink<evt::map_notify, evt::randr_screen_change_notify> {
|
2016-11-26 18:46:41 -05:00
|
|
|
public:
|
2016-12-09 03:40:46 -05:00
|
|
|
using make_type = unique_ptr<screen>;
|
|
|
|
static make_type make();
|
2016-12-09 03:02:47 -05:00
|
|
|
|
2016-12-05 14:41:00 -05:00
|
|
|
explicit screen(connection& conn, signal_emitter& emitter, const logger& logger, const config& conf);
|
2016-11-26 18:46:41 -05:00
|
|
|
~screen();
|
|
|
|
|
|
|
|
protected:
|
2022-11-30 09:05:34 -05:00
|
|
|
void handle(const evt::map_notify& evt) override;
|
2021-01-04 04:38:43 -05:00
|
|
|
void handle(const evt::randr_screen_change_notify& evt) override;
|
2016-11-26 18:46:41 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
connection& m_connection;
|
2016-12-05 14:41:00 -05:00
|
|
|
signal_emitter& m_sig;
|
2016-11-26 18:46:41 -05:00
|
|
|
const logger& m_log;
|
|
|
|
const config& m_conf;
|
|
|
|
|
|
|
|
xcb_window_t m_root;
|
2016-12-01 02:41:49 -05:00
|
|
|
xcb_window_t m_proxy{XCB_NONE};
|
2016-11-26 18:46:41 -05:00
|
|
|
|
2016-12-03 10:44:31 -05:00
|
|
|
vector<monitor_t> m_monitors;
|
2021-01-04 04:38:43 -05:00
|
|
|
struct size m_size {
|
|
|
|
0U, 0U
|
|
|
|
};
|
2016-11-26 18:46:41 -05:00
|
|
|
bool m_sigraised{false};
|
2019-06-30 09:34:18 -04:00
|
|
|
|
2022-11-30 09:05:34 -05:00
|
|
|
/**
|
|
|
|
* Original event mask on the root window.
|
|
|
|
* Used to restore event mask after the proxy window is mapped.
|
|
|
|
*/
|
|
|
|
uint32_t m_root_mask{0};
|
|
|
|
|
2019-06-30 09:34:18 -04:00
|
|
|
bool have_monitors_changed() const;
|
2016-11-26 18:46:41 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|