Add const method variants to Xcb::Wrapper
Adding a const variant for ::data() to remove an unexpected copy. To complete also the bool cast operator and isNull get a const variant. REVIEW: 117469
This commit is contained in:
parent
acdff6ea52
commit
1c0d0211ca
2 changed files with 12 additions and 1 deletions
|
@ -351,7 +351,7 @@ void Workspace::init()
|
||||||
createUnmanaged(wins[i]);
|
createUnmanaged(wins[i]);
|
||||||
} else if (attr->map_state != XCB_MAP_STATE_UNMAPPED) {
|
} else if (attr->map_state != XCB_MAP_STATE_UNMAPPED) {
|
||||||
if (Application::wasCrash()) {
|
if (Application::wasCrash()) {
|
||||||
fixPositionAfterCrash(wins[i], windowGeometries[i].data());
|
fixPositionAfterCrash(wins[i], windowGeometries.at(i).data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### This will request the attributes again
|
// ### This will request the attributes again
|
||||||
|
|
11
xcbutils.h
11
xcbutils.h
|
@ -102,13 +102,24 @@ public:
|
||||||
getReply();
|
getReply();
|
||||||
return m_reply == NULL;
|
return m_reply == NULL;
|
||||||
}
|
}
|
||||||
|
inline bool isNull() const {
|
||||||
|
const_cast<Wrapper*>(this)->getReply();
|
||||||
|
return m_reply == NULL;
|
||||||
|
}
|
||||||
inline operator bool() {
|
inline operator bool() {
|
||||||
return !isNull();
|
return !isNull();
|
||||||
}
|
}
|
||||||
|
inline operator bool() const {
|
||||||
|
return !isNull();
|
||||||
|
}
|
||||||
inline const Reply *data() {
|
inline const Reply *data() {
|
||||||
getReply();
|
getReply();
|
||||||
return m_reply;
|
return m_reply;
|
||||||
}
|
}
|
||||||
|
inline const Reply *data() const {
|
||||||
|
const_cast<Wrapper*>(this)->getReply();
|
||||||
|
return m_reply;
|
||||||
|
}
|
||||||
inline WindowId window() const {
|
inline WindowId window() const {
|
||||||
return m_window;
|
return m_window;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue