Move detection for defaultDepth to xcbutils

This commit is contained in:
Martin Gräßlin 2013-02-11 15:52:36 +01:00
parent a1ac6df20e
commit 2dcbbd6a3a
2 changed files with 19 additions and 11 deletions

View file

@ -96,17 +96,7 @@ void Outline::showWithX()
m_initialized = true;
}
int screen = QX11Info::appScreen();
int defaultDepth = 0;
// TODO: move into xcbutils or maybe kwinglobals
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(connection()));
it.rem;
--screen, xcb_screen_next(&it)) {
if (screen == 0) {
defaultDepth = it.data->root_depth;
break;
}
}
const int defaultDepth = Xcb::defaultDepth();
// left/right parts are between top/bottom, they don't reach as far as the corners
const uint16_t verticalWidth = 5;

View file

@ -512,6 +512,24 @@ static inline void restackWindowsWithRaise(const QVector<xcb_window_t> &windows)
restackWindows(windows);
}
static inline int defaultDepth()
{
static int depth = 0;
if (depth != 0) {
return depth;
}
int screen = QX11Info::appScreen();
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(connection()));
it.rem;
--screen, xcb_screen_next(&it)) {
if (screen == 0) {
depth = it.data->root_depth;
break;
}
}
return depth;
}
} // namespace X11
} // namespace KWin