fix(x11): Preload the _NET_WM_WINDOW_OPACITY atom

This commit is contained in:
Michael Carlberg 2017-01-11 05:00:23 +01:00
parent 5c9bfc147c
commit 568837d06a
4 changed files with 7 additions and 9 deletions

View File

@ -8,7 +8,7 @@ struct cached_atom {
xcb_atom_t* atom;
};
extern cached_atom ATOMS[34];
extern cached_atom ATOMS[35];
extern xcb_atom_t _NET_SUPPORTED;
extern xcb_atom_t _NET_CURRENT_DESKTOP;
@ -44,3 +44,4 @@ extern xcb_atom_t _XROOTMAP_ID;
extern xcb_atom_t _XSETROOT_ID;
extern xcb_atom_t ESETROOT_PMAP_ID;
extern xcb_atom_t _COMPTON_SHADOW;
extern xcb_atom_t _NET_WM_WINDOW_OPACITY;

View File

@ -426,7 +426,7 @@ void bar::reconfigure_wm_hints() {
xcb_icccm_set_wm_name(m_connection, m_opts.window, XCB_ATOM_STRING, 8, m_opts.wmname.size(), m_opts.wmname.c_str());
xcb_icccm_set_wm_class(m_connection, m_opts.window, 15, "polybar\0Polybar");
m_log.trace("bar: Set window _NET_Wm_opts.window_TYPE");
m_log.trace("bar: Set window _NET_WM_WINDOW_TYPE");
set_wm_window_type(m_connection, m_opts.window, {_NET_WM_WINDOW_TYPE_DOCK});
m_log.trace("bar: Set window _NET_WM_STATE");

View File

@ -37,9 +37,10 @@ xcb_atom_t _XROOTMAP_ID;
xcb_atom_t _XSETROOT_ID;
xcb_atom_t ESETROOT_PMAP_ID;
xcb_atom_t _COMPTON_SHADOW;
xcb_atom_t _NET_WM_WINDOW_OPACITY;
// clang-format off
cached_atom ATOMS[34] = {
cached_atom ATOMS[35] = {
{"_NET_SUPPORTED", sizeof("_NET_SUPPORTED") - 1, &_NET_SUPPORTED},
{"_NET_CURRENT_DESKTOP", sizeof("_NET_CURRENT_DESKTOP") - 1, &_NET_CURRENT_DESKTOP},
{"_NET_ACTIVE_WINDOW", sizeof("_NET_ACTIVE_WINDOW") - 1, &_NET_ACTIVE_WINDOW},
@ -74,5 +75,6 @@ cached_atom ATOMS[34] = {
{"_XSETROOT_ID", sizeof("_XSETROOT_ID") - 1, &_XSETROOT_ID},
{"ESETROOT_PMAP_ID", sizeof("ESETROOT_PMAP_ID") - 1, &ESETROOT_PMAP_ID},
{"_COMPTON_SHADOW", sizeof("_COMPTON_SHADOW") - 1, &_COMPTON_SHADOW},
{"_NET_WM_WINDOW_OPACITY", sizeof("_NET_WM_WINDOW_OPACITY") - 1, &_NET_WM_WINDOW_OPACITY},
};
// clang-format on

View File

@ -38,12 +38,7 @@ namespace wm_util {
}
void set_wm_window_opacity(xcb_connection_t* conn, xcb_window_t win, uint64_t values) {
xcb_intern_atom_reply_t* reply{
xcb_intern_atom_reply(conn, xcb_intern_atom(conn, false, 22, "_NET_WM_WINDOW_OPACITY"), nullptr)};
if (reply) {
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, reply->atom, XCB_ATOM_CARDINAL, 32, 1, &values);
free(reply);
}
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win, _NET_WM_WINDOW_OPACITY, XCB_ATOM_CARDINAL, 32, 1, &values);
}
}