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]);
|
||||
} else if (attr->map_state != XCB_MAP_STATE_UNMAPPED) {
|
||||
if (Application::wasCrash()) {
|
||||
fixPositionAfterCrash(wins[i], windowGeometries[i].data());
|
||||
fixPositionAfterCrash(wins[i], windowGeometries.at(i).data());
|
||||
}
|
||||
|
||||
// ### This will request the attributes again
|
||||
|
|
11
xcbutils.h
11
xcbutils.h
|
@ -102,13 +102,24 @@ public:
|
|||
getReply();
|
||||
return m_reply == NULL;
|
||||
}
|
||||
inline bool isNull() const {
|
||||
const_cast<Wrapper*>(this)->getReply();
|
||||
return m_reply == NULL;
|
||||
}
|
||||
inline operator bool() {
|
||||
return !isNull();
|
||||
}
|
||||
inline operator bool() const {
|
||||
return !isNull();
|
||||
}
|
||||
inline const Reply *data() {
|
||||
getReply();
|
||||
return m_reply;
|
||||
}
|
||||
inline const Reply *data() const {
|
||||
const_cast<Wrapper*>(this)->getReply();
|
||||
return m_reply;
|
||||
}
|
||||
inline WindowId window() const {
|
||||
return m_window;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue