Move detection for defaultDepth to xcbutils
This commit is contained in:
parent
a1ac6df20e
commit
2dcbbd6a3a
2 changed files with 19 additions and 11 deletions
12
outline.cpp
12
outline.cpp
|
@ -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;
|
||||
|
|
18
xcbutils.h
18
xcbutils.h
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue