Switch to Q_ASSERT

Summary:
Switch to Q_ASSERT in order to make code a bit more consistent. We have
places where both assert and Q_ASSERT are used next to each other. Also,
distributions like Ubuntu don't strip away assert(), let's hope that
things are a bit different with Q_ASSERT.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23605
This commit is contained in:
Vlad Zagorodniy 2019-08-31 17:28:37 +03:00
parent 9102e41e71
commit 7a3722b4f5
30 changed files with 99 additions and 99 deletions

View file

@ -107,7 +107,7 @@ AbstractClient::AbstractClient()
AbstractClient::~AbstractClient()
{
assert(m_blockGeometryUpdates == 0);
Q_ASSERT(m_blockGeometryUpdates == 0);
Q_ASSERT(m_decoration.decoration == nullptr);
}
@ -1343,8 +1343,8 @@ bool AbstractClient::isModal() const
void AbstractClient::addTransient(AbstractClient *cl)
{
assert(!m_transients.contains(cl));
assert(cl != this);
Q_ASSERT(!m_transients.contains(cl));
Q_ASSERT(cl != this);
m_transients.append(cl);
}

View file

@ -414,7 +414,7 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
*/
void Workspace::clientHidden(AbstractClient* c)
{
assert(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity());
Q_ASSERT(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity());
activateNextClient(c);
}
@ -813,7 +813,7 @@ xcb_timestamp_t Client::userTime() const
xcb_timestamp_t time = m_userTime;
if (time == 0) // doesn't want focus after showing
return 0;
assert(group() != NULL);
Q_ASSERT(group() != NULL);
if (time == -1U
|| (group()->userTime() != -1U
&& NET::timestampCompare(group()->userTime(), time) > 0))

View file

