fix: Update _NET_WM_* atoms for the bar window

This commit is contained in:
Michael Carlberg 2016-10-15 20:07:05 +02:00
parent 1445b95af8
commit 0128168c51

View file

@ -244,7 +244,6 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose> {
m_log.trace("bar: Set _NET_WM_WINDOW_TYPE");
{
// const uint32_t win_types[2] = {_NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_NORMAL};
const uint32_t win_types[1] = {_NET_WM_WINDOW_TYPE_DOCK};
m_connection.change_property_checked(
XCB_PROP_MODE_REPLACE, m_window, _NET_WM_WINDOW_TYPE, XCB_ATOM_ATOM, 32, 1, win_types);
@ -252,52 +251,26 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose> {
m_log.trace("bar: Set _NET_WM_STATE");
{
if (m_bar.width == m_bar.monitor->w) {
const uint32_t win_states[3] = {
_NET_WM_STATE_STICKY, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_MAXIMIZED_VERT};
m_connection.change_property_checked(
XCB_PROP_MODE_REPLACE, m_window, _NET_WM_STATE, XCB_ATOM_ATOM, 32, 3, win_states);
} else {
const uint32_t win_states[2] = {_NET_WM_STATE_STICKY, _NET_WM_STATE_SKIP_TASKBAR};
m_connection.change_property_checked(
XCB_PROP_MODE_REPLACE, m_window, _NET_WM_STATE, XCB_ATOM_ATOM, 32, 2, win_states);
}
}
m_log.trace("bar: Set _NET_WM_STRUT");
{
// clang-format off
uint32_t none{0};
uint32_t value_list[4]{
static_cast<uint32_t>(m_bar.x), // left
none, // right
m_bar.bottom ? none : m_bar.height + m_bar.offset_y, // top
m_bar.bottom ? m_bar.height + m_bar.offset_y : none, // bottom
};
// clang-format on
const uint32_t win_states[2] = {_NET_WM_STATE_STICKY, _NET_WM_STATE_ABOVE};
m_connection.change_property_checked(
XCB_PROP_MODE_REPLACE, m_window, _NET_WM_STRUT, XCB_ATOM_CARDINAL, 32, 4, value_list);
XCB_PROP_MODE_REPLACE, m_window, _NET_WM_STATE, XCB_ATOM_ATOM, 32, 2, win_states);
}
m_log.trace("bar: Set _NET_WM_STRUT_PARTIAL");
{
// clang-format off
uint32_t none{0};
const uint32_t value_list[12]{
static_cast<uint32_t>(m_bar.x), // left
none, // right
m_bar.bottom ? none : m_bar.height + m_bar.offset_y, // top
m_bar.bottom ? m_bar.height + m_bar.offset_y : none, // bottom
none, // left_start_y
none, // left_end_y
none, // right_start_y
none, // right_end_y
m_bar.bottom ? none : m_bar.x, // top_start_x
m_bar.bottom ? none : static_cast<uint32_t>(m_bar.x + m_bar.width), // top_end_x
m_bar.bottom ? m_bar.x : none, // bottom_start_x
m_bar.bottom ? static_cast<uint32_t>(m_bar.x + m_bar.width) : none, // bottom_end_x
};
// clang-format on
uint32_t value_list[12]{none};
if (m_bar.bottom) {
value_list[3] = m_bar.height;
value_list[10] = m_bar.x;
value_list[11] = m_bar.x + m_bar.width;
} else {
value_list[2] = m_bar.height;
value_list[8] = m_bar.x;
value_list[9] = m_bar.x + m_bar.width;
}
m_connection.change_property_checked(XCB_PROP_MODE_REPLACE, m_window, _NET_WM_STRUT_PARTIAL,
XCB_ATOM_CARDINAL, 32, 12, value_list);
}