fix: Bottom strut relative to screen

This commit is contained in:
Michael Carlberg 2016-11-15 02:17:21 +01:00
parent ffe76b0556
commit 70a5f1d41e
3 changed files with 17 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
const bar_settings settings() const;
void parse(string data, bool force = false);
int i = 0;
protected:
void flush();
void refresh_window();
@ -86,6 +86,8 @@ int i = 0;
throttle_util::throttle_t m_throttler;
xcb_screen_t* m_screen;
rect m_screensize{};
xcb_visualtype_t* m_visual;
window m_window{m_connection, m_connection.generate_id()};

View File

@ -13,6 +13,11 @@ enum class attribute { NONE = 0, o = 2, u = 4 };
enum class mousebtn { NONE = 0, LEFT, MIDDLE, RIGHT, SCROLL_UP, SCROLL_DOWN };
enum class gc { NONE = 0, BG, FG, OL, UL, BT, BB, BL, BR };
struct rect {
uint16_t w{0};
uint16_t h{0};
};
enum class strut {
LEFT = 0,
RIGHT,

View File

@ -64,6 +64,10 @@ void bar::bootstrap(bool nodraw) {
m_screen = m_connection.screen();
auto geom = m_connection.get_geometry(m_screen->root);
m_screensize.w = geom->width;
m_screensize.h = geom->height;
// limit the amount of allowed input events to 1 per 60ms
m_throttler = throttle_util::make_throttler(1, 60ms);
@ -671,6 +675,7 @@ void bar::restack_window() {
* Map window and reconfigure its position
*/
void bar::map_window() {
auto geom = m_connection.get_geometry(m_screen->root);
auto w = m_opts.width + m_opts.offset_x;
auto h = m_opts.height + m_opts.offset_y;
auto x = m_opts.x;
@ -682,6 +687,10 @@ void bar::map_window() {
h += m_opts.margins.b;
}
if (m_opts.bottom && m_opts.monitor->y + m_opts.monitor->h < m_screensize.h) {
h += m_screensize.h - (m_opts.monitor->y + m_opts.monitor->h);
}
m_window.map_checked();
m_window.reconfigure_struts(w, h, x, m_opts.bottom);
m_window.reconfigure_pos(x, y);