@ -198,11 +198,11 @@ Client::~Client()
//SWrapper::Client::clientRelease(this);
if (syncRequest.alarm != XCB_NONE)
xcb_sync_destroy_alarm(connection(), syncRequest.alarm);
assert(!isMoveResize());
assert(m_client == XCB_WINDOW_NONE);
assert(m_wrapper == XCB_WINDOW_NONE);
//assert( frameId() == None );
assert(!check_active_modal);
Q_ASSERT(!isMoveResize());
Q_ASSERT(m_client == XCB_WINDOW_NONE);
Q_ASSERT(m_wrapper == XCB_WINDOW_NONE);
//Q_ASSERT( frameId() == None );
Q_ASSERT(!check_active_modal);
for (auto it = m_connections.constBegin(); it != m_connections.constEnd(); ++it) {
disconnect(*it);
}
@ -219,7 +219,7 @@ void Client::deleteClient(Client* c)
*/
void Client::releaseWindow(bool on_shutdown)
{
assert(!deleting);
Q_ASSERT(!deleting);
deleting = true;
#ifdef KWIN_BUILD_TABBOX
TabBox::TabBox *tabBox = TabBox::TabBox::self();
@ -295,7 +295,7 @@ void Client::releaseWindow(bool on_shutdown)
*/
void Client::destroyClient()
{
assert(!deleting);
Q_ASSERT(!deleting);
deleting = true;
#ifdef KWIN_BUILD_TABBOX
TabBox::TabBox *tabBox = TabBox::TabBox::self();
@ -841,7 +841,7 @@ void Client::setShade(ShadeMode mode)
return; // No real change in shaded state
}
assert(isDecorated()); // noborder windows can't be shaded
Q_ASSERT(isDecorated()); // noborder windows can't be shaded
GeometryUpdatesBlocker blocker(this);
// TODO: All this unmapping, resizing etc. feels too much duplicated from elsewhere
@ -983,13 +983,13 @@ void Client::updateVisibility()
*/
void Client::exportMappingState(int s)
{
assert(m_client != XCB_WINDOW_NONE);
assert(!deleting || s == WithdrawnState);
Q_ASSERT(m_client != XCB_WINDOW_NONE);
Q_ASSERT(!deleting || s == WithdrawnState);
if (s == WithdrawnState) {
m_client.deleteProperty(atoms->wm_state);
return;
}
assert(s == NormalState || s == IconicState);
Q_ASSERT(s == NormalState || s == IconicState);
int32_t data[2];
data[0] = s;
@ -1029,7 +1029,7 @@ void Client::internalHide()
void Client::internalKeep()
{
assert(compositing());
Q_ASSERT(compositing());
if (mapping_state == Kept)
return;
MappingState old = mapping_state;

View file

@ -582,14 +582,14 @@ void Compositor::timerEvent(QTimerEvent *te)
void Compositor::aboutToSwapBuffers()
{
assert(!m_bufferSwapPending);
Q_ASSERT(!m_bufferSwapPending);
m_bufferSwapPending = true;
}
void Compositor::bufferSwapComplete()
{
assert(m_bufferSwapPending);
Q_ASSERT(m_bufferSwapPending);
m_bufferSwapPending = false;
emit bufferSwapCompleted();

View file

@ -61,7 +61,7 @@ Deleted::~Deleted()
{
if (delete_refcount != 0)
qCCritical(KWIN_CORE) << "Deleted client has non-zero reference count (" << delete_refcount << ")";
assert(delete_refcount == 0);
Q_ASSERT(delete_refcount == 0);
if (workspace()) {
workspace()->removeDeleted(this);
}
@ -93,7 +93,7 @@ void Deleted::discard()
void Deleted::copyToDeleted(Toplevel* c)
{
assert(dynamic_cast< Deleted* >(c) == NULL);
Q_ASSERT(dynamic_cast< Deleted* >(c) == NULL);
Toplevel::copyToDeleted(c);
desk = c->desktop();
m_desktops = c->desktops();

View file

@ -678,7 +678,7 @@ bool EffectsHandlerImpl::doGrabKeyboard()
void EffectsHandlerImpl::ungrabKeyboard()
{
assert(keyboard_grab_effect != NULL);
Q_ASSERT(keyboard_grab_effect != NULL);
doUngrabKeyboard();
keyboard_grab_effect = NULL;
}

View file

@ -232,7 +232,7 @@ void LookingGlassEffect::paintScreen(int mask, QRegion region, ScreenPaintData &
if (m_valid && m_enabled) {
// Disable render texture
GLRenderTarget* target = GLRenderTarget::popRenderTarget();
assert(target == m_fbo);
Q_ASSERT(target == m_fbo);
Q_UNUSED(target);
m_texture->bind();
m_texture->generateMipmaps();

View file

@ -1073,7 +1073,7 @@ void PresentWindowsEffect::calculateWindowTransformationsClosest(EffectWindowLis
const int dist = distance(pos, slotCenters[i]);
if (dist < slotCandidateDistance) { // window is interested in this slot
EffectWindow *occupier = takenSlots[i];
assert(occupier != w);
Q_ASSERT(occupier != w);
if (!occupier || dist < distance((otherPos = occupier->geometry().center()), slotCenters[i])) {
// either nobody lives here, or we're better - takeover the slot if it's our best
slotCandidate = i;
@ -1081,7 +1081,7 @@ void PresentWindowsEffect::calculateWindowTransformationsClosest(EffectWindowLis
}
}
}
assert(slotCandidate != -1);
Q_ASSERT(slotCandidate != -1);
if (takenSlots[slotCandidate])
tmpList << takenSlots[slotCandidate]; // occupier needs a new home now :p
tmpList.removeAll(w);

View file

@ -1020,7 +1020,7 @@ NETExtendedStrut Client::strut() const
StrutRect Client::strutRect(StrutArea area) const
{
assert(area != StrutAreaAll); // Not valid
Q_ASSERT(area != StrutAreaAll); // Not valid
const QSize displaySize = screens()->displaySize();
NETExtendedStrut strutArea = strut();
switch(area) {
@ -1783,7 +1783,7 @@ void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, in
void Client::resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force)
{
assert(!shade_geometry_change);
Q_ASSERT(!shade_geometry_change);
if (isShade()) {
if (h == borderTop() + borderBottom()) {
qCWarning(KWIN_CORE) << "Shaded geometry passed for size:" ;
@ -2036,7 +2036,7 @@ void Client::plainResize(int w, int h, ForceGeometry_t force)
qCDebug(KWIN_CORE) << "forced size fail:" << s << ":" << rules()->checkSize(s);
}
// resuming geometry updates is handled only in setGeometry()
assert(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked());
Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked());
if (force == NormalGeometrySet && geom.size() == s)
return;
geom.setSize(s);
@ -2083,7 +2083,7 @@ void Client::plainResize(int w, int h, ForceGeometry_t force)
void AbstractClient::move(int x, int y, ForceGeometry_t force)
{
// resuming geometry updates is handled only in setGeometry()
assert(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked());
Q_ASSERT(pendingGeometryUpdate() == PendingGeometryNone || areGeometryUpdatesBlocked());
QPoint p(x, y);
if (!areGeometryUpdatesBlocked() && p != rules()->checkPosition(p)) {
qCDebug(KWIN_CORE) << "forced position fail:" << p << ":" << rules()->checkPosition(p);
@ -2555,7 +2555,7 @@ static GeometryTip* geometryTip = 0;
void Client::positionGeometryTip()
{
assert(isMove() || isResize());
Q_ASSERT(isMove() || isResize());
// Position and Size display
if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::GeometryTip))
return; // some effect paints this for us
@ -2577,9 +2577,9 @@ void Client::positionGeometryTip()
bool AbstractClient::startMoveResize()
{
assert(!isMoveResize());
assert(QWidget::keyboardGrabber() == NULL);
assert(QWidget::mouseGrabber() == NULL);
Q_ASSERT(!isMoveResize());
Q_ASSERT(QWidget::keyboardGrabber() == NULL);
Q_ASSERT(QWidget::mouseGrabber() == NULL);
stopDelayedMoveResize();
if (QApplication::activePopupWidget() != NULL)
return false; // popups have grab
@ -2774,7 +2774,7 @@ void AbstractClient::startDelayedMoveResize()
m_moveResize.delayedTimer->setSingleShot(true);
connect(m_moveResize.delayedTimer, &QTimer::timeout, this,
[this]() {
assert(isMoveResizePointerButtonDown());
Q_ASSERT(isMoveResizePointerButtonDown());
if (!startMoveResize()) {
setMoveResizePointerButtonDown(false);
}
@ -3032,7 +3032,7 @@ void AbstractClient::handleMoveResize(int x, int y, int x_root, int y_root)
if (moveResizeGeometry().size() != previousMoveResizeGeom.size())
update = true;
} else if (isMove()) {
assert(mode == PositionCenter);
Q_ASSERT(mode == PositionCenter);
if (!isMovable()) { // isMovableAcrossScreens() must have been true to get here
// Special moving of maximized windows on Xinerama screens
int screen = screens()->number(globalPos);

View file

@ -136,13 +136,13 @@ void Group::deref()
void Group::gotLeader(Client* leader_P)
{
assert(leader_P->window() == leader_wid);
Q_ASSERT(leader_P->window() == leader_wid);
leader_client = leader_P;
}
void Group::lostLeader()
{
assert(!_members.contains(leader_client));
Q_ASSERT(!_members.contains(leader_client));
leader_client = NULL;
if (_members.isEmpty()) {
workspace()->removeGroup(this);
@ -156,7 +156,7 @@ void Group::lostLeader()
Group* Workspace::findGroup(xcb_window_t leader) const
{
assert(leader != None);
Q_ASSERT(leader != None);
for (GroupList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it)
@ -439,7 +439,7 @@ void Client::setTransient(xcb_window_t new_transient_for_id)
m_transientForId = new_transient_for_id;
if (m_transientForId != XCB_WINDOW_NONE && !groupTransient()) {
transient_for = workspace()->findClient(Predicate::WindowMatch, m_transientForId);
assert(transient_for != NULL); // verifyTransient() had to check this
Q_ASSERT(transient_for != NULL); // verifyTransient() had to check this
transient_for->addTransient(this);
} // checkGroup() will check 'check_active_modal'
setTransientFor(transient_for);

View file

@ -111,7 +111,7 @@ void KCMRulesList::modifyClicked()
void KCMRulesList::deleteClicked()
{
int pos = rules_listbox->currentRow();
assert(pos != -1);
Q_ASSERT(pos != -1);
delete rules_listbox->takeItem(pos);
rules.erase(rules.begin() + pos);
emit changed(true);
@ -120,7 +120,7 @@ void KCMRulesList::deleteClicked()
void KCMRulesList::moveupClicked()
{
int pos = rules_listbox->currentRow();
assert(pos != -1);
Q_ASSERT(pos != -1);
if (pos > 0) {
QListWidgetItem * item = rules_listbox->takeItem(pos);
rules_listbox->insertItem(pos - 1 , item);
@ -135,7 +135,7 @@ void KCMRulesList::moveupClicked()
void KCMRulesList::movedownClicked()
{
int pos = rules_listbox->currentRow();
assert(pos != -1);
Q_ASSERT(pos != -1);
if (pos < int(rules_listbox->count()) - 1) {
QListWidgetItem * item = rules_listbox->takeItem(pos);
rules_listbox->insertItem(pos + 1 , item);
@ -150,7 +150,7 @@ void KCMRulesList::movedownClicked()
void KCMRulesList::exportClicked()
{
int pos = rules_listbox->currentRow();
assert(pos != -1);
Q_ASSERT(pos != -1);
QString path = QFileDialog::getSaveFileName(this, i18n("Export Rules"), QDir::home().absolutePath(),
i18n("KWin Rules (*.kwinrule)"));
if (path.isEmpty())

View file

@ -683,7 +683,7 @@ STRING_MATCH_COMBO(machine)
void RulesWidget::detectClicked()
{
assert(detect_dlg == nullptr);
Q_ASSERT(detect_dlg == nullptr);
detect_dlg = new DetectDialog;
connect(detect_dlg, SIGNAL(detectionDone(bool)), this, SLOT(detected(bool)));
detect_dlg->detect(Ui::RulesWidgetBase::detection_delay->value());

View file

@ -201,7 +201,7 @@ void Workspace::propagateClients(bool propagate_new_clients)
}
// TODO isn't it too inefficient to restack always all clients?
// TODO don't restack not visible windows?
assert(newWindowStack.at(0) == rootInfo()->supportWindow());
Q_ASSERT(newWindowStack.at(0) == rootInfo()->supportWindow());
Xcb::restackWindows(newWindowStack);
int pos = 0;
@ -450,7 +450,7 @@ void Workspace::lowerClientRequest(KWin::AbstractClient *c)
void Workspace::restack(AbstractClient* c, AbstractClient* under, bool force)
{
assert(unconstrained_stacking_order.contains(under));
Q_ASSERT(unconstrained_stacking_order.contains(under));
if (!force && !AbstractClient::belongToSameApplication(under, c)) {
// put in the stacking order below _all_ windows belonging to the active application
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
@ -466,7 +466,7 @@ void Workspace::restack(AbstractClient* c, AbstractClient* under, bool force)
unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(under), c);
}
assert(unconstrained_stacking_order.contains(c));
Q_ASSERT(unconstrained_stacking_order.contains(c));
FocusChain::self()->moveAfterClient(c, under);
updateStackingOrder();
}

View file

@ -736,7 +736,7 @@ EffectsHandler::EffectsHandler(CompositingType type)
EffectsHandler::~EffectsHandler()
{
// All effects should already be unloaded by Impl dtor
assert(loaded_effects.count() == 0);
Q_ASSERT(loaded_effects.count() == 0);
KWin::effects = nullptr;
}
@ -847,8 +847,8 @@ EffectWindowGroup::~EffectWindowGroup()
WindowQuad WindowQuad::makeSubQuad(double x1, double y1, double x2, double y2) const
{
assert(x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
#ifndef NDEBUG
Q_ASSERT(x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
#if !defined(QT_NO_DEBUG)
if (isTransformed())
qFatal("Splitting quads is allowed only in pre-paint calls!");
#endif
@ -935,7 +935,7 @@ WindowQuadList WindowQuadList::splitAtX(double x) const
{
WindowQuadList ret;
foreach (const WindowQuad & quad, *this) {
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (quad.isTransformed())
qFatal("Splitting quads is allowed only in pre-paint calls!");
#endif
@ -967,7 +967,7 @@ WindowQuadList WindowQuadList::splitAtY(double y) const
{
WindowQuadList ret;
foreach (const WindowQuad & quad, *this) {
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (quad.isTransformed())
qFatal("Splitting quads is allowed only in pre-paint calls!");
#endif
@ -1007,7 +1007,7 @@ WindowQuadList WindowQuadList::makeGrid(int maxQuadSize) const
double bottom = first().bottom();
foreach (const WindowQuad &quad, *this) {
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (quad.isTransformed())
qFatal("Splitting quads is allowed only in pre-paint calls!");
#endif
@ -1064,7 +1064,7 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
double bottom = first().bottom();
foreach (const WindowQuad &quad, *this) {
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (quad.isTransformed())
qFatal("Splitting quads is allowed only in pre-paint calls!");
#endif
@ -1129,7 +1129,7 @@ void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertic
GLVertex2D *vertex = vertices;
assert(type == GL_QUADS || type == GL_TRIANGLES);
Q_ASSERT(type == GL_QUADS || type == GL_TRIANGLES);
switch (type)
{
@ -1361,7 +1361,7 @@ bool PaintClipper::clip()
QRegion PaintClipper::paintArea()
{
assert(areas != nullptr); // can be called only with clip() == true
Q_ASSERT(areas != nullptr); // can be called only with clip() == true
const QSize &s = effects->virtualScreenSize();
QRegion ret = QRegion(0, 0, s.width(), s.height());
foreach (const QRegion & r, *areas)

View file

@ -3778,21 +3778,21 @@ WindowQuad::WindowQuad(WindowQuadType t, int id)
inline
WindowVertex& WindowQuad::operator[](int index)
{
assert(index >= 0 && index < 4);
Q_ASSERT(index >= 0 && index < 4);
return verts[ index ];
}
inline
const WindowVertex& WindowQuad::operator[](int index) const
{
assert(index >= 0 && index < 4);
Q_ASSERT(index >= 0 && index < 4);
return verts[ index ];
}
inline
WindowQuadType WindowQuad::type() const
{
assert(quadType != WindowQuadError);
Q_ASSERT(quadType != WindowQuadError);
return quadType;
}
@ -3805,14 +3805,14 @@ int WindowQuad::id() const
inline
bool WindowQuad::decoration() const
{
assert(quadType != WindowQuadError);
Q_ASSERT(quadType != WindowQuadError);
return quadType == WindowQuadDecoration;
}
inline
bool WindowQuad::effect() const
{
assert(quadType != WindowQuadError);
Q_ASSERT(quadType != WindowQuadError);
return quadType >= EFFECT_QUAD_TYPE_START;
}

View file

@ -1910,7 +1910,7 @@ bool GLVertexBufferPrivate::awaitFence(intptr_t end)
fences.pop_front();
}
assert(!fences.empty());
Q_ASSERT(!fences.empty());
// Wait on the next fence
const BufferFence &fence = fences.front();
@ -2113,8 +2113,8 @@ void GLVertexBuffer::setAttribLayout(const GLVertexAttrib *attribs, int count, i
for (int i = 0; i < count; i++) {
const int index = attribs[i].index;
assert(index >= 0 && index < VertexAttributeCount);
assert(!d->enabledArrays[index]);
Q_ASSERT(index >= 0 && index < VertexAttributeCount);
Q_ASSERT(!d->enabledArrays[index]);
d->attrib[index].size = attribs[i].size;
d->attrib[index].type = attribs[i].type;

View file

@ -617,7 +617,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
}
} else
updateVisibility();
assert(mapping_state != Withdrawn);
Q_ASSERT(mapping_state != Withdrawn);
m_managed = true;
blockGeometryUpdates(false);
@ -664,9 +664,9 @@ bool Client::manage(xcb_window_t w, bool isMapped)
// Called only from manage()
void Client::embedClient(xcb_window_t w, xcb_visualid_t visualid, xcb_colormap_t colormap, uint8_t depth)
{
assert(m_client == XCB_WINDOW_NONE);
assert(frameId() == XCB_WINDOW_NONE);
assert(m_wrapper == XCB_WINDOW_NONE);
Q_ASSERT(m_client == XCB_WINDOW_NONE);
Q_ASSERT(frameId() == XCB_WINDOW_NONE);
Q_ASSERT(m_wrapper == XCB_WINDOW_NONE);
m_client.reset(w, false);
const uint32_t zero_value = 0;

View file

@ -681,7 +681,7 @@ const char* Placement::policyToString(Policy policy)
"NoPlacement", "Default", "XXX should never see", "Random", "Smart", "Cascade", "Centered",
"ZeroCornered", "UnderMouse", "OnMainWindow", "Maximizing"
};
assert(policy < int(sizeof(policies) / sizeof(policies[ 0 ])));
Q_ASSERT(policy < int(sizeof(policies) / sizeof(policies[ 0 ])));
return policies[ policy ];
}

View file

@ -539,7 +539,7 @@ bool AbstractEglTexture::loadDmabufTexture(const QPointer< KWayland::Server::Buf
return false;
}
assert(m_image == EGL_NO_IMAGE_KHR);
Q_ASSERT(m_image == EGL_NO_IMAGE_KHR);
glGenTextures(1, &m_texture);
q->setWrapMode(GL_CLAMP_TO_EDGE);

View file

@ -466,10 +466,10 @@ void HwcomposerWindow::present(HWComposerNativeWindowBuffer *buffer)
fblayer->releaseFenceFd = -1;
int err = device->prepare(device, 1, m_list);
assert(err == 0);
Q_ASSERT(err == 0);
err = device->set(device, 1, m_list);
assert(err == 0);
Q_ASSERT(err == 0);
m_backend->enableVSync(true);
setFenceBufferFd(buffer, fblayer->releaseFenceFd);

View file

@ -904,7 +904,7 @@ bool GlxTexture::loadTexture(xcb_pixmap_t pixmap, const QSize &size, xcb_visuali
m_scale.setWidth(1.0f / m_size.width());
m_scale.setHeight(1.0f / m_size.height());
} else {
assert(info->texture_targets & GLX_TEXTURE_RECTANGLE_BIT_EXT);
Q_ASSERT(info->texture_targets & GLX_TEXTURE_RECTANGLE_BIT_EXT);
m_target = GL_TEXTURE_RECTANGLE;
m_scale.setWidth(1.0f);

View file

@ -52,7 +52,7 @@ OverlayWindowX11::~OverlayWindowX11()
bool OverlayWindowX11::create()
{
assert(m_window == XCB_WINDOW_NONE);
Q_ASSERT(m_window == XCB_WINDOW_NONE);
if (!Xcb::Extensions::self()->isCompositeOverlayAvailable())
return false;
if (!Xcb::Extensions::self()->isShapeInputAvailable()) // needed in setupOverlay()
@ -74,8 +74,8 @@ bool OverlayWindowX11::create()
void OverlayWindowX11::setup(xcb_window_t window)
{
assert(m_window != XCB_WINDOW_NONE);
assert(Xcb::Extensions::self()->isShapeInputAvailable());
Q_ASSERT(m_window != XCB_WINDOW_NONE);
Q_ASSERT(Xcb::Extensions::self()->isShapeInputAvailable());
setNoneBackgroundPixmap(m_window);
m_shape = QRegion();
const QSize &s = screens()->size();
@ -101,7 +101,7 @@ void OverlayWindowX11::setNoneBackgroundPixmap(xcb_window_t window)
void OverlayWindowX11::show()
{
assert(m_window != XCB_WINDOW_NONE);
Q_ASSERT(m_window != XCB_WINDOW_NONE);
if (m_shown)
return;
xcb_map_subwindows(connection(), m_window);
@ -111,7 +111,7 @@ void OverlayWindowX11::show()
void OverlayWindowX11::hide()
{
assert(m_window != XCB_WINDOW_NONE);
Q_ASSERT(m_window != XCB_WINDOW_NONE);
xcb_unmap_window(connection(), m_window);
m_shown = false;
const QSize &s = screens()->size();
@ -133,7 +133,7 @@ void OverlayWindowX11::setShape(const QRegion& reg)
void OverlayWindowX11::resize(const QSize &size)
{
assert(m_window != XCB_WINDOW_NONE);
Q_ASSERT(m_window != XCB_WINDOW_NONE);
const uint32_t geometry[2] = {
static_cast<uint32_t>(size.width()),
static_cast<uint32_t>(size.height())

View file

@ -149,7 +149,7 @@ SyncObject::~SyncObject()
void SyncObject::trigger()
{
assert(m_state == Ready || m_state == Resetting);
Q_ASSERT(m_state == Ready || m_state == Resetting);
// Finish resetting the fence if necessary
if (m_state == Resetting)
@ -176,7 +176,7 @@ bool SyncObject::finish()
// Note: It is possible that we never inserted a wait for the fence.
// This can happen if we ended up not rendering the damaged
// window because it is fully occluded.
assert(m_state == TriggerSent || m_state == Waiting);
Q_ASSERT(m_state == TriggerSent || m_state == Waiting);
// Check if the fence is signaled
GLint value;
@ -205,7 +205,7 @@ bool SyncObject::finish()
void SyncObject::reset()
{
assert(m_state == Done);
Q_ASSERT(m_state == Done);
xcb_connection_t * const c = connection();
@ -223,7 +223,7 @@ void SyncObject::reset()
void SyncObject::finishResetting()
{
assert(m_state == Resetting);
Q_ASSERT(m_state == Resetting);
free(xcb_get_input_focus_reply(connection(), m_reset_cookie, nullptr));
m_state = Ready;
}
@ -468,7 +468,7 @@ void SceneOpenGL::initDebugOutput()
if (have_KHR_debug)
glEnable(GL_DEBUG_OUTPUT);
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
// Enable all debug messages
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE);
#else

View file

@ -224,7 +224,7 @@ void Scene::paintGenericScreen(int orig_mask, ScreenPaintData)
data.quads = w->buildQuads();
// preparation step
effects->prePaintWindow(effectWindow(w), data, time_diff);
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (data.quads.isTransformed()) {
qFatal("Pre-paint calls are not allowed to transform quads!");
}
@ -248,7 +248,7 @@ void Scene::paintGenericScreen(int orig_mask, ScreenPaintData)
// to reduce painting and improve performance.
void Scene::paintSimpleScreen(int orig_mask, QRegion region)
{
assert((orig_mask & (PAINT_SCREEN_TRANSFORMED
Q_ASSERT((orig_mask & (PAINT_SCREEN_TRANSFORMED
| PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) == 0);
QVector<Phase2Data> phase2data;
phase2data.reserve(stacking_order.size());
@ -300,7 +300,7 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region)
data.quads = w->buildQuads();
// preparation step
effects->prePaintWindow(effectWindow(w), data, time_diff);
#ifndef NDEBUG
#if !defined(QT_NO_DEBUG)
if (data.quads.isTransformed()) {
qFatal("Pre-paint calls are not allowed to transform quads!");
}
@ -392,7 +392,7 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region)
void Scene::addToplevel(Toplevel *c)
{
assert(!m_windows.contains(c));
Q_ASSERT(!m_windows.contains(c));
Scene::Window *w = createWindow(c);
m_windows[ c ] = w;
connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(windowGeometryShapeChanged(KWin::Toplevel*)));
@ -447,7 +447,7 @@ void Scene::createStackingOrder(ToplevelList toplevels)
{
// TODO: cache the stacking_order in case it has not changed
foreach (Toplevel *c, toplevels) {
assert(m_windows.contains(c));
Q_ASSERT(m_windows.contains(c));
stacking_order.append(m_windows[ c ]);
}
}

View file

@ -1517,7 +1517,7 @@ bool TabBox::establishTabBoxGrab()
// in order to catch MouseRelease events and close the tabbox (#67416).
// All clients already have passive grabs in their wrapper windows, so check only
// the active client, which may not have it.
assert(!m_forcedGlobalMouseGrab);
Q_ASSERT(!m_forcedGlobalMouseGrab);
m_forcedGlobalMouseGrab = true;
if (Workspace::self()->activeClient() != nullptr)
Workspace::self()->activeClient()->updateMouseGrab();
@ -1533,7 +1533,7 @@ void TabBox::removeTabBoxGrab()
}
updateXTime();
ungrabXKeyboard();
assert(m_forcedGlobalMouseGrab);
Q_ASSERT(m_forcedGlobalMouseGrab);
m_forcedGlobalMouseGrab = false;
if (Workspace::self()->activeClient() != nullptr)
Workspace::self()->activeClient()->updateMouseGrab();

View file

@ -64,7 +64,7 @@ Toplevel::Toplevel()
Toplevel::~Toplevel()
{
assert(damage_handle == None);
Q_ASSERT(damage_handle == None);
delete info;
}

View file

@ -663,7 +663,7 @@ inline xcb_window_t Toplevel::window() const
inline void Toplevel::setWindowHandles(xcb_window_t w)
{
assert(!m_client.isValid() && w != XCB_WINDOW_NONE);
Q_ASSERT(!m_client.isValid() && w != XCB_WINDOW_NONE);
m_client.reset(w, false);
}

View file

@ -171,7 +171,7 @@ void UserActionsMenu::helperDialog(const QString& message, AbstractClient* clien
QString type;
auto shortcut = [](const QString &name) {
QAction* action = Workspace::self()->findChild<QAction*>(name);
assert(action != NULL);
Q_ASSERT(action != NULL);
const auto shortcuts = KGlobalAccel::self()->shortcut(action);
return QStringLiteral("%1 (%2)").arg(action->text())
.arg(shortcuts.isEmpty() ? QString() : shortcuts.first().toString(QKeySequence::NativeText));
@ -1120,7 +1120,7 @@ void Workspace::initShortcuts()
void Workspace::setupWindowShortcut(AbstractClient* c)
{
assert(client_keys_dialog == NULL);
Q_ASSERT(client_keys_dialog == NULL);
// TODO: PORT ME (KGlobalAccel related)
//keys->setEnabled( false );
//disable_shortcuts_keys->setEnabled( false );

View file

@ -96,7 +96,7 @@ void grabXServer()
void ungrabXServer()
{
assert(server_grab_count > 0);
Q_ASSERT(server_grab_count > 0);
if (--server_grab_count == 0) {
xcb_ungrab_server(connection());
xcb_flush(connection());

View file

@ -717,7 +717,7 @@ void Workspace::removeClient(Client* c)
void Workspace::removeUnmanaged(Unmanaged* c)
{
assert(unmanaged.contains(c));
Q_ASSERT(unmanaged.contains(c));
unmanaged.removeAll(c);
emit unmanagedRemoved(c);
markXStackingOrderAsDirty();
@ -725,7 +725,7 @@ void Workspace::removeUnmanaged(Unmanaged* c)
void Workspace::addDeleted(Deleted* c, Toplevel *orig)
{
assert(!deleted.contains(c));
Q_ASSERT(!deleted.contains(c));
deleted.append(c);
const int unconstraintedIndex = unconstrained_stacking_order.indexOf(orig);
if (unconstraintedIndex != -1) {
@ -745,7 +745,7 @@ void Workspace::addDeleted(Deleted* c, Toplevel *orig)
void Workspace::removeDeleted(Deleted* c)
{
assert(deleted.contains(c));
Q_ASSERT(deleted.contains(c));
emit deletedRemoved(c);
deleted.removeAll(c);
unconstrained_stacking_order.removeAll(c);