diff --git a/abstract_client.cpp b/abstract_client.cpp --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -297,7 +297,7 @@ ? 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 --- a/activation.cpp +++ b/activation.cpp @@ -240,12 +240,12 @@ 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; @@ -292,9 +292,9 @@ */ void Workspace::activateClient(AbstractClient* c, bool force) { - if (c == NULL) { + if (c == nullptr) { focusToNull(); - setActiveClient(NULL); + setActiveClient(nullptr); return; } raiseClient(c); @@ -359,7 +359,7 @@ 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 @@ -437,7 +437,7 @@ return client; } } - return 0; + return nullptr; } // deactivates 'c' and activates next client @@ -449,9 +449,9 @@ closeActivePopup(); - if (c != NULL) { + if (c != nullptr) { if (c == active_client) - setActiveClient(NULL); + setActiveClient(nullptr); should_get_focus.removeAll(c); } @@ -465,15 +465,15 @@ if (!options->focusPolicyIsReasonable()) return false; - AbstractClient* get_focus = NULL; + AbstractClient* get_focus = nullptr; // precedence on keeping the current tabgroup active. to the user that's the same window if (c && c->tabGroup() && c->isShown(false)) { if (c == c->tabGroup()->current()) c->tabGroup()->activateNext(); get_focus = c->tabGroup()->current(); if (get_focus == c) // single tab case - should not happen - get_focus = NULL; + get_focus = nullptr; } const int desktop = VirtualDesktopManager::self()->current(); @@ -485,7 +485,7 @@ 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; } } @@ -504,10 +504,10 @@ } } - 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(); @@ -525,9 +525,9 @@ 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); } @@ -601,7 +601,7 @@ // 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 } @@ -655,7 +655,7 @@ 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 } @@ -718,7 +718,7 @@ && (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); } @@ -738,7 +738,7 @@ // 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(); @@ -754,7 +754,7 @@ // 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, @@ -777,7 +777,7 @@ ; // 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; @@ -813,7 +813,7 @@ 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 --- a/activities.cpp +++ b/activities.cpp @@ -47,7 +47,7 @@ Activities::~Activities() { - s_self = NULL; + s_self = nullptr; } KActivities::Consumer::ServiceStatus Activities::serviceStatus() const diff --git a/client.h b/client.h --- a/client.h +++ b/client.h @@ -101,7 +101,7 @@ 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.cpp b/client.cpp --- a/client.cpp +++ b/client.cpp @@ -108,17 +108,17 @@ , 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) @@ -130,14 +130,14 @@ { // 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; @@ -227,7 +227,7 @@ } #endif destroyWindowManagementInterface(); - Deleted* del = NULL; + Deleted* del = nullptr; if (!on_shutdown) { del = Deleted::create(this); } @@ -877,7 +877,7 @@ 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)); @@ -888,7 +888,7 @@ if (shade_below && shade_below->isNormalWindow()) workspace()->raiseClient(this); else - shade_below = NULL; + shade_below = nullptr; } m_wrapper.map(); m_client.map(); @@ -923,7 +923,7 @@ void Client::cancelShadeHoverTimer() { delete shadeHoverTimer; - shadeHoverTimer = 0; + shadeHoverTimer = nullptr; } void Client::toggleShade() @@ -1101,7 +1101,7 @@ 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(); @@ -1179,7 +1179,7 @@ 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, @@ -1212,7 +1212,7 @@ if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) return; delete ping_timer; - ping_timer = NULL; + ping_timer = nullptr; setUnresponsive(false); @@ -1794,16 +1794,16 @@ 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); } } 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_machine.h b/client_machine.h --- a/client_machine.h +++ b/client_machine.h @@ -34,7 +34,7 @@ { 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 @@ { 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/client_machine.cpp b/client_machine.cpp --- a/client_machine.cpp +++ b/client_machine.cpp @@ -54,8 +54,8 @@ , 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/colorcorrection/manager.cpp b/colorcorrection/manager.cpp --- a/colorcorrection/manager.cpp +++ b/colorcorrection/manager.cpp @@ -94,7 +94,7 @@ // 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.h b/composite.h --- a/composite.h +++ b/composite.h @@ -93,7 +93,7 @@ virtual int refreshRate() const = 0; bool hasScene() const { - return m_scene != NULL; + return m_scene != nullptr; } Scene *scene() const { return m_scene; @@ -110,7 +110,7 @@ * @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/composite.cpp b/composite.cpp --- a/composite.cpp +++ b/composite.cpp @@ -121,11 +121,11 @@ 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 @@ stop(); deleteUnusedSupportProperties(); destroyCompositorSelection(); - s_compositor = NULL; + s_compositor = nullptr; } bool Compositor::setupStart() @@ -250,12 +250,12 @@ } } - 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); @@ -453,7 +453,7 @@ } delete m_scene; - m_scene = NULL; + m_scene = nullptr; compositeTimer.stop(); repaints_region = QRegion(); diff --git a/cursor.cpp b/cursor.cpp --- a/cursor.cpp +++ b/cursor.cpp @@ -56,7 +56,7 @@ Cursor::~Cursor() { - s_self = NULL; + s_self = nullptr; } void Cursor::loadThemeSettings() diff --git a/deleted.cpp b/deleted.cpp --- a/deleted.cpp +++ b/deleted.cpp @@ -93,7 +93,7 @@ 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 --- a/effects.cpp +++ b/effects.cpp @@ -104,7 +104,7 @@ // 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; } @@ -119,8 +119,8 @@ 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) @@ -152,7 +152,7 @@ [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); } @@ -466,7 +466,7 @@ 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) @@ -623,16 +623,16 @@ { // 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); } 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); } @@ -662,7 +662,7 @@ bool EffectsHandlerImpl::grabKeyboard(Effect* effect) { - if (keyboard_grab_effect != NULL) + if (keyboard_grab_effect != nullptr) return false; if (!doGrabKeyboard()) { return false; @@ -678,18 +678,18 @@ 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() { } void EffectsHandlerImpl::grabbedKeyboardEvent(QKeyEvent* e) { - if (keyboard_grab_effect != NULL) + if (keyboard_grab_effect != nullptr) keyboard_grab_effect->grabbedKeyboardEvent(e); } @@ -791,7 +791,7 @@ if ((*it).first == name) return (*it).second->proxy(); - return NULL; + return nullptr; } void EffectsHandlerImpl::startMousePolling() @@ -808,7 +808,7 @@ bool EffectsHandlerImpl::hasKeyboardGrab() const { - return keyboard_grab_effect != NULL; + return keyboard_grab_effect != nullptr; } void EffectsHandlerImpl::desktopResized(const QSize &size) @@ -888,7 +888,7 @@ 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) @@ -1075,7 +1075,7 @@ return w->effectWindow(); } } - return NULL; + return nullptr; } EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const @@ -1210,7 +1210,7 @@ if (auto c = TabBox::TabBox::self()->currentClient()) return c->effectWindow(); #endif - return NULL; + return nullptr; } void EffectsHandlerImpl::addRepaintFull() @@ -2147,13 +2147,13 @@ //**************************************** 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) { @@ -2269,7 +2269,7 @@ 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 --- a/effects/backgroundcontrast/contrastshader.cpp +++ b/effects/backgroundcontrast/contrastshader.cpp @@ -34,7 +34,7 @@ ContrastShader::ContrastShader() - : mValid(false), shader(NULL), m_opacity(1) + : mValid(false), shader(nullptr), m_opacity(1) { } @@ -51,7 +51,7 @@ 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 --- a/effects/blur/blur_config.h +++ b/effects/blur/blur_config.h @@ -31,7 +31,7 @@ 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.h b/effects/coverswitch/coverswitch.h --- a/effects/coverswitch/coverswitch.h +++ b/effects/coverswitch/coverswitch.h @@ -107,7 +107,7 @@ 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.cpp b/effects/coverswitch/coverswitch.cpp --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -50,8 +50,8 @@ , 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 @@ 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 @@ 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 @@ timeLine.reset(); if (stop) { stop = false; - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); foreach (EffectWindow * window, referrencedWindows) { window->unrefWindow(); } @@ -547,7 +547,7 @@ stopRequested = true; } } else { - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); start = false; animation = false; timeLine.reset(); @@ -565,7 +565,7 @@ 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::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 @@ 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 @@ // 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 @@ effects->unrefTabBox(); effects->stopMouseInterception(this); } - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); timeLine.reset(); mActivated = false; stop = false; @@ -930,7 +930,7 @@ 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_config.h b/effects/coverswitch/coverswitch_config.h --- a/effects/coverswitch/coverswitch_config.h +++ b/effects/coverswitch/coverswitch_config.h @@ -40,7 +40,7 @@ { 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 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -56,13 +56,13 @@ , 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 @@ , 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 @@ 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 @@ 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 @@ } // 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ 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 --- a/effects/cube/cube_config.h +++ b/effects/cube/cube_config.h @@ -40,7 +40,7 @@ { 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 --- a/effects/cubeslide/cubeslide.cpp +++ b/effects/cubeslide/cubeslide.cpp @@ -387,7 +387,7 @@ w->setData(WindowForceBackgroundContrastRole, QVariant()); } staticWindows.clear(); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); } } effects->addRepaintFull(); @@ -586,7 +586,7 @@ 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 --- a/effects/cubeslide/cubeslide_config.h +++ b/effects/cubeslide/cubeslide_config.h @@ -40,7 +40,7 @@ { 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.h b/effects/desktopgrid/desktopgrid.h --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -36,7 +36,7 @@ { 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: 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.cpp b/effects/desktopgrid/desktopgrid.cpp --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -57,16 +57,16 @@ , wasWindowCopy(false) , wasDesktopMove(false) , isValidMove(false) - , windowMove(NULL) + , windowMove(nullptr) , windowMoveDiff() , gridSize() , orientation(Qt::Horizontal) , activeCell(1, 1) , scale() , unscaledBorder() , scaledSize() , scaledOffset() - , m_proxy(0) + , m_proxy(nullptr) , m_activateAction(new QAction(this)) { initConfig(); @@ -428,7 +428,7 @@ 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::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 @@ 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 @@ 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 @@ 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 @@ effects->addRepaintFull(); } effects->setElevatedWindow(windowMove, false); - windowMove = NULL; + windowMove = nullptr; } wasWindowMove = false; wasWindowCopy = false; @@ -687,7 +687,7 @@ { 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 @@ 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 @@ 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 @@ return w; } } - return NULL; + return nullptr; } void DesktopGridEffect::setCurrentDesktop(int desktop) @@ -1223,13 +1223,13 @@ 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::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_config.h b/effects/desktopgrid/desktopgrid_config.h --- a/effects/desktopgrid/desktopgrid_config.h +++ b/effects/desktopgrid/desktopgrid_config.h @@ -41,7 +41,7 @@ { 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 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -45,7 +45,7 @@ , m_stop(false) , m_animation(false) , m_hasKeyboardGrab(false) - , m_captionFrame(NULL) + , m_captionFrame(nullptr) { initConfig(); reconfigure(ReconfigureAll); @@ -153,7 +153,7 @@ 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 @@ 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 @@ m_stop = false; m_active = false; m_captionFrame->free(); - effects->setActiveFullScreenEffect(0); + effects->setActiveFullScreenEffect(nullptr); effects->addRepaintFull(); qDeleteAll(m_windows); m_windows.clear(); @@ -439,7 +439,7 @@ 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; @@ -487,7 +487,7 @@ 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 --- a/effects/flipswitch/flipswitch_config.h +++ b/effects/flipswitch/flipswitch_config.h @@ -41,7 +41,7 @@ { 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.h b/effects/highlightwindow/highlightwindow.h --- a/effects/highlightwindow/highlightwindow.h +++ b/effects/highlightwindow/highlightwindow.h @@ -49,7 +49,7 @@ 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/highlightwindow/highlightwindow.cpp b/effects/highlightwindow/highlightwindow.cpp --- a/effects/highlightwindow/highlightwindow.cpp +++ b/effects/highlightwindow/highlightwindow.cpp @@ -26,7 +26,7 @@ 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); @@ -261,7 +261,7 @@ 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/invert/invert.cpp b/effects/invert/invert.cpp --- a/effects/invert/invert.cpp +++ b/effects/invert/invert.cpp @@ -37,7 +37,7 @@ 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 --- a/effects/invert/invert_config.h +++ b/effects/invert/invert_config.h @@ -32,7 +32,7 @@ { 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 --- a/effects/lookingglass/lookingglass.cpp +++ b/effects/lookingglass/lookingglass.cpp @@ -45,10 +45,10 @@ : 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 --- a/effects/lookingglass/lookingglass_config.h +++ b/effects/lookingglass/lookingglass_config.h @@ -41,7 +41,7 @@ { 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 --- a/effects/magiclamp/magiclamp.cpp +++ b/effects/magiclamp/magiclamp.cpp @@ -134,7 +134,7 @@ 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 --- a/effects/magiclamp/magiclamp_config.h +++ b/effects/magiclamp/magiclamp_config.h @@ -40,7 +40,7 @@ { 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 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -44,8 +44,8 @@ : 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 @@ // 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 @@ 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 @@ 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 @@ 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 --- a/effects/magnifier/magnifier_config.h +++ b/effects/magnifier/magnifier_config.h @@ -41,7 +41,7 @@ { 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 --- a/effects/mouseclick/mouseclick.cpp +++ b/effects/mouseclick/mouseclick.cpp @@ -164,7 +164,7 @@ 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 @@ 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 @@ 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 --- a/effects/mouseclick/mouseclick_config.h +++ b/effects/mouseclick/mouseclick_config.h @@ -41,7 +41,7 @@ { 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 --- a/effects/mousemark/mousemark.cpp +++ b/effects/mousemark/mousemark.cpp @@ -138,16 +138,16 @@ 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()) { verts.clear(); verts.reserve(drawing.size() * 2); 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 --- a/effects/mousemark/mousemark_config.h +++ b/effects/mousemark/mousemark_config.h @@ -41,7 +41,7 @@ { 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.h b/effects/presentwindows/presentwindows.h --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -36,7 +36,7 @@ { 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.cpp b/effects/presentwindows/presentwindows.cpp --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -56,12 +56,12 @@ , 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)) @@ -251,7 +251,7 @@ 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; @@ -328,7 +328,7 @@ winData->referenced = false; w->unrefWindow(); if (w == m_closeWindow) { - m_closeWindow = NULL; + m_closeWindow = nullptr; } } else w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); @@ -490,7 +490,7 @@ 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; @@ -592,7 +592,7 @@ // 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()) @@ -606,7 +606,7 @@ } } if (!hovering) - setHighlightedWindow(NULL); + setHighlightedWindow(nullptr); if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos)) updateCloseWindow(); else if (m_closeView) @@ -954,7 +954,7 @@ } } if (windowlist.isEmpty()) { - setHighlightedWindow(NULL); + setHighlightedWindow(nullptr); return; } @@ -989,7 +989,7 @@ } // 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()) @@ -1537,7 +1537,7 @@ 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)) { @@ -1646,7 +1646,7 @@ 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 @@ -1714,7 +1714,7 @@ 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) @@ -1805,24 +1805,24 @@ 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) continue; 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); if (eArea.x() < nArea.x()) next = e; } } } - 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 @@ -1835,24 +1835,24 @@ 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) continue; 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); if (eArea.x() + eArea.width() > nArea.x() + nArea.width()) next = e; } } } - 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 @@ -1870,24 +1870,24 @@ 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) continue; 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); if (eArea.y() < nArea.y()) next = e; } } } - 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 @@ -1900,24 +1900,24 @@ 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) continue; 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); if (eArea.y() + eArea.height() > nArea.y() + nArea.height()) next = e; } } } - 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 @@ -1933,7 +1933,7 @@ 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); @@ -1944,7 +1944,7 @@ 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_config.h b/effects/presentwindows/presentwindows_config.h --- a/effects/presentwindows/presentwindows_config.h +++ b/effects/presentwindows/presentwindows_config.h @@ -40,7 +40,7 @@ { 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 --- a/effects/resize/resize.cpp +++ b/effects/resize/resize.cpp @@ -38,7 +38,7 @@ ResizeEffect::ResizeEffect() : AnimationEffect() , m_active(false) - , m_resizeWindow(0) + , m_resizeWindow(nullptr) { initConfig(); reconfigure(ReconfigureAll); @@ -102,7 +102,7 @@ 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 @@ { 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 --- a/effects/resize/resize_config.h +++ b/effects/resize/resize_config.h @@ -33,14 +33,14 @@ { 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 --- a/effects/screenedge/screenedgeeffect.cpp +++ b/effects/screenedge/screenedgeeffect.cpp @@ -233,7 +233,7 @@ } if (glow->texture.isNull()) { delete glow; - return NULL; + return nullptr; } } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING @@ -246,7 +246,7 @@ } if (glow->picture.isNull()) { delete glow; - return NULL; + return nullptr; } #endif } else if (effects->compositingType() == QPainterCompositing) { @@ -259,7 +259,7 @@ } if (glow->image.isNull()) { delete glow; - return NULL; + return nullptr; } } @@ -281,7 +281,7 @@ case ElectricBottomLeft: return new T(m_glow->pixmap(QStringLiteral("topright")).toImage()); default: - return NULL; + return nullptr; } } @@ -336,7 +336,7 @@ 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 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -58,7 +58,7 @@ } 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 @@ 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 @@ } #endif } - m_scheduledScreenshot = NULL; + m_scheduledScreenshot = nullptr; } if (!m_scheduledGeometry.isNull()) { @@ -373,7 +373,7 @@ !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 @@ #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 @@ 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 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -201,7 +201,7 @@ 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 @@ 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 @@ 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,16 +406,16 @@ 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; verts.clear(); for (int i = 0; i < values.count(); i++) { 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 @@ 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 --- a/effects/showfps/showfps_config.h +++ b/effects/showfps/showfps_config.h @@ -32,7 +32,7 @@ { 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 --- a/effects/slideback/slideback.cpp +++ b/effects/slideback/slideback.cpp @@ -26,7 +26,7 @@ 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 @@ 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::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 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -78,13 +78,13 @@ , 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 @@ 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 @@ 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 @@ 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 --- a/effects/thumbnailaside/thumbnailaside.cpp +++ b/effects/thumbnailaside/thumbnailaside.cpp @@ -113,7 +113,7 @@ 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 --- a/effects/thumbnailaside/thumbnailaside_config.h +++ b/effects/thumbnailaside/thumbnailaside_config.h @@ -41,7 +41,7 @@ { 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 --- a/effects/touchpoints/touchpoints.cpp +++ b/effects/touchpoints/touchpoints.cpp @@ -231,7 +231,7 @@ 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 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -46,9 +46,9 @@ : 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 @@ 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 @@ }; #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 --- a/effects/trackmouse/trackmouse_config.h +++ b/effects/trackmouse/trackmouse_config.h @@ -42,7 +42,7 @@ { 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 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -37,7 +37,7 @@ 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 @@ { 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 --- a/effects/windowgeometry/windowgeometry_config.h +++ b/effects/windowgeometry/windowgeometry_config.h @@ -40,7 +40,7 @@ { 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 --- a/effects/wobblywindows/wobblywindows_config.h +++ b/effects/wobblywindows/wobblywindows_config.h @@ -34,7 +34,7 @@ { 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 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -61,7 +61,7 @@ , 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 @@ 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 --- a/effects/zoom/zoom_config.h +++ b/effects/zoom/zoom_config.h @@ -34,14 +34,14 @@ { 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 --- a/events.cpp +++ b/events.cpp @@ -326,7 +326,7 @@ 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 @@ 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 @@ 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 @@ } } if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) { - workspace()->requestDelayFocus(0); + workspace()->requestDelayFocus(nullptr); } return; } diff --git a/focuschain.cpp b/focuschain.cpp --- a/focuschain.cpp +++ b/focuschain.cpp @@ -29,14 +29,14 @@ 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 @@ { 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 @@ return tmp; } } - return NULL; + return nullptr; } void FocusChain::update(AbstractClient *client, FocusChain::Change change) @@ -191,15 +191,15 @@ AbstractClient *FocusChain::firstMostRecentlyUsed() const { if (m_mostRecentlyUsed.isEmpty()) { - return NULL; + return nullptr; } return m_mostRecentlyUsed.first(); } 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,16 +223,16 @@ { 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) { auto client = chain.at(i); if (isUsableFocusCandidate(client, reference)) { return client; } } - return NULL; + return nullptr; } void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain) diff --git a/geometry.cpp b/geometry.cpp --- a/geometry.cpp +++ b/geometry.cpp @@ -896,7 +896,7 @@ // (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) { @@ -2179,7 +2179,7 @@ m_client->tabGroup()->blockStateUpdates(false); m_client->tabGroup()->updateStates(dynamic_cast(m_client), m_states); } - m_client = 0; + m_client = nullptr; } private: AbstractClient *m_client; @@ -2551,7 +2551,7 @@ return total; } -static GeometryTip* geometryTip = 0; +static GeometryTip* geometryTip = nullptr; void Client::positionGeometryTip() { @@ -2578,10 +2578,10 @@ 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; @@ -2625,15 +2625,15 @@ // 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(); const xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer_unchecked(connection(), false, m_moveResizeGrabWindow, 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; } @@ -2706,7 +2706,7 @@ if (geometryTip) { geometryTip->hide(); delete geometryTip; - geometryTip = NULL; + geometryTip = nullptr; } if (move_resize_has_keyboard_grab) ungrabXKeyboard(); @@ -2716,7 +2716,7 @@ 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 --- a/geometrytip.cpp +++ b/geometrytip.cpp @@ -24,7 +24,7 @@ { GeometryTip::GeometryTip(const Xcb::GeometryHints* xSizeHints): - QLabel(0) + QLabel(nullptr) { setObjectName(QLatin1String("kwingeometry")); setMargin(1); diff --git a/group.cpp b/group.cpp --- a/group.cpp +++ b/group.cpp @@ -54,9 +54,9 @@ //******************************************** Group::Group(Window leader_P) - : leader_client(NULL), + : leader_client(nullptr), leader_wid(leader_P), - leader_info(NULL), + leader_info(nullptr), user_time(-1U), refcount(0) { @@ -77,7 +77,7 @@ QIcon Group::icon() const { - if (leader_client != NULL) + if (leader_client != nullptr) return leader_client->icon(); else if (leader_wid != None) { QIcon ic; @@ -143,7 +143,7 @@ void Group::lostLeader() { Q_ASSERT(!_members.contains(leader_client)); - leader_client = NULL; + leader_client = nullptr; if (_members.isEmpty()) { workspace()->removeGroup(this); delete this; @@ -162,21 +162,21 @@ ++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. @@ -439,11 +439,11 @@ 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(); @@ -516,7 +516,7 @@ // 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) @@ -547,7 +547,7 @@ 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 @@ -631,16 +631,16 @@ 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) { qCWarning(KWIN_CORE) << "Client " << this << " caused WM_TRANSIENT_FOR loop." ; new_transient_for = rootWindow(); } } 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(); } @@ -762,36 +762,36 @@ return ret; if (isModal() && allow_itself) return this; - return NULL; + return nullptr; } // Client::window_group only holds the contents of the hint, // but it should be used only to find the group, not for anything else // Argument is only when some specific group needs to be set. 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); } } 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); @@ -802,19 +802,19 @@ // 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); } } else if (groupTransient()) { // 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(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); @@ -824,11 +824,11 @@ // 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(None); if (in_group != new_group) { in_group = new_group; @@ -850,7 +850,7 @@ } 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) @@ -879,7 +879,7 @@ addTransient(*it); } } - if (old_group != NULL) + if (old_group != nullptr) old_group->deref(); // can be now deleted if empty checkGroupTransients(); checkActiveModal(); @@ -890,7 +890,7 @@ 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()) @@ -906,9 +906,9 @@ // 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 --- a/input.cpp +++ b/input.cpp @@ -1647,7 +1647,7 @@ InputRedirection::~InputRedirection() { - s_self = NULL; + s_self = nullptr; qDeleteAll(m_filters); qDeleteAll(m_spies); } @@ -2129,7 +2129,7 @@ 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 @@ 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 --- a/kcmkwin/kwincompositing/compositing.h +++ b/kcmkwin/kwincompositing/compositing.h @@ -48,7 +48,7 @@ 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 @@ 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 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -33,7 +33,7 @@ { 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 --- a/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h +++ b/kcmkwin/kwindecoration/declarative-plugin/buttonsmodel.h @@ -34,7 +34,7 @@ { 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 --- a/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp @@ -78,7 +78,7 @@ 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 --- a/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h +++ b/kcmkwin/kwindecoration/declarative-plugin/previewsettings.h @@ -37,7 +37,7 @@ { 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 --- a/kcmkwin/kwinoptions/mouse.cpp +++ b/kcmkwin/kwinoptions/mouse.cpp @@ -68,7 +68,7 @@ { char const * maxButtonXpms[][3 + 13] = { { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", @@ -84,7 +84,7 @@ "..............." }, { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", @@ -100,7 +100,7 @@ "..............." }, { - 0, 0, 0, + nullptr, nullptr, nullptr, "...............", "...............", "...............", diff --git a/kcmkwin/kwinscreenedges/monitor.h b/kcmkwin/kwinscreenedges/monitor.h --- a/kcmkwin/kwinscreenedges/monitor.h +++ b/kcmkwin/kwinscreenedges/monitor.h @@ -100,7 +100,7 @@ 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 --- a/kcmkwin/kwintabbox/thumbnailitem.cpp +++ b/kcmkwin/kwintabbox/thumbnailitem.cpp @@ -69,7 +69,7 @@ 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 --- a/layers.cpp +++ b/layers.cpp @@ -267,7 +267,7 @@ return c; } } - return 0; + return nullptr; } AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const @@ -288,13 +288,13 @@ 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()) @@ -336,7 +336,7 @@ } if (c == most_recently_raised) - most_recently_raised = 0; + most_recently_raised = nullptr; } void Workspace::lowerClientWithinApplication(AbstractClient* c) @@ -456,7 +456,7 @@ 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; } } @@ -516,7 +516,7 @@ 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 @@ -780,7 +780,7 @@ 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) { @@ -839,7 +839,7 @@ 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 --- a/libkwineffects/kwinglplatform.cpp +++ b/libkwineffects/kwinglplatform.cpp @@ -38,7 +38,7 @@ namespace KWin { -GLPlatform *GLPlatform::s_platform = 0; +GLPlatform *GLPlatform::s_platform = nullptr; static qint64 parseVersionString(const QByteArray &version) { @@ -293,7 +293,7 @@ { 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 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -1968,7 +1968,7 @@ 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 --- a/manage.cpp +++ b/manage.cpp @@ -223,7 +223,7 @@ desk = NET::OnAllDesktops; else if (on_current) desk = VirtualDesktopManager::self()->current(); - else if (maincl != NULL) + else if (maincl != nullptr) desk = maincl->desktop(); if (maincl) @@ -340,13 +340,13 @@ // Create client group if the window will have a decoration bool dontKeepInArea = false; - setTabGroup(NULL); + setTabGroup(nullptr); if (!noBorder() && false) { const bool autogrouping = rules()->checkAutogrouping(options->isAutogroupSimilarWindows()); const bool autogroupInFg = rules()->checkAutogroupInForeground(options->isAutogroupInForeground()); // Automatically add to previous groups on session restore if (session && session->tabGroupClient && !workspace()->hasClient(session->tabGroupClient)) - session->tabGroupClient = NULL; + session->tabGroupClient = nullptr; if (session && session->tabGroupClient && session->tabGroupClient != this) { tabBehind(session->tabGroupClient, autogroupInFg); } else if (isMapped && autogrouping) { @@ -560,7 +560,7 @@ 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 @@ -582,7 +582,7 @@ 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); @@ -749,7 +749,7 @@ { // Attempt to find a similar window to the input. If we find multiple possibilities that are in // different groups then ignore all of them. This function is for automatic window grouping. - Client *found = NULL; + Client *found = nullptr; // See if the window has a group ID to match with QString wGId = rules()->checkAutogroupById(QString()); @@ -759,7 +759,7 @@ continue; // don't cross activities if (wGId == c->rules()->checkAutogroupById(QString())) { if (found && found->tabGroup() != c->tabGroup()) { // We've found two, ignore both - found = NULL; + found = nullptr; break; // Continue to the next test } found = c; @@ -771,7 +771,7 @@ // If this is a transient window don't take a guess if (isTransient()) - return NULL; + return nullptr; // If we don't have an ID take a guess if (rules()->checkAutogrouping(options->isAutogroupSimilarWindows())) { @@ -784,7 +784,7 @@ wRole == wRoleB && // Same window role c->isNormalWindow()) { // Normal window TODO: Can modal windows be "normal"? if (found && found->tabGroup() != c->tabGroup()) // We've found two, ignore both - return NULL; + return nullptr; found = c; } } diff --git a/netinfo.cpp b/netinfo.cpp --- a/netinfo.cpp +++ b/netinfo.cpp @@ -33,7 +33,7 @@ { extern int screen_number; -RootInfo *RootInfo::s_self = NULL; +RootInfo *RootInfo::s_self = nullptr; RootInfo *RootInfo::create() { @@ -136,7 +136,7 @@ } 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 @@ workspace->activateClient(c); // if activation of the requestor's window would be allowed, allow activation too else if (active_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::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 --- a/options.h +++ b/options.h @@ -187,7 +187,7 @@ 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 --- a/placement.cpp +++ b/placement.cpp @@ -50,7 +50,7 @@ Placement::~Placement() { - s_self = NULL; + s_self = nullptr; } /** @@ -556,7 +556,7 @@ ++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 @@ -570,7 +570,7 @@ } } } - 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 --- a/platformsupport/scenes/opengl/backend.cpp +++ b/platformsupport/scenes/opengl/backend.cpp @@ -82,7 +82,7 @@ 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 --- a/platformsupport/scenes/opengl/linux_dmabuf.cpp +++ b/platformsupport/scenes/opengl/linux_dmabuf.cpp @@ -461,7 +461,7 @@ { 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 @@ 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 --- a/plugins/idletime/poller.h +++ b/plugins/idletime/poller.h @@ -41,7 +41,7 @@ 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 --- a/plugins/kglobalaccel/kglobalaccel_plugin.h +++ b/plugins/kglobalaccel/kglobalaccel_plugin.h @@ -31,7 +31,7 @@ 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 --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -209,10 +209,10 @@ } 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 --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -108,7 +108,7 @@ : OpenGLBackend() , m_overlayWindow(kwinApp()->platform()->createOverlayWindow()) , window(None) - , fbconfig(NULL) + , fbconfig(nullptr) , glxWindow(None) , ctx(nullptr) , m_bufferAge(0) @@ -271,7 +271,7 @@ // 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))); @@ -337,16 +337,16 @@ } 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; } } } 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."; @@ -356,7 +356,7 @@ if (!glXMakeCurrent(display(), glxWindow, ctx)) { qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current."; glXDestroyContext(display(), ctx); - ctx = 0; + ctx = nullptr; return false; } @@ -390,7 +390,7 @@ 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"; @@ -885,7 +885,7 @@ { 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 --- a/plugins/platforms/x11/standalone/overlaywindow_x11.cpp +++ b/plugins/platforms/x11/standalone/overlaywindow_x11.cpp @@ -90,7 +90,7 @@ 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 --- a/plugins/platforms/x11/standalone/windowselector.cpp +++ b/plugins/platforms/x11/standalone/windowselector.cpp @@ -94,7 +94,7 @@ 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 @@ 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/qpa/sharingplatformcontext.cpp b/plugins/qpa/sharingplatformcontext.cpp --- a/plugins/qpa/sharingplatformcontext.cpp +++ b/plugins/qpa/sharingplatformcontext.cpp @@ -109,7 +109,7 @@ void SharingPlatformContext::create() { - if (config() == 0) { + if (config() == nullptr) { qCWarning(KWIN_QPA) << "Did not get an EGL config"; return; } diff --git a/plugins/scenes/opengl/lanczosfilter.h b/plugins/scenes/opengl/lanczosfilter.h --- a/plugins/scenes/opengl/lanczosfilter.h +++ b/plugins/scenes/opengl/lanczosfilter.h @@ -43,7 +43,7 @@ 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/lanczosfilter.cpp b/plugins/scenes/opengl/lanczosfilter.cpp --- a/plugins/scenes/opengl/lanczosfilter.cpp +++ b/plugins/scenes/opengl/lanczosfilter.cpp @@ -45,10 +45,10 @@ 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 @@ } else { // offscreen texture not matching - delete delete cachedTexture; - cachedTexture = 0; + cachedTexture = nullptr; w->setData(LanczosCacheRole, QVariant()); } } @@ -392,8 +392,8 @@ 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/scene_opengl.h b/plugins/scenes/opengl/scene_opengl.h --- a/plugins/scenes/opengl/scene_opengl.h +++ b/plugins/scenes/opengl/scene_opengl.h @@ -183,7 +183,7 @@ struct LeafNode { LeafNode() - : texture(0), + : texture(nullptr), firstVertex(0), vertexCount(0), opacity(1.0), diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -494,15 +494,15 @@ } 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 @@ 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 @@ 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 @@ connect(screens(), &Screens::changed, this, [this]() { makeOpenGLContextCurrent(); delete m_lanczosFilter; - m_lanczosFilter = NULL; + m_lanczosFilter = nullptr; }); } m_lanczosFilter->performPaint(w, mask, region, data); @@ -1074,19 +1074,19 @@ SceneOpenGL::Window::Window(Toplevel* c) : Scene::Window(c) - , m_scene(NULL) + , m_scene(nullptr) { } 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; @@ -1288,7 +1288,7 @@ 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; @@ -1581,19 +1581,19 @@ // 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) { @@ -1617,55 +1617,55 @@ { 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) @@ -1936,7 +1936,7 @@ 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); @@ -1946,9 +1946,9 @@ 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; @@ -1981,9 +1981,9 @@ 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); @@ -2001,9 +2001,9 @@ 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/qpainter/scene_qpainter.cpp b/plugins/scenes/qpainter/scene_qpainter.cpp --- a/plugins/scenes/qpainter/scene_qpainter.cpp +++ b/plugins/scenes/qpainter/scene_qpainter.cpp @@ -53,7 +53,7 @@ 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 --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -80,7 +80,7 @@ OverlayWindow* XRenderBackend::overlayWindow() { - return NULL; + return nullptr; } void XRenderBackend::showOverlay() @@ -146,7 +146,7 @@ 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 @@ 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 @@ 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 @@ QScopedPointer backend; backend.reset(new X11XRenderBackend); if (backend->isFailed()) { - return NULL; + return nullptr; } return new SceneXrender(backend.take(), parent); } @@ -312,7 +312,7 @@ // 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 @@ void SceneXrender::Window::cleanup() { delete s_tempPicture; - s_tempPicture = NULL; + s_tempPicture = nullptr; delete s_fadeAlphaPicture; s_fadeAlphaPicture = nullptr; } @@ -392,7 +392,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { // 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 @@ :Shadow(toplevel) { for (int i=0; idesktop(), desktopMask, clippingRegion, data); - s_recursionCheck = NULL; + s_recursionCheck = nullptr; } } @@ -686,13 +686,13 @@ 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) { } @@ -839,7 +839,7 @@ 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 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -716,7 +716,7 @@ , 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() { - s_self = NULL; + s_self = nullptr; } void ScreenEdges::init() @@ -880,7 +880,7 @@ 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 --- a/screens.cpp +++ b/screens.cpp @@ -74,7 +74,7 @@ Screens::~Screens() { - s_self = NULL; + s_self = nullptr; } void Screens::init() diff --git a/scripting/dbuscall.h b/scripting/dbuscall.h --- a/scripting/dbuscall.h +++ b/scripting/dbuscall.h @@ -81,7 +81,7 @@ 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 --- a/scripting/screenedgeitem.h +++ b/scripting/screenedgeitem.h @@ -80,7 +80,7 @@ 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 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -357,7 +357,7 @@ 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 --- a/shadow.cpp +++ b/shadow.cpp @@ -51,7 +51,7 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) { if (!effects) { - return NULL; + return nullptr; } Shadow *shadow = createShadowFromDecoration(toplevel); if (!shadow && waylandServer()) { @@ -78,11 +78,11 @@ 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 --- a/sm.cpp +++ b/sm.cpp @@ -69,7 +69,7 @@ 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) @@ -288,7 +288,7 @@ info->active = (active_client == i); info->stackingOrder = cg.readEntry(QLatin1String("stackingOrder") + n, -1); info->tabGroup = cg.readEntry(QLatin1String("tabGroup") + n, 0); - info->tabGroupClient = NULL; + info->tabGroupClient = nullptr; info->activities = cg.readEntry(QLatin1String("activities") + n, QStringList()); } } @@ -319,7 +319,7 @@ */ SessionInfo* Workspace::takeSessionInfo(Client* c) { - SessionInfo *realInfo = 0; + SessionInfo *realInfo = nullptr; QByteArray sessionId = c->sessionId(); QByteArray windowRole = c->windowRole(); QByteArray wmCommand = c->wmCommand(); @@ -444,14 +444,14 @@ 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 @@ -470,8 +470,8 @@ 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; @@ -508,17 +508,17 @@ 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 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -1475,7 +1475,7 @@ { 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 @@ { 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/tabgroup.h b/tabgroup.h --- a/tabgroup.h +++ b/tabgroup.h @@ -138,7 +138,7 @@ * \p main as the primary client to copy the settings off. If \p only is set then only * that client is updated to match \p main. */ - void updateStates(AbstractClient* main, States states, AbstractClient* only = NULL); + void updateStates(AbstractClient* main, States states, AbstractClient* only = nullptr); /** * updates geometry restrictions of this group, basically called from Client::getWmNormalHints(), otherwise rather private diff --git a/tabgroup.cpp b/tabgroup.cpp --- a/tabgroup.cpp +++ b/tabgroup.cpp @@ -153,7 +153,7 @@ if (index < 0) return false; - c->setTabGroup(NULL); + c->setTabGroup(nullptr); m_clients.removeAt(index); updateMinMaxSize(); diff --git a/tests/pointerconstraintstest.cpp b/tests/pointerconstraintstest.cpp --- a/tests/pointerconstraintstest.cpp +++ b/tests/pointerconstraintstest.cpp @@ -260,7 +260,7 @@ 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.h b/thumbnailitem.h --- a/thumbnailitem.h +++ b/thumbnailitem.h @@ -56,7 +56,7 @@ 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 @@ 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 @@ 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/thumbnailitem.cpp b/thumbnailitem.cpp --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -121,8 +121,8 @@ WindowThumbnailItem::WindowThumbnailItem(QQuickItem* parent) : AbstractThumbnailItem(parent) - , m_wId(0) - , m_client(NULL) + , m_wId(nullptr) + , m_client(nullptr) { } @@ -136,10 +136,10 @@ 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/toplevel.cpp b/toplevel.cpp --- a/toplevel.cpp +++ b/toplevel.cpp @@ -42,14 +42,14 @@ 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(None) , is_shape(false) - , effect_window(NULL) + , effect_window(nullptr) , m_clientMachine(new ClientMachine(this)) , wmClientLeaderWin(0) , m_damageReplyPending(false) @@ -70,7 +70,7 @@ 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 @@ 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 @@ // owner by Deleted void Toplevel::disownDataPassedToDeleted() { - info = NULL; + info = nullptr; } QRect Toplevel::visibleRect() const @@ -295,13 +295,13 @@ 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(); } @@ -356,7 +356,7 @@ // 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 @@ -378,7 +378,7 @@ // 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; @@ -512,7 +512,7 @@ void Toplevel::deleteEffectWindow() { delete effect_window; - effect_window = NULL; + effect_window = nullptr; } void Toplevel::checkScreen() @@ -595,7 +595,7 @@ bool Toplevel::hasShadow() const { if (effectWindow() && effectWindow()->sceneWindow()) { - return effectWindow()->sceneWindow()->shadow() != NULL; + return effectWindow()->sceneWindow()->shadow() != nullptr; } return false; } @@ -605,16 +605,16 @@ if (effectWindow() && effectWindow()->sceneWindow()) { return effectWindow()->sceneWindow()->shadow(); } else { - return NULL; + return nullptr; } } 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 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -92,7 +92,7 @@ void Unmanaged::release(ReleaseReason releaseReason) { - Deleted* del = NULL; + Deleted* del = nullptr; if (releaseReason != ReleaseReason::KWinShutsDown) { del = Deleted::create(this); } diff --git a/useractions.h b/useractions.h --- a/useractions.h +++ b/useractions.h @@ -59,7 +59,7 @@ { 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/useractions.cpp b/useractions.cpp --- a/useractions.cpp +++ b/useractions.cpp @@ -77,25 +77,25 @@ UserActionsMenu::UserActionsMenu(QObject *parent) : QObject(parent) - , m_menu(NULL) - , m_desktopMenu(NULL) - , m_screenMenu(NULL) - , m_activityMenu(NULL) - , m_addTabsMenu(NULL) - , m_switchToTabMenu(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_removeFromTabGroup(NULL) - , m_closeTabGroup(NULL) + , m_menu(nullptr) + , m_desktopMenu(nullptr) + , m_screenMenu(nullptr) + , m_activityMenu(nullptr) + , m_addTabsMenu(nullptr) + , m_switchToTabMenu(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) + , m_removeFromTabGroup(nullptr) + , m_closeTabGroup(nullptr) { } @@ -171,7 +171,7 @@ 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)); @@ -379,14 +379,14 @@ 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_switchToTabMenu = NULL; - m_addTabsMenu = NULL; - m_scriptsMenu = NULL; + m_screenMenu = nullptr; + m_activityMenu = nullptr; + m_switchToTabMenu = nullptr; + m_addTabsMenu = nullptr; + m_scriptsMenu = nullptr; } void UserActionsMenu::menuAboutToShow() @@ -396,15 +396,15 @@ if (VirtualDesktopManager::self()->count() == 1) { delete m_desktopMenu; - m_desktopMenu = 0; + m_desktopMenu = nullptr; delete m_multipleDesktopsMenu; m_multipleDesktopsMenu = nullptr; } else { initDesktopPopup(); } if (screens()->count() == 1 || (!m_client->isMovable() && !m_client->isMovableAcrossScreens())) { delete m_screenMenu; - m_screenMenu = NULL; + m_screenMenu = nullptr; } else { initScreenPopup(); } @@ -431,12 +431,12 @@ m_addTabsMenu->setPalette(m_client->palette()); } else { delete m_addTabsMenu; - m_addTabsMenu = 0; + m_addTabsMenu = nullptr; } // drop the existing scripts menu delete m_scriptsMenu; - m_scriptsMenu = NULL; + m_scriptsMenu = nullptr; // ask scripts whether they want to add entries for the given Client QList scriptActions = Scripting::self()->actionsForUserActionMenu(m_client.data(), m_scriptsMenu); if (!scriptActions.isEmpty()) { @@ -466,7 +466,7 @@ qCDebug(KWIN_CORE) << "activities:" << openActivities_.size(); if (openActivities_.size() < 2) { delete m_activityMenu; - m_activityMenu = 0; + m_activityMenu = nullptr; } else { initActivityPopup(); } @@ -570,7 +570,7 @@ } } else { delete m_switchToTabMenu; - m_switchToTabMenu = 0; + m_switchToTabMenu = nullptr; } if (!m_addTabsMenu) { @@ -1075,8 +1075,8 @@ { if (active_popup) { active_popup->close(); - active_popup = NULL; - active_popup_client = NULL; + active_popup = nullptr; + active_popup_client = nullptr; } m_userActionsMenu->close(); } @@ -1120,7 +1120,7 @@ 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 ); @@ -1150,8 +1150,8 @@ 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(); } @@ -1161,7 +1161,7 @@ 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/utils.cpp b/utils.cpp --- a/utils.cpp +++ b/utils.cpp @@ -107,17 +107,17 @@ 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; } diff --git a/virtualdesktops.cpp b/virtualdesktops.cpp --- a/virtualdesktops.cpp +++ b/virtualdesktops.cpp @@ -232,13 +232,13 @@ 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.h b/workspace.h --- a/workspace.h +++ b/workspace.h @@ -331,7 +331,7 @@ 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/workspace.cpp b/workspace.cpp --- a/workspace.cpp +++ b/workspace.cpp @@ -99,31 +99,31 @@ } } -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 @@ options->loadConfig(); options->loadCompositingConfig(false); - delayFocusTimer = 0; + delayFocusTimer = nullptr; if (!sessionKey.isEmpty()) loadSessionInfo(sessionKey); @@ -281,7 +281,7 @@ QStringLiteral("refreshFonts"), this, SLOT(reconfigure())); - active_client = NULL; + active_client = nullptr; initWithX11(); @@ -517,15 +517,15 @@ --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); } @@ -581,7 +581,7 @@ // TODO: ungrabXServer(); Xcb::Extensions::destroy(); - _self = 0; + _self = nullptr; } void Workspace::setupClientConnections(AbstractClient *c) @@ -602,20 +602,20 @@ 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; } Unmanaged* Workspace::createUnmanaged(xcb_window_t w) { if (m_compositor && m_compositor->checkForOverlayWindow(w)) - return NULL; + return nullptr; 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); @@ -629,12 +629,12 @@ 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); @@ -651,7 +651,7 @@ 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(); @@ -696,15 +696,15 @@ 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(); @@ -798,14 +798,14 @@ 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; @@ -955,7 +955,7 @@ void Workspace::activateClientOnNewDesktop(uint desktop) { - AbstractClient* c = NULL; + AbstractClient* c = nullptr; if (options->focusPolicyIsReasonable()) { c = findClientToActivateOnDesktop(desktop); } @@ -965,11 +965,11 @@ 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); @@ -981,7 +981,7 @@ 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 @@ -1068,7 +1068,7 @@ // 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()) { @@ -1081,11 +1081,11 @@ 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); @@ -1243,7 +1243,7 @@ void Workspace::cancelDelayFocus() { delete delayFocusTimer; - delayFocusTimer = 0; + delayFocusTimer = nullptr; } bool Workspace::checkStartupNotification(xcb_window_t w, KStartupInfoId &id, KStartupInfoData &data) diff --git a/xcbutils.h b/xcbutils.h --- a/xcbutils.h +++ b/xcbutils.h @@ -263,11 +263,11 @@ } inline bool isNull() { getReply(); - return m_reply == NULL; + return m_reply == nullptr; } inline bool isNull() const { const_cast(this)->getReply(); - return m_reply == NULL; + return m_reply == nullptr; } inline operator bool() { return !isNull(); @@ -299,31 +299,31 @@ inline Reply *take() { getReply(); Reply *ret = m_reply; - m_reply = NULL; + m_reply = nullptr; m_window = XCB_WINDOW_NONE; return ret; } protected: AbstractWrapper() : m_retrieved(false) , m_window(XCB_WINDOW_NONE) - , m_reply(NULL) + , m_reply(nullptr) { m_cookie.sequence = 0; } explicit AbstractWrapper(WindowId window, Cookie cookie) : 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 @@ * @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 @@ * @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 @@ * @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 @@ * @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 @@ 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/xcbutils.cpp b/xcbutils.cpp --- a/xcbutils.cpp +++ b/xcbutils.cpp @@ -343,11 +343,11 @@ 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 @@ void Extensions::destroy() { delete s_self; - s_self = NULL; + s_self = nullptr; } Extensions::Extensions() @@ -499,7 +499,7 @@ 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 @@ //**************************************** 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 @@ 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 @@ 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/xkb.cpp b/xkb.cpp --- a/xkb.cpp +++ b/xkb.cpp @@ -69,8 +69,8 @@ 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 @@ 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 --- a/xwl/drag_x.cpp +++ b/xwl/drag_x.cpp @@ -408,8 +408,8 @@ 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 --- a/xwl/transfer.cpp +++ b/xwl/transfer.cpp @@ -265,7 +265,7 @@ 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 @@ 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;