From 726e6c1567cfa30d0e6ed98285da7e4ee1122917 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 15 Sep 2019 00:17:53 +0300 Subject: [PATCH] Don't initialize QFlags 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. Apparently, QFlags 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 --- abstract_client.cpp | 12 ++++++------ client.cpp | 14 +++++++------- geometry.cpp | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index f1811891f6..2370d4f5af 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -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; diff --git a/client.cpp b/client.cpp index 04557aac94..2be0103539 100644 --- a/client.cpp +++ b/client.cpp @@ -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) diff --git a/geometry.cpp b/geometry.cpp index 40672e5091..ab6cceb852 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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) {