refactor(x11): Close xlib display
This commit is contained in:
parent
a2bcb1a627
commit
ce7faa9fe7
@ -21,7 +21,6 @@
|
||||
using namespace polybar;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// std::cout << x << std::Endl;
|
||||
// clang-format off
|
||||
const command_line::options opts{
|
||||
command_line::option{"-h", "--help", "Show help options"},
|
||||
|
@ -62,9 +62,13 @@ connection::connection(Display* dsp) : base_type(XGetXCBConnection(dsp)), m_disp
|
||||
}
|
||||
|
||||
connection::~connection() {
|
||||
disconnect();
|
||||
std::for_each(m_visual.begin(), m_visual.end(), [=](pair<uint8_t, Visual*> p) { XFree(p.second); });
|
||||
m_visual.clear();
|
||||
if (m_display != nullptr) {
|
||||
XCloseDisplay(m_display);
|
||||
} else {
|
||||
disconnect();
|
||||
std::for_each(m_visual.begin(), m_visual.end(), [=](pair<uint8_t, Visual*> p) { XFree(p.second); });
|
||||
m_visual.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void connection::pack_values(uint32_t mask, const uint32_t* src, uint32_t* dest) {
|
||||
|
@ -37,11 +37,7 @@ font_manager::font_manager(connection& conn, const logger& logger)
|
||||
, m_logger(logger)
|
||||
, m_display(m_connection)
|
||||
, m_visual(m_connection.visual())
|
||||
, m_colormap(XDefaultColormap(m_display, m_connection.default_screen())) {
|
||||
if (!XftInit(nullptr) || !XftInitFtLibrary()) {
|
||||
throw application_error("Could not initialize Xft library");
|
||||
}
|
||||
}
|
||||
, m_colormap(XDefaultColormap(m_display, m_connection.default_screen())) {}
|
||||
|
||||
font_manager::~font_manager() {
|
||||
cleanup();
|
||||
|
Loading…
Reference in New Issue
Block a user