Don't initialize QFlags<T> with 0 value

Summary:
clang-tidy has a check that converts all usages of null pointer literals
to nullptr keyword. However, there's a small issue related to QFlags<T>.

Apparently, QFlags<T> has a constructor that takes a pointer and if you
pass 0 to it, clang-tidy will replace 0 with nullptr, e.g.

    NET::States(0) -> NET::States(nullptr)

Even though passing nullptr is totally correct, it looks very weird.

Test Plan: Complies.

Reviewers: #kwin, gladhorn

Reviewed By: #kwin, gladhorn

Subscribers: gladhorn, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23948
icc-effect-5.17.5
Vlad Zahorodnii 2019-09-15 00:17:53 +03:00
parent 02209aa8a4
commit 726e6c1567
3 changed files with 15 additions and 15 deletions

View File

@ -322,12 +322,12 @@ void AbstractClient::setKeepAbove(bool b)
if (b == keepAbove()) {
// force hint change if different
if (info && bool(info->state() & NET::KeepAbove) != keepAbove())
info->setState(keepAbove() ? NET::KeepAbove : NET::States(0), NET::KeepAbove);
info->setState(keepAbove() ? NET::KeepAbove : NET::States(), NET::KeepAbove);
return;
}
m_keepAbove = b;
if (info) {
info->setState(keepAbove() ? NET::KeepAbove : NET::States(0), NET::KeepAbove);
info->setState(keepAbove() ? NET::KeepAbove : NET::States(), NET::KeepAbove);
}
workspace()->updateClientLayer(this);
updateWindowRules(Rules::Above);
@ -348,12 +348,12 @@ void AbstractClient::setKeepBelow(bool b)
if (b == keepBelow()) {
// force hint change if different
if (info && bool(info->state() & NET::KeepBelow) != keepBelow())
info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow);
info->setState(keepBelow() ? NET::KeepBelow : NET::States(), NET::KeepBelow);
return;
}
m_keepBelow = b;
if (info) {
info->setState(keepBelow() ? NET::KeepBelow : NET::States(0), NET::KeepBelow);
info->setState(keepBelow() ? NET::KeepBelow : NET::States(), NET::KeepBelow);
}
workspace()->updateClientLayer(this);
updateWindowRules(Rules::Below);
@ -406,7 +406,7 @@ void AbstractClient::demandAttention(bool set)
return;
m_demandsAttention = set;
if (info) {
info->setState(set ? NET::DemandsAttention : NET::States(0), NET::DemandsAttention);
info->setState(set ? NET::DemandsAttention : NET::States(), NET::DemandsAttention);
}
workspace()->clientAttentionChanged(this, set);
emit demandsAttentionChanged();
@ -614,7 +614,7 @@ void AbstractClient::minimize(bool avoid_animation)
return;
if (isShade() && info) // NETWM restriction - KWindowInfo::isMinimized() == Hidden && !Shaded
info->setState(0, NET::Shaded);
info->setState(NET::States(), NET::Shaded);
m_minimized = true;

View File

@ -245,7 +245,7 @@ void Client::releaseWindow(bool on_shutdown)
workspace()->removeClient(this);
// Only when the window is being unmapped, not when closing down KWin (NETWM sections 5.5,5.7)
info->setDesktop(0);
info->setState(0, info->state()); // Reset all state flags
info->setState(NET::States(), info->state()); // Reset all state flags
}
xcb_connection_t *c = connection();
m_client.deleteProperty(atoms->kde_net_wm_user_creation_time);
@ -875,8 +875,8 @@ void Client::setShade(ShadeMode mode)
if (isActive())
workspace()->requestFocus(this);
}
info->setState(isShade() ? NET::Shaded : NET::States(0), NET::Shaded);
info->setState(isShown(false) ? NET::States(0) : NET::Hidden, NET::Hidden);
info->setState(isShade() ? NET::Shaded : NET::States(), NET::Shaded);
info->setState(isShown(false) ? NET::States() : NET::Hidden, NET::Hidden);
discardWindowPixmap();
updateVisibility();
updateAllowedActions();
@ -931,7 +931,7 @@ void Client::updateVisibility()
internalHide();
return;
}
info->setState(0, NET::Hidden);
info->setState(NET::States(), NET::Hidden);
if (!isOnCurrentDesktop()) {
if (compositing() && options->hiddenPreviews() != HiddenPreviewsNever)
internalKeep();
@ -1230,17 +1230,17 @@ void Client::killProcess(bool ask, xcb_timestamp_t timestamp)
void Client::doSetSkipTaskbar()
{
info->setState(skipTaskbar() ? NET::SkipTaskbar : NET::States(0), NET::SkipTaskbar);
info->setState(skipTaskbar() ? NET::SkipTaskbar : NET::States(), NET::SkipTaskbar);
}
void Client::doSetSkipPager()
{
info->setState(skipPager() ? NET::SkipPager : NET::States(0), NET::SkipPager);
info->setState(skipPager() ? NET::SkipPager : NET::States(), NET::SkipPager);
}
void Client::doSetSkipSwitcher()
{
info->setState(skipSwitcher() ? NET::SkipSwitcher : NET::States(0), NET::SkipSwitcher);
info->setState(skipSwitcher() ? NET::SkipSwitcher : NET::States(), NET::SkipSwitcher);
}
void Client::doSetDesktop(int desktop, int was_desk)

View File

@ -2341,7 +2341,7 @@ void Client::changeMaximize(bool horizontal, bool vertical, bool adjust)
setGeometry(restore, geom_mode);
if (!clientArea.contains(geom_restore.center())) // Not restoring to the same screen
Placement::self()->place(this, clientArea);
info->setState(0, NET::Max);
info->setState(NET::States(), NET::Max);
updateQuickTileMode(QuickTileFlag::None);
break;
}
@ -2446,7 +2446,7 @@ void Client::setFullScreen(bool set, bool user)
// active fullscreens get different layer
workspace()->updateClientLayer(this);
info->setState(isFullScreen() ? NET::FullScreen : NET::States(0), NET::FullScreen);
info->setState(isFullScreen() ? NET::FullScreen : NET::States(), NET::FullScreen);
updateDecoration(false, false);
if (set) {