2016-12-05 14:41:00 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <xcb/xcb.h>
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "utils/concurrency.hpp"
|
2021-09-08 12:13:21 -04:00
|
|
|
#include "x11/xembed.hpp"
|
2016-12-05 14:41:00 -05:00
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
// fwd declarations
|
|
|
|
class connection;
|
|
|
|
|
|
|
|
class tray_client {
|
|
|
|
public:
|
2017-01-19 05:11:28 -05:00
|
|
|
explicit tray_client(connection& conn, xcb_window_t win, unsigned int w, unsigned int h);
|
2019-03-06 03:00:11 -05:00
|
|
|
tray_client(const tray_client& c) = delete;
|
|
|
|
tray_client& operator=(tray_client& c) = delete;
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
~tray_client();
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2017-01-19 05:11:28 -05:00
|
|
|
unsigned int width() const;
|
|
|
|
unsigned int height() const;
|
2016-12-21 17:22:02 -05:00
|
|
|
void clear_window() const;
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
bool match(const xcb_window_t& win) const;
|
|
|
|
bool mapped() const;
|
|
|
|
void mapped(bool state);
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
xcb_window_t window() const;
|
2021-09-08 12:13:21 -04:00
|
|
|
|
|
|
|
void query_xembed();
|
|
|
|
bool is_xembed_supported() const;
|
|
|
|
const xembed::info& get_xembed() const;
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
void ensure_state() const;
|
2017-01-19 05:11:28 -05:00
|
|
|
void reconfigure(int x, int y) const;
|
|
|
|
void configure_notify(int x, int y) const;
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
protected:
|
|
|
|
connection& m_connection;
|
|
|
|
xcb_window_t m_window{0};
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2021-09-08 12:13:21 -04:00
|
|
|
/**
|
|
|
|
* Whether the client window supports XEMBED.
|
|
|
|
*
|
|
|
|
* A tray client can still work when it doesn't support XEMBED.
|
|
|
|
*/
|
|
|
|
bool m_xembed_supported{false};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _XEMBED_INFO of the client window
|
|
|
|
*/
|
|
|
|
xembed::info m_xembed;
|
|
|
|
|
2016-12-21 17:22:02 -05:00
|
|
|
bool m_mapped{false};
|
2016-12-05 14:41:00 -05:00
|
|
|
|
2017-01-19 05:11:28 -05:00
|
|
|
unsigned int m_width;
|
|
|
|
unsigned int m_height;
|
2016-12-21 17:22:02 -05:00
|
|
|
};
|
2016-12-05 14:41:00 -05:00
|
|
|
|
|
|
|
POLYBAR_NS_END
|