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