1 #pragma once 2 3 #include <xcb/xcb.h> 4 5 #include "common.hpp" 6 #include "utils/concurrency.hpp" 7 #include "x11/xembed.hpp" 8 9 POLYBAR_NS 10 11 // fwd declarations 12 class connection; 13 14 class tray_client { 15 public: 16 explicit tray_client(connection& conn, xcb_window_t win, unsigned int w, unsigned int h); 17 tray_client(const tray_client& c) = delete; 18 tray_client& operator=(tray_client& c) = delete; 19 20 ~tray_client(); 21 22 unsigned int width() const; 23 unsigned int height() const; 24 void clear_window() const; 25 26 bool match(const xcb_window_t& win) const; 27 bool mapped() const; 28 void mapped(bool state); 29 30 xcb_window_t window() const; 31 32 void query_xembed(); 33 bool is_xembed_supported() const; 34 const xembed::info& get_xembed() const; 35 36 void ensure_state() const; 37 void reconfigure(int x, int y) const; 38 void configure_notify(int x, int y) const; 39 40 protected: 41 connection& m_connection; 42 xcb_window_t m_window{0}; 43 44 /** 45 * Whether the client window supports XEMBED. 46 * 47 * A tray client can still work when it doesn't support XEMBED. 48 */ 49 bool m_xembed_supported{false}; 50 51 /** 52 * _XEMBED_INFO of the client window 53 */ 54 xembed::info m_xembed; 55 56 bool m_mapped{false}; 57 58 unsigned int m_width; 59 unsigned int m_height; 60 }; 61 62 POLYBAR_NS_END 63