From 62a7db7028146ca61e231cc597452fc5ece6eec1 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 19 Sep 2019 17:46:54 +0300 Subject: [PATCH] Use nullptr everywhere Summary: Because KWin is a very old project, we use three kinds of null pointer literals: 0, NULL, and nullptr. Since C++11, it's recommended to use nullptr keyword. This change converts all usages of 0 and NULL literal to nullptr. Even though it breaks git history, we need to do it in order to have consistent code as well to ease code reviews (it's very tempting for some people to add unrelated changes to their patches, e.g. converting NULL to nullptr). Test Plan: Compiles. Reviewers: #kwin, davidedmundson, romangg Reviewed By: #kwin, davidedmundson, romangg Subscribers: romangg, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D23618 --- abstract_client.cpp | 2 +- activation.cpp | 42 +++++----- activities.cpp | 2 +- client.cpp | 32 ++++---- client.h | 2 +- client_machine.cpp | 4 +- client_machine.h | 4 +- colorcorrection/manager.cpp | 2 +- composite.cpp | 12 +-- composite.h | 2 +- cursor.cpp | 2 +- deleted.cpp | 2 +- effects.cpp | 38 ++++----- effects/backgroundcontrast/contrastshader.cpp | 4 +- effects/blur/blur_config.h | 2 +- effects/coverswitch/coverswitch.cpp | 24 +++--- effects/coverswitch/coverswitch.h | 2 +- effects/coverswitch/coverswitch_config.h | 2 +- effects/cube/cube.cpp | 34 ++++---- effects/cube/cube_config.h | 2 +- effects/cubeslide/cubeslide.cpp | 4 +- effects/cubeslide/cubeslide_config.h | 2 +- effects/desktopgrid/desktopgrid.cpp | 40 ++++----- effects/desktopgrid/desktopgrid.h | 4 +- effects/desktopgrid/desktopgrid_config.cpp | 2 +- effects/desktopgrid/desktopgrid_config.h | 2 +- effects/flipswitch/flipswitch.cpp | 12 +-- effects/flipswitch/flipswitch_config.h | 2 +- effects/highlightwindow/highlightwindow.cpp | 4 +- effects/highlightwindow/highlightwindow.h | 2 +- effects/invert/invert.cpp | 2 +- effects/invert/invert_config.h | 2 +- effects/lookingglass/lookingglass.cpp | 8 +- effects/lookingglass/lookingglass_config.h | 2 +- effects/magiclamp/magiclamp.cpp | 2 +- effects/magiclamp/magiclamp_config.h | 2 +- effects/magnifier/magnifier.cpp | 18 ++-- effects/magnifier/magnifier_config.h | 2 +- effects/mouseclick/mouseclick.cpp | 6 +- effects/mouseclick/mouseclick_config.h | 2 +- effects/mousemark/mousemark.cpp | 4 +- effects/mousemark/mousemark_config.h | 2 +- effects/presentwindows/presentwindows.cpp | 58 ++++++------- effects/presentwindows/presentwindows.h | 2 +- .../presentwindows/presentwindows_config.h | 2 +- effects/resize/resize.cpp | 6 +- effects/resize/resize_config.h | 4 +- effects/screenedge/screenedgeeffect.cpp | 10 +-- effects/screenshot/screenshot.cpp | 14 ++-- effects/showfps/showfps.cpp | 12 +-- effects/showfps/showfps_config.h | 2 +- effects/slideback/slideback.cpp | 8 +- effects/startupfeedback/startupfeedback.cpp | 14 ++-- effects/thumbnailaside/thumbnailaside.cpp | 2 +- .../thumbnailaside/thumbnailaside_config.h | 2 +- effects/touchpoints/touchpoints.cpp | 2 +- effects/trackmouse/trackmouse.cpp | 12 +-- effects/trackmouse/trackmouse_config.h | 2 +- effects/windowgeometry/windowgeometry.cpp | 4 +- .../windowgeometry/windowgeometry_config.h | 2 +- effects/wobblywindows/wobblywindows_config.h | 2 +- effects/zoom/zoom.cpp | 4 +- effects/zoom/zoom_config.h | 4 +- events.cpp | 10 +-- focuschain.cpp | 16 ++-- geometry.cpp | 18 ++-- geometrytip.cpp | 2 +- group.cpp | 64 +++++++-------- input.cpp | 6 +- kcmkwin/kwincompositing/compositing.h | 4 +- kcmkwin/kwincompositing/main.cpp | 2 +- .../declarative-plugin/buttonsmodel.h | 2 +- .../declarative-plugin/previewitem.cpp | 2 +- .../declarative-plugin/previewsettings.h | 2 +- kcmkwin/kwinoptions/mouse.cpp | 6 +- kcmkwin/kwinrules/ruleswidget.cpp | 2 +- kcmkwin/kwinscreenedges/monitor.h | 2 +- kcmkwin/kwintabbox/thumbnailitem.cpp | 2 +- layers.cpp | 16 ++-- libkwineffects/kwinglplatform.cpp | 4 +- libkwineffects/kwinglutils.cpp | 2 +- manage.cpp | 8 +- netinfo.cpp | 8 +- options.h | 2 +- placement.cpp | 6 +- platformsupport/scenes/opengl/backend.cpp | 2 +- .../scenes/opengl/linux_dmabuf.cpp | 6 +- plugins/idletime/poller.h | 2 +- plugins/kglobalaccel/kglobalaccel_plugin.h | 2 +- plugins/platforms/wayland/wayland_backend.cpp | 6 +- .../platforms/x11/standalone/glxbackend.cpp | 14 ++-- .../x11/standalone/overlaywindow_x11.cpp | 2 +- .../x11/standalone/windowselector.cpp | 4 +- plugins/scenes/opengl/lanczosfilter.cpp | 12 +-- plugins/scenes/opengl/lanczosfilter.h | 2 +- plugins/scenes/opengl/scene_opengl.cpp | 82 +++++++++---------- plugins/scenes/opengl/scene_opengl.h | 2 +- plugins/scenes/qpainter/scene_qpainter.cpp | 2 +- plugins/scenes/xrender/scene_xrender.cpp | 52 ++++++------ scene.cpp | 10 +-- screenedge.cpp | 6 +- screens.cpp | 2 +- scripting/dbuscall.h | 2 +- scripting/screenedgeitem.h | 2 +- scripting/workspace_wrapper.cpp | 2 +- shadow.cpp | 6 +- sm.cpp | 28 +++---- tabbox/tabbox.cpp | 4 +- tests/pointerconstraintstest.cpp | 2 +- thumbnailitem.cpp | 8 +- thumbnailitem.h | 6 +- toplevel.cpp | 26 +++--- unmanaged.cpp | 2 +- useractions.cpp | 60 +++++++------- useractions.h | 2 +- utils.cpp | 10 +-- virtualdesktops.cpp | 4 +- workspace.cpp | 80 +++++++++--------- workspace.h | 2 +- xcbutils.cpp | 18 ++-- xcbutils.h | 20 ++--- xkb.cpp | 6 +- xwl/drag_x.cpp | 4 +- xwl/transfer.cpp | 6 +- 124 files changed, 602 insertions(+), 602 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 64e6cec193..363e4fa508 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -211,7 +211,7 @@ void AbstractClient::setActive(bool act) ? rules()->checkOpacityActive(qRound(opacity() * 100.0)) : rules()->checkOpacityInactive(qRound(opacity() * 100.0)); setOpacity(ruledOpacity / 100.0); - workspace()->setActiveClient(act ? this : NULL); + workspace()->setActiveClient(act ? this : nullptr); if (!m_active) cancelAutoRaise(); diff --git a/activation.cpp b/activation.cpp index 9ffe34450f..0c9a3af72d 100644 --- a/activation.cpp +++ b/activation.cpp @@ -239,12 +239,12 @@ void Workspace::setActiveClient(AbstractClient* c) StackingUpdatesBlocker blocker(this); ++set_active_client_recursion; updateFocusMousePosition(Cursor::pos()); - if (active_client != NULL) { + if (active_client != nullptr) { // note that this may call setActiveClient( NULL ), therefore the recursion counter active_client->setActive(false); } active_client = c; - Q_ASSERT(c == NULL || c->isActive()); + Q_ASSERT(c == nullptr || c->isActive()); if (active_client) { last_active_client = active_client; @@ -291,9 +291,9 @@ void Workspace::setActiveClient(AbstractClient* c) */ void Workspace::activateClient(AbstractClient* c, bool force) { - if (c == NULL) { + if (c == nullptr) { focusToNull(); - setActiveClient(NULL); + setActiveClient(nullptr); return; } raiseClient(c); @@ -358,7 +358,7 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags) if (flags & ActivityFocus) { AbstractClient* modal = c->findModal(); - if (modal != NULL && modal != c) { + if (modal != nullptr && modal != c) { if (!modal->isOnDesktop(c->desktop())) modal->setDesktop(c->desktop()); if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window @@ -434,7 +434,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const return client; } } - return 0; + return nullptr; } // deactivates 'c' and activates next client @@ -446,9 +446,9 @@ bool Workspace::activateNextClient(AbstractClient* c) closeActivePopup(); - if (c != NULL) { + if (c != nullptr) { if (c == active_client) - setActiveClient(NULL); + setActiveClient(nullptr); should_get_focus.removeAll(c); } @@ -462,7 +462,7 @@ bool Workspace::activateNextClient(AbstractClient* c) if (!options->focusPolicyIsReasonable()) return false; - AbstractClient* get_focus = NULL; + AbstractClient* get_focus = nullptr; const int desktop = VirtualDesktopManager::self()->current(); @@ -473,7 +473,7 @@ bool Workspace::activateNextClient(AbstractClient* c) get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); if (get_focus && (get_focus == c || get_focus->isDesktop())) { // should rather not happen, but it cannot get the focus. rest of usability is tested above - get_focus = NULL; + get_focus = nullptr; } } @@ -492,10 +492,10 @@ bool Workspace::activateNextClient(AbstractClient* c) } } - if (get_focus == NULL) // last chance: focus the desktop + if (get_focus == nullptr) // last chance: focus the desktop get_focus = findDesktop(true, desktop); - if (get_focus != NULL) + if (get_focus != nullptr) requestFocus(get_focus); else focusToNull(); @@ -513,9 +513,9 @@ void Workspace::setCurrentScreen(int new_screen) closeActivePopup(); const int desktop = VirtualDesktopManager::self()->current(); AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); - if (get_focus == NULL) + if (get_focus == nullptr) get_focus = findDesktop(true, desktop); - if (get_focus != NULL && get_focus != mostRecentlyActivatedClient()) + if (get_focus != nullptr && get_focus != mostRecentlyActivatedClient()) requestFocus(get_focus); screens()->setCurrent(new_screen); } @@ -589,7 +589,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta // No active client, it's ok to pass focus // NOTICE that extreme protection needs to be handled before to allow protection on unmanged windows - if (ac == NULL || ac->isDesktop()) { + if (ac == nullptr || ac->isDesktop()) { qCDebug(KWIN_CORE) << "Activation: No client active, allowing"; return true; // no active client -> always allow } @@ -643,7 +643,7 @@ bool Workspace::allowFullClientRaising(const KWin::AbstractClient *c, xcb_timest return true; if (level == 4) // extreme return false; - if (ac == NULL || ac->isDesktop()) { + if (ac == nullptr || ac->isDesktop()) { qCDebug(KWIN_CORE) << "Raising: No client active, allowing"; return true; // no active client -> always allow } @@ -706,7 +706,7 @@ void Client::updateUserTime(xcb_timestamp_t time) && (m_userTime == XCB_TIME_CURRENT_TIME || NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time m_userTime = time; - shade_below = NULL; // do not hover re-shade a window after it got interaction + shade_below = nullptr; // do not hover re-shade a window after it got interaction } group()->updateUserTime(m_userTime); } @@ -726,7 +726,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c // newer ASN timestamp always replaces user timestamp, unless user timestamp is 0 // helps e.g. with konqy reusing - if (asn_data != NULL && time != 0) { + if (asn_data != nullptr && time != 0) { if (asn_id->timestamp() != 0 && (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) { time = asn_id->timestamp(); @@ -742,7 +742,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c // from already running application if this application // is not the active one (unless focus stealing prevention is turned off). Client* act = dynamic_cast(workspace()->mostRecentlyActivatedClient()); - if (act != NULL && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) { + if (act != nullptr && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) { bool first_window = true; auto sameApplicationActiveHackPredicate = [this](const Client *cl) { // ignore already existing splashes, toolbars, utilities and menus, @@ -765,7 +765,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c ; // is transient for currently active window, even though it's not // the same app (e.g. kcookiejar dialog) -> allow activation else if (groupTransient() && - findInList(clientMainClients(), sameApplicationActiveHackPredicate) == NULL) + findInList(clientMainClients(), sameApplicationActiveHackPredicate) == nullptr) ; // standalone transient else first_window = false; @@ -801,7 +801,7 @@ xcb_timestamp_t Client::userTime() const xcb_timestamp_t time = m_userTime; if (time == 0) // doesn't want focus after showing return 0; - Q_ASSERT(group() != NULL); + Q_ASSERT(group() != nullptr); if (time == -1U || (group()->userTime() != -1U && NET::timestampCompare(group()->userTime(), time) > 0)) diff --git a/activities.cpp b/activities.cpp index 42c5db8019..262cd54bb1 100644 --- a/activities.cpp +++ b/activities.cpp @@ -47,7 +47,7 @@ Activities::Activities(QObject *parent) Activities::~Activities() { - s_self = NULL; + s_self = nullptr; } KActivities::Consumer::ServiceStatus Activities::serviceStatus() const diff --git a/client.cpp b/client.cpp index 2be0103539..873522efe0 100644 --- a/client.cpp +++ b/client.cpp @@ -106,17 +106,17 @@ Client::Client() , m_managed(false) , m_transientForId(XCB_WINDOW_NONE) , m_originalTransientForId(XCB_WINDOW_NONE) - , shade_below(NULL) + , shade_below(nullptr) , m_motif(atoms->motif_wm_hints) , blocks_compositing(false) - , shadeHoverTimer(NULL) + , shadeHoverTimer(nullptr) , m_colormap(XCB_COLORMAP_NONE) - , in_group(NULL) - , ping_timer(NULL) + , in_group(nullptr) + , ping_timer(nullptr) , m_killHelperPID(0) , m_pingTimestamp(XCB_TIME_CURRENT_TIME) , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet - , allowed_actions(0) + , allowed_actions(nullptr) , shade_geometry_change(false) , sm_stacking_order(-1) , activitiesDefined(false) @@ -128,14 +128,14 @@ Client::Client() { // TODO: Do all as initialization syncRequest.counter = syncRequest.alarm = XCB_NONE; - syncRequest.timeout = syncRequest.failsafeTimeout = NULL; + syncRequest.timeout = syncRequest.failsafeTimeout = nullptr; syncRequest.lastTimestamp = xTime(); syncRequest.isPending = false; // Set the initial mapping state mapping_state = Withdrawn; - info = NULL; + info = nullptr; shade_mode = ShadeNone; deleting = false; @@ -214,7 +214,7 @@ void Client::releaseWindow(bool on_shutdown) } #endif destroyWindowManagementInterface(); - Deleted* del = NULL; + Deleted* del = nullptr; if (!on_shutdown) { del = Deleted::create(this); } @@ -856,7 +856,7 @@ void Client::setShade(ShadeMode mode) if (shade_mode == ShadeHover) { ToplevelList order = workspace()->stackingOrder(); // invalidate, since "this" could be the topmost toplevel and shade_below dangeling - shade_below = NULL; + shade_below = nullptr; // this is likely related to the index parameter?! for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { shade_below = qobject_cast(order.at(idx)); @@ -867,7 +867,7 @@ void Client::setShade(ShadeMode mode) if (shade_below && shade_below->isNormalWindow()) workspace()->raiseClient(this); else - shade_below = NULL; + shade_below = nullptr; } m_wrapper.map(); m_client.map(); @@ -900,7 +900,7 @@ void Client::shadeUnhover() void Client::cancelShadeHoverTimer() { delete shadeHoverTimer; - shadeHoverTimer = 0; + shadeHoverTimer = nullptr; } void Client::toggleShade() @@ -1077,7 +1077,7 @@ void Client::updateHiddenPreview() workspace()->forceRestacking(); if (Xcb::Extensions::self()->isShapeInputAvailable()) { xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, - XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, NULL); + XCB_CLIP_ORDERING_UNSORTED, frameId(), 0, 0, 0, nullptr); } } else { workspace()->forceRestacking(); @@ -1155,7 +1155,7 @@ void Client::pingWindow() return; // Can't ping :( if (options->killPingTimeout() == 0) return; // Turned off - if (ping_timer != NULL) + if (ping_timer != nullptr) return; // Pinging already ping_timer = new QTimer(this); connect(ping_timer, &QTimer::timeout, this, @@ -1188,7 +1188,7 @@ void Client::gotPing(xcb_timestamp_t timestamp) if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) return; delete ping_timer; - ping_timer = NULL; + ping_timer = nullptr; setUnresponsive(false); @@ -1759,7 +1759,7 @@ void Client::setBlockingCompositing(bool block) const bool usedToBlock = blocks_compositing; blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); if (usedToBlock != blocks_compositing) { - emit blockingCompositingChanged(blocks_compositing ? this : 0); + emit blockingCompositingChanged(blocks_compositing ? this : nullptr); } } @@ -1768,7 +1768,7 @@ void Client::updateAllowedActions(bool force) if (!isManaged() && !force) return; NET::Actions old_allowed_actions = NET::Actions(allowed_actions); - allowed_actions = 0; + allowed_actions = nullptr; if (isMovable()) allowed_actions |= NET::ActionMove; if (isResizable()) diff --git a/client.h b/client.h index 0bf24baa11..2b4b46474b 100644 --- a/client.h +++ b/client.h @@ -100,7 +100,7 @@ public: AbstractClient* findModal(bool allow_itself = false) override; const Group* group() const override; Group* group() override; - void checkGroup(Group* gr = NULL, bool force = false); + void checkGroup(Group* gr = nullptr, bool force = false); void changeClientLeaderGroup(Group* gr); void updateWindowRules(Rules::Types selection) override; void updateFullscreenMonitors(NETFullscreenMonitors topology); diff --git a/client_machine.cpp b/client_machine.cpp index 764b137138..f6c29bf5bf 100644 --- a/client_machine.cpp +++ b/client_machine.cpp @@ -54,8 +54,8 @@ GetAddrInfo::GetAddrInfo(const QByteArray &hostName, QObject *parent) , m_ownResolved(false) , m_hostName(hostName) , m_addressHints(new addrinfo) - , m_address(NULL) - , m_ownAddress(NULL) + , m_address(nullptr) + , m_ownAddress(nullptr) , m_watcher(new QFutureWatcher(this)) , m_ownAddressWatcher(new QFutureWatcher(this)) { diff --git a/client_machine.h b/client_machine.h index a3fc1f5a3d..63c3b7c00a 100644 --- a/client_machine.h +++ b/client_machine.h @@ -34,7 +34,7 @@ class GetAddrInfo : public QObject { Q_OBJECT public: - explicit GetAddrInfo(const QByteArray &hostName, QObject *parent = NULL); + explicit GetAddrInfo(const QByteArray &hostName, QObject *parent = nullptr); ~GetAddrInfo() override; void resolve(); @@ -64,7 +64,7 @@ class ClientMachine : public QObject { Q_OBJECT public: - explicit ClientMachine(QObject *parent = NULL); + explicit ClientMachine(QObject *parent = nullptr); ~ClientMachine() override; void resolve(xcb_window_t window, xcb_window_t clientLeader); diff --git a/colorcorrection/manager.cpp b/colorcorrection/manager.cpp index 70580500d0..cb91faa11f 100644 --- a/colorcorrection/manager.cpp +++ b/colorcorrection/manager.cpp @@ -94,7 +94,7 @@ void Manager::init() // Monitor for the time changing (flags == TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET). // However these are not exposed in glibc so value is hardcoded: - ::timerfd_settime(timeChangedFd, 3, ×pec, 0); + ::timerfd_settime(timeChangedFd, 3, ×pec, nullptr); connect(this, &QObject::destroyed, [timeChangedFd]() { ::close(timeChangedFd); diff --git a/composite.cpp b/composite.cpp index fd7f93069e..3bc79a28c4 100644 --- a/composite.cpp +++ b/composite.cpp @@ -121,11 +121,11 @@ static inline qint64 nanoToMilli(int nano) { return nano / (1000*1000); } Compositor::Compositor(QObject* workspace) : QObject(workspace) , m_state(State::Off) - , m_selectionOwner(NULL) + , m_selectionOwner(nullptr) , vBlankInterval(0) , fpsInterval(0) , m_timeSinceLastVBlank(0) - , m_scene(NULL) + , m_scene(nullptr) , m_bufferSwapPending(false) , m_composeAtSwapCompletion(false) { @@ -176,7 +176,7 @@ Compositor::~Compositor() stop(); deleteUnusedSupportProperties(); destroyCompositorSelection(); - s_compositor = NULL; + s_compositor = nullptr; } bool Compositor::setupStart() @@ -250,12 +250,12 @@ bool Compositor::setupStart() } } - if (m_scene == NULL || m_scene->initFailed()) { + if (m_scene == nullptr || m_scene->initFailed()) { qCCritical(KWIN_CORE) << "Failed to initialize compositing, compositing disabled"; m_state = State::Off; delete m_scene; - m_scene = NULL; + m_scene = nullptr; if (m_selectionOwner) { m_selectionOwner->setOwning(false); @@ -449,7 +449,7 @@ void Compositor::stop() } delete m_scene; - m_scene = NULL; + m_scene = nullptr; compositeTimer.stop(); repaints_region = QRegion(); diff --git a/composite.h b/composite.h index 9f9e52d7e5..0dc0d8d0dc 100644 --- a/composite.h +++ b/composite.h @@ -102,7 +102,7 @@ public: * @return bool @c true if there is a Compositor and it is active, @c false otherwise */ static bool compositing() { - return s_compositor != NULL && s_compositor->isActive(); + return s_compositor != nullptr && s_compositor->isActive(); } // for delayed supportproperty management of effects diff --git a/cursor.cpp b/cursor.cpp index 47e60e05b8..7576690061 100644 --- a/cursor.cpp +++ b/cursor.cpp @@ -56,7 +56,7 @@ Cursor::Cursor(QObject *parent) Cursor::~Cursor() { - s_self = NULL; + s_self = nullptr; } void Cursor::loadThemeSettings() diff --git a/deleted.cpp b/deleted.cpp index 1713efc5f7..9cf4d49fce 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -92,7 +92,7 @@ void Deleted::discard() void Deleted::copyToDeleted(Toplevel* c) { - Q_ASSERT(dynamic_cast< Deleted* >(c) == NULL); + Q_ASSERT(dynamic_cast< Deleted* >(c) == nullptr); Toplevel::copyToDeleted(c); desk = c->desktop(); m_desktops = c->desktops(); diff --git a/effects.cpp b/effects.cpp index 1d3083eb9a..65b8036e2f 100644 --- a/effects.cpp +++ b/effects.cpp @@ -102,7 +102,7 @@ static xcb_atom_t registerSupportProperty(const QByteArray &propertyName) // get the atom for the propertyName ScopedCPointer atomReply(xcb_intern_atom_reply(c, xcb_intern_atom_unchecked(c, false, propertyName.size(), propertyName.constData()), - NULL)); + nullptr)); if (atomReply.isNull()) { return XCB_ATOM_NONE; } @@ -117,8 +117,8 @@ static xcb_atom_t registerSupportProperty(const QByteArray &propertyName) EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) : EffectsHandler(scene->compositingType()) - , keyboard_grab_effect(NULL) - , fullscreen_effect(0) + , keyboard_grab_effect(nullptr) + , fullscreen_effect(nullptr) , next_window_quad_type(EFFECT_QUAD_TYPE_START) , m_compositor(compositor) , m_scene(scene) @@ -150,7 +150,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) [this](int old, AbstractClient *c) { const int newDesktop = VirtualDesktopManager::self()->current(); if (old != 0 && newDesktop != old) { - emit desktopChanged(old, newDesktop, c ? c->effectWindow() : 0); + emit desktopChanged(old, newDesktop, c ? c->effectWindow() : nullptr); // TODO: remove in 4.10 emit desktopChanged(old, newDesktop); } @@ -464,7 +464,7 @@ Effect *EffectsHandlerImpl::provides(Effect::Feature ef) for (int i = 0; i < loaded_effects.size(); ++i) if (loaded_effects.at(i).second->provides(ef)) return loaded_effects.at(i).second; - return NULL; + return nullptr; } void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) @@ -620,7 +620,7 @@ void EffectsHandlerImpl::slotGeometryShapeChanged(Toplevel* t, const QRect& old) { // during late cleanup effectWindow() may be already NULL // in some functions that may still call this - if (t == NULL || t->effectWindow() == NULL) + if (t == nullptr || t->effectWindow() == nullptr) return; emit windowGeometryShapeChanged(t->effectWindow(), old); } @@ -629,7 +629,7 @@ void EffectsHandlerImpl::slotPaddingChanged(Toplevel* t, const QRect& old) { // during late cleanup effectWindow() may be already NULL // in some functions that may still call this - if (t == NULL || t->effectWindow() == NULL) + if (t == nullptr || t->effectWindow() == nullptr) return; emit windowPaddingChanged(t->effectWindow(), old); } @@ -659,7 +659,7 @@ bool EffectsHandlerImpl::hasActiveFullScreenEffect() const bool EffectsHandlerImpl::grabKeyboard(Effect* effect) { - if (keyboard_grab_effect != NULL) + if (keyboard_grab_effect != nullptr) return false; if (!doGrabKeyboard()) { return false; @@ -675,9 +675,9 @@ bool EffectsHandlerImpl::doGrabKeyboard() void EffectsHandlerImpl::ungrabKeyboard() { - Q_ASSERT(keyboard_grab_effect != NULL); + Q_ASSERT(keyboard_grab_effect != nullptr); doUngrabKeyboard(); - keyboard_grab_effect = NULL; + keyboard_grab_effect = nullptr; } void EffectsHandlerImpl::doUngrabKeyboard() @@ -686,7 +686,7 @@ void EffectsHandlerImpl::doUngrabKeyboard() void EffectsHandlerImpl::grabbedKeyboardEvent(QKeyEvent* e) { - if (keyboard_grab_effect != NULL) + if (keyboard_grab_effect != nullptr) keyboard_grab_effect->grabbedKeyboardEvent(e); } @@ -788,7 +788,7 @@ void* EffectsHandlerImpl::getProxy(QString name) if ((*it).first == name) return (*it).second->proxy(); - return NULL; + return nullptr; } void EffectsHandlerImpl::startMousePolling() @@ -805,7 +805,7 @@ void EffectsHandlerImpl::stopMousePolling() bool EffectsHandlerImpl::hasKeyboardGrab() const { - return keyboard_grab_effect != NULL; + return keyboard_grab_effect != nullptr; } void EffectsHandlerImpl::desktopResized(const QSize &size) @@ -885,7 +885,7 @@ void EffectsHandlerImpl::activateWindow(EffectWindow* c) EffectWindow* EffectsHandlerImpl::activeWindow() const { - return Workspace::self()->activeClient() ? Workspace::self()->activeClient()->effectWindow() : NULL; + return Workspace::self()->activeClient() ? Workspace::self()->activeClient()->effectWindow() : nullptr; } void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool snap, double snapAdjust) @@ -1072,7 +1072,7 @@ EffectWindow* EffectsHandlerImpl::findWindow(WId id) const return w->effectWindow(); } } - return NULL; + return nullptr; } EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const @@ -1207,7 +1207,7 @@ EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const if (auto c = TabBox::TabBox::self()->currentClient()) return c->effectWindow(); #endif - return NULL; + return nullptr; } void EffectsHandlerImpl::addRepaintFull() @@ -2149,13 +2149,13 @@ EffectWindowList EffectWindowGroupImpl::members() const //**************************************** EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment) - : QObject(0) + : QObject(nullptr) , EffectFrame() , m_style(style) , m_static(staticSize) , m_point(position) , m_alignment(alignment) - , m_shader(NULL) + , m_shader(nullptr) , m_theme(new Plasma::Theme(this)) { if (m_style == EffectFrameStyled) { @@ -2271,7 +2271,7 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity if (m_geometry.isEmpty()) { return; // Nothing to display } - m_shader = NULL; + m_shader = nullptr; setScreenProjectionMatrix(static_cast(effects)->scene()->screenProjectionMatrix()); effects->paintEffectFrame(this, region, opacity, frameOpacity); } diff --git a/effects/backgroundcontrast/contrastshader.cpp b/effects/backgroundcontrast/contrastshader.cpp index 64a708768f..936a88e697 100644 --- a/effects/backgroundcontrast/contrastshader.cpp +++ b/effects/backgroundcontrast/contrastshader.cpp @@ -34,7 +34,7 @@ using namespace KWin; ContrastShader::ContrastShader() - : mValid(false), shader(NULL), m_opacity(1) + : mValid(false), shader(nullptr), m_opacity(1) { } @@ -51,7 +51,7 @@ ContrastShader *ContrastShader::create() void ContrastShader::reset() { delete shader; - shader = NULL; + shader = nullptr; setIsValid(false); } diff --git a/effects/blur/blur_config.h b/effects/blur/blur_config.h index a766eec68c..60edd08efd 100644 --- a/effects/blur/blur_config.h +++ b/effects/blur/blur_config.h @@ -31,7 +31,7 @@ class BlurEffectConfig : public KCModule Q_OBJECT public: - explicit BlurEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList()); + explicit BlurEffectConfig(QWidget *parent = nullptr, const QVariantList& args = QVariantList()); ~BlurEffectConfig() override; void save() override; diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index 29b7009c46..3776366771 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -50,8 +50,8 @@ CoverSwitchEffect::CoverSwitchEffect() , zPosition(900.0) , scaleFactor(0.0) , direction(Left) - , selected_window(0) - , captionFrame(NULL) + , selected_window(nullptr) + , captionFrame(nullptr) , primaryTabBox(false) , secondaryTabBox(false) { @@ -65,7 +65,7 @@ CoverSwitchEffect::CoverSwitchEffect() if (effects->compositingType() == OpenGL2Compositing) { m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("coverswitch-reflection.glsl")); } else { - m_reflectionShader = NULL; + m_reflectionShader = nullptr; } connect(effects, &EffectsHandler::windowClosed, this, &CoverSwitchEffect::slotWindowClosed); connect(effects, &EffectsHandler::tabBoxAdded, this, &CoverSwitchEffect::slotTabBoxAdded); @@ -123,7 +123,7 @@ void CoverSwitchEffect::prePaintScreen(ScreenPrePaintData& data, int time) if (animation || start || stop) { timeLine.update(std::chrono::milliseconds(time)); } - if (selected_window == NULL) + if (selected_window == nullptr) abort(); } effects->prePaintScreen(data, time); @@ -292,7 +292,7 @@ void CoverSwitchEffect::postPaintScreen() timeLine.reset(); if (stop) { stop = false; - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); foreach (EffectWindow * window, referrencedWindows) { window->unrefWindow(); } @@ -547,7 +547,7 @@ void CoverSwitchEffect::slotTabBoxClosed() stopRequested = true; } } else { - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); start = false; animation = false; timeLine.reset(); @@ -565,7 +565,7 @@ void CoverSwitchEffect::slotTabBoxUpdated() if (animateSwitch && currentWindowList.count() > 1) { // determine the switch direction if (selected_window != effects->currentTabBoxWindow()) { - if (selected_window != NULL) { + if (selected_window != nullptr) { int old_index = currentWindowList.indexOf(selected_window); int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow()); Direction new_direction; @@ -701,7 +701,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow, void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow) { - if (frontWindow == NULL) + if (frontWindow == nullptr) return; bool specialHandlingForward = false; WindowPaintData data(frontWindow); @@ -764,7 +764,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left, xTranslate = ((float)screenSize.width() * 0.5 * scaleFactor) - (float)width * 0.5f; // handling for additional window from other side // has to appear on this side after half of the time - if (animation && timeLine.value() >= 0.5 && additionalWindow != NULL) { + if (animation && timeLine.value() >= 0.5 && additionalWindow != nullptr) { WindowPaintData data(additionalWindow); if (effects->numScreens() > 1) { data.setProjectionMatrix(m_projectionMatrix); @@ -786,7 +786,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left, // normal behaviour for (int i = 0; i < windows.count(); i++) { window = windows.at(i); - if (window == NULL || window->isDeleted()) { + if (window == nullptr || window->isDeleted()) { continue; } WindowPaintData data(window); @@ -918,7 +918,7 @@ void CoverSwitchEffect::abort() effects->unrefTabBox(); effects->stopMouseInterception(this); } - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); timeLine.reset(); mActivated = false; stop = false; @@ -930,7 +930,7 @@ void CoverSwitchEffect::abort() void CoverSwitchEffect::slotWindowClosed(EffectWindow* c) { if (c == selected_window) - selected_window = 0; + selected_window = nullptr; // if the list is not empty, the effect is active if (!currentWindowList.isEmpty()) { c->refWindow(); diff --git a/effects/coverswitch/coverswitch.h b/effects/coverswitch/coverswitch.h index 7b071b987b..2629e90b23 100644 --- a/effects/coverswitch/coverswitch.h +++ b/effects/coverswitch/coverswitch.h @@ -107,7 +107,7 @@ private: bool reflectedWindows = false); void paintWindowCover(EffectWindow* w, bool reflectedWindow, WindowPaintData& data); void paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow); - void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL); + void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = nullptr); void selectNextOrPreviousWindow(bool forward); inline void selectNextWindow() { selectNextOrPreviousWindow(true); } inline void selectPreviousWindow() { selectNextOrPreviousWindow(false); } diff --git a/effects/coverswitch/coverswitch_config.h b/effects/coverswitch/coverswitch_config.h index f6986a5dbe..c82b76b83e 100644 --- a/effects/coverswitch/coverswitch_config.h +++ b/effects/coverswitch/coverswitch_config.h @@ -40,7 +40,7 @@ class CoverSwitchEffectConfig : public KCModule { Q_OBJECT public: - explicit CoverSwitchEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit CoverSwitchEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); public Q_SLOTS: void save() override; diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 6430ad9e21..f6d48c3978 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -56,13 +56,13 @@ CubeEffect::CubeEffect() , cubeOpacity(1.0) , opacityDesktopOnly(true) , displayDesktopName(false) - , desktopNameFrame(NULL) + , desktopNameFrame(nullptr) , reflection(true) , desktopChangedWhileRotating(false) , paintCaps(true) - , wallpaper(NULL) + , wallpaper(nullptr) , texturedCaps(true) - , capTexture(NULL) + , capTexture(nullptr) , reflectionPainting(false) , activeScreen(0) , bottomCap(false) @@ -74,12 +74,12 @@ CubeEffect::CubeEffect() , shortcutsRegistered(false) , mode(Cube) , useShaders(false) - , cylinderShader(0) - , sphereShader(0) + , cylinderShader(nullptr) + , sphereShader(nullptr) , zOrderingFactor(0.0f) , mAddedHeightCoeff1(0.0f) , mAddedHeightCoeff2(0.0f) - , m_cubeCapBuffer(NULL) + , m_cubeCapBuffer(nullptr) , m_proxy(this) , m_cubeAction(new QAction(this)) , m_cylinderAction(new QAction(this)) @@ -93,8 +93,8 @@ CubeEffect::CubeEffect() m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-reflection.glsl")); m_capShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-cap.glsl")); } else { - m_reflectionShader = NULL; - m_capShader = NULL; + m_reflectionShader = nullptr; + m_capShader = nullptr; } m_textureMirrorMatrix.scale(1.0, -1.0, 1.0); m_textureMirrorMatrix.translate(0.0, -1.0, 0.0); @@ -179,9 +179,9 @@ void CubeEffect::reconfigure(ReconfigureFlags) capDeformationFactor = (float)CubeConfig::capDeformation() / 100.0f; useZOrdering = CubeConfig::zOrdering(); delete wallpaper; - wallpaper = NULL; + wallpaper = nullptr; delete capTexture; - capTexture = NULL; + capTexture = nullptr; texturedCaps = CubeConfig::texturedCaps(); timeLine.setEasingCurve(QEasingCurve::InOutSine); @@ -282,7 +282,7 @@ void CubeEffect::slotCubeCapLoaded() } // need to recreate the VBO for the cube cap delete m_cubeCapBuffer; - m_cubeCapBuffer = NULL; + m_cubeCapBuffer = nullptr; effects->addRepaintFull(); } watcher->deleteLater(); @@ -844,7 +844,7 @@ void CubeEffect::paintCubeCap() } delete m_cubeCapBuffer; m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : NULL); + m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); } void CubeEffect::paintCylinderCap() @@ -899,7 +899,7 @@ void CubeEffect::paintCylinderCap() } delete m_cubeCapBuffer; m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : NULL); + m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); } void CubeEffect::paintSphereCap() @@ -956,7 +956,7 @@ void CubeEffect::paintSphereCap() } delete m_cubeCapBuffer; m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); - m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : NULL); + m_cubeCapBuffer->setData(verts.count() / 3, 3, verts.constData(), texture ? texCoords.constData() : nullptr); } void CubeEffect::postPaintScreen() @@ -975,9 +975,9 @@ void CubeEffect::postPaintScreen() keyboard_grab = false; effects->stopMouseInterception(this); effects->setCurrentDesktop(frontDesktop); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); delete m_cubeCapBuffer; - m_cubeCapBuffer = NULL; + m_cubeCapBuffer = nullptr; if (desktopNameFrame) desktopNameFrame->free(); activated = false; @@ -1314,7 +1314,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa QColor color = capColor; capColor.setAlphaF(cubeOpacity); vbo->setColor(color); - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); + vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); if (!capShader || mode == Cube) { // TODO: use sphere and cylinder shaders vbo->render(GL_TRIANGLES); diff --git a/effects/cube/cube_config.h b/effects/cube/cube_config.h index 1cb151ab49..e3964e4f97 100644 --- a/effects/cube/cube_config.h +++ b/effects/cube/cube_config.h @@ -40,7 +40,7 @@ class CubeEffectConfig : public KCModule { Q_OBJECT public: - explicit CubeEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit CubeEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); public Q_SLOTS: void save() override; diff --git a/effects/cubeslide/cubeslide.cpp b/effects/cubeslide/cubeslide.cpp index d3e86eb19e..79c75b0a26 100644 --- a/effects/cubeslide/cubeslide.cpp +++ b/effects/cubeslide/cubeslide.cpp @@ -387,7 +387,7 @@ void CubeSlideEffect::postPaintScreen() w->setData(WindowForceBackgroundContrastRole, QVariant()); } staticWindows.clear(); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); } } effects->addRepaintFull(); @@ -586,7 +586,7 @@ void CubeSlideEffect::slotWindowStepUserMovedResized(EffectWindow* w) timeLine.setCurrentTime(0); if (!slideRotations.isEmpty()) slideRotations.clear(); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); effects->addRepaintFull(); } } diff --git a/effects/cubeslide/cubeslide_config.h b/effects/cubeslide/cubeslide_config.h index 647a2621c3..bb032b1dce 100644 --- a/effects/cubeslide/cubeslide_config.h +++ b/effects/cubeslide/cubeslide_config.h @@ -40,7 +40,7 @@ class CubeSlideEffectConfig : public KCModule { Q_OBJECT public: - explicit CubeSlideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit CubeSlideEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); public Q_SLOTS: void save() override; diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 95f6eba596..03925f959f 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -57,7 +57,7 @@ DesktopGridEffect::DesktopGridEffect() , wasWindowCopy(false) , wasDesktopMove(false) , isValidMove(false) - , windowMove(NULL) + , windowMove(nullptr) , windowMoveDiff() , gridSize() , orientation(Qt::Horizontal) @@ -66,7 +66,7 @@ DesktopGridEffect::DesktopGridEffect() , unscaledBorder() , scaledSize() , scaledOffset() - , m_proxy(0) + , m_proxy(nullptr) , m_activateAction(new QAction(this)) { initConfig(); @@ -428,7 +428,7 @@ void DesktopGridEffect::slotWindowClosed(EffectWindow* w) return; if (w == windowMove) { effects->setElevatedWindow(windowMove, false); - windowMove = NULL; + windowMove = nullptr; } if (isUsingPresentWindows()) { foreach (const int i, desktopList(w)) { @@ -443,7 +443,7 @@ void DesktopGridEffect::slotWindowClosed(EffectWindow* w) void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) { if (w == windowMove) - windowMove = 0; + windowMove = nullptr; foreach (DesktopButtonsView *view, m_desktopButtonsViews) { if (view->effectWindow && view->effectWindow == w) { view->effectWindow = nullptr; @@ -494,7 +494,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) if (e->type() == QEvent::MouseMove) { int d = posToDesktop(me->pos()); - if (windowMove != NULL && + if (windowMove != nullptr && (me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) { // Handle window moving if (!wasWindowMove) { // Activate on move @@ -522,7 +522,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) if (windowMove->isMovable() && !isUsingPresentWindows()) { wasWindowMove = true; int screen = effects->screenNumber(me->pos()); - effects->moveWindow(windowMove, unscalePos(me->pos(), NULL) + windowMoveDiff, true, 1.0 / scale[screen]); + effects->moveWindow(windowMove, unscalePos(me->pos(), nullptr) + windowMoveDiff, true, 1.0 / scale[screen]); } if (wasWindowMove) { if (effects->waylandDisplay() && (me->modifiers() & Qt::ControlModifier)) { @@ -603,25 +603,25 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) dragStartPos = me->pos(); sourceDesktop = posToDesktop(me->pos()); bool isDesktop = (me->modifiers() & Qt::ShiftModifier); - EffectWindow* w = isDesktop ? NULL : windowAt(me->pos()); - if (w != NULL) + EffectWindow* w = isDesktop ? nullptr : windowAt(me->pos()); + if (w != nullptr) isDesktop = w->isDesktop(); if (isDesktop) m_originalMovingDesktop = posToDesktop(me->pos()); else m_originalMovingDesktop = 0; - if (w != NULL && !w->isDesktop() && (w->isMovable() || w->isMovableAcrossScreens() || isUsingPresentWindows())) { + if (w != nullptr && !w->isDesktop() && (w->isMovable() || w->isMovableAcrossScreens() || isUsingPresentWindows())) { // Prepare it for moving - windowMoveDiff = w->pos() - unscalePos(me->pos(), NULL); + windowMoveDiff = w->pos() - unscalePos(me->pos(), nullptr); windowMove = w; effects->setElevatedWindow(windowMove, true); } - } else if ((me->buttons() == Qt::MidButton || me->buttons() == Qt::RightButton) && windowMove == NULL) { + } else if ((me->buttons() == Qt::MidButton || me->buttons() == Qt::RightButton) && windowMove == nullptr) { EffectWindow* w = windowAt(me->pos()); if (w && w->isDesktop()) { w = nullptr; } - if (w != NULL) { + if (w != nullptr) { const int desktop = posToDesktop(me->pos()); if (w->isOnAllDesktops()) { effects->windowToDesktop(w, desktop); @@ -675,7 +675,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e) effects->addRepaintFull(); } effects->setElevatedWindow(windowMove, false); - windowMove = NULL; + windowMove = nullptr; } wasWindowMove = false; wasWindowCopy = false; @@ -687,7 +687,7 @@ void DesktopGridEffect::grabbedKeyboardEvent(QKeyEvent* e) { if (timeline.currentValue() != 1) // Block user input during animations return; - if (windowMove != NULL) + if (windowMove != nullptr) return; if (e->type() == QEvent::KeyPress) { // check for global shortcuts @@ -823,7 +823,7 @@ QPoint DesktopGridEffect::unscalePos(const QPoint& pos, int* desktop) const int gy = qBound(0, int(scaledY), gridSize.height() - 1); scaledX -= gx; scaledY -= gy; - if (desktop != NULL) { + if (desktop != nullptr) { if (orientation == Qt::Horizontal) *desktop = gy * gridSize.width() + gx + 1; else @@ -879,7 +879,7 @@ EffectWindow* DesktopGridEffect::windowAt(QPoint pos) const int desktop; pos = unscalePos(pos, &desktop); if (desktop > effects->numberOfDesktops()) - return NULL; + return nullptr; if (isUsingPresentWindows()) { const int screen = effects->screenNumber(pos); EffectWindow *w = @@ -896,7 +896,7 @@ EffectWindow* DesktopGridEffect::windowAt(QPoint pos) const return w; } } - return NULL; + return nullptr; } void DesktopGridEffect::setCurrentDesktop(int desktop) @@ -1223,13 +1223,13 @@ void DesktopGridEffect::finish() effects->ungrabKeyboard(); keyboardGrab = false; effects->stopMouseInterception(this); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); if (isUsingPresentWindows()) { while (!m_managers.isEmpty()) { m_managers.first().unmanageAll(); m_managers.removeFirst(); } - m_proxy = 0; + m_proxy = nullptr; } } @@ -1256,7 +1256,7 @@ bool DesktopGridEffect::isMotionManagerMovingWindows() const bool DesktopGridEffect::isUsingPresentWindows() const { - return (m_proxy != NULL); + return (m_proxy != nullptr); } // transforms the geometry of the moved window to a geometry on the desktop diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h index abcf98d508..4d6c8df56c 100644 --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -36,7 +36,7 @@ class DesktopButtonsView : public QQuickView { Q_OBJECT public: - explicit DesktopButtonsView(QWindow *parent = 0); + explicit DesktopButtonsView(QWindow *parent = nullptr); void windowInputMouseEvent(QMouseEvent* e); void setAddDesktopEnabled(bool enable); void setRemoveDesktopEnabled(bool enable); @@ -119,7 +119,7 @@ private Q_SLOTS: private: QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const; - QPoint unscalePos(const QPoint& pos, int* desktop = NULL) const; + QPoint unscalePos(const QPoint& pos, int* desktop = nullptr) const; int posToDesktop(const QPoint& pos) const; EffectWindow* windowAt(QPoint pos) const; void setCurrentDesktop(int desktop); diff --git a/effects/desktopgrid/desktopgrid_config.cpp b/effects/desktopgrid/desktopgrid_config.cpp index 2d8e917a97..ab5525d8fe 100644 --- a/effects/desktopgrid/desktopgrid_config.cpp +++ b/effects/desktopgrid/desktopgrid_config.cpp @@ -73,7 +73,7 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant m_ui->shortcutEditor->addCollection(m_actionCollection); - m_ui->desktopNameAlignmentCombo->addItem(i18nc("Desktop name alignment:", "Disabled"), QVariant(Qt::Alignment(0))); + m_ui->desktopNameAlignmentCombo->addItem(i18nc("Desktop name alignment:", "Disabled"), QVariant(Qt::Alignment(nullptr))); m_ui->desktopNameAlignmentCombo->addItem(i18n("Top"), QVariant(Qt::AlignHCenter | Qt::AlignTop)); m_ui->desktopNameAlignmentCombo->addItem(i18n("Top-Right"), QVariant(Qt::AlignRight | Qt::AlignTop)); m_ui->desktopNameAlignmentCombo->addItem(i18n("Right"), QVariant(Qt::AlignRight | Qt::AlignVCenter)); diff --git a/effects/desktopgrid/desktopgrid_config.h b/effects/desktopgrid/desktopgrid_config.h index 1654d36234..6167293881 100644 --- a/effects/desktopgrid/desktopgrid_config.h +++ b/effects/desktopgrid/desktopgrid_config.h @@ -41,7 +41,7 @@ class DesktopGridEffectConfig : public KCModule { Q_OBJECT public: - explicit DesktopGridEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit DesktopGridEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~DesktopGridEffectConfig() override; public Q_SLOTS: diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index 15b7446fd3..38aedd98dd 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -45,7 +45,7 @@ FlipSwitchEffect::FlipSwitchEffect() , m_stop(false) , m_animation(false) , m_hasKeyboardGrab(false) - , m_captionFrame(NULL) + , m_captionFrame(nullptr) { initConfig(); reconfigure(ReconfigureAll); @@ -153,7 +153,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da index = index % tempList.count(); } tabIndex = index; - EffectWindow* w = NULL; + EffectWindow* w = nullptr; if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) { index--; if (index < 0) @@ -180,7 +180,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da index = 0; } tabIndex = index; - EffectWindow* w = NULL; + EffectWindow* w = nullptr; if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) { index++; if (index >= tempList.count()) @@ -331,7 +331,7 @@ void FlipSwitchEffect::postPaintScreen() m_stop = false; m_active = false; m_captionFrame->free(); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); effects->addRepaintFull(); qDeleteAll(m_windows); m_windows.clear(); @@ -437,7 +437,7 @@ void FlipSwitchEffect::slotTabBoxUpdated() if (!effects->currentTabBoxWindowList().isEmpty()) { // determine the switch direction if (m_selectedWindow != effects->currentTabBoxWindow()) { - if (m_selectedWindow != NULL) { + if (m_selectedWindow != nullptr) { int old_index = effects->currentTabBoxWindowList().indexOf(m_selectedWindow); int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow()); SwitchingDirection new_direction; @@ -485,7 +485,7 @@ void FlipSwitchEffect::slotWindowAdded(EffectWindow* w) void FlipSwitchEffect::slotWindowClosed(EffectWindow* w) { if (m_selectedWindow == w) - m_selectedWindow = 0; + m_selectedWindow = nullptr; if (m_active) { QHash< const EffectWindow*, ItemInfo* >::iterator it = m_windows.find(w); if (it != m_windows.end()) { diff --git a/effects/flipswitch/flipswitch_config.h b/effects/flipswitch/flipswitch_config.h index 27252e4746..317763730e 100644 --- a/effects/flipswitch/flipswitch_config.h +++ b/effects/flipswitch/flipswitch_config.h @@ -41,7 +41,7 @@ class FlipSwitchEffectConfig : public KCModule { Q_OBJECT public: - explicit FlipSwitchEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit FlipSwitchEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~FlipSwitchEffectConfig() override; public Q_SLOTS: diff --git a/effects/highlightwindow/highlightwindow.cpp b/effects/highlightwindow/highlightwindow.cpp index 9fa28120ca..9de3c1785a 100644 --- a/effects/highlightwindow/highlightwindow.cpp +++ b/effects/highlightwindow/highlightwindow.cpp @@ -26,7 +26,7 @@ namespace KWin HighlightWindowEffect::HighlightWindowEffect() : m_finishing(false) , m_fadeDuration(float(animationTime(150))) - , m_monitorWindow(NULL) + , m_monitorWindow(nullptr) { m_atom = effects->announceSupportProperty("_KDE_WINDOW_HIGHLIGHT", this); connect(effects, &EffectsHandler::windowAdded, this, &HighlightWindowEffect::slotWindowAdded); @@ -259,7 +259,7 @@ void HighlightWindowEffect::prepareHighlighting() void HighlightWindowEffect::finishHighlighting() { m_finishing = true; - m_monitorWindow = NULL; + m_monitorWindow = nullptr; m_highlightedWindows.clear(); if (!m_windowOpacity.isEmpty()) m_windowOpacity.constBegin().key()->addRepaintFull(); diff --git a/effects/highlightwindow/highlightwindow.h b/effects/highlightwindow/highlightwindow.h index 58158813c5..dc3a6d92b2 100644 --- a/effects/highlightwindow/highlightwindow.h +++ b/effects/highlightwindow/highlightwindow.h @@ -49,7 +49,7 @@ public Q_SLOTS: void slotWindowAdded(KWin::EffectWindow* w); void slotWindowClosed(KWin::EffectWindow *w); void slotWindowDeleted(KWin::EffectWindow *w); - void slotPropertyNotify(KWin::EffectWindow* w, long atom, EffectWindow *addedWindow = NULL); + void slotPropertyNotify(KWin::EffectWindow* w, long atom, EffectWindow *addedWindow = nullptr); private: void prepareHighlighting(); diff --git a/effects/invert/invert.cpp b/effects/invert/invert.cpp index be1e1f6a32..b8b907017b 100644 --- a/effects/invert/invert.cpp +++ b/effects/invert/invert.cpp @@ -37,7 +37,7 @@ namespace KWin InvertEffect::InvertEffect() : m_inited(false), m_valid(true), - m_shader(NULL), + m_shader(nullptr), m_allWindows(false) { QAction* a = new QAction(this); diff --git a/effects/invert/invert_config.h b/effects/invert/invert_config.h index b4269a19b5..e5237bca6a 100644 --- a/effects/invert/invert_config.h +++ b/effects/invert/invert_config.h @@ -32,7 +32,7 @@ class InvertEffectConfig : public KCModule { Q_OBJECT public: - explicit InvertEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit InvertEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~InvertEffectConfig() override; public Q_SLOTS: diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp index dd806a9f6d..a08fa59806 100644 --- a/effects/lookingglass/lookingglass.cpp +++ b/effects/lookingglass/lookingglass.cpp @@ -45,10 +45,10 @@ LookingGlassEffect::LookingGlassEffect() : zoom(1.0f) , target_zoom(1.0f) , polling(false) - , m_texture(NULL) - , m_fbo(NULL) - , m_vbo(NULL) - , m_shader(NULL) + , m_texture(nullptr) + , m_fbo(nullptr) + , m_vbo(nullptr) + , m_shader(nullptr) , m_enabled(false) , m_valid(false) { diff --git a/effects/lookingglass/lookingglass_config.h b/effects/lookingglass/lookingglass_config.h index 22adf1b10f..21619ee5f5 100644 --- a/effects/lookingglass/lookingglass_config.h +++ b/effects/lookingglass/lookingglass_config.h @@ -41,7 +41,7 @@ class LookingGlassEffectConfig : public KCModule { Q_OBJECT public: - explicit LookingGlassEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit LookingGlassEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~LookingGlassEffectConfig() override; void save() override; diff --git a/effects/magiclamp/magiclamp.cpp b/effects/magiclamp/magiclamp.cpp index 76513b7105..155ccf39ee 100644 --- a/effects/magiclamp/magiclamp.cpp +++ b/effects/magiclamp/magiclamp.cpp @@ -134,7 +134,7 @@ void MagicLampEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win icon = QRect(pt, QSize(0, 0)); } else { // Assumption: there is a panel containing the icon position - EffectWindow* panel = NULL; + EffectWindow* panel = nullptr; foreach (EffectWindow * window, effects->stackingOrder()) { if (!window->isDock()) continue; diff --git a/effects/magiclamp/magiclamp_config.h b/effects/magiclamp/magiclamp_config.h index 2f074c07d6..c4b838d96a 100644 --- a/effects/magiclamp/magiclamp_config.h +++ b/effects/magiclamp/magiclamp_config.h @@ -40,7 +40,7 @@ class MagicLampEffectConfig : public KCModule { Q_OBJECT public: - explicit MagicLampEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit MagicLampEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); public Q_SLOTS: void save() override; diff --git a/effects/magnifier/magnifier.cpp b/effects/magnifier/magnifier.cpp index 9a22b3806d..d800ef4f87 100644 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -44,8 +44,8 @@ MagnifierEffect::MagnifierEffect() : zoom(1) , target_zoom(1) , polling(false) - , m_texture(0) - , m_fbo(0) + , m_texture(nullptr) + , m_fbo(nullptr) #ifdef KWIN_HAVE_XRENDER_COMPOSITING , m_pixmap(XCB_PIXMAP_NONE) #endif @@ -127,8 +127,8 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time) // zoom ended - delete FBO and texture delete m_fbo; delete m_texture; - m_fbo = NULL; - m_texture = NULL; + m_fbo = nullptr; + m_texture = nullptr; destroyPixmap(); } } @@ -195,7 +195,7 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH; verts << areaF.right() + FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH; verts << areaF.right() + FRAME_WIDTH << areaF.bottom(); - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); + vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); ShaderBinder binder(ShaderTrait::UniformColor); binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix()); @@ -228,10 +228,10 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat xform.matrix22 = DOUBLE_TO_FIXED(1.0/zoom); #undef DOUBLE_TO_FIXED xcb_render_set_picture_transform(xcbConnection(), *m_picture, xform); - xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("good"), 0, NULL); + xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("good"), 0, nullptr); xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_SRC, *m_picture, 0, effects->xrenderBufferPicture(), 0, 0, 0, 0, area.x(), area.y(), area.width(), area.height() ); - xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("fast"), 0, NULL); + xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast("fast"), 0, nullptr); xcb_render_set_picture_transform(xcbConnection(), *m_picture, identity); const xcb_rectangle_t rects[4] = { { int16_t(area.x()+FRAME_WIDTH), int16_t(area.y()), uint16_t(area.width()-FRAME_WIDTH), uint16_t(FRAME_WIDTH)}, @@ -290,8 +290,8 @@ void MagnifierEffect::zoomOut() effects->makeOpenGLContextCurrent(); delete m_fbo; delete m_texture; - m_fbo = NULL; - m_texture = NULL; + m_fbo = nullptr; + m_texture = nullptr; destroyPixmap(); } } diff --git a/effects/magnifier/magnifier_config.h b/effects/magnifier/magnifier_config.h index 6dafd4f877..6b7ec1a920 100644 --- a/effects/magnifier/magnifier_config.h +++ b/effects/magnifier/magnifier_config.h @@ -41,7 +41,7 @@ class MagnifierEffectConfig : public KCModule { Q_OBJECT public: - explicit MagnifierEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit MagnifierEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~MagnifierEffectConfig() override; void save() override; diff --git a/effects/mouseclick/mouseclick.cpp b/effects/mouseclick/mouseclick.cpp index baa53f5913..a735b14199 100644 --- a/effects/mouseclick/mouseclick.cpp +++ b/effects/mouseclick/mouseclick.cpp @@ -164,7 +164,7 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&, if (buttons == oldButtons) return; - MouseEvent* m = NULL; + MouseEvent* m = nullptr; int i = BUTTON_COUNT; while (--i >= 0) { MouseButton* b = m_buttons[i]; @@ -187,7 +187,7 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&, EffectFrame* MouseClickEffect::createEffectFrame(const QPoint& pos, const QString& text) { if (!m_showText) { - return NULL; + return nullptr; } QPoint point(pos.x() + m_ringMaxSize, pos.y()); EffectFrame* frame = effects->effectFrame(EffectFrameStyled, false, point, Qt::AlignLeft); @@ -295,7 +295,7 @@ void MouseClickEffect::drawCircleGl(const QColor& color, float cx, float cy, flo x = c * x - s * y; y = s * t + c * y; } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); + vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->render(GL_LINE_LOOP); } diff --git a/effects/mouseclick/mouseclick_config.h b/effects/mouseclick/mouseclick_config.h index 9e8ef375c1..52713c9330 100644 --- a/effects/mouseclick/mouseclick_config.h +++ b/effects/mouseclick/mouseclick_config.h @@ -41,7 +41,7 @@ class MouseClickEffectConfig : public KCModule { Q_OBJECT public: - explicit MouseClickEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit MouseClickEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~MouseClickEffectConfig() override; void save() override; diff --git a/effects/mousemark/mousemark.cpp b/effects/mousemark/mousemark.cpp index a205ea13c8..d135b04af0 100644 --- a/effects/mousemark/mousemark.cpp +++ b/effects/mousemark/mousemark.cpp @@ -138,7 +138,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat foreach (const QPoint & p, mark) { verts << p.x() << p.y(); } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); + vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->render(GL_LINE_STRIP); } if (!drawing.isEmpty()) { @@ -147,7 +147,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat foreach (const QPoint & p, drawing) { verts << p.x() << p.y(); } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); + vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->render(GL_LINE_STRIP); } glLineWidth(1.0); diff --git a/effects/mousemark/mousemark_config.h b/effects/mousemark/mousemark_config.h index aea63f0c03..20bd754cfd 100644 --- a/effects/mousemark/mousemark_config.h +++ b/effects/mousemark/mousemark_config.h @@ -41,7 +41,7 @@ class MouseMarkEffectConfig : public KCModule { Q_OBJECT public: - explicit MouseMarkEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit MouseMarkEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~MouseMarkEffectConfig() override; void save() override; diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 35a29fdadf..b1238e9dc7 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -55,12 +55,12 @@ PresentWindowsEffect::PresentWindowsEffect() , m_decalOpacity(0.0) , m_hasKeyboardGrab(false) , m_mode(ModeCurrentDesktop) - , m_managerWindow(NULL) + , m_managerWindow(nullptr) , m_needInitialSelection(false) - , m_highlightedWindow(NULL) - , m_filterFrame(NULL) - , m_closeView(NULL) - , m_closeWindow(NULL) + , m_highlightedWindow(nullptr) + , m_filterFrame(nullptr) + , m_closeView(nullptr) + , m_closeWindow(nullptr) , m_exposeAction(new QAction(this)) , m_exposeAllAction(new QAction(this)) , m_exposeClassAction(new QAction(this)) @@ -250,7 +250,7 @@ void PresentWindowsEffect::postPaintScreen() w->setData(WindowForceBlurRole, QVariant()); w->setData(WindowForceBackgroundContrastRole, QVariant()); } - effects->setActiveFullScreenEffect(NULL); + effects->setActiveFullScreenEffect(nullptr); effects->addRepaintFull(); } else if (m_activated && m_needInitialSelection) { m_needInitialSelection = false; @@ -325,7 +325,7 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d winData->referenced = false; w->unrefWindow(); if (w == m_closeWindow) { - m_closeWindow = NULL; + m_closeWindow = nullptr; } } else w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); @@ -487,7 +487,7 @@ void PresentWindowsEffect::slotWindowAdded(EffectWindow *w) void PresentWindowsEffect::slotWindowClosed(EffectWindow *w) { if (m_managerWindow == w) - m_managerWindow = NULL; + m_managerWindow = nullptr; DataHash::iterator winData = m_windowData.find(w); if (winData == m_windowData.end()) return; @@ -589,7 +589,7 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type // We cannot use m_motionManager.windowAtPoint() as the window might not be visible EffectWindowList windows = m_motionManager.managedWindows(); bool hovering = false; - EffectWindow *highlightCandidate = NULL; + EffectWindow *highlightCandidate = nullptr; for (int i = 0; i < windows.size(); ++i) { DataHash::const_iterator winData = m_windowData.constFind(windows.at(i)); if (winData == m_windowData.constEnd()) @@ -603,7 +603,7 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type } } if (!hovering) - setHighlightedWindow(NULL); + setHighlightedWindow(nullptr); if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos)) updateCloseWindow(); else if (m_closeView) @@ -951,7 +951,7 @@ void PresentWindowsEffect::rearrangeWindows() } } if (windowlist.isEmpty()) { - setHighlightedWindow(NULL); + setHighlightedWindow(nullptr); return; } @@ -986,7 +986,7 @@ void PresentWindowsEffect::rearrangeWindows() } // Resize text frames if required - QFontMetrics* metrics = NULL; // All fonts are the same + QFontMetrics* metrics = nullptr; // All fonts are the same foreach (EffectWindow * w, m_motionManager.managedWindows()) { DataHash::iterator winData = m_windowData.find(w); if (winData == m_windowData.end()) @@ -1534,7 +1534,7 @@ void PresentWindowsEffect::setActive(bool active) m_needInitialSelection = true; m_closeButtonCorner = (Qt::Corner)effects->kwinOption(KWin::CloseButtonCorner).toInt(); m_decalOpacity = 0.0; - m_highlightedWindow = NULL; + m_highlightedWindow = nullptr; m_windowFilter.clear(); if (!(m_doNotCloseWindows || m_closeView)) { @@ -1643,7 +1643,7 @@ void PresentWindowsEffect::setActive(bool active) m_managerWindow->deleteProperty(m_atomDesktop); else if (m_mode == ModeWindowGroup && m_atomWindows != XCB_ATOM_NONE) m_managerWindow->deleteProperty(m_atomWindows); - m_managerWindow = NULL; + m_managerWindow = nullptr; } } effects->addRepaintFull(); // Trigger the first repaint @@ -1709,7 +1709,7 @@ bool PresentWindowsEffect::isVisibleWindow(EffectWindow *w) void PresentWindowsEffect::setHighlightedWindow(EffectWindow *w) { - if (w == m_highlightedWindow || (w != NULL && !m_motionManager.isManaging(w))) + if (w == m_highlightedWindow || (w != nullptr && !m_motionManager.isManaging(w))) return; if (m_closeView) @@ -1800,7 +1800,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i for (int i = 0; i < xdiff; i++) { QRectF wArea = m_motionManager.transformedGeometry(w); detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); - next = NULL; + next = nullptr; foreach (EffectWindow * e, m_motionManager.managedWindows()) { DataHash::const_iterator winData = m_windowData.find(e); if (winData == m_windowData.end() || !winData->visible) @@ -1808,7 +1808,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i QRectF eArea = m_motionManager.transformedGeometry(e); if (eArea.intersects(detectRect) && eArea.x() > wArea.x()) { - if (next == NULL) + if (next == nullptr) next = e; else { QRectF nArea = m_motionManager.transformedGeometry(next); @@ -1817,7 +1817,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i } } } - if (next == NULL) { + if (next == nullptr) { if (wrap) // We are at the right-most window, now get the left-most one to wrap return relativeWindow(w, -1000, 0, false); break; // No more windows to the right @@ -1830,7 +1830,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i for (int i = 0; i < -xdiff; i++) { QRectF wArea = m_motionManager.transformedGeometry(w); detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); - next = NULL; + next = nullptr; foreach (EffectWindow * e, m_motionManager.managedWindows()) { DataHash::const_iterator winData = m_windowData.find(e); if (winData == m_windowData.end() || !winData->visible) @@ -1838,7 +1838,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i QRectF eArea = m_motionManager.transformedGeometry(e); if (eArea.intersects(detectRect) && eArea.x() + eArea.width() < wArea.x() + wArea.width()) { - if (next == NULL) + if (next == nullptr) next = e; else { QRectF nArea = m_motionManager.transformedGeometry(next); @@ -1847,7 +1847,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i } } } - if (next == NULL) { + if (next == nullptr) { if (wrap) // We are at the left-most window, now get the right-most one to wrap return relativeWindow(w, 1000, 0, false); break; // No more windows to the left @@ -1865,7 +1865,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i for (int i = 0; i < ydiff; i++) { QRectF wArea = m_motionManager.transformedGeometry(w); detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); - next = NULL; + next = nullptr; foreach (EffectWindow * e, m_motionManager.managedWindows()) { DataHash::const_iterator winData = m_windowData.find(e); if (winData == m_windowData.end() || !winData->visible) @@ -1873,7 +1873,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i QRectF eArea = m_motionManager.transformedGeometry(e); if (eArea.intersects(detectRect) && eArea.y() > wArea.y()) { - if (next == NULL) + if (next == nullptr) next = e; else { QRectF nArea = m_motionManager.transformedGeometry(next); @@ -1882,7 +1882,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i } } } - if (next == NULL) { + if (next == nullptr) { if (wrap) // We are at the bottom-most window, now get the top-most one to wrap return relativeWindow(w, 0, -1000, false); break; // No more windows to the bottom @@ -1895,7 +1895,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i for (int i = 0; i < -ydiff; i++) { QRectF wArea = m_motionManager.transformedGeometry(w); detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); - next = NULL; + next = nullptr; foreach (EffectWindow * e, m_motionManager.managedWindows()) { DataHash::const_iterator winData = m_windowData.find(e); if (winData == m_windowData.end() || !winData->visible) @@ -1903,7 +1903,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i QRectF eArea = m_motionManager.transformedGeometry(e); if (eArea.intersects(detectRect) && eArea.y() + eArea.height() < wArea.y() + wArea.height()) { - if (next == NULL) + if (next == nullptr) next = e; else { QRectF nArea = m_motionManager.transformedGeometry(next); @@ -1912,7 +1912,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i } } } - if (next == NULL) { + if (next == nullptr) { if (wrap) // We are at the top-most window, now get the bottom-most one to wrap return relativeWindow(w, 0, 1000, false); break; // No more windows to the top @@ -1928,7 +1928,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i EffectWindow* PresentWindowsEffect::findFirstWindow() const { - EffectWindow *topLeft = NULL; + EffectWindow *topLeft = nullptr; QRectF topLeftGeometry; foreach (EffectWindow * w, m_motionManager.managedWindows()) { DataHash::const_iterator winData = m_windowData.find(w); @@ -1939,7 +1939,7 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const continue; // Not visible if (winData->deleted) continue; // Window has been closed - if (topLeft == NULL) { + if (topLeft == nullptr) { topLeft = w; topLeftGeometry = geometry; } else if (geometry.x() < topLeftGeometry.x() || geometry.y() < topLeftGeometry.y()) { diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index 7d94136a71..8b7c259a40 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -36,7 +36,7 @@ class CloseWindowView : public QObject { Q_OBJECT public: - explicit CloseWindowView(QObject *parent = 0); + explicit CloseWindowView(QObject *parent = nullptr); void windowInputMouseEvent(QMouseEvent* e); void disarm(); diff --git a/effects/presentwindows/presentwindows_config.h b/effects/presentwindows/presentwindows_config.h index 4607be00b9..bc15ea7624 100644 --- a/effects/presentwindows/presentwindows_config.h +++ b/effects/presentwindows/presentwindows_config.h @@ -40,7 +40,7 @@ class PresentWindowsEffectConfig : public KCModule { Q_OBJECT public: - explicit PresentWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit PresentWindowsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~PresentWindowsEffectConfig() override; public Q_SLOTS: diff --git a/effects/resize/resize.cpp b/effects/resize/resize.cpp index 2b4e51428f..4cdbb90493 100644 --- a/effects/resize/resize.cpp +++ b/effects/resize/resize.cpp @@ -38,7 +38,7 @@ namespace KWin ResizeEffect::ResizeEffect() : AnimationEffect() , m_active(false) - , m_resizeWindow(0) + , m_resizeWindow(nullptr) { initConfig(); reconfigure(ReconfigureAll); @@ -102,7 +102,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window verts << r.x() + r.width() << r.y() + r.height(); verts << r.x() + r.width() << r.y(); } - vbo->setData(verts.count() / 2, 2, verts.data(), NULL); + vbo->setData(verts.count() / 2, 2, verts.data(), nullptr); vbo->render(GL_TRIANGLES); glDisable(GL_BLEND); } @@ -159,7 +159,7 @@ void ResizeEffect::slotWindowFinishUserMovedResized(EffectWindow *w) { if (m_active && w == m_resizeWindow) { m_active = false; - m_resizeWindow = NULL; + m_resizeWindow = nullptr; if (m_features & TextureScale) animate(w, CrossFadePrevious, 0, 150, FPx2(1.0)); effects->addRepaintFull(); diff --git a/effects/resize/resize_config.h b/effects/resize/resize_config.h index e02e596e38..7c07c23acc 100644 --- a/effects/resize/resize_config.h +++ b/effects/resize/resize_config.h @@ -33,14 +33,14 @@ class ResizeEffectConfigForm : public QWidget, public Ui::ResizeEffectConfigForm { Q_OBJECT public: - explicit ResizeEffectConfigForm(QWidget* parent = 0); + explicit ResizeEffectConfigForm(QWidget* parent = nullptr); }; class ResizeEffectConfig : public KCModule { Q_OBJECT public: - explicit ResizeEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit ResizeEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); public Q_SLOTS: void save() override; diff --git a/effects/screenedge/screenedgeeffect.cpp b/effects/screenedge/screenedgeeffect.cpp index 3c0810eb10..88654bb627 100644 --- a/effects/screenedge/screenedgeeffect.cpp +++ b/effects/screenedge/screenedgeeffect.cpp @@ -233,7 +233,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR } if (glow->texture.isNull()) { delete glow; - return NULL; + return nullptr; } } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -246,7 +246,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR } if (glow->picture.isNull()) { delete glow; - return NULL; + return nullptr; } #endif } else if (effects->compositingType() == QPainterCompositing) { @@ -259,7 +259,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR } if (glow->image.isNull()) { delete glow; - return NULL; + return nullptr; } } @@ -281,7 +281,7 @@ T *ScreenEdgeEffect::createCornerGlow(ElectricBorder border) case ElectricBottomLeft: return new T(m_glow->pixmap(QStringLiteral("topright")).toImage()); default: - return NULL; + return nullptr; } } @@ -336,7 +336,7 @@ T *ScreenEdgeEffect::createEdgeGlow(ElectricBorder border, const QSize &size) pixmapPosition = QPoint(size.width() - c.width(), 0); break; default: - return NULL; + return nullptr; } QPixmap image(size); image.fill(Qt::transparent); diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 35a64cbeb4..a37b684f25 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -58,7 +58,7 @@ bool ScreenShotEffect::supported() } ScreenShotEffect::ScreenShotEffect() - : m_scheduledScreenshot(0) + : m_scheduledScreenshot(nullptr) { connect(effects, &EffectsHandler::windowClosed, this, &ScreenShotEffect::windowClosed); QDBusConnection::sessionBus().registerObject(QStringLiteral("/Screenshot"), this, QDBusConnection::ExportScriptableContents); @@ -234,7 +234,7 @@ void ScreenShotEffect::postPaintScreen() ScreenShotEffect::convertFromGLImage(img, width, height); } #ifdef KWIN_HAVE_XRENDER_COMPOSITING - xcb_image_t *xImage = NULL; + xcb_image_t *xImage = nullptr; if (effects->compositingType() == XRenderCompositing) { setXRenderOffscreen(true); effects->drawWindow(m_scheduledScreenshot, mask, QRegion(0, 0, width, height), d); @@ -276,7 +276,7 @@ void ScreenShotEffect::postPaintScreen() } #endif } - m_scheduledScreenshot = NULL; + m_scheduledScreenshot = nullptr; } if (!m_scheduledGeometry.isNull()) { @@ -373,7 +373,7 @@ void ScreenShotEffect::screenshotWindowUnderCursor(int mask) !m_scheduledScreenshot->isMinimized() && !m_scheduledScreenshot->isDeleted() && m_scheduledScreenshot->geometry().contains(cursor)) break; - m_scheduledScreenshot = 0; + m_scheduledScreenshot = nullptr; } if (m_scheduledScreenshot) { m_windowMode = WindowMode::Xpixmap; @@ -626,7 +626,7 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry) #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) { - xcb_image_t *xImage = NULL; + xcb_image_t *xImage = nullptr; img = xPictureToImage(effects->xrenderBufferPicture(), geometry, &xImage); if (xImage) { xcb_image_destroy(xImage); @@ -684,13 +684,13 @@ void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h) bool ScreenShotEffect::isActive() const { - return (m_scheduledScreenshot != NULL || !m_scheduledGeometry.isNull()) && !effects->isScreenLocked(); + return (m_scheduledScreenshot != nullptr || !m_scheduledGeometry.isNull()) && !effects->isScreenLocked(); } void ScreenShotEffect::windowClosed( EffectWindow* w ) { if (w == m_scheduledScreenshot) { - m_scheduledScreenshot = NULL; + m_scheduledScreenshot = nullptr; screenshotWindowUnderCursor(m_type); } } diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp index ad7f707305..b02ca1eef5 100644 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -201,7 +201,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix) verts << x << y + MAX_TIME; verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y + MAX_TIME; verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y; - vbo->setData(6, 2, verts.constData(), NULL); + vbo->setData(6, 2, verts.constData(), nullptr); vbo->render(GL_TRIANGLES); y += MAX_TIME; // paint up from the bottom color.setRed(0); @@ -214,7 +214,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix) verts << x << y; verts << x + FPS_WIDTH << y; verts << x + FPS_WIDTH << y - fps; - vbo->setData(6, 2, verts.constData(), NULL); + vbo->setData(6, 2, verts.constData(), nullptr); vbo->render(GL_TRIANGLES); @@ -227,7 +227,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix) vertices << x << y - i; vertices << x + FPS_WIDTH << y - i; } - vbo->setData(vertices.size() / 2, 2, vertices.constData(), NULL); + vbo->setData(vertices.size() / 2, 2, vertices.constData(), nullptr); vbo->render(GL_LINES); x += FPS_WIDTH; @@ -406,7 +406,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines verts << x << y - h; verts << x + values.count() << y - h; } - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); + vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); vbo->render(GL_LINES); // Then the graph values int lastValue = 0; @@ -415,7 +415,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines int value = values[ i ]; if (colorize && value != lastValue) { if (!verts.isEmpty()) { - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); + vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); vbo->render(GL_LINES); } verts.clear(); @@ -435,7 +435,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines lastValue = value; } if (!verts.isEmpty()) { - vbo->setData(verts.size() / 2, 2, verts.constData(), NULL); + vbo->setData(verts.size() / 2, 2, verts.constData(), nullptr); vbo->render(GL_LINES); } } diff --git a/effects/showfps/showfps_config.h b/effects/showfps/showfps_config.h index 7ac264d08d..7d79a07fcf 100644 --- a/effects/showfps/showfps_config.h +++ b/effects/showfps/showfps_config.h @@ -32,7 +32,7 @@ class ShowFpsEffectConfig : public KCModule { Q_OBJECT public: - explicit ShowFpsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit ShowFpsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~ShowFpsEffectConfig() override; public Q_SLOTS: diff --git a/effects/slideback/slideback.cpp b/effects/slideback/slideback.cpp index 67970ecd43..00356e8baf 100644 --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -26,7 +26,7 @@ namespace KWin SlideBackEffect::SlideBackEffect() { m_tabboxActive = 0; - m_justMapped = m_upmostWindow = NULL; + m_justMapped = m_upmostWindow = nullptr; connect(effects, &EffectsHandler::windowAdded, this, &SlideBackEffect::slotWindowAdded); connect(effects, &EffectsHandler::windowDeleted, this, &SlideBackEffect::slotWindowDeleted); connect(effects, &EffectsHandler::windowUnminimized, this, &SlideBackEffect::slotWindowUnminimized); @@ -54,7 +54,7 @@ void SlideBackEffect::slotStackingOrderChanged() m_upmostWindow = usableNewStackingOrder.last(); if (m_upmostWindow == m_justMapped ) // a window was added, got on top, stacking changed. Nothing impressive - m_justMapped = 0; + m_justMapped = nullptr; else if (!usableOldStackingOrder.isEmpty() && m_upmostWindow != usableOldStackingOrder.last()) windowRaised(m_upmostWindow); @@ -259,9 +259,9 @@ void SlideBackEffect::postPaintWindow(EffectWindow* w) void SlideBackEffect::slotWindowDeleted(EffectWindow* w) { if (w == m_upmostWindow) - m_upmostWindow = 0; + m_upmostWindow = nullptr; if (w == m_justMapped) - m_justMapped = 0; + m_justMapped = nullptr; usableOldStackingOrder.removeAll(w); oldStackingOrder.removeAll(w); coveringWindows.removeAll(w); diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index 01f0ae23df..6864d65d98 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -78,13 +78,13 @@ StartupFeedbackEffect::StartupFeedbackEffect() , m_active(false) , m_frame(0) , m_progress(0) - , m_texture(0) + , m_texture(nullptr) , m_type(BouncingFeedback) - , m_blinkingShader(0) + , m_blinkingShader(nullptr) , m_cursorSize(0) { for (int i = 0; i < 5; ++i) { - m_bouncingTextures[i] = 0; + m_bouncingTextures[i] = nullptr; } if (KWindowSystem::isPlatformX11()) { m_selection = new KSelectionOwner("_KDE_STARTUP_FEEDBACK", xcbConnection(), x11RootWindow(), this); @@ -276,7 +276,7 @@ void StartupFeedbackEffect::start(const QString& icon) if (m_type == BouncingFeedback) m_bounceSizesRatio = IconSize(KIconLoader::Small) / 16.0; QPixmap iconPixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Small, 0, - KIconLoader::DefaultState, QStringList(), 0, true); // return null pixmap if not found + KIconLoader::DefaultState, QStringList(), nullptr, true); // return null pixmap if not found if (iconPixmap.isNull()) iconPixmap = SmallIcon(QStringLiteral("system-run")); prepareTextures(iconPixmap); @@ -307,13 +307,13 @@ void StartupFeedbackEffect::stop() case BouncingFeedback: for (int i = 0; i < 5; ++i) { delete m_bouncingTextures[i]; - m_bouncingTextures[i] = 0; + m_bouncingTextures[i] = nullptr; } break; case BlinkingFeedback: case PassiveFeedback: delete m_texture; - m_texture = 0; + m_texture = nullptr; break; case NoFeedback: return; // don't want the full repaint @@ -371,7 +371,7 @@ QRect StartupFeedbackEffect::feedbackRect() const else xDiff = 32 + 7; int yDiff = xDiff; - GLTexture* texture = 0; + GLTexture* texture = nullptr; int yOffset = 0; switch(m_type) { case BouncingFeedback: diff --git a/effects/thumbnailaside/thumbnailaside.cpp b/effects/thumbnailaside/thumbnailaside.cpp index 66ce377703..9bca3c6a78 100644 --- a/effects/thumbnailaside/thumbnailaside.cpp +++ b/effects/thumbnailaside/thumbnailaside.cpp @@ -113,7 +113,7 @@ void ThumbnailAsideEffect::slotWindowClosed(EffectWindow* w) void ThumbnailAsideEffect::toggleCurrentThumbnail() { EffectWindow* active = effects->activeWindow(); - if (active == NULL) + if (active == nullptr) return; if (windows.contains(active)) removeThumbnail(active); diff --git a/effects/thumbnailaside/thumbnailaside_config.h b/effects/thumbnailaside/thumbnailaside_config.h index 88973b8328..4055892652 100644 --- a/effects/thumbnailaside/thumbnailaside_config.h +++ b/effects/thumbnailaside/thumbnailaside_config.h @@ -41,7 +41,7 @@ class ThumbnailAsideEffectConfig : public KCModule { Q_OBJECT public: - explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit ThumbnailAsideEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~ThumbnailAsideEffectConfig() override; void save() override; diff --git a/effects/touchpoints/touchpoints.cpp b/effects/touchpoints/touchpoints.cpp index 5c358831c2..52e9e95212 100644 --- a/effects/touchpoints/touchpoints.cpp +++ b/effects/touchpoints/touchpoints.cpp @@ -231,7 +231,7 @@ void TouchPointsEffect::drawCircleGl(const QColor& color, float cx, float cy, fl x = c * x - s * y; y = s * t + c * y; } - vbo->setData(verts.size() / 2, 2, verts.data(), NULL); + vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->render(GL_LINE_LOOP); } diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index 534b98f240..e84728d98b 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -46,9 +46,9 @@ TrackMouseEffect::TrackMouseEffect() : m_angle(0) { initConfig(); - m_texture[0] = m_texture[1] = 0; + m_texture[0] = m_texture[1] = nullptr; #ifdef KWIN_HAVE_XRENDER_COMPOSITING - m_picture[0] = m_picture[1] = 0; + m_picture[0] = m_picture[1] = nullptr; if ( effects->compositingType() == XRenderCompositing) m_angleBase = 1.57079632679489661923; // Pi/2 #endif @@ -74,16 +74,16 @@ TrackMouseEffect::~TrackMouseEffect() if (m_mousePolling) effects->stopMousePolling(); for (int i = 0; i < 2; ++i) { - delete m_texture[i]; m_texture[i] = 0; + delete m_texture[i]; m_texture[i] = nullptr; #ifdef KWIN_HAVE_XRENDER_COMPOSITING - delete m_picture[i]; m_picture[i] = 0; + delete m_picture[i]; m_picture[i] = nullptr; #endif } } void TrackMouseEffect::reconfigure(ReconfigureFlags) { - m_modifiers = 0; + m_modifiers = nullptr; TrackMouseConfig::self()->read(); if (TrackMouseConfig::shift()) m_modifiers |= Qt::ShiftModifier; @@ -161,7 +161,7 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da }; #undef DOUBLE_TO_FIXED xcb_render_set_picture_transform(xcbConnection(), picture, xform); - xcb_render_set_picture_filter(xcbConnection(), picture, 8, "bilinear", 0, NULL); + xcb_render_set_picture_filter(xcbConnection(), picture, 8, "bilinear", 0, nullptr); const QRect &rect = m_lastRect[i]; xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE, effects->xrenderBufferPicture(), 0, 0, 0, 0, diff --git a/effects/trackmouse/trackmouse_config.h b/effects/trackmouse/trackmouse_config.h index 7a6a8d3f1c..a3bdc4b258 100644 --- a/effects/trackmouse/trackmouse_config.h +++ b/effects/trackmouse/trackmouse_config.h @@ -42,7 +42,7 @@ class TrackMouseEffectConfig : public KCModule { Q_OBJECT public: - explicit TrackMouseEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit TrackMouseEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~TrackMouseEffectConfig() override; public Q_SLOTS: diff --git a/effects/windowgeometry/windowgeometry.cpp b/effects/windowgeometry/windowgeometry.cpp index e976d664ba..c77af6efb3 100644 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -37,7 +37,7 @@ WindowGeometry::WindowGeometry() initConfig(); iAmActivated = true; iAmActive = false; - myResizeWindow = 0L; + myResizeWindow = nullptr; #define myResizeString "Window geometry display, %1 and %2 are the new size," \ " %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \ "Width: %1 (%3)\nHeight: %2 (%4)" @@ -128,7 +128,7 @@ void WindowGeometry::slotWindowFinishUserMovedResized(EffectWindow *w) { if (iAmActive && w == myResizeWindow) { iAmActive = false; - myResizeWindow = 0L; + myResizeWindow = nullptr; w->addRepaintFull(); if (myExtraDirtyArea.isValid()) w->addLayerRepaint(myExtraDirtyArea); diff --git a/effects/windowgeometry/windowgeometry_config.h b/effects/windowgeometry/windowgeometry_config.h index b45d302753..247f47c56f 100644 --- a/effects/windowgeometry/windowgeometry_config.h +++ b/effects/windowgeometry/windowgeometry_config.h @@ -40,7 +40,7 @@ class WindowGeometryConfig : public KCModule { Q_OBJECT public: - explicit WindowGeometryConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit WindowGeometryConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~WindowGeometryConfig() override; public Q_SLOTS: diff --git a/effects/wobblywindows/wobblywindows_config.h b/effects/wobblywindows/wobblywindows_config.h index 3dadb60fb8..f423c9a19f 100644 --- a/effects/wobblywindows/wobblywindows_config.h +++ b/effects/wobblywindows/wobblywindows_config.h @@ -34,7 +34,7 @@ class WobblyWindowsEffectConfig : public KCModule { Q_OBJECT public: - explicit WobblyWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit WobblyWindowsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~WobblyWindowsEffectConfig() override; public Q_SLOTS: diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index d239c9e4f2..413d0261c6 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -61,7 +61,7 @@ ZoomEffect::ZoomEffect() , moveFactor(20.0) { initConfig(); - QAction* a = 0; + QAction* a = nullptr; a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Equal); @@ -369,7 +369,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) }; if (mousePointer == MousePointerScale) { - xcb_render_set_picture_filter(xcbConnection(), *xrenderPicture, 4, const_cast("good"), 0, NULL); + xcb_render_set_picture_filter(xcbConnection(), *xrenderPicture, 4, const_cast("good"), 0, nullptr); const xcb_render_transform_t xform = { DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), diff --git a/effects/zoom/zoom_config.h b/effects/zoom/zoom_config.h index c40c8be975..72fe20ddba 100644 --- a/effects/zoom/zoom_config.h +++ b/effects/zoom/zoom_config.h @@ -34,14 +34,14 @@ class ZoomEffectConfigForm : public QWidget, public Ui::ZoomEffectConfigForm { Q_OBJECT public: - explicit ZoomEffectConfigForm(QWidget* parent = 0); + explicit ZoomEffectConfigForm(QWidget* parent = nullptr); }; class ZoomEffectConfig : public KCModule { Q_OBJECT public: - explicit ZoomEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit ZoomEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList()); ~ZoomEffectConfig() override; public Q_SLOTS: diff --git a/events.cpp b/events.cpp index b0fe982c87..54d812c511 100644 --- a/events.cpp +++ b/events.cpp @@ -326,7 +326,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) const auto *event = reinterpret_cast(e); if (event->override_redirect) { Unmanaged* c = findUnmanaged(event->window); - if (c == NULL) + if (c == nullptr) c = createUnmanaged(event->window); if (c) return c->windowEvent(e); @@ -373,9 +373,9 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot)) { //kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ; AbstractClient *c = mostRecentlyActivatedClient(); - if (c != NULL) + if (c != nullptr) requestFocus(c, true); - else if (activateNextClient(NULL)) + else if (activateNextClient(nullptr)) ; // ok, activated else focusToNull(); @@ -444,7 +444,7 @@ bool Client::windowEvent(xcb_generic_event_t *e) emit opacityChanged(this, old_opacity); } else { // forward to the frame if there's possibly another compositing manager running - NETWinInfo i(connection(), frameId(), rootWindow(), 0, 0); + NETWinInfo i(connection(), frameId(), rootWindow(), nullptr, nullptr); i.setOpacity(info->opacity()); } } @@ -821,7 +821,7 @@ void Client::leaveNotifyEvent(xcb_leave_notify_event_t *e) } } if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) { - workspace()->requestDelayFocus(0); + workspace()->requestDelayFocus(nullptr); } return; } diff --git a/focuschain.cpp b/focuschain.cpp index 1054d69a55..229314968c 100644 --- a/focuschain.cpp +++ b/focuschain.cpp @@ -29,14 +29,14 @@ KWIN_SINGLETON_FACTORY_VARIABLE(FocusChain, s_manager) FocusChain::FocusChain(QObject *parent) : QObject(parent) , m_separateScreenFocus(false) - , m_activeClient(NULL) + , m_activeClient(nullptr) , m_currentDesktop(0) { } FocusChain::~FocusChain() { - s_manager = NULL; + s_manager = nullptr; } void FocusChain::remove(AbstractClient *client) @@ -68,7 +68,7 @@ AbstractClient *FocusChain::getForActivation(uint desktop, int screen) const { auto it = m_desktopFocusChains.constFind(desktop); if (it == m_desktopFocusChains.constEnd()) { - return NULL; + return nullptr; } const auto &chain = it.value(); for (int i = chain.size() - 1; i >= 0; --i) { @@ -79,7 +79,7 @@ AbstractClient *FocusChain::getForActivation(uint desktop, int screen) const return tmp; } } - return NULL; + return nullptr; } void FocusChain::update(AbstractClient *client, FocusChain::Change change) @@ -191,7 +191,7 @@ void FocusChain::moveAfterClientInChain(AbstractClient *client, AbstractClient * AbstractClient *FocusChain::firstMostRecentlyUsed() const { if (m_mostRecentlyUsed.isEmpty()) { - return NULL; + return nullptr; } return m_mostRecentlyUsed.first(); } @@ -199,7 +199,7 @@ AbstractClient *FocusChain::firstMostRecentlyUsed() const AbstractClient *FocusChain::nextMostRecentlyUsed(AbstractClient *reference) const { if (m_mostRecentlyUsed.isEmpty()) { - return NULL; + return nullptr; } const int index = m_mostRecentlyUsed.indexOf(reference); if (index == -1) { @@ -223,7 +223,7 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt { auto it = m_desktopFocusChains.constFind(desktop); if (it == m_desktopFocusChains.constEnd()) { - return NULL; + return nullptr; } const auto &chain = it.value(); for (int i = chain.size() - 1; i >= 0; --i) { @@ -232,7 +232,7 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt return client; } } - return NULL; + return nullptr; } void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain) diff --git a/geometry.cpp b/geometry.cpp index ab6cceb852..7164e6b4f8 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -894,7 +894,7 @@ void Workspace::setMoveResizeClient(AbstractClient *c) // (the property with the size of the frame remains on the window after the crash). void Workspace::fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geometry) { - NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, 0); + NETWinInfo i(connection(), w, rootWindow(), NET::WMFrameExtents, nullptr); NETStrut frame = i.frameExtents(); if (frame.left != 0 || frame.top != 0) { @@ -2511,7 +2511,7 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co return total; } -static GeometryTip* geometryTip = 0; +static GeometryTip* geometryTip = nullptr; void Client::positionGeometryTip() { @@ -2538,10 +2538,10 @@ void Client::positionGeometryTip() bool AbstractClient::startMoveResize() { Q_ASSERT(!isMoveResize()); - Q_ASSERT(QWidget::keyboardGrabber() == NULL); - Q_ASSERT(QWidget::mouseGrabber() == NULL); + Q_ASSERT(QWidget::keyboardGrabber() == nullptr); + Q_ASSERT(QWidget::mouseGrabber() == nullptr); stopDelayedMoveResize(); - if (QApplication::activePopupWidget() != NULL) + if (QApplication::activePopupWidget() != nullptr) return false; // popups have grab if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) return false; @@ -2585,7 +2585,7 @@ bool Client::doStartMoveResize() // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* // (https://lists.kde.org/?t=107302193400001&r=1&w=2) QRect r = workspace()->clientArea(FullArea, this); - m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, NULL, rootWindow()); + m_moveResizeGrabWindow.create(r, XCB_WINDOW_CLASS_INPUT_ONLY, 0, nullptr, rootWindow()); m_moveResizeGrabWindow.map(); m_moveResizeGrabWindow.raise(); updateXTime(); @@ -2593,7 +2593,7 @@ bool Client::doStartMoveResize() XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); - ScopedCPointer pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); + ScopedCPointer pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr)); if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { has_grab = true; } @@ -2666,7 +2666,7 @@ void Client::leaveMoveResize() if (geometryTip) { geometryTip->hide(); delete geometryTip; - geometryTip = NULL; + geometryTip = nullptr; } if (move_resize_has_keyboard_grab) ungrabXKeyboard(); @@ -2676,7 +2676,7 @@ void Client::leaveMoveResize() if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire syncRequest.isPending = false; delete syncRequest.timeout; - syncRequest.timeout = NULL; + syncRequest.timeout = nullptr; AbstractClient::leaveMoveResize(); } diff --git a/geometrytip.cpp b/geometrytip.cpp index 237f3644f3..0395213644 100644 --- a/geometrytip.cpp +++ b/geometrytip.cpp @@ -24,7 +24,7 @@ namespace KWin { GeometryTip::GeometryTip(const Xcb::GeometryHints* xSizeHints): - QLabel(0) + QLabel(nullptr) { setObjectName(QLatin1String("kwingeometry")); setMargin(1); diff --git a/group.cpp b/group.cpp index 0fea1fdbb8..44d3821c8e 100644 --- a/group.cpp +++ b/group.cpp @@ -51,16 +51,16 @@ namespace KWin //******************************************** Group::Group(xcb_window_t leader_P) - : leader_client(NULL), + : leader_client(nullptr), leader_wid(leader_P), - leader_info(NULL), + leader_info(nullptr), user_time(-1U), refcount(0) { if (leader_P != XCB_WINDOW_NONE) { leader_client = workspace()->findClient(Predicate::WindowMatch, leader_P); leader_info = new NETWinInfo(connection(), leader_P, rootWindow(), - 0, NET::WM2StartupId); + nullptr, NET::WM2StartupId); } effect_group = new EffectWindowGroupImpl(this); workspace()->addGroup(this); @@ -74,7 +74,7 @@ Group::~Group() QIcon Group::icon() const { - if (leader_client != NULL) + if (leader_client != nullptr) return leader_client->icon(); else if (leader_wid != XCB_WINDOW_NONE) { QIcon ic; @@ -140,7 +140,7 @@ void Group::gotLeader(Client* leader_P) void Group::lostLeader() { Q_ASSERT(!_members.contains(leader_client)); - leader_client = NULL; + leader_client = nullptr; if (_members.isEmpty()) { workspace()->removeGroup(this); delete this; @@ -159,21 +159,21 @@ Group* Workspace::findGroup(xcb_window_t leader) const ++it) if ((*it)->leader() == leader) return *it; - return NULL; + return nullptr; } // Client is group transient, but has no group set. Try to find // group with windows with the same client leader. Group* Workspace::findClientLeaderGroup(const Client* c) const { - Group* ret = NULL; + Group* ret = nullptr; for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it) { if (*it == c) continue; if ((*it)->wmClientLeader() == c->wmClientLeader()) { - if (ret == NULL || ret == (*it)->group()) + if (ret == nullptr || ret == (*it)->group()) ret = (*it)->group(); else { // There are already two groups with the same client leader. @@ -436,11 +436,11 @@ 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); - Q_ASSERT(transient_for != NULL); // verifyTransient() had to check this + Q_ASSERT(transient_for != nullptr); // verifyTransient() had to check this transient_for->addTransient(this); } // checkGroup() will check 'check_active_modal' setTransientFor(transient_for); - checkGroup(NULL, true); // force, because transiency has changed + checkGroup(nullptr, true); // force, because transiency has changed workspace()->updateClientLayer(this); workspace()->resetUpdateToolWindowsTimer(); emit transientChanged(); @@ -513,7 +513,7 @@ void Client::cleanGrouping() // added 'this' to those transient lists :( ClientList group_members = group()->members(); group()->removeMember(this); - in_group = NULL; + in_group = nullptr; for (ClientList::ConstIterator it = group_members.constBegin(); it != group_members.constEnd(); ++it) @@ -544,7 +544,7 @@ void Client::checkGroupTransients() if (*it1 == *it2) continue; for (AbstractClient* cl = (*it2)->transientFor(); - cl != NULL; + cl != nullptr; cl = cl->transientFor()) { if (cl == *it1) { // don't use removeTransient(), that would modify *it2 too @@ -628,7 +628,7 @@ xcb_window_t Client::verifyTransientFor(xcb_window_t new_transient_for, bool set xcb_window_t loop_pos = new_transient_for; while (loop_pos != XCB_WINDOW_NONE && loop_pos != rootWindow()) { Client* pos = workspace()->findClient(Predicate::WindowMatch, loop_pos); - if (pos == NULL) + if (pos == nullptr) break; loop_pos = pos->m_transientForId; if (--count == 0 || pos == this) { @@ -637,7 +637,7 @@ xcb_window_t Client::verifyTransientFor(xcb_window_t new_transient_for, bool set } } if (new_transient_for != rootWindow() - && workspace()->findClient(Predicate::WindowMatch, new_transient_for) == NULL) { + && workspace()->findClient(Predicate::WindowMatch, new_transient_for) == nullptr) { // it's transient for a specific window, but that window is not mapped new_transient_for = rootWindow(); } @@ -759,7 +759,7 @@ AbstractClient* Client::findModal(bool allow_itself) return ret; if (isModal() && allow_itself) return this; - return NULL; + return nullptr; } // Client::window_group only holds the contents of the hint, @@ -768,11 +768,11 @@ AbstractClient* Client::findModal(bool allow_itself) void Client::checkGroup(Group* set_group, bool force) { Group* old_group = in_group; - if (old_group != NULL) + if (old_group != nullptr) old_group->ref(); // turn off automatic deleting - if (set_group != NULL) { + if (set_group != nullptr) { if (set_group != in_group) { - if (in_group != NULL) + if (in_group != nullptr) in_group->removeMember(this); in_group = set_group; in_group->addMember(this); @@ -780,15 +780,15 @@ void Client::checkGroup(Group* set_group, bool force) } else if (info->groupLeader() != XCB_WINDOW_NONE) { Group* new_group = workspace()->findGroup(info->groupLeader()); Client *t = qobject_cast(transientFor()); - if (t != NULL && t->group() != new_group) { + if (t != nullptr && t->group() != new_group) { // move the window to the right group (e.g. a dialog provided // by different app, but transient for this one, so make it part of that group) new_group = t->group(); } - if (new_group == NULL) // doesn't exist yet + if (new_group == nullptr) // doesn't exist yet new_group = new Group(info->groupLeader()); if (new_group != in_group) { - if (in_group != NULL) + if (in_group != nullptr) in_group->removeMember(this); in_group = new_group; in_group->addMember(this); @@ -799,7 +799,7 @@ void Client::checkGroup(Group* set_group, bool force) // so make it part of that group Group* new_group = t->group(); if (new_group != in_group) { - if (in_group != NULL) + if (in_group != nullptr) in_group->removeMember(this); in_group = t->group(); in_group->addMember(this); @@ -808,10 +808,10 @@ void Client::checkGroup(Group* set_group, bool force) // group transient which actually doesn't have a group :( // try creating group with other windows with the same client leader Group* new_group = workspace()->findClientLeaderGroup(this); - if (new_group == NULL) + if (new_group == nullptr) new_group = new Group(XCB_WINDOW_NONE); if (new_group != in_group) { - if (in_group != NULL) + if (in_group != nullptr) in_group->removeMember(this); in_group = new_group; in_group->addMember(this); @@ -821,11 +821,11 @@ void Client::checkGroup(Group* set_group, bool force) // or minimizing together the whole group, but as long as it is used // only for dialogs it's better to keep windows from one app in one group. Group* new_group = workspace()->findClientLeaderGroup(this); - if (in_group != NULL && in_group != new_group) { + if (in_group != nullptr && in_group != new_group) { in_group->removeMember(this); - in_group = NULL; + in_group = nullptr; } - if (new_group == NULL) + if (new_group == nullptr) new_group = new Group(XCB_WINDOW_NONE); if (in_group != new_group) { in_group = new_group; @@ -847,7 +847,7 @@ void Client::checkGroup(Group* set_group, bool force) } if (groupTransient()) { // no longer transient for ones in the old group - if (old_group != NULL) { + if (old_group != nullptr) { for (ClientList::ConstIterator it = old_group->members().constBegin(); it != old_group->members().constEnd(); ++it) @@ -876,7 +876,7 @@ void Client::checkGroup(Group* set_group, bool force) addTransient(*it); } } - if (old_group != NULL) + if (old_group != nullptr) old_group->deref(); // can be now deleted if empty checkGroupTransients(); checkActiveModal(); @@ -887,7 +887,7 @@ void Client::checkGroup(Group* set_group, bool force) void Client::changeClientLeaderGroup(Group* gr) { // transientFor() != NULL are in the group of their mainwindow, so keep them there - if (transientFor() != NULL) + if (transientFor() != nullptr) return; // also don't change the group for window which have group set if (info->groupLeader()) @@ -903,9 +903,9 @@ void Client::checkActiveModal() // cannot be done in AddTransient(), because there may temporarily // exist loops, breaking findModal Client* check_modal = dynamic_cast(workspace()->mostRecentlyActivatedClient()); - if (check_modal != NULL && check_modal->check_active_modal) { + if (check_modal != nullptr && check_modal->check_active_modal) { Client* new_modal = dynamic_cast(check_modal->findModal()); - if (new_modal != NULL && new_modal != check_modal) { + if (new_modal != nullptr && new_modal != check_modal) { if (!new_modal->isManaged()) return; // postpone check until end of manage() workspace()->activateClient(new_modal); diff --git a/input.cpp b/input.cpp index 627da7b352..839e24db2b 100644 --- a/input.cpp +++ b/input.cpp @@ -1647,7 +1647,7 @@ InputRedirection::InputRedirection(QObject *parent) InputRedirection::~InputRedirection() { - s_self = NULL; + s_self = nullptr; qDeleteAll(m_filters); qDeleteAll(m_spies); } @@ -2129,7 +2129,7 @@ Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos) const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); const ToplevelList &stacking = Workspace::self()->stackingOrder(); if (stacking.isEmpty()) { - return NULL; + return nullptr; } auto it = stacking.end(); do { @@ -2156,7 +2156,7 @@ Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos) return t; } } while (it != stacking.begin()); - return NULL; + return nullptr; } Qt::KeyboardModifiers InputRedirection::keyboardModifiers() const diff --git a/kcmkwin/kwincompositing/compositing.h b/kcmkwin/kwincompositing/compositing.h index 0439e81b5d..902dd64fea 100644 --- a/kcmkwin/kwincompositing/compositing.h +++ b/kcmkwin/kwincompositing/compositing.h @@ -48,7 +48,7 @@ class Compositing : public QObject Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged) Q_PROPERTY(bool compositingRequired READ compositingRequired CONSTANT) public: - explicit Compositing(QObject *parent = 0); + explicit Compositing(QObject *parent = nullptr); Q_INVOKABLE bool OpenGLIsUnsafe() const; Q_INVOKABLE bool OpenGLIsBroken(); @@ -132,7 +132,7 @@ public: TypeRole = Qt::UserRole +2 }; - explicit CompositingType(QObject *parent = 0); + explicit CompositingType(QObject *parent = nullptr); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &child) const override; diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 81f38ac92a..1412776a5c 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -33,7 +33,7 @@ class KWinCompositingSettings : public KCModule { Q_OBJECT public: - explicit KWinCompositingSettings(QWidget *parent = 0, const QVariantList &args = QVariantList()); + explicit KWinCompositingSettings(QWidget *parent = nullptr, const QVariantList &args = QVariantList()); public Q_SLOTS: void load() override; diff --git a/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h b/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h index 9c19faf5f2..ae0a1c2afd 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h +++ b/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h @@ -34,7 +34,7 @@ class ButtonsModel : public QAbstractListModel { Q_OBJECT public: - explicit ButtonsModel(const QVector< DecorationButtonType > &buttons, QObject *parent = 0); + explicit ButtonsModel(const QVector< DecorationButtonType > &buttons, QObject *parent = nullptr); explicit ButtonsModel(QObject *parent = nullptr); ~ButtonsModel() override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp index d31c4dd3b0..616b88ae2d 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp @@ -78,7 +78,7 @@ void PreviewItem::createDecoration() if (m_bridge.isNull() || m_settings.isNull() || m_decoration) { return; } - Decoration *decoration = m_bridge->createDecoration(0); + Decoration *decoration = m_bridge->createDecoration(nullptr); m_client = m_bridge->lastCreatedClient(); setDecoration(decoration); } diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h b/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h index f206e79ff2..abace01eb3 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h @@ -37,7 +37,7 @@ class BorderSizesModel : public QAbstractListModel { Q_OBJECT public: - explicit BorderSizesModel(QObject *parent = 0); + explicit BorderSizesModel(QObject *parent = nullptr); ~BorderSizesModel() override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; diff --git a/kcmkwin/kwinoptions/mouse.cpp b/kcmkwin/kwinoptions/mouse.cpp index 90ac7faa4f..10626f88b3 100644 --- a/kcmkwin/kwinoptions/mouse.cpp +++ b/kcmkwin/kwinoptions/mouse.cpp @@ -64,7 +64,7 @@ void createMaxButtonPixmaps() { char const * maxButtonXpms[][3 + 13] = { { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", @@ -80,7 +80,7 @@ void createMaxButtonPixmaps() "..............." }, { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", @@ -96,7 +96,7 @@ void createMaxButtonPixmaps() "..............." }, { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", "...............", "...............", diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 1ff550093d..b6029a9e78 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -586,7 +586,7 @@ Rules* RulesWidget::rules() const rules->wmclassmatch = static_cast< Rules::StringMatch >(wmclass_match->currentIndex()); rules->windowrole = role->text().toUtf8(); rules->windowrolematch = static_cast< Rules::StringMatch >(role_match->currentIndex()); - rules->types = 0; + rules->types = nullptr; bool all_types = true; for (int i = 0; i < types->count(); diff --git a/kcmkwin/kwinscreenedges/monitor.h b/kcmkwin/kwinscreenedges/monitor.h index 300305815f..aa50dcd076 100644 --- a/kcmkwin/kwinscreenedges/monitor.h +++ b/kcmkwin/kwinscreenedges/monitor.h @@ -100,7 +100,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent* e) override; void hoverEnterEvent(QGraphicsSceneHoverEvent * e) override; void hoverLeaveEvent(QGraphicsSceneHoverEvent * e) override; - void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) override; + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override; private: Monitor* monitor; Plasma::FrameSvg *button; diff --git a/kcmkwin/kwintabbox/thumbnailitem.cpp b/kcmkwin/kwintabbox/thumbnailitem.cpp index 8c8edb488b..4d8f5762f9 100644 --- a/kcmkwin/kwintabbox/thumbnailitem.cpp +++ b/kcmkwin/kwintabbox/thumbnailitem.cpp @@ -69,7 +69,7 @@ const char *BrightnessSaturationShader::fragmentShader() const const char* const *BrightnessSaturationShader::attributeNames() const { - static char const *const names[] = { "vertex", "texCoord", 0 }; + static char const *const names[] = { "vertex", "texCoord", nullptr }; return names; } diff --git a/layers.cpp b/layers.cpp index fb41bfe9ae..e871819bc9 100644 --- a/layers.cpp +++ b/layers.cpp @@ -265,7 +265,7 @@ AbstractClient* Workspace::topClientOnDesktop(int desktop, int screen, bool unco return c; } } - return 0; + return nullptr; } AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const @@ -286,13 +286,13 @@ AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const return client; } } - return NULL; + return nullptr; } void Workspace::raiseOrLowerClient(AbstractClient *c) { if (!c) return; - AbstractClient* topmost = NULL; + AbstractClient* topmost = nullptr; // TODO Q_ASSERT( block_stacking_updates == 0 ); if (most_recently_raised && stacking_order.contains(most_recently_raised) && most_recently_raised->isShown(true) && c->isOnCurrentDesktop()) @@ -334,7 +334,7 @@ void Workspace::lowerClient(AbstractClient* c, bool nogroup) } if (c == most_recently_raised) - most_recently_raised = 0; + most_recently_raised = nullptr; } void Workspace::lowerClientWithinApplication(AbstractClient* c) @@ -454,7 +454,7 @@ void Workspace::restack(AbstractClient* c, AbstractClient* under, bool force) for (int i = 0; i < unconstrained_stacking_order.size(); ++i) { AbstractClient *other = qobject_cast(unconstrained_stacking_order.at(i)); if (other && other->layer() == c->layer() && AbstractClient::belongToSameApplication(under, other)) { - under = (c == other) ? 0 : other; + under = (c == other) ? nullptr : other; break; } } @@ -514,7 +514,7 @@ ToplevelList Workspace::constrainedStackingOrder() const int screen = (*it)->screen(); Client *c = qobject_cast(*it); - QMap< Group*, Layer >::iterator mLayer = minimum_layer[screen].find(c ? c->group() : NULL); + QMap< Group*, Layer >::iterator mLayer = minimum_layer[screen].find(c ? c->group() : nullptr); if (mLayer != minimum_layer[screen].end()) { // If a window is raised above some other window in the same window group // which is in the ActiveLayer (i.e. it's fulscreened), make sure it stays @@ -778,7 +778,7 @@ void Workspace::updateXStackingOrder() void Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource src, xcb_timestamp_t timestamp, bool send_event) { - Client *other = 0; + Client *other = nullptr; if (detail == XCB_STACK_MODE_OPPOSITE) { other = workspace()->findClient(Predicate::WindowMatch, above); if (!other) { @@ -837,7 +837,7 @@ void Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource sr if (it != begin && (*(it - 1) == other)) other = qobject_cast(*it); else - other = 0; + other = nullptr; } if (other) diff --git a/libkwineffects/kwinglplatform.cpp b/libkwineffects/kwinglplatform.cpp index d3c91b75f7..9c80bc4c3d 100644 --- a/libkwineffects/kwinglplatform.cpp +++ b/libkwineffects/kwinglplatform.cpp @@ -38,7 +38,7 @@ along with this program. If not, see . namespace KWin { -GLPlatform *GLPlatform::s_platform = 0; +GLPlatform *GLPlatform::s_platform = nullptr; static qint64 parseVersionString(const QByteArray &version) { @@ -293,7 +293,7 @@ static ChipClass detectNVidiaClass(const QString &chipset) { QString name = extract(chipset, QStringLiteral("\\bNV[0-9,A-F]{2}\\b")); // NV followed by two hexadecimal digits if (!name.isEmpty()) { - const int id = chipset.midRef(2, -1).toInt(0, 16); // Strip the 'NV' from the id + const int id = chipset.midRef(2, -1).toInt(nullptr, 16); // Strip the 'NV' from the id switch(id & 0xf0) { case 0x00: diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index be0843348a..fcd885128d 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -1968,7 +1968,7 @@ void GLVertexBufferPrivate::reallocateBuffer(size_t size) const size_t minSize = 32768; // Minimum size for streaming buffers const size_t alloc = usage != GL_STATIC_DRAW ? align(qMax(size, minSize), 4096) : size; - glBufferData(GL_ARRAY_BUFFER, alloc, 0, usage); + glBufferData(GL_ARRAY_BUFFER, alloc, nullptr, usage); bufferSize = alloc; } diff --git a/manage.cpp b/manage.cpp index b801fe93bb..31cc30910a 100644 --- a/manage.cpp +++ b/manage.cpp @@ -223,7 +223,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) desk = NET::OnAllDesktops; else if (on_current) desk = VirtualDesktopManager::self()->current(); - else if (maincl != NULL) + else if (maincl != nullptr) desk = maincl->desktop(); if (maincl) @@ -517,7 +517,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) updateAllowedActions(true); // Set initial user time directly - m_userTime = readUserTimeMapTimestamp(asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session); + m_userTime = readUserTimeMapTimestamp(asn_valid ? &asn_id : nullptr, asn_valid ? &asn_data : nullptr, session); group()->updateUserTime(m_userTime); // And do what Client::updateUserTime() does // This should avoid flicker, because real restacking is done @@ -539,7 +539,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) bool allow; if (session) allow = session->active && - (!workspace()->wasUserInteraction() || workspace()->activeClient() == NULL || + (!workspace()->wasUserInteraction() || workspace()->activeClient() == nullptr || workspace()->activeClient()->isDesktop()); else allow = workspace()->allowClientActivation(this, userTime(), false); @@ -606,7 +606,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) if (opacity() == 1.0) { return; } - NETWinInfo info(connection(), frameId(), rootWindow(), 0, 0); + NETWinInfo info(connection(), frameId(), rootWindow(), nullptr, nullptr); info.setOpacity(static_cast(opacity() * 0xffffffff)); } ); diff --git a/netinfo.cpp b/netinfo.cpp index fc40245443..1f09c1818a 100644 --- a/netinfo.cpp +++ b/netinfo.cpp @@ -33,7 +33,7 @@ namespace KWin { extern int screen_number; -RootInfo *RootInfo::s_self = NULL; +RootInfo *RootInfo::s_self = nullptr; RootInfo *RootInfo::create() { @@ -136,7 +136,7 @@ void RootInfo::destroy() } xcb_window_t supportWindow = s_self->supportWindow(); delete s_self; - s_self = NULL; + s_self = nullptr; xcb_destroy_window(connection(), supportWindow); } @@ -176,7 +176,7 @@ void RootInfo::changeActiveWindow(xcb_window_t w, NET::RequestSource src, xcb_ti workspace->activateClient(c); // if activation of the requestor's window would be allowed, allow activation too else if (active_window != XCB_WINDOW_NONE - && (c2 = workspace->findClient(Predicate::WindowMatch, active_window)) != NULL + && (c2 = workspace->findClient(Predicate::WindowMatch, active_window)) != nullptr && workspace->allowClientActivation(c2, timestampCompare(timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()), false, true)) { workspace->activateClient(c); @@ -299,7 +299,7 @@ void WinInfo::changeState(NET::States state, NET::States mask) void WinInfo::disable() { - m_client = NULL; // only used when the object is passed to Deleted + m_client = nullptr; // only used when the object is passed to Deleted } } // namespace diff --git a/options.h b/options.h index 7f0996eed5..8d92f09a83 100644 --- a/options.h +++ b/options.h @@ -184,7 +184,7 @@ class KWIN_EXPORT Options : public QObject Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged) public: - explicit Options(QObject *parent = NULL); + explicit Options(QObject *parent = nullptr); ~Options() override; void updateSettings(); diff --git a/placement.cpp b/placement.cpp index fb40c20f77..d617046131 100644 --- a/placement.cpp +++ b/placement.cpp @@ -48,7 +48,7 @@ Placement::Placement(QObject*) Placement::~Placement() { - s_self = NULL; + s_self = nullptr; } /** @@ -562,7 +562,7 @@ void Placement::placeOnMainWindow(AbstractClient *c, const QRect &area, Policy n ++mains_count; place_on2 = *it; if ((*it)->isOnCurrentDesktop()) { - if (place_on == NULL) + if (place_on == nullptr) place_on = *it; else { // two or more on current desktop -> center @@ -576,7 +576,7 @@ void Placement::placeOnMainWindow(AbstractClient *c, const QRect &area, Policy n } } } - if (place_on == NULL) { + if (place_on == nullptr) { // 'mains_count' is used because it doesn't include ignored mainwindows if (mains_count != 1) { place(c, area, Centered); diff --git a/platformsupport/scenes/opengl/backend.cpp b/platformsupport/scenes/opengl/backend.cpp index 5e6c3e6260..45b6fbd30a 100644 --- a/platformsupport/scenes/opengl/backend.cpp +++ b/platformsupport/scenes/opengl/backend.cpp @@ -82,7 +82,7 @@ QRegion OpenGLBackend::accumulatedDamageHistory(int bufferAge) const OverlayWindow* OpenGLBackend::overlayWindow() const { - return NULL; + return nullptr; } QRegion OpenGLBackend::prepareRenderingForScreen(int screenId) diff --git a/platformsupport/scenes/opengl/linux_dmabuf.cpp b/platformsupport/scenes/opengl/linux_dmabuf.cpp index c9dd2de334..56941e9b58 100644 --- a/platformsupport/scenes/opengl/linux_dmabuf.cpp +++ b/platformsupport/scenes/opengl/linux_dmabuf.cpp @@ -461,7 +461,7 @@ void LinuxDmabuf::setSupportedFormatsAndModifiers() { const EGLDisplay eglDisplay = m_backend->eglDisplay(); EGLint count = 0; - EGLBoolean success = eglQueryDmaBufFormatsEXT(eglDisplay, 0, NULL, &count); + EGLBoolean success = eglQueryDmaBufFormatsEXT(eglDisplay, 0, nullptr, &count); if (!success || count == 0) { return; @@ -479,13 +479,13 @@ void LinuxDmabuf::setSupportedFormatsAndModifiers() for (auto format : qAsConst(formats)) { if (eglQueryDmaBufModifiersEXT != nullptr) { count = 0; - success = eglQueryDmaBufModifiersEXT(eglDisplay, format, 0, NULL, NULL, &count); + success = eglQueryDmaBufModifiersEXT(eglDisplay, format, 0, nullptr, nullptr, &count); if (success && count > 0) { QVector modifiers(count); if (eglQueryDmaBufModifiersEXT(eglDisplay, format, count, modifiers.data(), - NULL, &count)) { + nullptr, &count)) { QSet modifiersSet; for (auto mod : qAsConst(modifiers)) { modifiersSet.insert(mod); diff --git a/plugins/idletime/poller.h b/plugins/idletime/poller.h index 62e6e88ae5..7b51275f32 100644 --- a/plugins/idletime/poller.h +++ b/plugins/idletime/poller.h @@ -41,7 +41,7 @@ class Poller : public AbstractSystemPoller Q_INTERFACES(AbstractSystemPoller) public: - Poller(QObject *parent = 0); + Poller(QObject *parent = nullptr); ~Poller() override; bool isAvailable() override; diff --git a/plugins/kglobalaccel/kglobalaccel_plugin.h b/plugins/kglobalaccel/kglobalaccel_plugin.h index 2b72b6d3e2..ac594e6bd2 100644 --- a/plugins/kglobalaccel/kglobalaccel_plugin.h +++ b/plugins/kglobalaccel/kglobalaccel_plugin.h @@ -31,7 +31,7 @@ class KGlobalAccelImpl : public KGlobalAccelInterface Q_INTERFACES(KGlobalAccelInterface) public: - KGlobalAccelImpl(QObject *parent = 0); + KGlobalAccelImpl(QObject *parent = nullptr); ~KGlobalAccelImpl() override; bool grabKey(int key, bool grab) override; diff --git a/plugins/platforms/wayland/wayland_backend.cpp b/plugins/platforms/wayland/wayland_backend.cpp index 0b10029d0e..e0e3b6f399 100644 --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -209,10 +209,10 @@ void WaylandSubSurfaceCursor::move(const QPointF &globalPosition) } WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend) - : QObject(NULL) + : QObject(nullptr) , m_seat(new Seat(this)) - , m_pointer(NULL) - , m_keyboard(NULL) + , m_pointer(nullptr) + , m_keyboard(nullptr) , m_touch(nullptr) , m_enteredSerial(0) , m_backend(backend) diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp index d2bbc666a9..1ae6ccd9ae 100644 --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -107,7 +107,7 @@ GlxBackend::GlxBackend(Display *display) : OpenGLBackend() , m_overlayWindow(kwinApp()->platform()->createOverlayWindow()) , window(None) - , fbconfig(NULL) + , fbconfig(nullptr) , glxWindow(None) , ctx(nullptr) , m_bufferAge(0) @@ -270,7 +270,7 @@ void GlxBackend::init() // VirtualBox does not support glxQueryDrawable // this should actually be in kwinglutils_funcs, but QueryDrawable seems not to be provided by an extension // and the GLPlatform has not been initialized at the moment when initGLX() is called. - glXQueryDrawable = NULL; + glXQueryDrawable = nullptr; } setIsDirectRendering(bool(glXIsDirect(display(), ctx))); @@ -336,7 +336,7 @@ bool GlxBackend::initRenderingContext() } for (auto it = candidates.begin(); it != candidates.end(); it++) { const auto attribs = it->build(); - ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, true, attribs.data()); + ctx = glXCreateContextAttribsARB(display(), fbconfig, nullptr, true, attribs.data()); if (ctx) { qCDebug(KWIN_X11STANDALONE) << "Created GLX context with attributes:" << &(*it); break; @@ -345,7 +345,7 @@ bool GlxBackend::initRenderingContext() } if (!ctx) - ctx = glXCreateNewContext(display(), fbconfig, GLX_RGBA_TYPE, NULL, direct); + ctx = glXCreateNewContext(display(), fbconfig, GLX_RGBA_TYPE, nullptr, direct); if (!ctx) { qCDebug(KWIN_X11STANDALONE) << "Failed to create an OpenGL context."; @@ -355,7 +355,7 @@ bool GlxBackend::initRenderingContext() if (!glXMakeCurrent(display(), glxWindow, ctx)) { qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current."; glXDestroyContext(display(), ctx); - ctx = 0; + ctx = nullptr; return false; } @@ -389,7 +389,7 @@ bool GlxBackend::initBuffer() 0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, visual, XCB_CW_COLORMAP, &colormap); - glxWindow = glXCreateWindow(display(), fbconfig, window, NULL); + glxWindow = glXCreateWindow(display(), fbconfig, window, nullptr); overlayWindow()->setup(window); } else { qCCritical(KWIN_X11STANDALONE) << "Failed to create overlay window"; @@ -884,7 +884,7 @@ void GlxTexture::onDamage() { if (options->isGlStrictBinding() && m_glxpixmap) { glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT); - glXBindTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT, NULL); + glXBindTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT, nullptr); } GLTexturePrivate::onDamage(); } diff --git a/plugins/platforms/x11/standalone/overlaywindow_x11.cpp b/plugins/platforms/x11/standalone/overlaywindow_x11.cpp index 05e70a5396..3bd2281806 100644 --- a/plugins/platforms/x11/standalone/overlaywindow_x11.cpp +++ b/plugins/platforms/x11/standalone/overlaywindow_x11.cpp @@ -88,7 +88,7 @@ void OverlayWindowX11::setup(xcb_window_t window) void OverlayWindowX11::setupInputShape(xcb_window_t window) { - xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, window, 0, 0, 0, NULL); + xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, window, 0, 0, 0, nullptr); } void OverlayWindowX11::setNoneBackgroundPixmap(xcb_window_t window) diff --git a/plugins/platforms/x11/standalone/windowselector.cpp b/plugins/platforms/x11/standalone/windowselector.cpp index 4f7d39e5e8..aa4412e972 100644 --- a/plugins/platforms/x11/standalone/windowselector.cpp +++ b/plugins/platforms/x11/standalone/windowselector.cpp @@ -94,7 +94,7 @@ bool WindowSelector::activate(const QByteArray &cursorName) XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE, - cursor, XCB_TIME_CURRENT_TIME), NULL)); + cursor, XCB_TIME_CURRENT_TIME), nullptr)); if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) { return false; } @@ -241,7 +241,7 @@ void WindowSelector::selectWindowId(xcb_window_t window_to_select) return; } xcb_window_t window = window_to_select; - Client* client = NULL; + Client* client = nullptr; while (true) { client = Workspace::self()->findClient(Predicate::FrameIdMatch, window); if (client) { diff --git a/plugins/scenes/opengl/lanczosfilter.cpp b/plugins/scenes/opengl/lanczosfilter.cpp index f70c2c12a5..6b4cae1003 100644 --- a/plugins/scenes/opengl/lanczosfilter.cpp +++ b/plugins/scenes/opengl/lanczosfilter.cpp @@ -45,10 +45,10 @@ namespace KWin LanczosFilter::LanczosFilter(QObject* parent) : QObject(parent) - , m_offscreenTex(0) - , m_offscreenTarget(0) + , m_offscreenTex(nullptr) + , m_offscreenTarget(nullptr) , m_inited(false) - , m_shader(0) + , m_shader(nullptr) , m_uOffsets(0) , m_uKernel(0) { @@ -240,7 +240,7 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, } else { // offscreen texture not matching - delete delete cachedTexture; - cachedTexture = 0; + cachedTexture = nullptr; w->setData(LanczosCacheRole, QVariant()); } } @@ -392,8 +392,8 @@ void LanczosFilter::timerEvent(QTimerEvent *event) delete m_offscreenTarget; delete m_offscreenTex; - m_offscreenTarget = 0; - m_offscreenTex = 0; + m_offscreenTarget = nullptr; + m_offscreenTex = nullptr; foreach (Client *c, Workspace::self()->clientList()) { discardCacheTexture(c->effectWindow()); } diff --git a/plugins/scenes/opengl/lanczosfilter.h b/plugins/scenes/opengl/lanczosfilter.h index bb11a6e1fa..f05872db38 100644 --- a/plugins/scenes/opengl/lanczosfilter.h +++ b/plugins/scenes/opengl/lanczosfilter.h @@ -43,7 +43,7 @@ class LanczosFilter : public QObject Q_OBJECT public: - explicit LanczosFilter(QObject* parent = 0); + explicit LanczosFilter(QObject* parent = nullptr); ~LanczosFilter() override; void performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index e7460375b1..b253ee9c9d 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -494,15 +494,15 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent) } if (backend->isFailed()) { delete backend; - return NULL; + return nullptr; } - SceneOpenGL *scene = NULL; + SceneOpenGL *scene = nullptr; // first let's try an OpenGL 2 scene if (SceneOpenGL2::supported(backend)) { scene = new SceneOpenGL2(backend, parent); if (scene->initFailed()) { delete scene; - scene = NULL; + scene = nullptr; } else { return scene; } @@ -918,7 +918,7 @@ bool SceneOpenGL2::supported(OpenGLBackend *backend) SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent) : SceneOpenGL(backend, parent) - , m_lanczosFilter(NULL) + , m_lanczosFilter(nullptr) { if (!init_ok) { // base ctor already failed @@ -1027,7 +1027,7 @@ void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices) GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); vbo->setUseColor(true); - vbo->setData(vertices.count() / 2, 2, vertices.data(), NULL); + vbo->setData(vertices.count() / 2, 2, vertices.data(), nullptr); ShaderBinder binder(ShaderTrait::UniformColor); binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, m_projectionMatrix); @@ -1060,7 +1060,7 @@ void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion reg connect(screens(), &Screens::changed, this, [this]() { makeOpenGLContextCurrent(); delete m_lanczosFilter; - m_lanczosFilter = NULL; + m_lanczosFilter = nullptr; }); } m_lanczosFilter->performPaint(w, mask, region, data); @@ -1074,7 +1074,7 @@ void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion reg SceneOpenGL::Window::Window(Toplevel* c) : Scene::Window(c) - , m_scene(NULL) + , m_scene(nullptr) { } @@ -1082,11 +1082,11 @@ SceneOpenGL::Window::~Window() { } -static SceneOpenGLTexture *s_frameTexture = NULL; +static SceneOpenGLTexture *s_frameTexture = nullptr; // Bind the window pixmap to an OpenGL texture. bool SceneOpenGL::Window::bindTexture() { - s_frameTexture = NULL; + s_frameTexture = nullptr; OpenGLWindowPixmap *pixmap = windowPixmap(); if (!pixmap) { return false; @@ -1293,7 +1293,7 @@ void SceneOpenGL2Window::setupLeafNodes(LeafNode *nodes, const WindowQuadList *q if (data.crossFadeProgress() != 1.0) { OpenGLWindowPixmap *previous = previousWindowPixmap(); - nodes[PreviousContentLeaf].texture = previous ? previous->texture() : NULL; + nodes[PreviousContentLeaf].texture = previous ? previous->texture() : nullptr; nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; @@ -1596,19 +1596,19 @@ bool OpenGLWindowPixmap::isValid() const // SceneOpenGL::EffectFrame //**************************************** -GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; -QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; +GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = nullptr; +QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = nullptr; SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) : Scene::EffectFrame(frame) - , m_texture(NULL) - , m_textTexture(NULL) - , m_oldTextTexture(NULL) - , m_textPixmap(NULL) - , m_iconTexture(NULL) - , m_oldIconTexture(NULL) - , m_selectionTexture(NULL) - , m_unstyledVBO(NULL) + , m_texture(nullptr) + , m_textTexture(nullptr) + , m_oldTextTexture(nullptr) + , m_textPixmap(nullptr) + , m_iconTexture(nullptr) + , m_oldIconTexture(nullptr) + , m_selectionTexture(nullptr) + , m_unstyledVBO(nullptr) , m_scene(scene) { if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { @@ -1632,55 +1632,55 @@ void SceneOpenGL::EffectFrame::free() { glFlush(); delete m_texture; - m_texture = NULL; + m_texture = nullptr; delete m_textTexture; - m_textTexture = NULL; + m_textTexture = nullptr; delete m_textPixmap; - m_textPixmap = NULL; + m_textPixmap = nullptr; delete m_iconTexture; - m_iconTexture = NULL; + m_iconTexture = nullptr; delete m_selectionTexture; - m_selectionTexture = NULL; + m_selectionTexture = nullptr; delete m_unstyledVBO; - m_unstyledVBO = NULL; + m_unstyledVBO = nullptr; delete m_oldIconTexture; - m_oldIconTexture = NULL; + m_oldIconTexture = nullptr; delete m_oldTextTexture; - m_oldTextTexture = NULL; + m_oldTextTexture = nullptr; } void SceneOpenGL::EffectFrame::freeIconFrame() { delete m_iconTexture; - m_iconTexture = NULL; + m_iconTexture = nullptr; } void SceneOpenGL::EffectFrame::freeTextFrame() { delete m_textTexture; - m_textTexture = NULL; + m_textTexture = nullptr; delete m_textPixmap; - m_textPixmap = NULL; + m_textPixmap = nullptr; } void SceneOpenGL::EffectFrame::freeSelection() { delete m_selectionTexture; - m_selectionTexture = NULL; + m_selectionTexture = nullptr; } void SceneOpenGL::EffectFrame::crossFadeIcon() { delete m_oldIconTexture; m_oldIconTexture = m_iconTexture; - m_iconTexture = NULL; + m_iconTexture = nullptr; } void SceneOpenGL::EffectFrame::crossFadeText() { delete m_oldTextTexture; m_oldTextTexture = m_textTexture; - m_textTexture = NULL; + m_textTexture = nullptr; } void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) @@ -1951,7 +1951,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra void SceneOpenGL::EffectFrame::updateTexture() { delete m_texture; - m_texture = 0L; + m_texture = nullptr; if (m_effectFrame->style() == EffectFrameStyled) { QPixmap pixmap = m_effectFrame->frame().framePixmap(); m_texture = new GLTexture(pixmap); @@ -1961,9 +1961,9 @@ void SceneOpenGL::EffectFrame::updateTexture() void SceneOpenGL::EffectFrame::updateTextTexture() { delete m_textTexture; - m_textTexture = 0L; + m_textTexture = nullptr; delete m_textPixmap; - m_textPixmap = 0L; + m_textPixmap = nullptr; if (m_effectFrame->text().isEmpty()) return; @@ -1996,9 +1996,9 @@ void SceneOpenGL::EffectFrame::updateTextTexture() void SceneOpenGL::EffectFrame::updateUnstyledTexture() { delete m_unstyledTexture; - m_unstyledTexture = 0L; + m_unstyledTexture = nullptr; delete m_unstyledPixmap; - m_unstyledPixmap = 0L; + m_unstyledPixmap = nullptr; // Based off circle() from kwinxrenderutils.cpp #define CS 8 m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); @@ -2016,9 +2016,9 @@ void SceneOpenGL::EffectFrame::updateUnstyledTexture() void SceneOpenGL::EffectFrame::cleanup() { delete m_unstyledTexture; - m_unstyledTexture = NULL; + m_unstyledTexture = nullptr; delete m_unstyledPixmap; - m_unstyledPixmap = NULL; + m_unstyledPixmap = nullptr; } //**************************************** diff --git a/plugins/scenes/opengl/scene_opengl.h b/plugins/scenes/opengl/scene_opengl.h index 3c0d54b871..b2eea05f68 100644 --- a/plugins/scenes/opengl/scene_opengl.h +++ b/plugins/scenes/opengl/scene_opengl.h @@ -183,7 +183,7 @@ public: struct LeafNode { LeafNode() - : texture(0), + : texture(nullptr), firstVertex(0), vertexCount(0), opacity(1.0), diff --git a/plugins/scenes/qpainter/scene_qpainter.cpp b/plugins/scenes/qpainter/scene_qpainter.cpp index bf462071e6..0fffdfc39b 100644 --- a/plugins/scenes/qpainter/scene_qpainter.cpp +++ b/plugins/scenes/qpainter/scene_qpainter.cpp @@ -53,7 +53,7 @@ SceneQPainter *SceneQPainter::createScene(QObject *parent) return nullptr; } if (backend->isFailed()) { - return NULL; + return nullptr; } return new SceneQPainter(backend.take(), parent); } diff --git a/plugins/scenes/xrender/scene_xrender.cpp b/plugins/scenes/xrender/scene_xrender.cpp index 24ad72bb2c..633cc0b1eb 100644 --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -80,7 +80,7 @@ XRenderBackend::~XRenderBackend() OverlayWindow* XRenderBackend::overlayWindow() { - return NULL; + return nullptr; } void XRenderBackend::showOverlay() @@ -146,7 +146,7 @@ void X11XRenderBackend::init(bool createOverlay) if (haveOverlay) { m_overlayWindow->setup(XCB_WINDOW_NONE); ScopedCPointer attribs(xcb_get_window_attributes_reply(connection(), - xcb_get_window_attributes_unchecked(connection(), m_overlayWindow->window()), NULL)); + xcb_get_window_attributes_unchecked(connection(), m_overlayWindow->window()), nullptr)); if (!attribs) { setFailed("Failed getting window attributes for overlay window"); return; @@ -157,7 +157,7 @@ void X11XRenderBackend::init(bool createOverlay) return; } m_front = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), m_front, m_overlayWindow->window(), m_format, 0, NULL); + xcb_render_create_picture(connection(), m_front, m_overlayWindow->window(), m_format, 0, nullptr); } else { // create XRender picture for the root window m_format = XRenderUtils::findPictFormat(defaultScreen()->root_visual); @@ -178,7 +178,7 @@ void X11XRenderBackend::createBuffer() const auto displaySize = screens()->displaySize(); xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displaySize.width(), displaySize.height()); xcb_render_picture_t b = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), b, pixmap, m_format, 0, NULL); + xcb_render_create_picture(connection(), b, pixmap, m_format, 0, nullptr); xcb_free_pixmap(connection(), pixmap); // The picture owns the pixmap now setBuffer(b); } @@ -224,7 +224,7 @@ SceneXrender* SceneXrender::createScene(QObject *parent) QScopedPointer backend; backend.reset(new X11XRenderBackend); if (backend->isFailed()) { - return NULL; + return nullptr; } return new SceneXrender(backend.take(), parent); } @@ -312,7 +312,7 @@ Decoration::Renderer *SceneXrender::createDecorationRenderer(Decoration::Decorat // SceneXrender::Window //**************************************** -XRenderPicture *SceneXrender::Window::s_tempPicture = 0; +XRenderPicture *SceneXrender::Window::s_tempPicture = nullptr; QRect SceneXrender::Window::temp_visibleRect; XRenderPicture *SceneXrender::Window::s_fadeAlphaPicture = nullptr; @@ -331,7 +331,7 @@ SceneXrender::Window::~Window() void SceneXrender::Window::cleanup() { delete s_tempPicture; - s_tempPicture = NULL; + s_tempPicture = nullptr; delete s_fadeAlphaPicture; s_fadeAlphaPicture = nullptr; } @@ -392,7 +392,7 @@ void SceneXrender::Window::prepareTempPixmap() temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos()); if (s_tempPicture && (oldSize.width() < temp_visibleRect.width() || oldSize.height() < temp_visibleRect.height())) { delete s_tempPicture; - s_tempPicture = NULL; + s_tempPicture = nullptr; scene_setXRenderOffscreenTarget(0); // invalidate, better crash than cause weird results for developers } if (!s_tempPicture) { @@ -768,7 +768,7 @@ void SceneXrender::Window::setPictureFilter(xcb_render_picture_t pic, Scene::Ima filterName = QByteArray("good"); break; } - xcb_render_set_picture_filter(connection(), pic, filterName.length(), filterName.constData(), 0, NULL); + xcb_render_set_picture_filter(connection(), pic, filterName.length(), filterName.constData(), 0, nullptr); } WindowPixmap* SceneXrender::Window::createWindowPixmap() @@ -810,22 +810,22 @@ void XRenderWindowPixmap::create() return; } m_picture = xcb_generate_id(connection()); - xcb_render_create_picture(connection(), m_picture, pixmap(), m_format, 0, NULL); + xcb_render_create_picture(connection(), m_picture, pixmap(), m_format, 0, nullptr); } //**************************************** // SceneXrender::EffectFrame //**************************************** -XRenderPicture *SceneXrender::EffectFrame::s_effectFrameCircle = NULL; +XRenderPicture *SceneXrender::EffectFrame::s_effectFrameCircle = nullptr; SceneXrender::EffectFrame::EffectFrame(EffectFrameImpl* frame) : Scene::EffectFrame(frame) { - m_picture = NULL; - m_textPicture = NULL; - m_iconPicture = NULL; - m_selectionPicture = NULL; + m_picture = nullptr; + m_textPicture = nullptr; + m_iconPicture = nullptr; + m_selectionPicture = nullptr; } SceneXrender::EffectFrame::~EffectFrame() @@ -839,37 +839,37 @@ SceneXrender::EffectFrame::~EffectFrame() void SceneXrender::EffectFrame::cleanup() { delete s_effectFrameCircle; - s_effectFrameCircle = NULL; + s_effectFrameCircle = nullptr; } void SceneXrender::EffectFrame::free() { delete m_picture; - m_picture = NULL; + m_picture = nullptr; delete m_textPicture; - m_textPicture = NULL; + m_textPicture = nullptr; delete m_iconPicture; - m_iconPicture = NULL; + m_iconPicture = nullptr; delete m_selectionPicture; - m_selectionPicture = NULL; + m_selectionPicture = nullptr; } void SceneXrender::EffectFrame::freeIconFrame() { delete m_iconPicture; - m_iconPicture = NULL; + m_iconPicture = nullptr; } void SceneXrender::EffectFrame::freeTextFrame() { delete m_textPicture; - m_textPicture = NULL; + m_textPicture = nullptr; } void SceneXrender::EffectFrame::freeSelection() { delete m_selectionPicture; - m_selectionPicture = NULL; + m_selectionPicture = nullptr; } void SceneXrender::EffectFrame::crossFadeIcon() @@ -1038,7 +1038,7 @@ xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *s_effectFrameCircle void SceneXrender::EffectFrame::updatePicture() { delete m_picture; - m_picture = 0L; + m_picture = nullptr; if (m_effectFrame->style() == EffectFrameStyled) { const QPixmap pix = m_effectFrame->frame().framePixmap(); if (!pix.isNull()) @@ -1050,7 +1050,7 @@ void SceneXrender::EffectFrame::updateTextPicture() { // Mostly copied from SceneOpenGL::EffectFrame::updateTextTexture() above delete m_textPicture; - m_textPicture = 0L; + m_textPicture = nullptr; if (m_effectFrame->text().isEmpty()) { return; @@ -1088,7 +1088,7 @@ SceneXRenderShadow::SceneXRenderShadow(Toplevel *toplevel) :Shadow(toplevel) { for (int i=0; idesktop(), desktopMask, clippingRegion, data); - s_recursionCheck = NULL; + s_recursionCheck = nullptr; } } @@ -690,13 +690,13 @@ QVector Scene::openGLPlatformInterfaceExtensions() const Scene::Window::Window(Toplevel * c) : toplevel(c) , filter(ImageFilterFast) - , m_shadow(NULL) + , m_shadow(nullptr) , m_currentPixmap() , m_previousPixmap() , m_referencePixmapCounter(0) , disable_painting(0) , shape_valid(false) - , cached_quad_list(NULL) + , cached_quad_list(nullptr) { } @@ -841,7 +841,7 @@ void Scene::Window::disablePainting(int reason) WindowQuadList Scene::Window::buildQuads(bool force) const { - if (cached_quad_list != NULL && !force) + if (cached_quad_list != nullptr && !force) return *cached_quad_list; WindowQuadList ret; qreal scale = 1.0; diff --git a/screenedge.cpp b/screenedge.cpp index dce70ab81e..4dd6adf501 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -716,7 +716,7 @@ ScreenEdges::ScreenEdges(QObject *parent) , m_desktopSwitchingMovingClients(false) , m_timeThreshold(0) , m_reactivateThreshold(0) - , m_virtualDesktopLayout(0) + , m_virtualDesktopLayout(nullptr) , m_actionTopLeft(ElectricActionNone) , m_actionTop(ElectricActionNone) , m_actionTopRight(ElectricActionNone) @@ -735,7 +735,7 @@ ScreenEdges::ScreenEdges(QObject *parent) ScreenEdges::~ScreenEdges() { - s_self = NULL; + s_self = nullptr; } void ScreenEdges::init() @@ -880,7 +880,7 @@ void ScreenEdges::setActionForTouchBorder(ElectricBorder border, ElectricBorderA void ScreenEdges::updateLayout() { const QSize desktopMatrix = VirtualDesktopManager::self()->grid().size(); - Qt::Orientations newLayout = 0; + Qt::Orientations newLayout = nullptr; if (desktopMatrix.width() > 1) { newLayout |= Qt::Horizontal; } diff --git a/screens.cpp b/screens.cpp index e0cbb9d613..7b4e40415b 100644 --- a/screens.cpp +++ b/screens.cpp @@ -74,7 +74,7 @@ Screens::Screens(QObject *parent) Screens::~Screens() { - s_self = NULL; + s_self = nullptr; } void Screens::init() diff --git a/scripting/dbuscall.h b/scripting/dbuscall.h index 7b9391251b..53135ec086 100644 --- a/scripting/dbuscall.h +++ b/scripting/dbuscall.h @@ -81,7 +81,7 @@ class DBusCall : public QObject Q_PROPERTY(QString method READ method WRITE setMethod NOTIFY methodChanged) Q_PROPERTY(QVariantList arguments READ arguments WRITE setArguments NOTIFY argumentsChanged) public: - explicit DBusCall(QObject* parent = 0); + explicit DBusCall(QObject* parent = nullptr); ~DBusCall() override; const QString &service() const; diff --git a/scripting/screenedgeitem.h b/scripting/screenedgeitem.h index c5e10e85bb..64bbf16c33 100644 --- a/scripting/screenedgeitem.h +++ b/scripting/screenedgeitem.h @@ -80,7 +80,7 @@ public: Pointer, Touch }; - explicit ScreenEdgeItem(QObject *parent = 0); + explicit ScreenEdgeItem(QObject *parent = nullptr); ~ScreenEdgeItem() override; bool isEnabled() const; Edge edge() const; diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index be48d6e9de..a9844e7bc0 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -357,7 +357,7 @@ QList QtScriptWorkspaceWrapper::clientList() const QQmlListProperty DeclarativeScriptWorkspaceWrapper::clients() { - return QQmlListProperty(this, 0, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList); + return QQmlListProperty(this, nullptr, &DeclarativeScriptWorkspaceWrapper::countClientList, &DeclarativeScriptWorkspaceWrapper::atClientList); } int DeclarativeScriptWorkspaceWrapper::countClientList(QQmlListProperty *clients) diff --git a/shadow.cpp b/shadow.cpp index 1699b837af..ad53ca5ca5 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -51,7 +51,7 @@ Shadow::~Shadow() Shadow *Shadow::createShadow(Toplevel *toplevel) { if (!effects) { - return NULL; + return nullptr; } Shadow *shadow = createShadowFromDecoration(toplevel); if (!shadow && waylandServer()) { @@ -78,11 +78,11 @@ Shadow *Shadow::createShadowFromX11(Toplevel *toplevel) if (!shadow->init(data)) { delete shadow; - return NULL; + return nullptr; } return shadow; } else { - return NULL; + return nullptr; } } diff --git a/sm.cpp b/sm.cpp index 192ff33110..3cd48060d0 100644 --- a/sm.cpp +++ b/sm.cpp @@ -68,7 +68,7 @@ static const char* windowTypeToTxt(NET::WindowType type) if (type == -2) // undefined (not really part of NET::WindowType) return "Undefined"; qFatal("Unknown Window Type"); - return NULL; + return nullptr; } static NET::WindowType txtToWindowType(const char* txt) @@ -314,7 +314,7 @@ static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info) */ SessionInfo* Workspace::takeSessionInfo(Client* c) { - SessionInfo *realInfo = 0; + SessionInfo *realInfo = nullptr; QByteArray sessionId = c->sessionId(); QByteArray windowRole = c->windowRole(); QByteArray wmCommand = c->wmCommand(); @@ -430,14 +430,14 @@ SessionSaveDoneHelper::SessionSaveDoneHelper() calls.save_complete.client_data = reinterpret_cast< SmPointer >(this); calls.shutdown_cancelled.callback = shutdown_cancelled; calls.shutdown_cancelled.client_data = reinterpret_cast< SmPointer >(this); - char* id = NULL; + char* id = nullptr; char err[ 11 ]; - conn = SmcOpenConnection(NULL, 0, 1, 0, + conn = SmcOpenConnection(nullptr, nullptr, 1, 0, SmcSaveYourselfProcMask | SmcDieProcMask | SmcSaveCompleteProcMask - | SmcShutdownCancelledProcMask, &calls, NULL, &id, 10, err); - if (id != NULL) + | SmcShutdownCancelledProcMask, &calls, nullptr, &id, 10, err); + if (id != nullptr) free(id); - if (conn == NULL) + if (conn == nullptr) return; // no SM // detect ksmserver @@ -456,8 +456,8 @@ SessionSaveDoneHelper::SessionSaveDoneHelper() props[ 0 ].num_vals = 1; props[ 0 ].vals = &propvalue[ 0 ]; struct passwd* entry = getpwuid(geteuid()); - propvalue[ 1 ].length = entry != NULL ? strlen(entry->pw_name) : 0; - propvalue[ 1 ].value = (SmPointer)(entry != NULL ? entry->pw_name : ""); + propvalue[ 1 ].length = entry != nullptr ? strlen(entry->pw_name) : 0; + propvalue[ 1 ].value = (SmPointer)(entry != nullptr ? entry->pw_name : ""); props[ 1 ].name = const_cast< char* >(SmUserID); props[ 1 ].type = const_cast< char* >(SmARRAY8); props[ 1 ].num_vals = 1; @@ -494,17 +494,17 @@ SessionSaveDoneHelper::~SessionSaveDoneHelper() void SessionSaveDoneHelper::close() { - if (conn != NULL) { + if (conn != nullptr) { delete notifier; - SmcCloseConnection(conn, 0, NULL); + SmcCloseConnection(conn, 0, nullptr); } - conn = NULL; + conn = nullptr; } void SessionSaveDoneHelper::processData() { - if (conn != NULL) - IceProcessMessages(SmcGetIceConnection(conn), 0, 0); + if (conn != nullptr) + IceProcessMessages(SmcGetIceConnection(conn), nullptr, nullptr); } void Workspace::sessionSaveDone() diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 1175eb0bf7..9736ee21b5 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -1475,7 +1475,7 @@ AbstractClient* TabBox::nextClientStatic(AbstractClient* c) const { const auto &list = Workspace::self()->allClientList(); if (!c || list.isEmpty()) - return 0; + return nullptr; int pos = list.indexOf(c); if (pos == -1) return list.first(); @@ -1493,7 +1493,7 @@ AbstractClient* TabBox::previousClientStatic(AbstractClient* c) const { const auto &list = Workspace::self()->allClientList(); if (!c || list.isEmpty()) - return 0; + return nullptr; int pos = list.indexOf(c); if (pos == -1) return list.last(); diff --git a/tests/pointerconstraintstest.cpp b/tests/pointerconstraintstest.cpp index 8334d3b1a7..66722fda59 100644 --- a/tests/pointerconstraintstest.cpp +++ b/tests/pointerconstraintstest.cpp @@ -260,7 +260,7 @@ XBackend::XBackend(QObject *parent) void XBackend::init(QQuickView *view) { Backend::init(view); - m_xcbConn = xcb_connect(NULL, NULL); + m_xcbConn = xcb_connect(nullptr, nullptr); if (!m_xcbConn) { qDebug() << "Could not open XCB connection."; } diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index b3cf84cadb..662512a859 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -121,8 +121,8 @@ void AbstractThumbnailItem::setClipTo(QQuickItem *clip) WindowThumbnailItem::WindowThumbnailItem(QQuickItem* parent) : AbstractThumbnailItem(parent) - , m_wId(0) - , m_client(NULL) + , m_wId(nullptr) + , m_client(nullptr) { } @@ -136,10 +136,10 @@ void WindowThumbnailItem::setWId(const QUuid &wId) return; } m_wId = wId; - if (m_wId != 0) { + if (m_wId != nullptr) { setClient(workspace()->findAbstractClient([this] (const AbstractClient *c) { return c->internalId() == m_wId; })); } else if (m_client) { - m_client = NULL; + m_client = nullptr; emit clientChanged(); } emit wIdChanged(wId); diff --git a/thumbnailitem.h b/thumbnailitem.h index 2c2cc065a8..4c23d7a1ab 100644 --- a/thumbnailitem.h +++ b/thumbnailitem.h @@ -56,7 +56,7 @@ Q_SIGNALS: void clipToChanged(); protected: - explicit AbstractThumbnailItem(QQuickItem *parent = 0); + explicit AbstractThumbnailItem(QQuickItem *parent = nullptr); protected Q_SLOTS: virtual void repaint(KWin::EffectWindow* w) = 0; @@ -80,7 +80,7 @@ class WindowThumbnailItem : public AbstractThumbnailItem Q_PROPERTY(QUuid wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) Q_PROPERTY(KWin::AbstractClient *client READ client WRITE setClient NOTIFY clientChanged) public: - explicit WindowThumbnailItem(QQuickItem *parent = 0); + explicit WindowThumbnailItem(QQuickItem *parent = nullptr); ~WindowThumbnailItem() override; QUuid wId() const { @@ -105,7 +105,7 @@ class DesktopThumbnailItem : public AbstractThumbnailItem Q_OBJECT Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) public: - DesktopThumbnailItem(QQuickItem *parent = 0); + DesktopThumbnailItem(QQuickItem *parent = nullptr); ~DesktopThumbnailItem() override; int desktop() const { diff --git a/toplevel.cpp b/toplevel.cpp index ec23d754f8..88cee2fb76 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -42,14 +42,14 @@ namespace KWin Toplevel::Toplevel() : m_visual(XCB_NONE) , bit_depth(24) - , info(NULL) + , info(nullptr) , ready_for_painting(true) , m_isDamaged(false) , m_internalId(QUuid::createUuid()) , m_client() , damage_handle(XCB_NONE) , is_shape(false) - , effect_window(NULL) + , effect_window(nullptr) , m_clientMachine(new ClientMachine(this)) , m_wmClientLeader(XCB_WINDOW_NONE) , m_damageReplyPending(false) @@ -70,7 +70,7 @@ Toplevel::~Toplevel() QDebug& operator<<(QDebug& stream, const Toplevel* cl) { - if (cl == NULL) + if (cl == nullptr) return stream << "\'NULL\'"; cl->debug(stream); return stream; @@ -122,7 +122,7 @@ void Toplevel::copyToDeleted(Toplevel* c) layer_repaints_region = c->layer_repaints_region; is_shape = c->is_shape; effect_window = c->effect_window; - if (effect_window != NULL) + if (effect_window != nullptr) effect_window->setWindow(this); resource_name = c->resourceName(); resource_class = c->resourceClass(); @@ -139,7 +139,7 @@ void Toplevel::copyToDeleted(Toplevel* c) // owner by Deleted void Toplevel::disownDataPassedToDeleted() { - info = NULL; + info = nullptr; } QRect Toplevel::visibleRect() const @@ -298,13 +298,13 @@ void Toplevel::finishCompositing(ReleaseReason releaseReason) damage_handle = XCB_NONE; damage_region = QRegion(); repaints_region = QRegion(); - effect_window = NULL; + effect_window = nullptr; } void Toplevel::discardWindowPixmap() { addDamageFull(); - if (effectWindow() != NULL && effectWindow()->sceneWindow() != NULL) + if (effectWindow() != nullptr && effectWindow()->sceneWindow() != nullptr) effectWindow()->sceneWindow()->pixmapDiscarded(); } @@ -359,7 +359,7 @@ bool Toplevel::resetAndFetchDamage() // Create a new region and copy the damage region to it, // resetting the damaged state. xcb_xfixes_region_t region = xcb_generate_id(conn); - xcb_xfixes_create_region(conn, region, 0, 0); + xcb_xfixes_create_region(conn, region, 0, nullptr); xcb_damage_subtract(conn, damage_handle, 0, region); // Send a fetch-region request and destroy the region @@ -381,7 +381,7 @@ void Toplevel::getDamageRegionReply() // Get the fetch-region reply xcb_xfixes_fetch_region_reply_t *reply = - xcb_xfixes_fetch_region_reply(connection(), m_regionCookie, 0); + xcb_xfixes_fetch_region_reply(connection(), m_regionCookie, nullptr); if (!reply) return; @@ -511,7 +511,7 @@ void Toplevel::setReadyForPainting() void Toplevel::deleteEffectWindow() { delete effect_window; - effect_window = NULL; + effect_window = nullptr; } void Toplevel::checkScreen() @@ -594,7 +594,7 @@ void Toplevel::getShadow() bool Toplevel::hasShadow() const { if (effectWindow() && effectWindow()->sceneWindow()) { - return effectWindow()->sceneWindow()->shadow() != NULL; + return effectWindow()->sceneWindow()->shadow() != nullptr; } return false; } @@ -604,7 +604,7 @@ Shadow *Toplevel::shadow() if (effectWindow() && effectWindow()->sceneWindow()) { return effectWindow()->sceneWindow()->shadow(); } else { - return NULL; + return nullptr; } } @@ -613,7 +613,7 @@ const Shadow *Toplevel::shadow() const if (effectWindow() && effectWindow()->sceneWindow()) { return effectWindow()->sceneWindow()->shadow(); } else { - return NULL; + return nullptr; } } diff --git a/unmanaged.cpp b/unmanaged.cpp index 393b1363ff..1e5b6231f9 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -92,7 +92,7 @@ bool Unmanaged::track(xcb_window_t w) void Unmanaged::release(ReleaseReason releaseReason) { - Deleted* del = NULL; + Deleted* del = nullptr; if (releaseReason != ReleaseReason::KWinShutsDown) { del = Deleted::create(this); } diff --git a/useractions.cpp b/useractions.cpp index aa998c2875..d57674fabb 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -79,21 +79,21 @@ namespace KWin UserActionsMenu::UserActionsMenu(QObject *parent) : QObject(parent) - , m_menu(NULL) - , m_desktopMenu(NULL) - , m_screenMenu(NULL) - , m_activityMenu(NULL) - , m_scriptsMenu(NULL) - , m_resizeOperation(NULL) - , m_moveOperation(NULL) - , m_maximizeOperation(NULL) - , m_shadeOperation(NULL) - , m_keepAboveOperation(NULL) - , m_keepBelowOperation(NULL) - , m_fullScreenOperation(NULL) - , m_noBorderOperation(NULL) - , m_minimizeOperation(NULL) - , m_closeOperation(NULL) + , m_menu(nullptr) + , m_desktopMenu(nullptr) + , m_screenMenu(nullptr) + , m_activityMenu(nullptr) + , m_scriptsMenu(nullptr) + , m_resizeOperation(nullptr) + , m_moveOperation(nullptr) + , m_maximizeOperation(nullptr) + , m_shadeOperation(nullptr) + , m_keepAboveOperation(nullptr) + , m_keepBelowOperation(nullptr) + , m_fullScreenOperation(nullptr) + , m_noBorderOperation(nullptr) + , m_minimizeOperation(nullptr) + , m_closeOperation(nullptr) { } @@ -169,7 +169,7 @@ void UserActionsMenu::helperDialog(const QString& message, AbstractClient* clien QString type; auto shortcut = [](const QString &name) { QAction* action = Workspace::self()->findChild(name); - Q_ASSERT(action != NULL); + Q_ASSERT(action != nullptr); const auto shortcuts = KGlobalAccel::self()->shortcut(action); return QStringLiteral("%1 (%2)").arg(action->text()) .arg(shortcuts.isEmpty() ? QString() : shortcuts.first().toString(QKeySequence::NativeText)); @@ -363,12 +363,12 @@ void UserActionsMenu::init() void UserActionsMenu::discard() { delete m_menu; - m_menu = NULL; - m_desktopMenu = NULL; + m_menu = nullptr; + m_desktopMenu = nullptr; m_multipleDesktopsMenu = nullptr; - m_screenMenu = NULL; - m_activityMenu = NULL; - m_scriptsMenu = NULL; + m_screenMenu = nullptr; + m_activityMenu = nullptr; + m_scriptsMenu = nullptr; } void UserActionsMenu::menuAboutToShow() @@ -378,7 +378,7 @@ void UserActionsMenu::menuAboutToShow() if (VirtualDesktopManager::self()->count() == 1) { delete m_desktopMenu; - m_desktopMenu = 0; + m_desktopMenu = nullptr; delete m_multipleDesktopsMenu; m_multipleDesktopsMenu = nullptr; } else { @@ -386,7 +386,7 @@ void UserActionsMenu::menuAboutToShow() } if (screens()->count() == 1 || (!m_client->isMovable() && !m_client->isMovableAcrossScreens())) { delete m_screenMenu; - m_screenMenu = NULL; + m_screenMenu = nullptr; } else { initScreenPopup(); } @@ -440,7 +440,7 @@ void UserActionsMenu::showHideActivityMenu() qCDebug(KWIN_CORE) << "activities:" << openActivities_.size(); if (openActivities_.size() < 2) { delete m_activityMenu; - m_activityMenu = 0; + m_activityMenu = nullptr; } else { initActivityPopup(); } @@ -941,8 +941,8 @@ void Workspace::closeActivePopup() { if (active_popup) { active_popup->close(); - active_popup = NULL; - active_popup_client = NULL; + active_popup = nullptr; + active_popup_client = nullptr; } m_userActionsMenu->close(); } @@ -986,7 +986,7 @@ void Workspace::initShortcuts() void Workspace::setupWindowShortcut(AbstractClient* c) { - Q_ASSERT(client_keys_dialog == NULL); + Q_ASSERT(client_keys_dialog == nullptr); // TODO: PORT ME (KGlobalAccel related) //keys->setEnabled( false ); //disable_shortcuts_keys->setEnabled( false ); @@ -1016,8 +1016,8 @@ void Workspace::setupWindowShortcutDone(bool ok) client_keys_client->setShortcut(client_keys_dialog->shortcut().toString()); closeActivePopup(); client_keys_dialog->deleteLater(); - client_keys_dialog = NULL; - client_keys_client = NULL; + client_keys_dialog = nullptr; + client_keys_client = nullptr; if (active_client) active_client->takeFocus(); } @@ -1027,7 +1027,7 @@ void Workspace::clientShortcutUpdated(AbstractClient* c) QString key = QStringLiteral("_k_session:%1").arg(c->window()); QAction* action = findChild(key); if (!c->shortcut().isEmpty()) { - if (action == NULL) { // new shortcut + if (action == nullptr) { // new shortcut action = new QAction(this); kwinApp()->platform()->setupActionForGlobalAccel(action); action->setProperty("componentName", QStringLiteral(KWIN_NAME)); diff --git a/useractions.h b/useractions.h index af93bcc0a5..2de1804821 100644 --- a/useractions.h +++ b/useractions.h @@ -59,7 +59,7 @@ class KWIN_EXPORT UserActionsMenu : public QObject { Q_OBJECT public: - explicit UserActionsMenu(QObject *parent = 0); + explicit UserActionsMenu(QObject *parent = nullptr); ~UserActionsMenu() override; /** * Discards the constructed menu, so that it gets recreates diff --git a/utils.cpp b/utils.cpp index 3c63c91dc2..b28330fbbe 100644 --- a/utils.cpp +++ b/utils.cpp @@ -104,17 +104,17 @@ static bool keyboard_grabbed = false; bool grabXKeyboard(xcb_window_t w) { - if (QWidget::keyboardGrabber() != NULL) + if (QWidget::keyboardGrabber() != nullptr) return false; if (keyboard_grabbed) return false; - if (qApp->activePopupWidget() != NULL) + if (qApp->activePopupWidget() != nullptr) return false; if (w == XCB_WINDOW_NONE) w = rootWindow(); const xcb_grab_keyboard_cookie_t c = xcb_grab_keyboard_unchecked(connection(), false, w, xTime(), XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); - ScopedCPointer grab(xcb_grab_keyboard_reply(connection(), c, NULL)); + ScopedCPointer grab(xcb_grab_keyboard_reply(connection(), c, nullptr)); if (grab.isNull()) { return false; } @@ -172,7 +172,7 @@ Qt::MouseButton x11ToQtMouseButton(int button) Qt::MouseButtons x11ToQtMouseButtons(int state) { - Qt::MouseButtons ret = 0; + Qt::MouseButtons ret = nullptr; if (state & XCB_KEY_BUT_MASK_BUTTON_1) ret |= Qt::LeftButton; if (state & XCB_KEY_BUT_MASK_BUTTON_2) @@ -188,7 +188,7 @@ Qt::MouseButtons x11ToQtMouseButtons(int state) Qt::KeyboardModifiers x11ToQtKeyboardModifiers(int state) { - Qt::KeyboardModifiers ret = 0; + Qt::KeyboardModifiers ret = nullptr; if (state & XCB_KEY_BUT_MASK_SHIFT) ret |= Qt::ShiftModifier; if (state & XCB_KEY_BUT_MASK_CONTROL) diff --git a/virtualdesktops.cpp b/virtualdesktops.cpp index 76ed4819fa..31b64badc4 100644 --- a/virtualdesktops.cpp +++ b/virtualdesktops.cpp @@ -232,13 +232,13 @@ KWIN_SINGLETON_FACTORY_VARIABLE(VirtualDesktopManager, s_manager) VirtualDesktopManager::VirtualDesktopManager(QObject *parent) : QObject(parent) , m_navigationWrapsAround(false) - , m_rootInfo(NULL) + , m_rootInfo(nullptr) { } VirtualDesktopManager::~VirtualDesktopManager() { - s_manager = NULL; + s_manager = nullptr; } void VirtualDesktopManager::setRootInfo(NETRootInfo *info) diff --git a/workspace.cpp b/workspace.cpp index 6d4309b447..298f72653d 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -99,31 +99,31 @@ void ColorMapper::update() } } -Workspace* Workspace::_self = 0; +Workspace* Workspace::_self = nullptr; Workspace::Workspace(const QString &sessionKey) - : QObject(0) - , m_compositor(NULL) + : QObject(nullptr) + , m_compositor(nullptr) // Unsorted - , active_popup(NULL) - , active_popup_client(NULL) + , active_popup(nullptr) + , active_popup_client(nullptr) , m_initialDesktop(1) - , active_client(0) - , last_active_client(0) - , most_recently_raised(0) - , movingClient(0) - , delayfocus_client(0) + , active_client(nullptr) + , last_active_client(nullptr) + , most_recently_raised(nullptr) + , movingClient(nullptr) + , delayfocus_client(nullptr) , force_restacking(false) , showing_desktop(false) , was_user_interaction(false) , session_saving(false) , block_focus(0) , m_userActionsMenu(new UserActionsMenu(this)) - , client_keys_dialog(NULL) - , client_keys_client(NULL) + , client_keys_dialog(nullptr) + , client_keys_client(nullptr) , global_shortcuts_disabled_for_client(false) , workspaceInit(true) - , startup(0) + , startup(nullptr) , set_active_client_recursion(0) , block_stacking_updates(0) { @@ -150,7 +150,7 @@ Workspace::Workspace(const QString &sessionKey) options->loadConfig(); options->loadCompositingConfig(false); - delayFocusTimer = 0; + delayFocusTimer = nullptr; if (!sessionKey.isEmpty()) loadSessionInfo(sessionKey); @@ -281,7 +281,7 @@ void Workspace::init() QStringLiteral("refreshFonts"), this, SLOT(reconfigure())); - active_client = NULL; + active_client = nullptr; initWithX11(); @@ -517,15 +517,15 @@ void Workspace::initWithX11() --block_focus; new_active_client = findClient(Predicate::WindowMatch, client_info.activeWindow()); } - if (new_active_client == NULL - && activeClient() == NULL && should_get_focus.count() == 0) { + if (new_active_client == nullptr + && activeClient() == nullptr && should_get_focus.count() == 0) { // No client activated in manage() - if (new_active_client == NULL) + if (new_active_client == nullptr) new_active_client = topClientOnDesktop(VirtualDesktopManager::self()->current(), -1); - if (new_active_client == NULL && !desktops.isEmpty()) + if (new_active_client == nullptr && !desktops.isEmpty()) new_active_client = findDesktop(true, VirtualDesktopManager::self()->current()); } - if (new_active_client != NULL) + if (new_active_client != nullptr) activateClient(new_active_client); } @@ -594,7 +594,7 @@ Workspace::~Workspace() // TODO: ungrabXServer(); Xcb::Extensions::destroy(); - _self = 0; + _self = nullptr; } void Workspace::setupClientConnections(AbstractClient *c) @@ -615,7 +615,7 @@ Client* Workspace::createClient(xcb_window_t w, bool is_mapped) connect(c, SIGNAL(clientFullScreenSet(KWin::Client*,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking())); if (!c->manage(w, is_mapped)) { Client::deleteClient(c); - return NULL; + return nullptr; } addClient(c); return c; @@ -631,7 +631,7 @@ Unmanaged* Workspace::createUnmanaged(xcb_window_t w) Unmanaged* c = new Unmanaged(); if (!c->track(w)) { Unmanaged::deleteUnmanaged(c); - return NULL; + return nullptr; } connect(c, &Unmanaged::needsRepaint, m_compositor, &Compositor::scheduleRepaint); addUnmanaged(c); @@ -645,12 +645,12 @@ void Workspace::addClient(Client* c) emit clientAdded(c); - if (grp != NULL) + if (grp != nullptr) grp->gotLeader(c); if (c->isDesktop()) { desktops.append(c); - if (active_client == NULL && should_get_focus.isEmpty() && c->isOnCurrentDesktop()) + if (active_client == nullptr && should_get_focus.isEmpty() && c->isOnCurrentDesktop()) requestFocus(c); // TODO: Make sure desktop is active after startup if there's no other window active } else { FocusChain::self()->update(c, FocusChain::Update); @@ -667,7 +667,7 @@ void Workspace::addClient(Client* c) if (c->isDesktop()) { raiseClient(c); // If there's no active client, make this desktop the active one - if (activeClient() == NULL && should_get_focus.count() == 0) + if (activeClient() == nullptr && should_get_focus.count() == 0) activateClient(findDesktop(true, VirtualDesktopManager::self()->current())); } c->checkActiveModal(); @@ -710,15 +710,15 @@ void Workspace::removeClient(Client* c) markXStackingOrderAsDirty(); attention_chain.removeAll(c); Group* group = findGroup(c->window()); - if (group != NULL) + if (group != nullptr) group->lostLeader(); if (c == most_recently_raised) - most_recently_raised = 0; + most_recently_raised = nullptr; should_get_focus.removeAll(c); Q_ASSERT(c != active_client); if (c == last_active_client) - last_active_client = 0; + last_active_client = nullptr; if (c == delayfocus_client) cancelDelayFocus(); @@ -811,14 +811,14 @@ void Workspace::updateToolWindows(bool also_hide) if (!c->isTransient()) { if (!c->group() || c->group()->members().count() == 1) // Has its own group, keep always visible show = true; - else if (client != NULL && c->group() == client->group()) + else if (client != nullptr && c->group() == client->group()) show = true; else show = false; } else { - if (group != NULL && c->group() == group) + if (group != nullptr && c->group() == group) show = true; - else if (client != NULL && client->hasTransient(c, true)) + else if (client != nullptr && client->hasTransient(c, true)) show = true; else show = false; @@ -968,7 +968,7 @@ void Workspace::updateClientVisibilityOnDesktopChange(uint newDesktop) void Workspace::activateClientOnNewDesktop(uint desktop) { - AbstractClient* c = NULL; + AbstractClient* c = nullptr; if (options->focusPolicyIsReasonable()) { c = findClientToActivateOnDesktop(desktop); } @@ -978,11 +978,11 @@ void Workspace::activateClientOnNewDesktop(uint desktop) else if (active_client && active_client->isShown(true) && active_client->isOnCurrentDesktop()) c = active_client; - if (c == NULL && !desktops.isEmpty()) + if (c == nullptr && !desktops.isEmpty()) c = findDesktop(true, desktop); if (c != active_client) - setActiveClient(NULL); + setActiveClient(nullptr); if (c) requestFocus(c); @@ -994,7 +994,7 @@ void Workspace::activateClientOnNewDesktop(uint desktop) AbstractClient *Workspace::findClientToActivateOnDesktop(uint desktop) { - if (movingClient != NULL && active_client == movingClient && + if (movingClient != nullptr && active_client == movingClient && FocusChain::self()->contains(active_client, desktop) && active_client->isShown(true) && active_client->isOnCurrentDesktop()) { // A requestFocus call will fail, as the client is already active @@ -1081,7 +1081,7 @@ void Workspace::updateCurrentActivity(const QString &new_activity) // Restore the focus on this desktop --block_focus; - AbstractClient* c = 0; + AbstractClient* c = nullptr; //FIXME below here is a lot of focuschain stuff, probably all wrong now if (options->focusPolicyIsReasonable()) { @@ -1094,11 +1094,11 @@ void Workspace::updateCurrentActivity(const QString &new_activity) else if (active_client && active_client->isShown(true) && active_client->isOnCurrentDesktop() && active_client->isOnCurrentActivity()) c = active_client; - if (c == NULL && !desktops.isEmpty()) + if (c == nullptr && !desktops.isEmpty()) c = findDesktop(true, VirtualDesktopManager::self()->current()); if (c != active_client) - setActiveClient(NULL); + setActiveClient(nullptr); if (c) requestFocus(c); @@ -1256,7 +1256,7 @@ void Workspace::requestDelayFocus(AbstractClient* c) void Workspace::cancelDelayFocus() { delete delayFocusTimer; - delayFocusTimer = 0; + delayFocusTimer = nullptr; } bool Workspace::checkStartupNotification(xcb_window_t w, KStartupInfoId &id, KStartupInfoData &data) diff --git a/workspace.h b/workspace.h index 1aff18e2ea..12a3b15e13 100644 --- a/workspace.h +++ b/workspace.h @@ -331,7 +331,7 @@ public: void focusToNull(); // SELI TODO: Public? void clientShortcutUpdated(AbstractClient* c); - bool shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore = NULL) const; + bool shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore = nullptr) const; bool globalShortcutsDisabled() const; void disableGlobalShortcutsForClient(bool disable); diff --git a/xcbutils.cpp b/xcbutils.cpp index fa9f5936e6..1c873205d4 100644 --- a/xcbutils.cpp +++ b/xcbutils.cpp @@ -343,11 +343,11 @@ ExtensionData::ExtensionData() template void Extensions::initVersion(T cookie, F f, ExtensionData *dataToFill) { - ScopedCPointer version(f(connection(), cookie, NULL)); + ScopedCPointer version(f(connection(), cookie, nullptr)); dataToFill->version = version->major_version * 0x10 + version->minor_version; } -Extensions *Extensions::s_self = NULL; +Extensions *Extensions::s_self = nullptr; Extensions *Extensions::self() { @@ -360,7 +360,7 @@ Extensions *Extensions::self() void Extensions::destroy() { delete s_self; - s_self = NULL; + s_self = nullptr; } Extensions::Extensions() @@ -499,7 +499,7 @@ bool Extensions::hasShape(xcb_window_t w) const return false; } ScopedCPointer extents(xcb_shape_query_extents_reply( - connection(), xcb_shape_query_extents_unchecked(connection(), w), NULL)); + connection(), xcb_shape_query_extents_unchecked(connection(), w), nullptr)); if (extents.isNull()) { return false; } @@ -560,7 +560,7 @@ QVector Extensions::extensions() const //**************************************** Shm::Shm() : m_shmId(-1) - , m_buffer(NULL) + , m_buffer(nullptr) , m_segment(XCB_NONE) , m_valid(false) , m_pixmapFormat(XCB_IMAGE_FORMAT_XY_BITMAP) @@ -584,7 +584,7 @@ bool Shm::init() return false; } ScopedCPointer version(xcb_shm_query_version_reply(connection(), - xcb_shm_query_version_unchecked(connection()), NULL)); + xcb_shm_query_version_unchecked(connection()), nullptr)); if (version.isNull()) { qCDebug(KWIN_CORE) << "Failed to get SHM extension version information"; return false; @@ -596,13 +596,13 @@ bool Shm::init() qCDebug(KWIN_CORE) << "Failed to allocate SHM segment"; return false; } - m_buffer = shmat(m_shmId, NULL, 0 /*read/write*/); + m_buffer = shmat(m_shmId, nullptr, 0 /*read/write*/); if (-1 == reinterpret_cast(m_buffer)) { qCDebug(KWIN_CORE) << "Failed to attach SHM segment"; - shmctl(m_shmId, IPC_RMID, NULL); + shmctl(m_shmId, IPC_RMID, nullptr); return false; } - shmctl(m_shmId, IPC_RMID, NULL); + shmctl(m_shmId, IPC_RMID, nullptr); m_segment = xcb_generate_id(connection()); const xcb_void_cookie_t cookie = xcb_shm_attach_checked(connection(), m_segment, m_shmId, false); diff --git a/xcbutils.h b/xcbutils.h index d446297860..827d92498a 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -263,7 +263,7 @@ public: } inline bool isNull() { getReply(); - return m_reply == NULL; + return m_reply == nullptr; } inline bool isNull() const { const_cast(this)->getReply(); @@ -299,7 +299,7 @@ public: inline Reply *take() { getReply(); Reply *ret = m_reply; - m_reply = NULL; + m_reply = nullptr; m_window = XCB_WINDOW_NONE; return ret; } @@ -308,7 +308,7 @@ protected: AbstractWrapper() : m_retrieved(false) , m_window(XCB_WINDOW_NONE) - , m_reply(NULL) + , m_reply(nullptr) { m_cookie.sequence = 0; } @@ -316,14 +316,14 @@ protected: : m_retrieved(false) , m_cookie(cookie) , m_window(window) - , m_reply(NULL) + , m_reply(nullptr) { } explicit AbstractWrapper(const AbstractWrapper &other) : m_retrieved(other.m_retrieved) , m_cookie(other.m_cookie) , m_window(other.m_window) - , m_reply(NULL) + , m_reply(nullptr) { takeFromOther(const_cast(other)); } @@ -1332,7 +1332,7 @@ public: * @param values The values to be passed to xcb_create_window * @param parent The parent window */ - Window(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); + Window(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); /** * Creates an xcb_window_t and manages it. It's a convenient method to create a window with * depth and visual being copied from parent and border being @c 0. @@ -1342,7 +1342,7 @@ public: * @param values The values to be passed to xcb_create_window * @param parent The parent window */ - Window(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); + Window(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); Window(const Window &other) = delete; ~Window(); @@ -1356,7 +1356,7 @@ public: * @param values The values to be passed to xcb_create_window * @param parent The parent window */ - void create(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); + void create(const QRect &geometry, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); /** * Creates a new window for which the responsibility is taken over. If a window had been managed * before it is freed. @@ -1368,7 +1368,7 @@ public: * @param values The values to be passed to xcb_create_window * @param parent The parent window */ - void create(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); + void create(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); /** * Frees the existing window and starts to manage the new @p window. * If @p destroy is @c true the new managed window will be destroyed together with this @@ -1419,7 +1419,7 @@ public: void kill(); operator xcb_window_t() const; private: - xcb_window_t doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = NULL, xcb_window_t parent = rootWindow()); + xcb_window_t doCreate(const QRect &geometry, uint16_t windowClass, uint32_t mask = 0, const uint32_t *values = nullptr, xcb_window_t parent = rootWindow()); void destroy(); xcb_window_t m_window; bool m_destroy; diff --git a/xkb.cpp b/xkb.cpp index d334b1ebbc..4b99630f84 100644 --- a/xkb.cpp +++ b/xkb.cpp @@ -69,8 +69,8 @@ static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const ch Xkb::Xkb(QObject *parent) : QObject(parent) , m_context(xkb_context_new(XKB_CONTEXT_NO_FLAGS)) - , m_keymap(NULL) - , m_state(NULL) + , m_keymap(nullptr) + , m_state(nullptr) , m_shiftModifier(0) , m_capsModifier(0) , m_controlModifier(0) @@ -206,7 +206,7 @@ void Xkb::installKeymap(int fd, uint32_t size) if (!m_context) { return; } - char *map = reinterpret_cast(mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0)); + char *map = reinterpret_cast(mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0)); if (map == MAP_FAILED) { return; } diff --git a/xwl/drag_x.cpp b/xwl/drag_x.cpp index a0e50f715d..b108c07be1 100644 --- a/xwl/drag_x.cpp +++ b/xwl/drag_x.cpp @@ -408,8 +408,8 @@ void WlVisit::getMimesFromWinProperty(Mimes &offers) XCB_GET_PROPERTY_TYPE_ANY, 0, 0x1fffffff); - auto *reply = xcb_get_property_reply(xcbConn, cookie, NULL); - if (reply == NULL) { + auto *reply = xcb_get_property_reply(xcbConn, cookie, nullptr); + if (reply == nullptr) { return; } if (reply->type != XCB_ATOM_ATOM || reply->value_len == 0) { diff --git a/xwl/transfer.cpp b/xwl/transfer.cpp index e2a8f4dd77..8f4945a273 100644 --- a/xwl/transfer.cpp +++ b/xwl/transfer.cpp @@ -265,7 +265,7 @@ void TransferWltoX::handlePropertyDelete() m_request->requestor, m_request->property, m_request->target, - 8, 0, NULL); + 8, 0, nullptr); xcb_flush(xcbConn); m_flushPropertyOnDelete = false; endTransfer(); @@ -375,8 +375,8 @@ void TransferXtoWl::startTransfer() 0x1fffffff ); - auto *reply = xcb_get_property_reply(xcbConn, cookie, NULL); - if (reply == NULL) { + auto *reply = xcb_get_property_reply(xcbConn, cookie, nullptr); + if (reply == nullptr) { qCWarning(KWIN_XWL) << "Can't get selection property."; endTransfer(); return;