2016-06-15 03:32:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.hpp"
|
2016-11-02 19:22:45 +00:00
|
|
|
#include "x11/connection.hpp"
|
2016-11-13 15:10:20 +00:00
|
|
|
#include "x11/randr.hpp"
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
using connection_t = connection;
|
|
|
|
|
|
|
|
class window : public xpp::window<connection_t&> {
|
|
|
|
public:
|
|
|
|
using xpp::window<connection_t&>::window;
|
|
|
|
|
2016-11-19 03:03:18 +00:00
|
|
|
explicit window(connection_t& conn) : xpp::window<connection_t&>(conn, XCB_NONE) {}
|
|
|
|
|
|
|
|
window& operator=(const xcb_window_t win) {
|
|
|
|
*this = window{connection(), win};
|
|
|
|
return *this;
|
|
|
|
}
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-13 20:50:21 +00:00
|
|
|
window create_checked(
|
|
|
|
int16_t x, int16_t y, uint16_t w, uint16_t h, uint32_t mask = 0, const xcb_params_cw_t* p = nullptr);
|
2016-11-02 19:22:45 +00:00
|
|
|
|
2016-11-19 03:03:18 +00:00
|
|
|
window change_event_mask(uint32_t mask);
|
|
|
|
window ensure_event_mask(uint32_t event);
|
|
|
|
|
2016-11-12 11:56:39 +00:00
|
|
|
window reconfigure_geom(uint16_t w, uint16_t h, int16_t x = 0, int16_t y = 0);
|
|
|
|
window reconfigure_pos(int16_t x, int16_t y);
|
2016-11-13 20:50:21 +00:00
|
|
|
window reconfigure_struts(uint16_t w, uint16_t h, int16_t x, bool bottom = false);
|
2016-11-04 17:54:33 +00:00
|
|
|
|
2016-11-12 11:56:39 +00:00
|
|
|
void redraw();
|
2016-06-15 03:32:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// struct cw_size {
|
|
|
|
// cw_size(uint16_t w, uint16_t h) : w(w), h(h){};
|
|
|
|
// uint16_t w;
|
|
|
|
// uint16_t h;
|
|
|
|
// };
|
|
|
|
// struct cw_pos {
|
|
|
|
// cw_pos(int16_t x, int16_t y) : x(x), y(y){};
|
|
|
|
// int16_t x;
|
|
|
|
// int16_t y;
|
|
|
|
// };
|
|
|
|
// struct cw_border {
|
|
|
|
// cw_border(uint16_t border_width) : border_width(border_width){};
|
|
|
|
// uint16_t border_width;
|
|
|
|
// };
|
|
|
|
// struct cw_class {
|
|
|
|
// cw_class(uint16_t class_) : class_(class_){};
|
|
|
|
// uint16_t class_;
|
|
|
|
// };
|
|
|
|
// struct cw_parent {
|
|
|
|
// cw_parent(xcb_window_t parent) : parent(parent){};
|
|
|
|
// xcb_window_t parent;
|
|
|
|
// };
|
|
|
|
// struct cw_depth {
|
|
|
|
// cw_depth(uint8_t depth) : depth(depth){};
|
|
|
|
// uint8_t depth;
|
|
|
|
// };
|
|
|
|
// struct cw_visual {
|
|
|
|
// cw_visual(xcb_visualid_t visualid) : visualid(visualid){};
|
|
|
|
// xcb_visualid_t visualid;
|
|
|
|
// };
|
|
|
|
// struct cw_mask {
|
|
|
|
// cw_mask(uint32_t mask) : mask(mask){};
|
|
|
|
// const uint32_t mask;
|
|
|
|
// };
|
|
|
|
// struct cw_params {
|
|
|
|
// cw_params(const xcb_params_cw_t* params) : params(params){};
|
|
|
|
// const xcb_params_cw_t* params;
|
|
|
|
// };
|
|
|
|
// struct cw_flush {
|
|
|
|
// cw_flush(bool checked = true) : checked(checked){};
|
|
|
|
// bool checked;
|
|
|
|
// };
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * Create X window
|
|
|
|
// *
|
|
|
|
// * Example usage:
|
|
|
|
// * @code cpp
|
|
|
|
// * auto win = winspec()
|
|
|
|
// * << cw_size(100, 200)
|
|
|
|
// * << cw_pos(10, -20)
|
|
|
|
// * << cw_border(9)
|
|
|
|
// * << cw_class(XCB_WINDOW_CLASS_INPUT_ONLY)
|
|
|
|
// * << cw_parent(0x000110a);
|
|
|
|
// * << cw_flush(false);
|
|
|
|
// * @endcode
|
|
|
|
// */
|
|
|
|
// class winspec {
|
|
|
|
// public:
|
|
|
|
// explicit winspec(connection& conn) : m_connection(conn) {}
|
|
|
|
//
|
|
|
|
// winspec& operator<<(cw_size w) {
|
|
|
|
// m_width = w.w;
|
|
|
|
// m_height = w.h;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_pos p) {
|
|
|
|
// m_x = p.x;
|
|
|
|
// m_y = p.y;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_border b) {
|
|
|
|
// m_border = b.border_width;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_class c) {
|
|
|
|
// m_class = c.class_;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_parent p) {
|
|
|
|
// m_parent = p.parent;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_depth d) {
|
|
|
|
// m_depth = d.depth;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_visual v) {
|
|
|
|
// m_visual = v.visualid;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_mask m) {
|
|
|
|
// m_mask = m.mask;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
// winspec& operator<<(cw_params p) {
|
|
|
|
// m_params = p.params;
|
|
|
|
// return *this;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// window operator<<(cw_flush f) {
|
|
|
|
// if (f.checked)
|
2016-10-11 21:36:11 +00:00
|
|
|
// m_connection.create_window_checked(m_depth, m_window, m_parent, m_x, m_y, m_width,
|
|
|
|
// m_height,
|
2016-06-15 03:32:35 +00:00
|
|
|
// m_border, m_class, m_visual, m_mask, m_params);
|
|
|
|
// else
|
2016-10-11 21:36:11 +00:00
|
|
|
// m_connection.create_window(m_depth, m_window, m_parent, m_x, m_y, m_width, m_height,
|
|
|
|
// m_border,
|
2016-06-15 03:32:35 +00:00
|
|
|
// m_class, m_visual, m_mask, m_params);
|
|
|
|
// return m_window;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// protected:
|
|
|
|
// connection& m_connection;
|
|
|
|
// window m_window{m_connection};
|
|
|
|
//
|
|
|
|
// uint8_t m_depth;
|
|
|
|
// xcb_window_t m_parent;
|
|
|
|
// int16_t m_x;
|
|
|
|
// int16_t m_y;
|
|
|
|
// uint16_t m_width;
|
|
|
|
// uint16_t m_height;
|
|
|
|
// uint16_t m_border;
|
|
|
|
// uint16_t m_class;
|
|
|
|
// xcb_visualid_t m_visual;
|
|
|
|
// uint32_t m_mask;
|
|
|
|
// const xcb_params_cw_t* m_params;
|
|
|
|
// };
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|