From b30438c311a356f7bb1621f1ed3cb9a99e7d96c9 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 16 Jan 2015 08:44:49 +0100 Subject: Refactor: bundle xinerama-info together, simpler code Part of this massive looking but simple rather simple change is a the way we check for active Xinerama: XineramaIsActive() was used before. The docs for XineramaQueryScreens() state that XineramaQueryScreens() returns NULL and sets number to 0 if Xinerama is not active. Sold. --- src/Screen.cc | 84 +++++++++++++++++++++++++---------------------------------- src/Screen.hh | 29 ++++++++++++--------- 2 files changed, 52 insertions(+), 61 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 296fec0..6ddcded 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -227,7 +227,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, m_focus_control(new FocusControl(*this)), m_placement_strategy(new ScreenPlacement(*this)), m_cycling(false), m_cycle_opts(0), - m_xinerama_headinfo(0), m_restart(false), m_shutdown(false) { @@ -468,8 +467,8 @@ BScreen::~BScreen() { tmp.pop_back(); } - if (hasXinerama() && m_xinerama_headinfo) { - delete [] m_xinerama_headinfo; + if (hasXinerama()) { + m_xinerama.heads.clear(); } // slit must be destroyed before headAreas (Struts) @@ -1608,51 +1607,42 @@ WinClient *BScreen::findGroupRight(WinClient &winclient) { void BScreen::clearXinerama() { fbdbg<<"BScreen::initXinerama(): dont have Xinerama"<display(); + Display* display = FbTk::App::instance()->display(); + int number = 0; + XineramaScreenInfo *si = XineramaQueryScreens(display, &number); - if (!XineramaIsActive(display)) { + if (!si && number == 0) { clearXinerama(); return; } - fbdbg<<"BScreen::initXinerama(): have Xinerama"<