Merge branch 'Plasma/5.17'

This commit is contained in:
Vlad Zahorodnii 2019-09-19 17:48:35 +03:00
commit d18fa5217b
124 changed files with 602 additions and 602 deletions

View file

@ -211,7 +211,7 @@ void AbstractClient::setActive(bool act)
? rules()->checkOpacityActive(qRound(opacity() * 100.0)) ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
: rules()->checkOpacityInactive(qRound(opacity() * 100.0)); : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
setOpacity(ruledOpacity / 100.0); setOpacity(ruledOpacity / 100.0);
workspace()->setActiveClient(act ? this : NULL); workspace()->setActiveClient(act ? this : nullptr);
if (!m_active) if (!m_active)
cancelAutoRaise(); cancelAutoRaise();

View file

@ -239,12 +239,12 @@ void Workspace::setActiveClient(AbstractClient* c)
StackingUpdatesBlocker blocker(this); StackingUpdatesBlocker blocker(this);
++set_active_client_recursion; ++set_active_client_recursion;
updateFocusMousePosition(Cursor::pos()); updateFocusMousePosition(Cursor::pos());
if (active_client != NULL) { if (active_client != nullptr) {
// note that this may call setActiveClient( NULL ), therefore the recursion counter // note that this may call setActiveClient( NULL ), therefore the recursion counter
active_client->setActive(false); active_client->setActive(false);
} }
active_client = c; active_client = c;
Q_ASSERT(c == NULL || c->isActive()); Q_ASSERT(c == nullptr || c->isActive());
if (active_client) { if (active_client) {
last_active_client = active_client; last_active_client = active_client;
@ -291,9 +291,9 @@ void Workspace::setActiveClient(AbstractClient* c)
*/ */
void Workspace::activateClient(AbstractClient* c, bool force) void Workspace::activateClient(AbstractClient* c, bool force)
{ {
if (c == NULL) { if (c == nullptr) {
focusToNull(); focusToNull();
setActiveClient(NULL); setActiveClient(nullptr);
return; return;
} }
raiseClient(c); raiseClient(c);
@ -358,7 +358,7 @@ void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags)
if (flags & ActivityFocus) { if (flags & ActivityFocus) {
AbstractClient* modal = c->findModal(); AbstractClient* modal = c->findModal();
if (modal != NULL && modal != c) { if (modal != nullptr && modal != c) {
if (!modal->isOnDesktop(c->desktop())) if (!modal->isOnDesktop(c->desktop()))
modal->setDesktop(c->desktop()); modal->setDesktop(c->desktop());
if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window if (!modal->isShown(true) && !modal->isMinimized()) // forced desktop or utility window
@ -434,7 +434,7 @@ AbstractClient *Workspace::clientUnderMouse(int screen) const
return client; return client;
} }
} }
return 0; return nullptr;
} }
// deactivates 'c' and activates next client // deactivates 'c' and activates next client
@ -446,9 +446,9 @@ bool Workspace::activateNextClient(AbstractClient* c)
closeActivePopup(); closeActivePopup();
if (c != NULL) { if (c != nullptr) {
if (c == active_client) if (c == active_client)
setActiveClient(NULL); setActiveClient(nullptr);
should_get_focus.removeAll(c); should_get_focus.removeAll(c);
} }
@ -462,7 +462,7 @@ bool Workspace::activateNextClient(AbstractClient* c)
if (!options->focusPolicyIsReasonable()) if (!options->focusPolicyIsReasonable())
return false; return false;
AbstractClient* get_focus = NULL; AbstractClient* get_focus = nullptr;
const int desktop = VirtualDesktopManager::self()->current(); const int desktop = VirtualDesktopManager::self()->current();
@ -473,7 +473,7 @@ bool Workspace::activateNextClient(AbstractClient* c)
get_focus = clientUnderMouse(c ? c->screen() : screens()->current()); get_focus = clientUnderMouse(c ? c->screen() : screens()->current());
if (get_focus && (get_focus == c || get_focus->isDesktop())) { 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 // should rather not happen, but it cannot get the focus. rest of usability is tested above
get_focus = NULL; get_focus = nullptr;
} }
} }
@ -492,10 +492,10 @@ bool Workspace::activateNextClient(AbstractClient* c)
} }
} }
if (get_focus == NULL) // last chance: focus the desktop if (get_focus == nullptr) // last chance: focus the desktop
get_focus = findDesktop(true, desktop); get_focus = findDesktop(true, desktop);
if (get_focus != NULL) if (get_focus != nullptr)
requestFocus(get_focus); requestFocus(get_focus);
else else
focusToNull(); focusToNull();
@ -513,9 +513,9 @@ void Workspace::setCurrentScreen(int new_screen)
closeActivePopup(); closeActivePopup();
const int desktop = VirtualDesktopManager::self()->current(); const int desktop = VirtualDesktopManager::self()->current();
AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen); AbstractClient *get_focus = FocusChain::self()->getForActivation(desktop, new_screen);
if (get_focus == NULL) if (get_focus == nullptr)
get_focus = findDesktop(true, desktop); get_focus = findDesktop(true, desktop);
if (get_focus != NULL && get_focus != mostRecentlyActivatedClient()) if (get_focus != nullptr && get_focus != mostRecentlyActivatedClient())
requestFocus(get_focus); requestFocus(get_focus);
screens()->setCurrent(new_screen); screens()->setCurrent(new_screen);
} }
@ -589,7 +589,7 @@ bool Workspace::allowClientActivation(const KWin::AbstractClient *c, xcb_timesta
// No active client, it's ok to pass focus // No active client, it's ok to pass focus
// NOTICE that extreme protection needs to be handled before to allow protection on unmanged windows // 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"; qCDebug(KWIN_CORE) << "Activation: No client active, allowing";
return true; // no active client -> always allow return true; // no active client -> always allow
} }
@ -643,7 +643,7 @@ bool Workspace::allowFullClientRaising(const KWin::AbstractClient *c, xcb_timest
return true; return true;
if (level == 4) // extreme if (level == 4) // extreme
return false; return false;
if (ac == NULL || ac->isDesktop()) { if (ac == nullptr || ac->isDesktop()) {
qCDebug(KWIN_CORE) << "Raising: No client active, allowing"; qCDebug(KWIN_CORE) << "Raising: No client active, allowing";
return true; // no active client -> always allow return true; // no active client -> always allow
} }
@ -706,7 +706,7 @@ void Client::updateUserTime(xcb_timestamp_t time)
&& (m_userTime == XCB_TIME_CURRENT_TIME && (m_userTime == XCB_TIME_CURRENT_TIME
|| NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time || NET::timestampCompare(time, m_userTime) > 0)) { // time > user_time
m_userTime = 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); group()->updateUserTime(m_userTime);
} }
@ -726,7 +726,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c
// newer ASN timestamp always replaces user timestamp, unless user timestamp is 0 // newer ASN timestamp always replaces user timestamp, unless user timestamp is 0
// helps e.g. with konqy reusing // helps e.g. with konqy reusing
if (asn_data != NULL && time != 0) { if (asn_data != nullptr && time != 0) {
if (asn_id->timestamp() != 0 if (asn_id->timestamp() != 0
&& (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) { && (time == -1U || NET::timestampCompare(asn_id->timestamp(), time) > 0)) {
time = asn_id->timestamp(); time = asn_id->timestamp();
@ -742,7 +742,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c
// from already running application if this application // from already running application if this application
// is not the active one (unless focus stealing prevention is turned off). // is not the active one (unless focus stealing prevention is turned off).
Client* act = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); Client* act = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient());
if (act != NULL && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) { if (act != nullptr && !belongToSameApplication(act, this, SameApplicationCheck::RelaxedForActive)) {
bool first_window = true; bool first_window = true;
auto sameApplicationActiveHackPredicate = [this](const Client *cl) { auto sameApplicationActiveHackPredicate = [this](const Client *cl) {
// ignore already existing splashes, toolbars, utilities and menus, // ignore already existing splashes, toolbars, utilities and menus,
@ -765,7 +765,7 @@ xcb_timestamp_t Client::readUserTimeMapTimestamp(const KStartupInfoId *asn_id, c
; // is transient for currently active window, even though it's not ; // is transient for currently active window, even though it's not
// the same app (e.g. kcookiejar dialog) -> allow activation // the same app (e.g. kcookiejar dialog) -> allow activation
else if (groupTransient() && else if (groupTransient() &&
findInList<Client, Client>(clientMainClients(), sameApplicationActiveHackPredicate) == NULL) findInList<Client, Client>(clientMainClients(), sameApplicationActiveHackPredicate) == nullptr)
; // standalone transient ; // standalone transient
else else
first_window = false; first_window = false;
@ -801,7 +801,7 @@ xcb_timestamp_t Client::userTime() const
xcb_timestamp_t time = m_userTime; xcb_timestamp_t time = m_userTime;
if (time == 0) // doesn't want focus after showing if (time == 0) // doesn't want focus after showing
return 0; return 0;
Q_ASSERT(group() != NULL); Q_ASSERT(group() != nullptr);
if (time == -1U if (time == -1U
|| (group()->userTime() != -1U || (group()->userTime() != -1U
&& NET::timestampCompare(group()->userTime(), time) > 0)) && NET::timestampCompare(group()->userTime(), time) > 0))

View file

@ -47,7 +47,7 @@ Activities::Activities(QObject *parent)
Activities::~Activities() Activities::~Activities()
{ {
s_self = NULL; s_self = nullptr;
} }
KActivities::Consumer::ServiceStatus Activities::serviceStatus() const KActivities::Consumer::ServiceStatus Activities::serviceStatus() const

View file

@ -106,17 +106,17 @@ Client::Client()
, m_managed(false) , m_managed(false)
, m_transientForId(XCB_WINDOW_NONE) , m_transientForId(XCB_WINDOW_NONE)
, m_originalTransientForId(XCB_WINDOW_NONE) , m_originalTransientForId(XCB_WINDOW_NONE)
, shade_below(NULL) , shade_below(nullptr)
, m_motif(atoms->motif_wm_hints) , m_motif(atoms->motif_wm_hints)
, blocks_compositing(false) , blocks_compositing(false)
, shadeHoverTimer(NULL) , shadeHoverTimer(nullptr)
, m_colormap(XCB_COLORMAP_NONE) , m_colormap(XCB_COLORMAP_NONE)
, in_group(NULL) , in_group(nullptr)
, ping_timer(NULL) , ping_timer(nullptr)
, m_killHelperPID(0) , m_killHelperPID(0)
, m_pingTimestamp(XCB_TIME_CURRENT_TIME) , m_pingTimestamp(XCB_TIME_CURRENT_TIME)
, m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet , m_userTime(XCB_TIME_CURRENT_TIME) // Not known yet
, allowed_actions(0) , allowed_actions(nullptr)
, shade_geometry_change(false) , shade_geometry_change(false)
, sm_stacking_order(-1) , sm_stacking_order(-1)
, activitiesDefined(false) , activitiesDefined(false)
@ -128,14 +128,14 @@ Client::Client()
{ {
// TODO: Do all as initialization // TODO: Do all as initialization
syncRequest.counter = syncRequest.alarm = XCB_NONE; syncRequest.counter = syncRequest.alarm = XCB_NONE;
syncRequest.timeout = syncRequest.failsafeTimeout = NULL; syncRequest.timeout = syncRequest.failsafeTimeout = nullptr;
syncRequest.lastTimestamp = xTime(); syncRequest.lastTimestamp = xTime();
syncRequest.isPending = false; syncRequest.isPending = false;
// Set the initial mapping state // Set the initial mapping state
mapping_state = Withdrawn; mapping_state = Withdrawn;
info = NULL; info = nullptr;
shade_mode = ShadeNone; shade_mode = ShadeNone;
deleting = false; deleting = false;
@ -214,7 +214,7 @@ void Client::releaseWindow(bool on_shutdown)
} }
#endif #endif
destroyWindowManagementInterface(); destroyWindowManagementInterface();
Deleted* del = NULL; Deleted* del = nullptr;
if (!on_shutdown) { if (!on_shutdown) {
del = Deleted::create(this); del = Deleted::create(this);
} }
@ -856,7 +856,7 @@ void Client::setShade(ShadeMode mode)
if (shade_mode == ShadeHover) { if (shade_mode == ShadeHover) {
ToplevelList order = workspace()->stackingOrder(); ToplevelList order = workspace()->stackingOrder();
// invalidate, since "this" could be the topmost toplevel and shade_below dangeling // 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?! // this is likely related to the index parameter?!
for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) {
shade_below = qobject_cast<Client*>(order.at(idx)); shade_below = qobject_cast<Client*>(order.at(idx));
@ -867,7 +867,7 @@ void Client::setShade(ShadeMode mode)
if (shade_below && shade_below->isNormalWindow()) if (shade_below && shade_below->isNormalWindow())
workspace()->raiseClient(this); workspace()->raiseClient(this);
else else
shade_below = NULL; shade_below = nullptr;
} }
m_wrapper.map(); m_wrapper.map();
m_client.map(); m_client.map();
@ -900,7 +900,7 @@ void Client::shadeUnhover()
void Client::cancelShadeHoverTimer() void Client::cancelShadeHoverTimer()
{ {
delete shadeHoverTimer; delete shadeHoverTimer;
shadeHoverTimer = 0; shadeHoverTimer = nullptr;
} }
void Client::toggleShade() void Client::toggleShade()
@ -1077,7 +1077,7 @@ void Client::updateHiddenPreview()
workspace()->forceRestacking(); workspace()->forceRestacking();
if (Xcb::Extensions::self()->isShapeInputAvailable()) { if (Xcb::Extensions::self()->isShapeInputAvailable()) {
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, 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 { } else {
workspace()->forceRestacking(); workspace()->forceRestacking();
@ -1155,7 +1155,7 @@ void Client::pingWindow()
return; // Can't ping :( return; // Can't ping :(
if (options->killPingTimeout() == 0) if (options->killPingTimeout() == 0)
return; // Turned off return; // Turned off
if (ping_timer != NULL) if (ping_timer != nullptr)
return; // Pinging already return; // Pinging already
ping_timer = new QTimer(this); ping_timer = new QTimer(this);
connect(ping_timer, &QTimer::timeout, this, connect(ping_timer, &QTimer::timeout, this,
@ -1188,7 +1188,7 @@ void Client::gotPing(xcb_timestamp_t timestamp)
if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0) if (NET::timestampCompare(timestamp, m_pingTimestamp) != 0)
return; return;
delete ping_timer; delete ping_timer;
ping_timer = NULL; ping_timer = nullptr;
setUnresponsive(false); setUnresponsive(false);
@ -1759,7 +1759,7 @@ void Client::setBlockingCompositing(bool block)
const bool usedToBlock = blocks_compositing; const bool usedToBlock = blocks_compositing;
blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing()); blocks_compositing = rules()->checkBlockCompositing(block && options->windowsBlockCompositing());
if (usedToBlock != blocks_compositing) { if (usedToBlock != blocks_compositing) {
emit blockingCompositingChanged(blocks_compositing ? this : 0); emit blockingCompositingChanged(blocks_compositing ? this : nullptr);
} }
} }
@ -1768,7 +1768,7 @@ void Client::updateAllowedActions(bool force)
if (!isManaged() && !force) if (!isManaged() && !force)
return; return;
NET::Actions old_allowed_actions = NET::Actions(allowed_actions); NET::Actions old_allowed_actions = NET::Actions(allowed_actions);
allowed_actions = 0; allowed_actions = nullptr;
if (isMovable()) if (isMovable())
allowed_actions |= NET::ActionMove; allowed_actions |= NET::ActionMove;
if (isResizable()) if (isResizable())

View file

@ -100,7 +100,7 @@ public:
AbstractClient* findModal(bool allow_itself = false) override; AbstractClient* findModal(bool allow_itself = false) override;
const Group* group() const override; const Group* group() const override;
Group* group() 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 changeClientLeaderGroup(Group* gr);
void updateWindowRules(Rules::Types selection) override; void updateWindowRules(Rules::Types selection) override;
void updateFullscreenMonitors(NETFullscreenMonitors topology); void updateFullscreenMonitors(NETFullscreenMonitors topology);

View file

@ -54,8 +54,8 @@ GetAddrInfo::GetAddrInfo(const QByteArray &hostName, QObject *parent)
, m_ownResolved(false) , m_ownResolved(false)
, m_hostName(hostName) , m_hostName(hostName)
, m_addressHints(new addrinfo) , m_addressHints(new addrinfo)
, m_address(NULL) , m_address(nullptr)
, m_ownAddress(NULL) , m_ownAddress(nullptr)
, m_watcher(new QFutureWatcher<int>(this)) , m_watcher(new QFutureWatcher<int>(this))
, m_ownAddressWatcher(new QFutureWatcher<int>(this)) , m_ownAddressWatcher(new QFutureWatcher<int>(this))
{ {

View file

@ -34,7 +34,7 @@ class GetAddrInfo : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit GetAddrInfo(const QByteArray &hostName, QObject *parent = NULL); explicit GetAddrInfo(const QByteArray &hostName, QObject *parent = nullptr);
~GetAddrInfo() override; ~GetAddrInfo() override;
void resolve(); void resolve();
@ -64,7 +64,7 @@ class ClientMachine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ClientMachine(QObject *parent = NULL); explicit ClientMachine(QObject *parent = nullptr);
~ClientMachine() override; ~ClientMachine() override;
void resolve(xcb_window_t window, xcb_window_t clientLeader); void resolve(xcb_window_t window, xcb_window_t clientLeader);

View file

@ -94,7 +94,7 @@ void Manager::init()
// Monitor for the time changing (flags == TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET). // 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: // However these are not exposed in glibc so value is hardcoded:
::timerfd_settime(timeChangedFd, 3, &timespec, 0); ::timerfd_settime(timeChangedFd, 3, &timespec, nullptr);
connect(this, &QObject::destroyed, [timeChangedFd]() { connect(this, &QObject::destroyed, [timeChangedFd]() {
::close(timeChangedFd); ::close(timeChangedFd);

View file

@ -121,11 +121,11 @@ static inline qint64 nanoToMilli(int nano) { return nano / (1000*1000); }
Compositor::Compositor(QObject* workspace) Compositor::Compositor(QObject* workspace)
: QObject(workspace) : QObject(workspace)
, m_state(State::Off) , m_state(State::Off)
, m_selectionOwner(NULL) , m_selectionOwner(nullptr)
, vBlankInterval(0) , vBlankInterval(0)
, fpsInterval(0) , fpsInterval(0)
, m_timeSinceLastVBlank(0) , m_timeSinceLastVBlank(0)
, m_scene(NULL) , m_scene(nullptr)
, m_bufferSwapPending(false) , m_bufferSwapPending(false)
, m_composeAtSwapCompletion(false) , m_composeAtSwapCompletion(false)
{ {
@ -176,7 +176,7 @@ Compositor::~Compositor()
stop(); stop();
deleteUnusedSupportProperties(); deleteUnusedSupportProperties();
destroyCompositorSelection(); destroyCompositorSelection();
s_compositor = NULL; s_compositor = nullptr;
} }
bool Compositor::setupStart() bool Compositor::setupStart()
@ -250,12 +250,12 @@ bool Compositor::setupStart()
} }
} }
if (m_scene == NULL || m_scene->initFailed()) { if (m_scene == nullptr || m_scene->initFailed()) {
qCCritical(KWIN_CORE) << "Failed to initialize compositing, compositing disabled"; qCCritical(KWIN_CORE) << "Failed to initialize compositing, compositing disabled";
m_state = State::Off; m_state = State::Off;
delete m_scene; delete m_scene;
m_scene = NULL; m_scene = nullptr;
if (m_selectionOwner) { if (m_selectionOwner) {
m_selectionOwner->setOwning(false); m_selectionOwner->setOwning(false);
@ -449,7 +449,7 @@ void Compositor::stop()
} }
delete m_scene; delete m_scene;
m_scene = NULL; m_scene = nullptr;
compositeTimer.stop(); compositeTimer.stop();
repaints_region = QRegion(); repaints_region = QRegion();

View file

@ -102,7 +102,7 @@ public:
* @return bool @c true if there is a Compositor and it is active, @c false otherwise * @return bool @c true if there is a Compositor and it is active, @c false otherwise
*/ */
static bool compositing() { static bool compositing() {
return s_compositor != NULL && s_compositor->isActive(); return s_compositor != nullptr && s_compositor->isActive();
} }
// for delayed supportproperty management of effects // for delayed supportproperty management of effects

View file

@ -56,7 +56,7 @@ Cursor::Cursor(QObject *parent)
Cursor::~Cursor() Cursor::~Cursor()
{ {
s_self = NULL; s_self = nullptr;
} }
void Cursor::loadThemeSettings() void Cursor::loadThemeSettings()

View file

@ -92,7 +92,7 @@ void Deleted::discard()
void Deleted::copyToDeleted(Toplevel* c) void Deleted::copyToDeleted(Toplevel* c)
{ {
Q_ASSERT(dynamic_cast< Deleted* >(c) == NULL); Q_ASSERT(dynamic_cast< Deleted* >(c) == nullptr);
Toplevel::copyToDeleted(c); Toplevel::copyToDeleted(c);
desk = c->desktop(); desk = c->desktop();
m_desktops = c->desktops(); m_desktops = c->desktops();

View file

@ -102,7 +102,7 @@ static xcb_atom_t registerSupportProperty(const QByteArray &propertyName)
// get the atom for the propertyName // get the atom for the propertyName
ScopedCPointer<xcb_intern_atom_reply_t> atomReply(xcb_intern_atom_reply(c, ScopedCPointer<xcb_intern_atom_reply_t> atomReply(xcb_intern_atom_reply(c,
xcb_intern_atom_unchecked(c, false, propertyName.size(), propertyName.constData()), xcb_intern_atom_unchecked(c, false, propertyName.size(), propertyName.constData()),
NULL)); nullptr));
if (atomReply.isNull()) { if (atomReply.isNull()) {
return XCB_ATOM_NONE; return XCB_ATOM_NONE;
} }
@ -117,8 +117,8 @@ static xcb_atom_t registerSupportProperty(const QByteArray &propertyName)
EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
: EffectsHandler(scene->compositingType()) : EffectsHandler(scene->compositingType())
, keyboard_grab_effect(NULL) , keyboard_grab_effect(nullptr)
, fullscreen_effect(0) , fullscreen_effect(nullptr)
, next_window_quad_type(EFFECT_QUAD_TYPE_START) , next_window_quad_type(EFFECT_QUAD_TYPE_START)
, m_compositor(compositor) , m_compositor(compositor)
, m_scene(scene) , m_scene(scene)
@ -150,7 +150,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
[this](int old, AbstractClient *c) { [this](int old, AbstractClient *c) {
const int newDesktop = VirtualDesktopManager::self()->current(); const int newDesktop = VirtualDesktopManager::self()->current();
if (old != 0 && newDesktop != old) { 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 // TODO: remove in 4.10
emit desktopChanged(old, newDesktop); emit desktopChanged(old, newDesktop);
} }
@ -464,7 +464,7 @@ Effect *EffectsHandlerImpl::provides(Effect::Feature ef)
for (int i = 0; i < loaded_effects.size(); ++i) for (int i = 0; i < loaded_effects.size(); ++i)
if (loaded_effects.at(i).second->provides(ef)) if (loaded_effects.at(i).second->provides(ef))
return loaded_effects.at(i).second; return loaded_effects.at(i).second;
return NULL; return nullptr;
} }
void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) void EffectsHandlerImpl::drawWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data)
@ -620,7 +620,7 @@ void EffectsHandlerImpl::slotGeometryShapeChanged(Toplevel* t, const QRect& old)
{ {
// during late cleanup effectWindow() may be already NULL // during late cleanup effectWindow() may be already NULL
// in some functions that may still call this // in some functions that may still call this
if (t == NULL || t->effectWindow() == NULL) if (t == nullptr || t->effectWindow() == nullptr)
return; return;
emit windowGeometryShapeChanged(t->effectWindow(), old); emit windowGeometryShapeChanged(t->effectWindow(), old);
} }
@ -629,7 +629,7 @@ void EffectsHandlerImpl::slotPaddingChanged(Toplevel* t, const QRect& old)
{ {
// during late cleanup effectWindow() may be already NULL // during late cleanup effectWindow() may be already NULL
// in some functions that may still call this // in some functions that may still call this
if (t == NULL || t->effectWindow() == NULL) if (t == nullptr || t->effectWindow() == nullptr)
return; return;
emit windowPaddingChanged(t->effectWindow(), old); emit windowPaddingChanged(t->effectWindow(), old);
} }
@ -659,7 +659,7 @@ bool EffectsHandlerImpl::hasActiveFullScreenEffect() const
bool EffectsHandlerImpl::grabKeyboard(Effect* effect) bool EffectsHandlerImpl::grabKeyboard(Effect* effect)
{ {
if (keyboard_grab_effect != NULL) if (keyboard_grab_effect != nullptr)
return false; return false;
if (!doGrabKeyboard()) { if (!doGrabKeyboard()) {
return false; return false;
@ -675,9 +675,9 @@ bool EffectsHandlerImpl::doGrabKeyboard()
void EffectsHandlerImpl::ungrabKeyboard() void EffectsHandlerImpl::ungrabKeyboard()
{ {
Q_ASSERT(keyboard_grab_effect != NULL); Q_ASSERT(keyboard_grab_effect != nullptr);
doUngrabKeyboard(); doUngrabKeyboard();
keyboard_grab_effect = NULL; keyboard_grab_effect = nullptr;
} }
void EffectsHandlerImpl::doUngrabKeyboard() void EffectsHandlerImpl::doUngrabKeyboard()
@ -686,7 +686,7 @@ void EffectsHandlerImpl::doUngrabKeyboard()
void EffectsHandlerImpl::grabbedKeyboardEvent(QKeyEvent* e) void EffectsHandlerImpl::grabbedKeyboardEvent(QKeyEvent* e)
{ {
if (keyboard_grab_effect != NULL) if (keyboard_grab_effect != nullptr)
keyboard_grab_effect->grabbedKeyboardEvent(e); keyboard_grab_effect->grabbedKeyboardEvent(e);
} }
@ -788,7 +788,7 @@ void* EffectsHandlerImpl::getProxy(QString name)
if ((*it).first == name) if ((*it).first == name)
return (*it).second->proxy(); return (*it).second->proxy();
return NULL; return nullptr;
} }
void EffectsHandlerImpl::startMousePolling() void EffectsHandlerImpl::startMousePolling()
@ -805,7 +805,7 @@ void EffectsHandlerImpl::stopMousePolling()
bool EffectsHandlerImpl::hasKeyboardGrab() const bool EffectsHandlerImpl::hasKeyboardGrab() const
{ {
return keyboard_grab_effect != NULL; return keyboard_grab_effect != nullptr;
} }
void EffectsHandlerImpl::desktopResized(const QSize &size) void EffectsHandlerImpl::desktopResized(const QSize &size)
@ -885,7 +885,7 @@ void EffectsHandlerImpl::activateWindow(EffectWindow* c)
EffectWindow* EffectsHandlerImpl::activeWindow() const 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) void EffectsHandlerImpl::moveWindow(EffectWindow* w, const QPoint& pos, bool snap, double snapAdjust)
@ -1072,7 +1072,7 @@ EffectWindow* EffectsHandlerImpl::findWindow(WId id) const
return w->effectWindow(); return w->effectWindow();
} }
} }
return NULL; return nullptr;
} }
EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const EffectWindow* EffectsHandlerImpl::findWindow(KWayland::Server::SurfaceInterface *surf) const
@ -1207,7 +1207,7 @@ EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const
if (auto c = TabBox::TabBox::self()->currentClient()) if (auto c = TabBox::TabBox::self()->currentClient())
return c->effectWindow(); return c->effectWindow();
#endif #endif
return NULL; return nullptr;
} }
void EffectsHandlerImpl::addRepaintFull() void EffectsHandlerImpl::addRepaintFull()
@ -2149,13 +2149,13 @@ EffectWindowList EffectWindowGroupImpl::members() const
//**************************************** //****************************************
EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment) EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint position, Qt::Alignment alignment)
: QObject(0) : QObject(nullptr)
, EffectFrame() , EffectFrame()
, m_style(style) , m_style(style)
, m_static(staticSize) , m_static(staticSize)
, m_point(position) , m_point(position)
, m_alignment(alignment) , m_alignment(alignment)
, m_shader(NULL) , m_shader(nullptr)
, m_theme(new Plasma::Theme(this)) , m_theme(new Plasma::Theme(this))
{ {
if (m_style == EffectFrameStyled) { if (m_style == EffectFrameStyled) {
@ -2271,7 +2271,7 @@ void EffectFrameImpl::render(QRegion region, double opacity, double frameOpacity
if (m_geometry.isEmpty()) { if (m_geometry.isEmpty()) {
return; // Nothing to display return; // Nothing to display
} }
m_shader = NULL; m_shader = nullptr;
setScreenProjectionMatrix(static_cast<EffectsHandlerImpl*>(effects)->scene()->screenProjectionMatrix()); setScreenProjectionMatrix(static_cast<EffectsHandlerImpl*>(effects)->scene()->screenProjectionMatrix());
effects->paintEffectFrame(this, region, opacity, frameOpacity); effects->paintEffectFrame(this, region, opacity, frameOpacity);
} }

View file

@ -34,7 +34,7 @@ using namespace KWin;
ContrastShader::ContrastShader() ContrastShader::ContrastShader()
: mValid(false), shader(NULL), m_opacity(1) : mValid(false), shader(nullptr), m_opacity(1)
{ {
} }
@ -51,7 +51,7 @@ ContrastShader *ContrastShader::create()
void ContrastShader::reset() void ContrastShader::reset()
{ {
delete shader; delete shader;
shader = NULL; shader = nullptr;
setIsValid(false); setIsValid(false);
} }

View file

@ -31,7 +31,7 @@ class BlurEffectConfig : public KCModule
Q_OBJECT Q_OBJECT
public: public:
explicit BlurEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList()); explicit BlurEffectConfig(QWidget *parent = nullptr, const QVariantList& args = QVariantList());
~BlurEffectConfig() override; ~BlurEffectConfig() override;
void save() override; void save() override;

View file

@ -50,8 +50,8 @@ CoverSwitchEffect::CoverSwitchEffect()
, zPosition(900.0) , zPosition(900.0)
, scaleFactor(0.0) , scaleFactor(0.0)
, direction(Left) , direction(Left)
, selected_window(0) , selected_window(nullptr)
, captionFrame(NULL) , captionFrame(nullptr)
, primaryTabBox(false) , primaryTabBox(false)
, secondaryTabBox(false) , secondaryTabBox(false)
{ {
@ -65,7 +65,7 @@ CoverSwitchEffect::CoverSwitchEffect()
if (effects->compositingType() == OpenGL2Compositing) { if (effects->compositingType() == OpenGL2Compositing) {
m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("coverswitch-reflection.glsl")); m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("coverswitch-reflection.glsl"));
} else { } else {
m_reflectionShader = NULL; m_reflectionShader = nullptr;
} }
connect(effects, &EffectsHandler::windowClosed, this, &CoverSwitchEffect::slotWindowClosed); connect(effects, &EffectsHandler::windowClosed, this, &CoverSwitchEffect::slotWindowClosed);
connect(effects, &EffectsHandler::tabBoxAdded, this, &CoverSwitchEffect::slotTabBoxAdded); connect(effects, &EffectsHandler::tabBoxAdded, this, &CoverSwitchEffect::slotTabBoxAdded);
@ -123,7 +123,7 @@ void CoverSwitchEffect::prePaintScreen(ScreenPrePaintData& data, int time)
if (animation || start || stop) { if (animation || start || stop) {
timeLine.update(std::chrono::milliseconds(time)); timeLine.update(std::chrono::milliseconds(time));
} }
if (selected_window == NULL) if (selected_window == nullptr)
abort(); abort();
} }
effects->prePaintScreen(data, time); effects->prePaintScreen(data, time);
@ -292,7 +292,7 @@ void CoverSwitchEffect::postPaintScreen()
timeLine.reset(); timeLine.reset();
if (stop) { if (stop) {
stop = false; stop = false;
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
foreach (EffectWindow * window, referrencedWindows) { foreach (EffectWindow * window, referrencedWindows) {
window->unrefWindow(); window->unrefWindow();
} }
@ -547,7 +547,7 @@ void CoverSwitchEffect::slotTabBoxClosed()
stopRequested = true; stopRequested = true;
} }
} else { } else {
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
start = false; start = false;
animation = false; animation = false;
timeLine.reset(); timeLine.reset();
@ -565,7 +565,7 @@ void CoverSwitchEffect::slotTabBoxUpdated()
if (animateSwitch && currentWindowList.count() > 1) { if (animateSwitch && currentWindowList.count() > 1) {
// determine the switch direction // determine the switch direction
if (selected_window != effects->currentTabBoxWindow()) { if (selected_window != effects->currentTabBoxWindow()) {
if (selected_window != NULL) { if (selected_window != nullptr) {
int old_index = currentWindowList.indexOf(selected_window); int old_index = currentWindowList.indexOf(selected_window);
int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow()); int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow());
Direction new_direction; Direction new_direction;
@ -701,7 +701,7 @@ void CoverSwitchEffect::paintWindowCover(EffectWindow* w, bool reflectedWindow,
void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow) void CoverSwitchEffect::paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow)
{ {
if (frontWindow == NULL) if (frontWindow == nullptr)
return; return;
bool specialHandlingForward = false; bool specialHandlingForward = false;
WindowPaintData data(frontWindow); WindowPaintData data(frontWindow);
@ -764,7 +764,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
xTranslate = ((float)screenSize.width() * 0.5 * scaleFactor) - (float)width * 0.5f; xTranslate = ((float)screenSize.width() * 0.5 * scaleFactor) - (float)width * 0.5f;
// handling for additional window from other side // handling for additional window from other side
// has to appear on this side after half of the time // 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); WindowPaintData data(additionalWindow);
if (effects->numScreens() > 1) { if (effects->numScreens() > 1) {
data.setProjectionMatrix(m_projectionMatrix); data.setProjectionMatrix(m_projectionMatrix);
@ -786,7 +786,7 @@ void CoverSwitchEffect::paintWindows(const EffectWindowList& windows, bool left,
// normal behaviour // normal behaviour
for (int i = 0; i < windows.count(); i++) { for (int i = 0; i < windows.count(); i++) {
window = windows.at(i); window = windows.at(i);
if (window == NULL || window->isDeleted()) { if (window == nullptr || window->isDeleted()) {
continue; continue;
} }
WindowPaintData data(window); WindowPaintData data(window);
@ -918,7 +918,7 @@ void CoverSwitchEffect::abort()
effects->unrefTabBox(); effects->unrefTabBox();
effects->stopMouseInterception(this); effects->stopMouseInterception(this);
} }
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
timeLine.reset(); timeLine.reset();
mActivated = false; mActivated = false;
stop = false; stop = false;
@ -930,7 +930,7 @@ void CoverSwitchEffect::abort()
void CoverSwitchEffect::slotWindowClosed(EffectWindow* c) void CoverSwitchEffect::slotWindowClosed(EffectWindow* c)
{ {
if (c == selected_window) if (c == selected_window)
selected_window = 0; selected_window = nullptr;
// if the list is not empty, the effect is active // if the list is not empty, the effect is active
if (!currentWindowList.isEmpty()) { if (!currentWindowList.isEmpty()) {
c->refWindow(); c->refWindow();

View file

@ -107,7 +107,7 @@ private:
bool reflectedWindows = false); bool reflectedWindows = false);
void paintWindowCover(EffectWindow* w, bool reflectedWindow, WindowPaintData& data); void paintWindowCover(EffectWindow* w, bool reflectedWindow, WindowPaintData& data);
void paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow); 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); void selectNextOrPreviousWindow(bool forward);
inline void selectNextWindow() { selectNextOrPreviousWindow(true); } inline void selectNextWindow() { selectNextOrPreviousWindow(true); }
inline void selectPreviousWindow() { selectNextOrPreviousWindow(false); } inline void selectPreviousWindow() { selectNextOrPreviousWindow(false); }

View file

@ -40,7 +40,7 @@ class CoverSwitchEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CoverSwitchEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit CoverSwitchEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;

View file

@ -56,13 +56,13 @@ CubeEffect::CubeEffect()
, cubeOpacity(1.0) , cubeOpacity(1.0)
, opacityDesktopOnly(true) , opacityDesktopOnly(true)
, displayDesktopName(false) , displayDesktopName(false)
, desktopNameFrame(NULL) , desktopNameFrame(nullptr)
, reflection(true) , reflection(true)
, desktopChangedWhileRotating(false) , desktopChangedWhileRotating(false)
, paintCaps(true) , paintCaps(true)
, wallpaper(NULL) , wallpaper(nullptr)
, texturedCaps(true) , texturedCaps(true)
, capTexture(NULL) , capTexture(nullptr)
, reflectionPainting(false) , reflectionPainting(false)
, activeScreen(0) , activeScreen(0)
, bottomCap(false) , bottomCap(false)
@ -74,12 +74,12 @@ CubeEffect::CubeEffect()
, shortcutsRegistered(false) , shortcutsRegistered(false)
, mode(Cube) , mode(Cube)
, useShaders(false) , useShaders(false)
, cylinderShader(0) , cylinderShader(nullptr)
, sphereShader(0) , sphereShader(nullptr)
, zOrderingFactor(0.0f) , zOrderingFactor(0.0f)
, mAddedHeightCoeff1(0.0f) , mAddedHeightCoeff1(0.0f)
, mAddedHeightCoeff2(0.0f) , mAddedHeightCoeff2(0.0f)
, m_cubeCapBuffer(NULL) , m_cubeCapBuffer(nullptr)
, m_proxy(this) , m_proxy(this)
, m_cubeAction(new QAction(this)) , m_cubeAction(new QAction(this))
, m_cylinderAction(new QAction(this)) , m_cylinderAction(new QAction(this))
@ -93,8 +93,8 @@ CubeEffect::CubeEffect()
m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-reflection.glsl")); m_reflectionShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-reflection.glsl"));
m_capShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-cap.glsl")); m_capShader = ShaderManager::instance()->generateShaderFromResources(ShaderTrait::MapTexture, QString(), QStringLiteral("cube-cap.glsl"));
} else { } else {
m_reflectionShader = NULL; m_reflectionShader = nullptr;
m_capShader = NULL; m_capShader = nullptr;
} }
m_textureMirrorMatrix.scale(1.0, -1.0, 1.0); m_textureMirrorMatrix.scale(1.0, -1.0, 1.0);
m_textureMirrorMatrix.translate(0.0, -1.0, 0.0); m_textureMirrorMatrix.translate(0.0, -1.0, 0.0);
@ -179,9 +179,9 @@ void CubeEffect::reconfigure(ReconfigureFlags)
capDeformationFactor = (float)CubeConfig::capDeformation() / 100.0f; capDeformationFactor = (float)CubeConfig::capDeformation() / 100.0f;
useZOrdering = CubeConfig::zOrdering(); useZOrdering = CubeConfig::zOrdering();
delete wallpaper; delete wallpaper;
wallpaper = NULL; wallpaper = nullptr;
delete capTexture; delete capTexture;
capTexture = NULL; capTexture = nullptr;
texturedCaps = CubeConfig::texturedCaps(); texturedCaps = CubeConfig::texturedCaps();
timeLine.setEasingCurve(QEasingCurve::InOutSine); timeLine.setEasingCurve(QEasingCurve::InOutSine);
@ -282,7 +282,7 @@ void CubeEffect::slotCubeCapLoaded()
} }
// need to recreate the VBO for the cube cap // need to recreate the VBO for the cube cap
delete m_cubeCapBuffer; delete m_cubeCapBuffer;
m_cubeCapBuffer = NULL; m_cubeCapBuffer = nullptr;
effects->addRepaintFull(); effects->addRepaintFull();
} }
watcher->deleteLater(); watcher->deleteLater();
@ -844,7 +844,7 @@ void CubeEffect::paintCubeCap()
} }
delete m_cubeCapBuffer; delete m_cubeCapBuffer;
m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); 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() void CubeEffect::paintCylinderCap()
@ -899,7 +899,7 @@ void CubeEffect::paintCylinderCap()
} }
delete m_cubeCapBuffer; delete m_cubeCapBuffer;
m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); 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() void CubeEffect::paintSphereCap()
@ -956,7 +956,7 @@ void CubeEffect::paintSphereCap()
} }
delete m_cubeCapBuffer; delete m_cubeCapBuffer;
m_cubeCapBuffer = new GLVertexBuffer(GLVertexBuffer::Static); 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() void CubeEffect::postPaintScreen()
@ -975,9 +975,9 @@ void CubeEffect::postPaintScreen()
keyboard_grab = false; keyboard_grab = false;
effects->stopMouseInterception(this); effects->stopMouseInterception(this);
effects->setCurrentDesktop(frontDesktop); effects->setCurrentDesktop(frontDesktop);
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
delete m_cubeCapBuffer; delete m_cubeCapBuffer;
m_cubeCapBuffer = NULL; m_cubeCapBuffer = nullptr;
if (desktopNameFrame) if (desktopNameFrame)
desktopNameFrame->free(); desktopNameFrame->free();
activated = false; activated = false;
@ -1314,7 +1314,7 @@ void CubeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPa
QColor color = capColor; QColor color = capColor;
capColor.setAlphaF(cubeOpacity); capColor.setAlphaF(cubeOpacity);
vbo->setColor(color); 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) { if (!capShader || mode == Cube) {
// TODO: use sphere and cylinder shaders // TODO: use sphere and cylinder shaders
vbo->render(GL_TRIANGLES); vbo->render(GL_TRIANGLES);

View file

@ -40,7 +40,7 @@ class CubeEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CubeEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit CubeEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;

View file

@ -387,7 +387,7 @@ void CubeSlideEffect::postPaintScreen()
w->setData(WindowForceBackgroundContrastRole, QVariant()); w->setData(WindowForceBackgroundContrastRole, QVariant());
} }
staticWindows.clear(); staticWindows.clear();
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
} }
} }
effects->addRepaintFull(); effects->addRepaintFull();
@ -586,7 +586,7 @@ void CubeSlideEffect::slotWindowStepUserMovedResized(EffectWindow* w)
timeLine.setCurrentTime(0); timeLine.setCurrentTime(0);
if (!slideRotations.isEmpty()) if (!slideRotations.isEmpty())
slideRotations.clear(); slideRotations.clear();
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
effects->addRepaintFull(); effects->addRepaintFull();
} }
} }

View file

@ -40,7 +40,7 @@ class CubeSlideEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CubeSlideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit CubeSlideEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;

View file

@ -57,7 +57,7 @@ DesktopGridEffect::DesktopGridEffect()
, wasWindowCopy(false) , wasWindowCopy(false)
, wasDesktopMove(false) , wasDesktopMove(false)
, isValidMove(false) , isValidMove(false)
, windowMove(NULL) , windowMove(nullptr)
, windowMoveDiff() , windowMoveDiff()
, gridSize() , gridSize()
, orientation(Qt::Horizontal) , orientation(Qt::Horizontal)
@ -66,7 +66,7 @@ DesktopGridEffect::DesktopGridEffect()
, unscaledBorder() , unscaledBorder()
, scaledSize() , scaledSize()
, scaledOffset() , scaledOffset()
, m_proxy(0) , m_proxy(nullptr)
, m_activateAction(new QAction(this)) , m_activateAction(new QAction(this))
{ {
initConfig<DesktopGridConfig>(); initConfig<DesktopGridConfig>();
@ -428,7 +428,7 @@ void DesktopGridEffect::slotWindowClosed(EffectWindow* w)
return; return;
if (w == windowMove) { if (w == windowMove) {
effects->setElevatedWindow(windowMove, false); effects->setElevatedWindow(windowMove, false);
windowMove = NULL; windowMove = nullptr;
} }
if (isUsingPresentWindows()) { if (isUsingPresentWindows()) {
foreach (const int i, desktopList(w)) { foreach (const int i, desktopList(w)) {
@ -443,7 +443,7 @@ void DesktopGridEffect::slotWindowClosed(EffectWindow* w)
void DesktopGridEffect::slotWindowDeleted(EffectWindow* w) void DesktopGridEffect::slotWindowDeleted(EffectWindow* w)
{ {
if (w == windowMove) if (w == windowMove)
windowMove = 0; windowMove = nullptr;
foreach (DesktopButtonsView *view, m_desktopButtonsViews) { foreach (DesktopButtonsView *view, m_desktopButtonsViews) {
if (view->effectWindow && view->effectWindow == w) { if (view->effectWindow && view->effectWindow == w) {
view->effectWindow = nullptr; view->effectWindow = nullptr;
@ -494,7 +494,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
if (e->type() == QEvent::MouseMove) { if (e->type() == QEvent::MouseMove) {
int d = posToDesktop(me->pos()); int d = posToDesktop(me->pos());
if (windowMove != NULL && if (windowMove != nullptr &&
(me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) { (me->pos() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) {
// Handle window moving // Handle window moving
if (!wasWindowMove) { // Activate on move if (!wasWindowMove) { // Activate on move
@ -522,7 +522,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
if (windowMove->isMovable() && !isUsingPresentWindows()) { if (windowMove->isMovable() && !isUsingPresentWindows()) {
wasWindowMove = true; wasWindowMove = true;
int screen = effects->screenNumber(me->pos()); 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 (wasWindowMove) {
if (effects->waylandDisplay() && (me->modifiers() & Qt::ControlModifier)) { if (effects->waylandDisplay() && (me->modifiers() & Qt::ControlModifier)) {
@ -603,25 +603,25 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
dragStartPos = me->pos(); dragStartPos = me->pos();
sourceDesktop = posToDesktop(me->pos()); sourceDesktop = posToDesktop(me->pos());
bool isDesktop = (me->modifiers() & Qt::ShiftModifier); bool isDesktop = (me->modifiers() & Qt::ShiftModifier);
EffectWindow* w = isDesktop ? NULL : windowAt(me->pos()); EffectWindow* w = isDesktop ? nullptr : windowAt(me->pos());
if (w != NULL) if (w != nullptr)
isDesktop = w->isDesktop(); isDesktop = w->isDesktop();
if (isDesktop) if (isDesktop)
m_originalMovingDesktop = posToDesktop(me->pos()); m_originalMovingDesktop = posToDesktop(me->pos());
else else
m_originalMovingDesktop = 0; 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 // Prepare it for moving
windowMoveDiff = w->pos() - unscalePos(me->pos(), NULL); windowMoveDiff = w->pos() - unscalePos(me->pos(), nullptr);
windowMove = w; windowMove = w;
effects->setElevatedWindow(windowMove, true); 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()); EffectWindow* w = windowAt(me->pos());
if (w && w->isDesktop()) { if (w && w->isDesktop()) {
w = nullptr; w = nullptr;
} }
if (w != NULL) { if (w != nullptr) {
const int desktop = posToDesktop(me->pos()); const int desktop = posToDesktop(me->pos());
if (w->isOnAllDesktops()) { if (w->isOnAllDesktops()) {
effects->windowToDesktop(w, desktop); effects->windowToDesktop(w, desktop);
@ -675,7 +675,7 @@ void DesktopGridEffect::windowInputMouseEvent(QEvent* e)
effects->addRepaintFull(); effects->addRepaintFull();
} }
effects->setElevatedWindow(windowMove, false); effects->setElevatedWindow(windowMove, false);
windowMove = NULL; windowMove = nullptr;
} }
wasWindowMove = false; wasWindowMove = false;
wasWindowCopy = false; wasWindowCopy = false;
@ -687,7 +687,7 @@ void DesktopGridEffect::grabbedKeyboardEvent(QKeyEvent* e)
{ {
if (timeline.currentValue() != 1) // Block user input during animations if (timeline.currentValue() != 1) // Block user input during animations
return; return;
if (windowMove != NULL) if (windowMove != nullptr)
return; return;
if (e->type() == QEvent::KeyPress) { if (e->type() == QEvent::KeyPress) {
// check for global shortcuts // check for global shortcuts
@ -823,7 +823,7 @@ QPoint DesktopGridEffect::unscalePos(const QPoint& pos, int* desktop) const
int gy = qBound(0, int(scaledY), gridSize.height() - 1); int gy = qBound(0, int(scaledY), gridSize.height() - 1);
scaledX -= gx; scaledX -= gx;
scaledY -= gy; scaledY -= gy;
if (desktop != NULL) { if (desktop != nullptr) {
if (orientation == Qt::Horizontal) if (orientation == Qt::Horizontal)
*desktop = gy * gridSize.width() + gx + 1; *desktop = gy * gridSize.width() + gx + 1;
else else
@ -879,7 +879,7 @@ EffectWindow* DesktopGridEffect::windowAt(QPoint pos) const
int desktop; int desktop;
pos = unscalePos(pos, &desktop); pos = unscalePos(pos, &desktop);
if (desktop > effects->numberOfDesktops()) if (desktop > effects->numberOfDesktops())
return NULL; return nullptr;
if (isUsingPresentWindows()) { if (isUsingPresentWindows()) {
const int screen = effects->screenNumber(pos); const int screen = effects->screenNumber(pos);
EffectWindow *w = EffectWindow *w =
@ -896,7 +896,7 @@ EffectWindow* DesktopGridEffect::windowAt(QPoint pos) const
return w; return w;
} }
} }
return NULL; return nullptr;
} }
void DesktopGridEffect::setCurrentDesktop(int desktop) void DesktopGridEffect::setCurrentDesktop(int desktop)
@ -1223,13 +1223,13 @@ void DesktopGridEffect::finish()
effects->ungrabKeyboard(); effects->ungrabKeyboard();
keyboardGrab = false; keyboardGrab = false;
effects->stopMouseInterception(this); effects->stopMouseInterception(this);
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
if (isUsingPresentWindows()) { if (isUsingPresentWindows()) {
while (!m_managers.isEmpty()) { while (!m_managers.isEmpty()) {
m_managers.first().unmanageAll(); m_managers.first().unmanageAll();
m_managers.removeFirst(); m_managers.removeFirst();
} }
m_proxy = 0; m_proxy = nullptr;
} }
} }
@ -1256,7 +1256,7 @@ bool DesktopGridEffect::isMotionManagerMovingWindows() const
bool DesktopGridEffect::isUsingPresentWindows() const bool DesktopGridEffect::isUsingPresentWindows() const
{ {
return (m_proxy != NULL); return (m_proxy != nullptr);
} }
// transforms the geometry of the moved window to a geometry on the desktop // transforms the geometry of the moved window to a geometry on the desktop

View file

@ -36,7 +36,7 @@ class DesktopButtonsView : public QQuickView
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DesktopButtonsView(QWindow *parent = 0); explicit DesktopButtonsView(QWindow *parent = nullptr);
void windowInputMouseEvent(QMouseEvent* e); void windowInputMouseEvent(QMouseEvent* e);
void setAddDesktopEnabled(bool enable); void setAddDesktopEnabled(bool enable);
void setRemoveDesktopEnabled(bool enable); void setRemoveDesktopEnabled(bool enable);
@ -119,7 +119,7 @@ private Q_SLOTS:
private: private:
QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const; 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; int posToDesktop(const QPoint& pos) const;
EffectWindow* windowAt(QPoint pos) const; EffectWindow* windowAt(QPoint pos) const;
void setCurrentDesktop(int desktop); void setCurrentDesktop(int desktop);

View file

@ -73,7 +73,7 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant
m_ui->shortcutEditor->addCollection(m_actionCollection); m_ui->shortcutEditor->addCollection(m_actionCollection);
m_ui->desktopNameAlignmentCombo->addItem(i18nc("Desktop name alignment:", "Disabled"), QVariant(Qt::Alignment(0))); m_ui->desktopNameAlignmentCombo->addItem(i18nc("Desktop name alignment:", "Disabled"), QVariant(Qt::Alignment(nullptr)));
m_ui->desktopNameAlignmentCombo->addItem(i18n("Top"), QVariant(Qt::AlignHCenter | Qt::AlignTop)); m_ui->desktopNameAlignmentCombo->addItem(i18n("Top"), QVariant(Qt::AlignHCenter | Qt::AlignTop));
m_ui->desktopNameAlignmentCombo->addItem(i18n("Top-Right"), QVariant(Qt::AlignRight | Qt::AlignTop)); m_ui->desktopNameAlignmentCombo->addItem(i18n("Top-Right"), QVariant(Qt::AlignRight | Qt::AlignTop));
m_ui->desktopNameAlignmentCombo->addItem(i18n("Right"), QVariant(Qt::AlignRight | Qt::AlignVCenter)); m_ui->desktopNameAlignmentCombo->addItem(i18n("Right"), QVariant(Qt::AlignRight | Qt::AlignVCenter));

View file

@ -41,7 +41,7 @@ class DesktopGridEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DesktopGridEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit DesktopGridEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~DesktopGridEffectConfig() override; ~DesktopGridEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -45,7 +45,7 @@ FlipSwitchEffect::FlipSwitchEffect()
, m_stop(false) , m_stop(false)
, m_animation(false) , m_animation(false)
, m_hasKeyboardGrab(false) , m_hasKeyboardGrab(false)
, m_captionFrame(NULL) , m_captionFrame(nullptr)
{ {
initConfig<FlipSwitchConfig>(); initConfig<FlipSwitchConfig>();
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
@ -153,7 +153,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
index = index % tempList.count(); index = index % tempList.count();
} }
tabIndex = index; tabIndex = index;
EffectWindow* w = NULL; EffectWindow* w = nullptr;
if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) { if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) {
index--; index--;
if (index < 0) if (index < 0)
@ -180,7 +180,7 @@ void FlipSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
index = 0; index = 0;
} }
tabIndex = index; tabIndex = index;
EffectWindow* w = NULL; EffectWindow* w = nullptr;
if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) { if (!m_scheduledDirections.isEmpty() && m_scheduledDirections.head() == DirectionBackward) {
index++; index++;
if (index >= tempList.count()) if (index >= tempList.count())
@ -331,7 +331,7 @@ void FlipSwitchEffect::postPaintScreen()
m_stop = false; m_stop = false;
m_active = false; m_active = false;
m_captionFrame->free(); m_captionFrame->free();
effects->setActiveFullScreenEffect(0); effects->setActiveFullScreenEffect(nullptr);
effects->addRepaintFull(); effects->addRepaintFull();
qDeleteAll(m_windows); qDeleteAll(m_windows);
m_windows.clear(); m_windows.clear();
@ -437,7 +437,7 @@ void FlipSwitchEffect::slotTabBoxUpdated()
if (!effects->currentTabBoxWindowList().isEmpty()) { if (!effects->currentTabBoxWindowList().isEmpty()) {
// determine the switch direction // determine the switch direction
if (m_selectedWindow != effects->currentTabBoxWindow()) { if (m_selectedWindow != effects->currentTabBoxWindow()) {
if (m_selectedWindow != NULL) { if (m_selectedWindow != nullptr) {
int old_index = effects->currentTabBoxWindowList().indexOf(m_selectedWindow); int old_index = effects->currentTabBoxWindowList().indexOf(m_selectedWindow);
int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow()); int new_index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow());
SwitchingDirection new_direction; SwitchingDirection new_direction;
@ -485,7 +485,7 @@ void FlipSwitchEffect::slotWindowAdded(EffectWindow* w)
void FlipSwitchEffect::slotWindowClosed(EffectWindow* w) void FlipSwitchEffect::slotWindowClosed(EffectWindow* w)
{ {
if (m_selectedWindow == w) if (m_selectedWindow == w)
m_selectedWindow = 0; m_selectedWindow = nullptr;
if (m_active) { if (m_active) {
QHash< const EffectWindow*, ItemInfo* >::iterator it = m_windows.find(w); QHash< const EffectWindow*, ItemInfo* >::iterator it = m_windows.find(w);
if (it != m_windows.end()) { if (it != m_windows.end()) {

View file

@ -41,7 +41,7 @@ class FlipSwitchEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit FlipSwitchEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit FlipSwitchEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~FlipSwitchEffectConfig() override; ~FlipSwitchEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -26,7 +26,7 @@ namespace KWin
HighlightWindowEffect::HighlightWindowEffect() HighlightWindowEffect::HighlightWindowEffect()
: m_finishing(false) : m_finishing(false)
, m_fadeDuration(float(animationTime(150))) , m_fadeDuration(float(animationTime(150)))
, m_monitorWindow(NULL) , m_monitorWindow(nullptr)
{ {
m_atom = effects->announceSupportProperty("_KDE_WINDOW_HIGHLIGHT", this); m_atom = effects->announceSupportProperty("_KDE_WINDOW_HIGHLIGHT", this);
connect(effects, &EffectsHandler::windowAdded, this, &HighlightWindowEffect::slotWindowAdded); connect(effects, &EffectsHandler::windowAdded, this, &HighlightWindowEffect::slotWindowAdded);
@ -259,7 +259,7 @@ void HighlightWindowEffect::prepareHighlighting()
void HighlightWindowEffect::finishHighlighting() void HighlightWindowEffect::finishHighlighting()
{ {
m_finishing = true; m_finishing = true;
m_monitorWindow = NULL; m_monitorWindow = nullptr;
m_highlightedWindows.clear(); m_highlightedWindows.clear();
if (!m_windowOpacity.isEmpty()) if (!m_windowOpacity.isEmpty())
m_windowOpacity.constBegin().key()->addRepaintFull(); m_windowOpacity.constBegin().key()->addRepaintFull();

View file

@ -49,7 +49,7 @@ public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow* w); void slotWindowAdded(KWin::EffectWindow* w);
void slotWindowClosed(KWin::EffectWindow *w); void slotWindowClosed(KWin::EffectWindow *w);
void slotWindowDeleted(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: private:
void prepareHighlighting(); void prepareHighlighting();

View file

@ -37,7 +37,7 @@ namespace KWin
InvertEffect::InvertEffect() InvertEffect::InvertEffect()
: m_inited(false), : m_inited(false),
m_valid(true), m_valid(true),
m_shader(NULL), m_shader(nullptr),
m_allWindows(false) m_allWindows(false)
{ {
QAction* a = new QAction(this); QAction* a = new QAction(this);

View file

@ -32,7 +32,7 @@ class InvertEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit InvertEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit InvertEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~InvertEffectConfig() override; ~InvertEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -45,10 +45,10 @@ LookingGlassEffect::LookingGlassEffect()
: zoom(1.0f) : zoom(1.0f)
, target_zoom(1.0f) , target_zoom(1.0f)
, polling(false) , polling(false)
, m_texture(NULL) , m_texture(nullptr)
, m_fbo(NULL) , m_fbo(nullptr)
, m_vbo(NULL) , m_vbo(nullptr)
, m_shader(NULL) , m_shader(nullptr)
, m_enabled(false) , m_enabled(false)
, m_valid(false) , m_valid(false)
{ {

View file

@ -41,7 +41,7 @@ class LookingGlassEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LookingGlassEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit LookingGlassEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~LookingGlassEffectConfig() override; ~LookingGlassEffectConfig() override;
void save() override; void save() override;

View file

@ -134,7 +134,7 @@ void MagicLampEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
icon = QRect(pt, QSize(0, 0)); icon = QRect(pt, QSize(0, 0));
} else { } else {
// Assumption: there is a panel containing the icon position // Assumption: there is a panel containing the icon position
EffectWindow* panel = NULL; EffectWindow* panel = nullptr;
foreach (EffectWindow * window, effects->stackingOrder()) { foreach (EffectWindow * window, effects->stackingOrder()) {
if (!window->isDock()) if (!window->isDock())
continue; continue;

View file

@ -40,7 +40,7 @@ class MagicLampEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MagicLampEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit MagicLampEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;

View file

@ -44,8 +44,8 @@ MagnifierEffect::MagnifierEffect()
: zoom(1) : zoom(1)
, target_zoom(1) , target_zoom(1)
, polling(false) , polling(false)
, m_texture(0) , m_texture(nullptr)
, m_fbo(0) , m_fbo(nullptr)
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
, m_pixmap(XCB_PIXMAP_NONE) , m_pixmap(XCB_PIXMAP_NONE)
#endif #endif
@ -127,8 +127,8 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time)
// zoom ended - delete FBO and texture // zoom ended - delete FBO and texture
delete m_fbo; delete m_fbo;
delete m_texture; delete m_texture;
m_fbo = NULL; m_fbo = nullptr;
m_texture = NULL; m_texture = nullptr;
destroyPixmap(); destroyPixmap();
} }
} }
@ -195,7 +195,7 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH; verts << areaF.left() - FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
verts << areaF.right() + FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH; verts << areaF.right() + FRAME_WIDTH << areaF.bottom() + FRAME_WIDTH;
verts << areaF.right() + FRAME_WIDTH << areaF.bottom(); 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); ShaderBinder binder(ShaderTrait::UniformColor);
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix()); binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix());
@ -228,10 +228,10 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
xform.matrix22 = DOUBLE_TO_FIXED(1.0/zoom); xform.matrix22 = DOUBLE_TO_FIXED(1.0/zoom);
#undef DOUBLE_TO_FIXED #undef DOUBLE_TO_FIXED
xcb_render_set_picture_transform(xcbConnection(), *m_picture, xform); xcb_render_set_picture_transform(xcbConnection(), *m_picture, xform);
xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast<char*>("good"), 0, NULL); xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast<char*>("good"), 0, nullptr);
xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_SRC, *m_picture, 0, effects->xrenderBufferPicture(), 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() ); 0, 0, 0, 0, area.x(), area.y(), area.width(), area.height() );
xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast<char*>("fast"), 0, NULL); xcb_render_set_picture_filter(xcbConnection(), *m_picture, 4, const_cast<char*>("fast"), 0, nullptr);
xcb_render_set_picture_transform(xcbConnection(), *m_picture, identity); xcb_render_set_picture_transform(xcbConnection(), *m_picture, identity);
const xcb_rectangle_t rects[4] = { 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)}, { int16_t(area.x()+FRAME_WIDTH), int16_t(area.y()), uint16_t(area.width()-FRAME_WIDTH), uint16_t(FRAME_WIDTH)},
@ -290,8 +290,8 @@ void MagnifierEffect::zoomOut()
effects->makeOpenGLContextCurrent(); effects->makeOpenGLContextCurrent();
delete m_fbo; delete m_fbo;
delete m_texture; delete m_texture;
m_fbo = NULL; m_fbo = nullptr;
m_texture = NULL; m_texture = nullptr;
destroyPixmap(); destroyPixmap();
} }
} }

View file

@ -41,7 +41,7 @@ class MagnifierEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MagnifierEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit MagnifierEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~MagnifierEffectConfig() override; ~MagnifierEffectConfig() override;
void save() override; void save() override;

View file

@ -164,7 +164,7 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&,
if (buttons == oldButtons) if (buttons == oldButtons)
return; return;
MouseEvent* m = NULL; MouseEvent* m = nullptr;
int i = BUTTON_COUNT; int i = BUTTON_COUNT;
while (--i >= 0) { while (--i >= 0) {
MouseButton* b = m_buttons[i]; MouseButton* b = m_buttons[i];
@ -187,7 +187,7 @@ void MouseClickEffect::slotMouseChanged(const QPoint& pos, const QPoint&,
EffectFrame* MouseClickEffect::createEffectFrame(const QPoint& pos, const QString& text) { EffectFrame* MouseClickEffect::createEffectFrame(const QPoint& pos, const QString& text) {
if (!m_showText) { if (!m_showText) {
return NULL; return nullptr;
} }
QPoint point(pos.x() + m_ringMaxSize, pos.y()); QPoint point(pos.x() + m_ringMaxSize, pos.y());
EffectFrame* frame = effects->effectFrame(EffectFrameStyled, false, point, Qt::AlignLeft); EffectFrame* frame = effects->effectFrame(EffectFrameStyled, false, point, Qt::AlignLeft);
@ -295,7 +295,7 @@ void MouseClickEffect::drawCircleGl(const QColor& color, float cx, float cy, flo
x = c * x - s * y; x = c * x - s * y;
y = s * t + c * 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); vbo->render(GL_LINE_LOOP);
} }

View file

@ -41,7 +41,7 @@ class MouseClickEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MouseClickEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit MouseClickEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~MouseClickEffectConfig() override; ~MouseClickEffectConfig() override;
void save() override; void save() override;

View file

@ -138,7 +138,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
foreach (const QPoint & p, mark) { foreach (const QPoint & p, mark) {
verts << p.x() << p.y(); 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); vbo->render(GL_LINE_STRIP);
} }
if (!drawing.isEmpty()) { if (!drawing.isEmpty()) {
@ -147,7 +147,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
foreach (const QPoint & p, drawing) { foreach (const QPoint & p, drawing) {
verts << p.x() << p.y(); 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); vbo->render(GL_LINE_STRIP);
} }
glLineWidth(1.0); glLineWidth(1.0);

View file

@ -41,7 +41,7 @@ class MouseMarkEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MouseMarkEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit MouseMarkEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~MouseMarkEffectConfig() override; ~MouseMarkEffectConfig() override;
void save() override; void save() override;

View file

@ -55,12 +55,12 @@ PresentWindowsEffect::PresentWindowsEffect()
, m_decalOpacity(0.0) , m_decalOpacity(0.0)
, m_hasKeyboardGrab(false) , m_hasKeyboardGrab(false)
, m_mode(ModeCurrentDesktop) , m_mode(ModeCurrentDesktop)
, m_managerWindow(NULL) , m_managerWindow(nullptr)
, m_needInitialSelection(false) , m_needInitialSelection(false)
, m_highlightedWindow(NULL) , m_highlightedWindow(nullptr)
, m_filterFrame(NULL) , m_filterFrame(nullptr)
, m_closeView(NULL) , m_closeView(nullptr)
, m_closeWindow(NULL) , m_closeWindow(nullptr)
, m_exposeAction(new QAction(this)) , m_exposeAction(new QAction(this))
, m_exposeAllAction(new QAction(this)) , m_exposeAllAction(new QAction(this))
, m_exposeClassAction(new QAction(this)) , m_exposeClassAction(new QAction(this))
@ -250,7 +250,7 @@ void PresentWindowsEffect::postPaintScreen()
w->setData(WindowForceBlurRole, QVariant()); w->setData(WindowForceBlurRole, QVariant());
w->setData(WindowForceBackgroundContrastRole, QVariant()); w->setData(WindowForceBackgroundContrastRole, QVariant());
} }
effects->setActiveFullScreenEffect(NULL); effects->setActiveFullScreenEffect(nullptr);
effects->addRepaintFull(); effects->addRepaintFull();
} else if (m_activated && m_needInitialSelection) { } else if (m_activated && m_needInitialSelection) {
m_needInitialSelection = false; m_needInitialSelection = false;
@ -325,7 +325,7 @@ void PresentWindowsEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &d
winData->referenced = false; winData->referenced = false;
w->unrefWindow(); w->unrefWindow();
if (w == m_closeWindow) { if (w == m_closeWindow) {
m_closeWindow = NULL; m_closeWindow = nullptr;
} }
} else } else
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
@ -487,7 +487,7 @@ void PresentWindowsEffect::slotWindowAdded(EffectWindow *w)
void PresentWindowsEffect::slotWindowClosed(EffectWindow *w) void PresentWindowsEffect::slotWindowClosed(EffectWindow *w)
{ {
if (m_managerWindow == w) if (m_managerWindow == w)
m_managerWindow = NULL; m_managerWindow = nullptr;
DataHash::iterator winData = m_windowData.find(w); DataHash::iterator winData = m_windowData.find(w);
if (winData == m_windowData.end()) if (winData == m_windowData.end())
return; return;
@ -589,7 +589,7 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type
// We cannot use m_motionManager.windowAtPoint() as the window might not be visible // We cannot use m_motionManager.windowAtPoint() as the window might not be visible
EffectWindowList windows = m_motionManager.managedWindows(); EffectWindowList windows = m_motionManager.managedWindows();
bool hovering = false; bool hovering = false;
EffectWindow *highlightCandidate = NULL; EffectWindow *highlightCandidate = nullptr;
for (int i = 0; i < windows.size(); ++i) { for (int i = 0; i < windows.size(); ++i) {
DataHash::const_iterator winData = m_windowData.constFind(windows.at(i)); DataHash::const_iterator winData = m_windowData.constFind(windows.at(i));
if (winData == m_windowData.constEnd()) if (winData == m_windowData.constEnd())
@ -603,7 +603,7 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type
} }
} }
if (!hovering) if (!hovering)
setHighlightedWindow(NULL); setHighlightedWindow(nullptr);
if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos)) if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos))
updateCloseWindow(); updateCloseWindow();
else if (m_closeView) else if (m_closeView)
@ -951,7 +951,7 @@ void PresentWindowsEffect::rearrangeWindows()
} }
} }
if (windowlist.isEmpty()) { if (windowlist.isEmpty()) {
setHighlightedWindow(NULL); setHighlightedWindow(nullptr);
return; return;
} }
@ -986,7 +986,7 @@ void PresentWindowsEffect::rearrangeWindows()
} }
// Resize text frames if required // 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()) { foreach (EffectWindow * w, m_motionManager.managedWindows()) {
DataHash::iterator winData = m_windowData.find(w); DataHash::iterator winData = m_windowData.find(w);
if (winData == m_windowData.end()) if (winData == m_windowData.end())
@ -1534,7 +1534,7 @@ void PresentWindowsEffect::setActive(bool active)
m_needInitialSelection = true; m_needInitialSelection = true;
m_closeButtonCorner = (Qt::Corner)effects->kwinOption(KWin::CloseButtonCorner).toInt(); m_closeButtonCorner = (Qt::Corner)effects->kwinOption(KWin::CloseButtonCorner).toInt();
m_decalOpacity = 0.0; m_decalOpacity = 0.0;
m_highlightedWindow = NULL; m_highlightedWindow = nullptr;
m_windowFilter.clear(); m_windowFilter.clear();
if (!(m_doNotCloseWindows || m_closeView)) { if (!(m_doNotCloseWindows || m_closeView)) {
@ -1643,7 +1643,7 @@ void PresentWindowsEffect::setActive(bool active)
m_managerWindow->deleteProperty(m_atomDesktop); m_managerWindow->deleteProperty(m_atomDesktop);
else if (m_mode == ModeWindowGroup && m_atomWindows != XCB_ATOM_NONE) else if (m_mode == ModeWindowGroup && m_atomWindows != XCB_ATOM_NONE)
m_managerWindow->deleteProperty(m_atomWindows); m_managerWindow->deleteProperty(m_atomWindows);
m_managerWindow = NULL; m_managerWindow = nullptr;
} }
} }
effects->addRepaintFull(); // Trigger the first repaint effects->addRepaintFull(); // Trigger the first repaint
@ -1709,7 +1709,7 @@ bool PresentWindowsEffect::isVisibleWindow(EffectWindow *w)
void PresentWindowsEffect::setHighlightedWindow(EffectWindow *w) void PresentWindowsEffect::setHighlightedWindow(EffectWindow *w)
{ {
if (w == m_highlightedWindow || (w != NULL && !m_motionManager.isManaging(w))) if (w == m_highlightedWindow || (w != nullptr && !m_motionManager.isManaging(w)))
return; return;
if (m_closeView) if (m_closeView)
@ -1800,7 +1800,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
for (int i = 0; i < xdiff; i++) { for (int i = 0; i < xdiff; i++) {
QRectF wArea = m_motionManager.transformedGeometry(w); QRectF wArea = m_motionManager.transformedGeometry(w);
detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); detectRect = QRect(0, wArea.y(), area.width(), wArea.height());
next = NULL; next = nullptr;
foreach (EffectWindow * e, m_motionManager.managedWindows()) { foreach (EffectWindow * e, m_motionManager.managedWindows()) {
DataHash::const_iterator winData = m_windowData.find(e); DataHash::const_iterator winData = m_windowData.find(e);
if (winData == m_windowData.end() || !winData->visible) if (winData == m_windowData.end() || !winData->visible)
@ -1808,7 +1808,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
QRectF eArea = m_motionManager.transformedGeometry(e); QRectF eArea = m_motionManager.transformedGeometry(e);
if (eArea.intersects(detectRect) && if (eArea.intersects(detectRect) &&
eArea.x() > wArea.x()) { eArea.x() > wArea.x()) {
if (next == NULL) if (next == nullptr)
next = e; next = e;
else { else {
QRectF nArea = m_motionManager.transformedGeometry(next); QRectF nArea = m_motionManager.transformedGeometry(next);
@ -1817,7 +1817,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
} }
} }
} }
if (next == NULL) { if (next == nullptr) {
if (wrap) // We are at the right-most window, now get the left-most one to wrap if (wrap) // We are at the right-most window, now get the left-most one to wrap
return relativeWindow(w, -1000, 0, false); return relativeWindow(w, -1000, 0, false);
break; // No more windows to the right break; // No more windows to the right
@ -1830,7 +1830,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
for (int i = 0; i < -xdiff; i++) { for (int i = 0; i < -xdiff; i++) {
QRectF wArea = m_motionManager.transformedGeometry(w); QRectF wArea = m_motionManager.transformedGeometry(w);
detectRect = QRect(0, wArea.y(), area.width(), wArea.height()); detectRect = QRect(0, wArea.y(), area.width(), wArea.height());
next = NULL; next = nullptr;
foreach (EffectWindow * e, m_motionManager.managedWindows()) { foreach (EffectWindow * e, m_motionManager.managedWindows()) {
DataHash::const_iterator winData = m_windowData.find(e); DataHash::const_iterator winData = m_windowData.find(e);
if (winData == m_windowData.end() || !winData->visible) if (winData == m_windowData.end() || !winData->visible)
@ -1838,7 +1838,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
QRectF eArea = m_motionManager.transformedGeometry(e); QRectF eArea = m_motionManager.transformedGeometry(e);
if (eArea.intersects(detectRect) && if (eArea.intersects(detectRect) &&
eArea.x() + eArea.width() < wArea.x() + wArea.width()) { eArea.x() + eArea.width() < wArea.x() + wArea.width()) {
if (next == NULL) if (next == nullptr)
next = e; next = e;
else { else {
QRectF nArea = m_motionManager.transformedGeometry(next); QRectF nArea = m_motionManager.transformedGeometry(next);
@ -1847,7 +1847,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
} }
} }
} }
if (next == NULL) { if (next == nullptr) {
if (wrap) // We are at the left-most window, now get the right-most one to wrap if (wrap) // We are at the left-most window, now get the right-most one to wrap
return relativeWindow(w, 1000, 0, false); return relativeWindow(w, 1000, 0, false);
break; // No more windows to the left break; // No more windows to the left
@ -1865,7 +1865,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
for (int i = 0; i < ydiff; i++) { for (int i = 0; i < ydiff; i++) {
QRectF wArea = m_motionManager.transformedGeometry(w); QRectF wArea = m_motionManager.transformedGeometry(w);
detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); detectRect = QRect(wArea.x(), 0, wArea.width(), area.height());
next = NULL; next = nullptr;
foreach (EffectWindow * e, m_motionManager.managedWindows()) { foreach (EffectWindow * e, m_motionManager.managedWindows()) {
DataHash::const_iterator winData = m_windowData.find(e); DataHash::const_iterator winData = m_windowData.find(e);
if (winData == m_windowData.end() || !winData->visible) if (winData == m_windowData.end() || !winData->visible)
@ -1873,7 +1873,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
QRectF eArea = m_motionManager.transformedGeometry(e); QRectF eArea = m_motionManager.transformedGeometry(e);
if (eArea.intersects(detectRect) && if (eArea.intersects(detectRect) &&
eArea.y() > wArea.y()) { eArea.y() > wArea.y()) {
if (next == NULL) if (next == nullptr)
next = e; next = e;
else { else {
QRectF nArea = m_motionManager.transformedGeometry(next); QRectF nArea = m_motionManager.transformedGeometry(next);
@ -1882,7 +1882,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
} }
} }
} }
if (next == NULL) { if (next == nullptr) {
if (wrap) // We are at the bottom-most window, now get the top-most one to wrap if (wrap) // We are at the bottom-most window, now get the top-most one to wrap
return relativeWindow(w, 0, -1000, false); return relativeWindow(w, 0, -1000, false);
break; // No more windows to the bottom break; // No more windows to the bottom
@ -1895,7 +1895,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
for (int i = 0; i < -ydiff; i++) { for (int i = 0; i < -ydiff; i++) {
QRectF wArea = m_motionManager.transformedGeometry(w); QRectF wArea = m_motionManager.transformedGeometry(w);
detectRect = QRect(wArea.x(), 0, wArea.width(), area.height()); detectRect = QRect(wArea.x(), 0, wArea.width(), area.height());
next = NULL; next = nullptr;
foreach (EffectWindow * e, m_motionManager.managedWindows()) { foreach (EffectWindow * e, m_motionManager.managedWindows()) {
DataHash::const_iterator winData = m_windowData.find(e); DataHash::const_iterator winData = m_windowData.find(e);
if (winData == m_windowData.end() || !winData->visible) if (winData == m_windowData.end() || !winData->visible)
@ -1903,7 +1903,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
QRectF eArea = m_motionManager.transformedGeometry(e); QRectF eArea = m_motionManager.transformedGeometry(e);
if (eArea.intersects(detectRect) && if (eArea.intersects(detectRect) &&
eArea.y() + eArea.height() < wArea.y() + wArea.height()) { eArea.y() + eArea.height() < wArea.y() + wArea.height()) {
if (next == NULL) if (next == nullptr)
next = e; next = e;
else { else {
QRectF nArea = m_motionManager.transformedGeometry(next); QRectF nArea = m_motionManager.transformedGeometry(next);
@ -1912,7 +1912,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
} }
} }
} }
if (next == NULL) { if (next == nullptr) {
if (wrap) // We are at the top-most window, now get the bottom-most one to wrap if (wrap) // We are at the top-most window, now get the bottom-most one to wrap
return relativeWindow(w, 0, 1000, false); return relativeWindow(w, 0, 1000, false);
break; // No more windows to the top break; // No more windows to the top
@ -1928,7 +1928,7 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
EffectWindow* PresentWindowsEffect::findFirstWindow() const EffectWindow* PresentWindowsEffect::findFirstWindow() const
{ {
EffectWindow *topLeft = NULL; EffectWindow *topLeft = nullptr;
QRectF topLeftGeometry; QRectF topLeftGeometry;
foreach (EffectWindow * w, m_motionManager.managedWindows()) { foreach (EffectWindow * w, m_motionManager.managedWindows()) {
DataHash::const_iterator winData = m_windowData.find(w); DataHash::const_iterator winData = m_windowData.find(w);
@ -1939,7 +1939,7 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const
continue; // Not visible continue; // Not visible
if (winData->deleted) if (winData->deleted)
continue; // Window has been closed continue; // Window has been closed
if (topLeft == NULL) { if (topLeft == nullptr) {
topLeft = w; topLeft = w;
topLeftGeometry = geometry; topLeftGeometry = geometry;
} else if (geometry.x() < topLeftGeometry.x() || geometry.y() < topLeftGeometry.y()) { } else if (geometry.x() < topLeftGeometry.x() || geometry.y() < topLeftGeometry.y()) {

View file

@ -36,7 +36,7 @@ class CloseWindowView : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit CloseWindowView(QObject *parent = 0); explicit CloseWindowView(QObject *parent = nullptr);
void windowInputMouseEvent(QMouseEvent* e); void windowInputMouseEvent(QMouseEvent* e);
void disarm(); void disarm();

View file

@ -40,7 +40,7 @@ class PresentWindowsEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PresentWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit PresentWindowsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~PresentWindowsEffectConfig() override; ~PresentWindowsEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -38,7 +38,7 @@ namespace KWin
ResizeEffect::ResizeEffect() ResizeEffect::ResizeEffect()
: AnimationEffect() : AnimationEffect()
, m_active(false) , m_active(false)
, m_resizeWindow(0) , m_resizeWindow(nullptr)
{ {
initConfig<ResizeConfig>(); initConfig<ResizeConfig>();
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
@ -102,7 +102,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window
verts << r.x() + r.width() << r.y() + r.height(); verts << r.x() + r.width() << r.y() + r.height();
verts << r.x() + r.width() << r.y(); 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); vbo->render(GL_TRIANGLES);
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
@ -159,7 +159,7 @@ void ResizeEffect::slotWindowFinishUserMovedResized(EffectWindow *w)
{ {
if (m_active && w == m_resizeWindow) { if (m_active && w == m_resizeWindow) {
m_active = false; m_active = false;
m_resizeWindow = NULL; m_resizeWindow = nullptr;
if (m_features & TextureScale) if (m_features & TextureScale)
animate(w, CrossFadePrevious, 0, 150, FPx2(1.0)); animate(w, CrossFadePrevious, 0, 150, FPx2(1.0));
effects->addRepaintFull(); effects->addRepaintFull();

View file

@ -33,14 +33,14 @@ class ResizeEffectConfigForm : public QWidget, public Ui::ResizeEffectConfigForm
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ResizeEffectConfigForm(QWidget* parent = 0); explicit ResizeEffectConfigForm(QWidget* parent = nullptr);
}; };
class ResizeEffectConfig : public KCModule class ResizeEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ResizeEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit ResizeEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;

View file

@ -233,7 +233,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR
} }
if (glow->texture.isNull()) { if (glow->texture.isNull()) {
delete glow; delete glow;
return NULL; return nullptr;
} }
} else if (effects->compositingType() == XRenderCompositing) { } else if (effects->compositingType() == XRenderCompositing) {
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -246,7 +246,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR
} }
if (glow->picture.isNull()) { if (glow->picture.isNull()) {
delete glow; delete glow;
return NULL; return nullptr;
} }
#endif #endif
} else if (effects->compositingType() == QPainterCompositing) { } else if (effects->compositingType() == QPainterCompositing) {
@ -259,7 +259,7 @@ Glow *ScreenEdgeEffect::createGlow(ElectricBorder border, qreal factor, const QR
} }
if (glow->image.isNull()) { if (glow->image.isNull()) {
delete glow; delete glow;
return NULL; return nullptr;
} }
} }
@ -281,7 +281,7 @@ T *ScreenEdgeEffect::createCornerGlow(ElectricBorder border)
case ElectricBottomLeft: case ElectricBottomLeft:
return new T(m_glow->pixmap(QStringLiteral("topright")).toImage()); return new T(m_glow->pixmap(QStringLiteral("topright")).toImage());
default: default:
return NULL; return nullptr;
} }
} }
@ -336,7 +336,7 @@ T *ScreenEdgeEffect::createEdgeGlow(ElectricBorder border, const QSize &size)
pixmapPosition = QPoint(size.width() - c.width(), 0); pixmapPosition = QPoint(size.width() - c.width(), 0);
break; break;
default: default:
return NULL; return nullptr;
} }
QPixmap image(size); QPixmap image(size);
image.fill(Qt::transparent); image.fill(Qt::transparent);

View file

@ -58,7 +58,7 @@ bool ScreenShotEffect::supported()
} }
ScreenShotEffect::ScreenShotEffect() ScreenShotEffect::ScreenShotEffect()
: m_scheduledScreenshot(0) : m_scheduledScreenshot(nullptr)
{ {
connect(effects, &EffectsHandler::windowClosed, this, &ScreenShotEffect::windowClosed); connect(effects, &EffectsHandler::windowClosed, this, &ScreenShotEffect::windowClosed);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Screenshot"), this, QDBusConnection::ExportScriptableContents); QDBusConnection::sessionBus().registerObject(QStringLiteral("/Screenshot"), this, QDBusConnection::ExportScriptableContents);
@ -234,7 +234,7 @@ void ScreenShotEffect::postPaintScreen()
ScreenShotEffect::convertFromGLImage(img, width, height); ScreenShotEffect::convertFromGLImage(img, width, height);
} }
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
xcb_image_t *xImage = NULL; xcb_image_t *xImage = nullptr;
if (effects->compositingType() == XRenderCompositing) { if (effects->compositingType() == XRenderCompositing) {
setXRenderOffscreen(true); setXRenderOffscreen(true);
effects->drawWindow(m_scheduledScreenshot, mask, QRegion(0, 0, width, height), d); effects->drawWindow(m_scheduledScreenshot, mask, QRegion(0, 0, width, height), d);
@ -276,7 +276,7 @@ void ScreenShotEffect::postPaintScreen()
} }
#endif #endif
} }
m_scheduledScreenshot = NULL; m_scheduledScreenshot = nullptr;
} }
if (!m_scheduledGeometry.isNull()) { if (!m_scheduledGeometry.isNull()) {
@ -373,7 +373,7 @@ void ScreenShotEffect::screenshotWindowUnderCursor(int mask)
!m_scheduledScreenshot->isMinimized() && !m_scheduledScreenshot->isDeleted() && !m_scheduledScreenshot->isMinimized() && !m_scheduledScreenshot->isDeleted() &&
m_scheduledScreenshot->geometry().contains(cursor)) m_scheduledScreenshot->geometry().contains(cursor))
break; break;
m_scheduledScreenshot = 0; m_scheduledScreenshot = nullptr;
} }
if (m_scheduledScreenshot) { if (m_scheduledScreenshot) {
m_windowMode = WindowMode::Xpixmap; m_windowMode = WindowMode::Xpixmap;
@ -626,7 +626,7 @@ QImage ScreenShotEffect::blitScreenshot(const QRect &geometry)
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing) { if (effects->compositingType() == XRenderCompositing) {
xcb_image_t *xImage = NULL; xcb_image_t *xImage = nullptr;
img = xPictureToImage(effects->xrenderBufferPicture(), geometry, &xImage); img = xPictureToImage(effects->xrenderBufferPicture(), geometry, &xImage);
if (xImage) { if (xImage) {
xcb_image_destroy(xImage); xcb_image_destroy(xImage);
@ -684,13 +684,13 @@ void ScreenShotEffect::convertFromGLImage(QImage &img, int w, int h)
bool ScreenShotEffect::isActive() const 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 ) void ScreenShotEffect::windowClosed( EffectWindow* w )
{ {
if (w == m_scheduledScreenshot) { if (w == m_scheduledScreenshot) {
m_scheduledScreenshot = NULL; m_scheduledScreenshot = nullptr;
screenshotWindowUnderCursor(m_type); screenshotWindowUnderCursor(m_type);
} }
} }

View file

@ -201,7 +201,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix)
verts << x << y + MAX_TIME; verts << x << y + MAX_TIME;
verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y + MAX_TIME; verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y + MAX_TIME;
verts << x + 2 * NUM_PAINTS + FPS_WIDTH << y; 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); vbo->render(GL_TRIANGLES);
y += MAX_TIME; // paint up from the bottom y += MAX_TIME; // paint up from the bottom
color.setRed(0); color.setRed(0);
@ -214,7 +214,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix)
verts << x << y; verts << x << y;
verts << x + FPS_WIDTH << y; verts << x + FPS_WIDTH << y;
verts << x + FPS_WIDTH << y - fps; verts << x + FPS_WIDTH << y - fps;
vbo->setData(6, 2, verts.constData(), NULL); vbo->setData(6, 2, verts.constData(), nullptr);
vbo->render(GL_TRIANGLES); vbo->render(GL_TRIANGLES);
@ -227,7 +227,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix)
vertices << x << y - i; vertices << x << y - i;
vertices << x + FPS_WIDTH << 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); vbo->render(GL_LINES);
x += FPS_WIDTH; x += FPS_WIDTH;
@ -406,7 +406,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines
verts << x << y - h; verts << x << y - h;
verts << x + values.count() << 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); vbo->render(GL_LINES);
// Then the graph values // Then the graph values
int lastValue = 0; int lastValue = 0;
@ -415,7 +415,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines
int value = values[ i ]; int value = values[ i ];
if (colorize && value != lastValue) { if (colorize && value != lastValue) {
if (!verts.isEmpty()) { 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); vbo->render(GL_LINES);
} }
verts.clear(); verts.clear();
@ -435,7 +435,7 @@ void ShowFpsEffect::paintGraph(int x, int y, QList<int> values, QList<int> lines
lastValue = value; lastValue = value;
} }
if (!verts.isEmpty()) { 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); vbo->render(GL_LINES);
} }
} }

View file

@ -32,7 +32,7 @@ class ShowFpsEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ShowFpsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit ShowFpsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~ShowFpsEffectConfig() override; ~ShowFpsEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -26,7 +26,7 @@ namespace KWin
SlideBackEffect::SlideBackEffect() SlideBackEffect::SlideBackEffect()
{ {
m_tabboxActive = 0; m_tabboxActive = 0;
m_justMapped = m_upmostWindow = NULL; m_justMapped = m_upmostWindow = nullptr;
connect(effects, &EffectsHandler::windowAdded, this, &SlideBackEffect::slotWindowAdded); connect(effects, &EffectsHandler::windowAdded, this, &SlideBackEffect::slotWindowAdded);
connect(effects, &EffectsHandler::windowDeleted, this, &SlideBackEffect::slotWindowDeleted); connect(effects, &EffectsHandler::windowDeleted, this, &SlideBackEffect::slotWindowDeleted);
connect(effects, &EffectsHandler::windowUnminimized, this, &SlideBackEffect::slotWindowUnminimized); connect(effects, &EffectsHandler::windowUnminimized, this, &SlideBackEffect::slotWindowUnminimized);
@ -54,7 +54,7 @@ void SlideBackEffect::slotStackingOrderChanged()
m_upmostWindow = usableNewStackingOrder.last(); m_upmostWindow = usableNewStackingOrder.last();
if (m_upmostWindow == m_justMapped ) // a window was added, got on top, stacking changed. Nothing impressive 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()) else if (!usableOldStackingOrder.isEmpty() && m_upmostWindow != usableOldStackingOrder.last())
windowRaised(m_upmostWindow); windowRaised(m_upmostWindow);
@ -259,9 +259,9 @@ void SlideBackEffect::postPaintWindow(EffectWindow* w)
void SlideBackEffect::slotWindowDeleted(EffectWindow* w) void SlideBackEffect::slotWindowDeleted(EffectWindow* w)
{ {
if (w == m_upmostWindow) if (w == m_upmostWindow)
m_upmostWindow = 0; m_upmostWindow = nullptr;
if (w == m_justMapped) if (w == m_justMapped)
m_justMapped = 0; m_justMapped = nullptr;
usableOldStackingOrder.removeAll(w); usableOldStackingOrder.removeAll(w);
oldStackingOrder.removeAll(w); oldStackingOrder.removeAll(w);
coveringWindows.removeAll(w); coveringWindows.removeAll(w);

View file

@ -78,13 +78,13 @@ StartupFeedbackEffect::StartupFeedbackEffect()
, m_active(false) , m_active(false)
, m_frame(0) , m_frame(0)
, m_progress(0) , m_progress(0)
, m_texture(0) , m_texture(nullptr)
, m_type(BouncingFeedback) , m_type(BouncingFeedback)
, m_blinkingShader(0) , m_blinkingShader(nullptr)
, m_cursorSize(0) , m_cursorSize(0)
{ {
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
m_bouncingTextures[i] = 0; m_bouncingTextures[i] = nullptr;
} }
if (KWindowSystem::isPlatformX11()) { if (KWindowSystem::isPlatformX11()) {
m_selection = new KSelectionOwner("_KDE_STARTUP_FEEDBACK", xcbConnection(), x11RootWindow(), this); m_selection = new KSelectionOwner("_KDE_STARTUP_FEEDBACK", xcbConnection(), x11RootWindow(), this);
@ -276,7 +276,7 @@ void StartupFeedbackEffect::start(const QString& icon)
if (m_type == BouncingFeedback) if (m_type == BouncingFeedback)
m_bounceSizesRatio = IconSize(KIconLoader::Small) / 16.0; m_bounceSizesRatio = IconSize(KIconLoader::Small) / 16.0;
QPixmap iconPixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Small, 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()) if (iconPixmap.isNull())
iconPixmap = SmallIcon(QStringLiteral("system-run")); iconPixmap = SmallIcon(QStringLiteral("system-run"));
prepareTextures(iconPixmap); prepareTextures(iconPixmap);
@ -307,13 +307,13 @@ void StartupFeedbackEffect::stop()
case BouncingFeedback: case BouncingFeedback:
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
delete m_bouncingTextures[i]; delete m_bouncingTextures[i];
m_bouncingTextures[i] = 0; m_bouncingTextures[i] = nullptr;
} }
break; break;
case BlinkingFeedback: case BlinkingFeedback:
case PassiveFeedback: case PassiveFeedback:
delete m_texture; delete m_texture;
m_texture = 0; m_texture = nullptr;
break; break;
case NoFeedback: case NoFeedback:
return; // don't want the full repaint return; // don't want the full repaint
@ -371,7 +371,7 @@ QRect StartupFeedbackEffect::feedbackRect() const
else else
xDiff = 32 + 7; xDiff = 32 + 7;
int yDiff = xDiff; int yDiff = xDiff;
GLTexture* texture = 0; GLTexture* texture = nullptr;
int yOffset = 0; int yOffset = 0;
switch(m_type) { switch(m_type) {
case BouncingFeedback: case BouncingFeedback:

View file

@ -113,7 +113,7 @@ void ThumbnailAsideEffect::slotWindowClosed(EffectWindow* w)
void ThumbnailAsideEffect::toggleCurrentThumbnail() void ThumbnailAsideEffect::toggleCurrentThumbnail()
{ {
EffectWindow* active = effects->activeWindow(); EffectWindow* active = effects->activeWindow();
if (active == NULL) if (active == nullptr)
return; return;
if (windows.contains(active)) if (windows.contains(active))
removeThumbnail(active); removeThumbnail(active);

View file

@ -41,7 +41,7 @@ class ThumbnailAsideEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit ThumbnailAsideEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~ThumbnailAsideEffectConfig() override; ~ThumbnailAsideEffectConfig() override;
void save() override; void save() override;

View file

@ -231,7 +231,7 @@ void TouchPointsEffect::drawCircleGl(const QColor& color, float cx, float cy, fl
x = c * x - s * y; x = c * x - s * y;
y = s * t + c * 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); vbo->render(GL_LINE_LOOP);
} }

View file

@ -46,9 +46,9 @@ TrackMouseEffect::TrackMouseEffect()
: m_angle(0) : m_angle(0)
{ {
initConfig<TrackMouseConfig>(); initConfig<TrackMouseConfig>();
m_texture[0] = m_texture[1] = 0; m_texture[0] = m_texture[1] = nullptr;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING #ifdef KWIN_HAVE_XRENDER_COMPOSITING
m_picture[0] = m_picture[1] = 0; m_picture[0] = m_picture[1] = nullptr;
if ( effects->compositingType() == XRenderCompositing) if ( effects->compositingType() == XRenderCompositing)
m_angleBase = 1.57079632679489661923; // Pi/2 m_angleBase = 1.57079632679489661923; // Pi/2
#endif #endif
@ -74,16 +74,16 @@ TrackMouseEffect::~TrackMouseEffect()
if (m_mousePolling) if (m_mousePolling)
effects->stopMousePolling(); effects->stopMousePolling();
for (int i = 0; i < 2; ++i) { 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 #ifdef KWIN_HAVE_XRENDER_COMPOSITING
delete m_picture[i]; m_picture[i] = 0; delete m_picture[i]; m_picture[i] = nullptr;
#endif #endif
} }
} }
void TrackMouseEffect::reconfigure(ReconfigureFlags) void TrackMouseEffect::reconfigure(ReconfigureFlags)
{ {
m_modifiers = 0; m_modifiers = nullptr;
TrackMouseConfig::self()->read(); TrackMouseConfig::self()->read();
if (TrackMouseConfig::shift()) if (TrackMouseConfig::shift())
m_modifiers |= Qt::ShiftModifier; m_modifiers |= Qt::ShiftModifier;
@ -161,7 +161,7 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da
}; };
#undef DOUBLE_TO_FIXED #undef DOUBLE_TO_FIXED
xcb_render_set_picture_transform(xcbConnection(), picture, xform); 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]; const QRect &rect = m_lastRect[i];
xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE, xcb_render_composite(xcbConnection(), XCB_RENDER_PICT_OP_OVER, picture, XCB_RENDER_PICTURE_NONE,
effects->xrenderBufferPicture(), 0, 0, 0, 0, effects->xrenderBufferPicture(), 0, 0, 0, 0,

View file

@ -42,7 +42,7 @@ class TrackMouseEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TrackMouseEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit TrackMouseEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~TrackMouseEffectConfig() override; ~TrackMouseEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -37,7 +37,7 @@ WindowGeometry::WindowGeometry()
initConfig<WindowGeometryConfiguration>(); initConfig<WindowGeometryConfiguration>();
iAmActivated = true; iAmActivated = true;
iAmActive = false; iAmActive = false;
myResizeWindow = 0L; myResizeWindow = nullptr;
#define myResizeString "Window geometry display, %1 and %2 are the new size," \ #define myResizeString "Window geometry display, %1 and %2 are the new size," \
" %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \ " %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \
"Width: %1 (%3)\nHeight: %2 (%4)" "Width: %1 (%3)\nHeight: %2 (%4)"
@ -128,7 +128,7 @@ void WindowGeometry::slotWindowFinishUserMovedResized(EffectWindow *w)
{ {
if (iAmActive && w == myResizeWindow) { if (iAmActive && w == myResizeWindow) {
iAmActive = false; iAmActive = false;
myResizeWindow = 0L; myResizeWindow = nullptr;
w->addRepaintFull(); w->addRepaintFull();
if (myExtraDirtyArea.isValid()) if (myExtraDirtyArea.isValid())
w->addLayerRepaint(myExtraDirtyArea); w->addLayerRepaint(myExtraDirtyArea);

View file

@ -40,7 +40,7 @@ class WindowGeometryConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit WindowGeometryConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit WindowGeometryConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~WindowGeometryConfig() override; ~WindowGeometryConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -34,7 +34,7 @@ class WobblyWindowsEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit WobblyWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit WobblyWindowsEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~WobblyWindowsEffectConfig() override; ~WobblyWindowsEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -61,7 +61,7 @@ ZoomEffect::ZoomEffect()
, moveFactor(20.0) , moveFactor(20.0)
{ {
initConfig<ZoomConfig>(); initConfig<ZoomConfig>();
QAction* a = 0; QAction* a = nullptr;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
@ -369,7 +369,7 @@ void ZoomEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1) DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1)
}; };
if (mousePointer == MousePointerScale) { if (mousePointer == MousePointerScale) {
xcb_render_set_picture_filter(xcbConnection(), *xrenderPicture, 4, const_cast<char*>("good"), 0, NULL); xcb_render_set_picture_filter(xcbConnection(), *xrenderPicture, 4, const_cast<char*>("good"), 0, nullptr);
const xcb_render_transform_t xform = { const xcb_render_transform_t xform = {
DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), 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), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(1.0 / zoom), DOUBLE_TO_FIXED(0),

View file

@ -34,14 +34,14 @@ class ZoomEffectConfigForm : public QWidget, public Ui::ZoomEffectConfigForm
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ZoomEffectConfigForm(QWidget* parent = 0); explicit ZoomEffectConfigForm(QWidget* parent = nullptr);
}; };
class ZoomEffectConfig : public KCModule class ZoomEffectConfig : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ZoomEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); explicit ZoomEffectConfig(QWidget* parent = nullptr, const QVariantList& args = QVariantList());
~ZoomEffectConfig() override; ~ZoomEffectConfig() override;
public Q_SLOTS: public Q_SLOTS:

View file

@ -326,7 +326,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
const auto *event = reinterpret_cast<xcb_map_notify_event_t*>(e); const auto *event = reinterpret_cast<xcb_map_notify_event_t*>(e);
if (event->override_redirect) { if (event->override_redirect) {
Unmanaged* c = findUnmanaged(event->window); Unmanaged* c = findUnmanaged(event->window);
if (c == NULL) if (c == nullptr)
c = createUnmanaged(event->window); c = createUnmanaged(event->window);
if (c) if (c)
return c->windowEvent(e); return c->windowEvent(e);
@ -373,9 +373,9 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
if (!currentInput.isNull() && (currentInput->focus == XCB_WINDOW_NONE || currentInput->focus == XCB_INPUT_FOCUS_POINTER_ROOT || lostFocusPointerToRoot)) { 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" ; //kWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" ;
AbstractClient *c = mostRecentlyActivatedClient(); AbstractClient *c = mostRecentlyActivatedClient();
if (c != NULL) if (c != nullptr)
requestFocus(c, true); requestFocus(c, true);
else if (activateNextClient(NULL)) else if (activateNextClient(nullptr))
; // ok, activated ; // ok, activated
else else
focusToNull(); focusToNull();
@ -444,7 +444,7 @@ bool Client::windowEvent(xcb_generic_event_t *e)
emit opacityChanged(this, old_opacity); emit opacityChanged(this, old_opacity);
} else { } else {
// forward to the frame if there's possibly another compositing manager running // 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()); i.setOpacity(info->opacity());
} }
} }
@ -821,7 +821,7 @@ void Client::leaveNotifyEvent(xcb_leave_notify_event_t *e)
} }
} }
if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) { if (options->focusPolicy() == Options::FocusStrictlyUnderMouse && isActive() && lostMouse) {
workspace()->requestDelayFocus(0); workspace()->requestDelayFocus(nullptr);
} }
return; return;
} }

View file

@ -29,14 +29,14 @@ KWIN_SINGLETON_FACTORY_VARIABLE(FocusChain, s_manager)
FocusChain::FocusChain(QObject *parent) FocusChain::FocusChain(QObject *parent)
: QObject(parent) : QObject(parent)
, m_separateScreenFocus(false) , m_separateScreenFocus(false)
, m_activeClient(NULL) , m_activeClient(nullptr)
, m_currentDesktop(0) , m_currentDesktop(0)
{ {
} }
FocusChain::~FocusChain() FocusChain::~FocusChain()
{ {
s_manager = NULL; s_manager = nullptr;
} }
void FocusChain::remove(AbstractClient *client) void FocusChain::remove(AbstractClient *client)
@ -68,7 +68,7 @@ AbstractClient *FocusChain::getForActivation(uint desktop, int screen) const
{ {
auto it = m_desktopFocusChains.constFind(desktop); auto it = m_desktopFocusChains.constFind(desktop);
if (it == m_desktopFocusChains.constEnd()) { if (it == m_desktopFocusChains.constEnd()) {
return NULL; return nullptr;
} }
const auto &chain = it.value(); const auto &chain = it.value();
for (int i = chain.size() - 1; i >= 0; --i) { for (int i = chain.size() - 1; i >= 0; --i) {
@ -79,7 +79,7 @@ AbstractClient *FocusChain::getForActivation(uint desktop, int screen) const
return tmp; return tmp;
} }
} }
return NULL; return nullptr;
} }
void FocusChain::update(AbstractClient *client, FocusChain::Change change) void FocusChain::update(AbstractClient *client, FocusChain::Change change)
@ -191,7 +191,7 @@ void FocusChain::moveAfterClientInChain(AbstractClient *client, AbstractClient *
AbstractClient *FocusChain::firstMostRecentlyUsed() const AbstractClient *FocusChain::firstMostRecentlyUsed() const
{ {
if (m_mostRecentlyUsed.isEmpty()) { if (m_mostRecentlyUsed.isEmpty()) {
return NULL; return nullptr;
} }
return m_mostRecentlyUsed.first(); return m_mostRecentlyUsed.first();
} }
@ -199,7 +199,7 @@ AbstractClient *FocusChain::firstMostRecentlyUsed() const
AbstractClient *FocusChain::nextMostRecentlyUsed(AbstractClient *reference) const AbstractClient *FocusChain::nextMostRecentlyUsed(AbstractClient *reference) const
{ {
if (m_mostRecentlyUsed.isEmpty()) { if (m_mostRecentlyUsed.isEmpty()) {
return NULL; return nullptr;
} }
const int index = m_mostRecentlyUsed.indexOf(reference); const int index = m_mostRecentlyUsed.indexOf(reference);
if (index == -1) { if (index == -1) {
@ -223,7 +223,7 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt
{ {
auto it = m_desktopFocusChains.constFind(desktop); auto it = m_desktopFocusChains.constFind(desktop);
if (it == m_desktopFocusChains.constEnd()) { if (it == m_desktopFocusChains.constEnd()) {
return NULL; return nullptr;
} }
const auto &chain = it.value(); const auto &chain = it.value();
for (int i = chain.size() - 1; i >= 0; --i) { for (int i = chain.size() - 1; i >= 0; --i) {
@ -232,7 +232,7 @@ AbstractClient *FocusChain::nextForDesktop(AbstractClient *reference, uint deskt
return client; return client;
} }
} }
return NULL; return nullptr;
} }
void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain) void FocusChain::makeFirstInChain(AbstractClient *client, Chain &chain)

View file

@ -894,7 +894,7 @@ void Workspace::setMoveResizeClient(AbstractClient *c)
// (the property with the size of the frame remains on the window after the crash). // (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) 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(); NETStrut frame = i.frameExtents();
if (frame.left != 0 || frame.top != 0) { if (frame.left != 0 || frame.top != 0) {
@ -2511,7 +2511,7 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co
return total; return total;
} }
static GeometryTip* geometryTip = 0; static GeometryTip* geometryTip = nullptr;
void Client::positionGeometryTip() void Client::positionGeometryTip()
{ {
@ -2538,10 +2538,10 @@ void Client::positionGeometryTip()
bool AbstractClient::startMoveResize() bool AbstractClient::startMoveResize()
{ {
Q_ASSERT(!isMoveResize()); Q_ASSERT(!isMoveResize());
Q_ASSERT(QWidget::keyboardGrabber() == NULL); Q_ASSERT(QWidget::keyboardGrabber() == nullptr);
Q_ASSERT(QWidget::mouseGrabber() == NULL); Q_ASSERT(QWidget::mouseGrabber() == nullptr);
stopDelayedMoveResize(); stopDelayedMoveResize();
if (QApplication::activePopupWidget() != NULL) if (QApplication::activePopupWidget() != nullptr)
return false; // popups have grab return false; // popups have grab
if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens())) if (isFullScreen() && (screens()->count() < 2 || !isMovableAcrossScreens()))
return false; return false;
@ -2585,7 +2585,7 @@ bool Client::doStartMoveResize()
// something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug* // something with Enter/LeaveNotify events, looks like XFree performance problem or something *shrug*
// (https://lists.kde.org/?t=107302193400001&r=1&w=2) // (https://lists.kde.org/?t=107302193400001&r=1&w=2)
QRect r = workspace()->clientArea(FullArea, this); 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.map();
m_moveResizeGrabWindow.raise(); m_moveResizeGrabWindow.raise();
updateXTime(); updateXTime();
@ -2593,7 +2593,7 @@ bool Client::doStartMoveResize()
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime()); XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, m_moveResizeGrabWindow, Cursor::x11Cursor(cursor()), xTime());
ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, NULL)); ScopedCPointer<xcb_grab_pointer_reply_t> pointerGrab(xcb_grab_pointer_reply(connection(), cookie, nullptr));
if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) { if (!pointerGrab.isNull() && pointerGrab->status == XCB_GRAB_STATUS_SUCCESS) {
has_grab = true; has_grab = true;
} }
@ -2666,7 +2666,7 @@ void Client::leaveMoveResize()
if (geometryTip) { if (geometryTip) {
geometryTip->hide(); geometryTip->hide();
delete geometryTip; delete geometryTip;
geometryTip = NULL; geometryTip = nullptr;
} }
if (move_resize_has_keyboard_grab) if (move_resize_has_keyboard_grab)
ungrabXKeyboard(); ungrabXKeyboard();
@ -2676,7 +2676,7 @@ void Client::leaveMoveResize()
if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire if (syncRequest.counter == XCB_NONE) // don't forget to sanitize since the timeout will no more fire
syncRequest.isPending = false; syncRequest.isPending = false;
delete syncRequest.timeout; delete syncRequest.timeout;
syncRequest.timeout = NULL; syncRequest.timeout = nullptr;
AbstractClient::leaveMoveResize(); AbstractClient::leaveMoveResize();
} }

View file

@ -24,7 +24,7 @@ namespace KWin
{ {
GeometryTip::GeometryTip(const Xcb::GeometryHints* xSizeHints): GeometryTip::GeometryTip(const Xcb::GeometryHints* xSizeHints):
QLabel(0) QLabel(nullptr)
{ {
setObjectName(QLatin1String("kwingeometry")); setObjectName(QLatin1String("kwingeometry"));
setMargin(1); setMargin(1);

View file

@ -51,16 +51,16 @@ namespace KWin
//******************************************** //********************************************
Group::Group(xcb_window_t leader_P) Group::Group(xcb_window_t leader_P)
: leader_client(NULL), : leader_client(nullptr),
leader_wid(leader_P), leader_wid(leader_P),
leader_info(NULL), leader_info(nullptr),
user_time(-1U), user_time(-1U),
refcount(0) refcount(0)
{ {
if (leader_P != XCB_WINDOW_NONE) { if (leader_P != XCB_WINDOW_NONE) {
leader_client = workspace()->findClient(Predicate::WindowMatch, leader_P); leader_client = workspace()->findClient(Predicate::WindowMatch, leader_P);
leader_info = new NETWinInfo(connection(), leader_P, rootWindow(), leader_info = new NETWinInfo(connection(), leader_P, rootWindow(),
0, NET::WM2StartupId); nullptr, NET::WM2StartupId);
} }
effect_group = new EffectWindowGroupImpl(this); effect_group = new EffectWindowGroupImpl(this);
workspace()->addGroup(this); workspace()->addGroup(this);
@ -74,7 +74,7 @@ Group::~Group()
QIcon Group::icon() const QIcon Group::icon() const
{ {
if (leader_client != NULL) if (leader_client != nullptr)
return leader_client->icon(); return leader_client->icon();
else if (leader_wid != XCB_WINDOW_NONE) { else if (leader_wid != XCB_WINDOW_NONE) {
QIcon ic; QIcon ic;
@ -140,7 +140,7 @@ void Group::gotLeader(Client* leader_P)
void Group::lostLeader() void Group::lostLeader()
{ {
Q_ASSERT(!_members.contains(leader_client)); Q_ASSERT(!_members.contains(leader_client));
leader_client = NULL; leader_client = nullptr;
if (_members.isEmpty()) { if (_members.isEmpty()) {
workspace()->removeGroup(this); workspace()->removeGroup(this);
delete this; delete this;
@ -159,21 +159,21 @@ Group* Workspace::findGroup(xcb_window_t leader) const
++it) ++it)
if ((*it)->leader() == leader) if ((*it)->leader() == leader)
return *it; return *it;
return NULL; return nullptr;
} }
// Client is group transient, but has no group set. Try to find // Client is group transient, but has no group set. Try to find
// group with windows with the same client leader. // group with windows with the same client leader.
Group* Workspace::findClientLeaderGroup(const Client* c) const Group* Workspace::findClientLeaderGroup(const Client* c) const
{ {
Group* ret = NULL; Group* ret = nullptr;
for (ClientList::ConstIterator it = clients.constBegin(); for (ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd(); it != clients.constEnd();
++it) { ++it) {
if (*it == c) if (*it == c)
continue; continue;
if ((*it)->wmClientLeader() == c->wmClientLeader()) { if ((*it)->wmClientLeader() == c->wmClientLeader()) {
if (ret == NULL || ret == (*it)->group()) if (ret == nullptr || ret == (*it)->group())
ret = (*it)->group(); ret = (*it)->group();
else { else {
// There are already two groups with the same client leader. // There are already two groups with the same client leader.
@ -436,11 +436,11 @@ void Client::setTransient(xcb_window_t new_transient_for_id)
m_transientForId = new_transient_for_id; m_transientForId = new_transient_for_id;
if (m_transientForId != XCB_WINDOW_NONE && !groupTransient()) { if (m_transientForId != XCB_WINDOW_NONE && !groupTransient()) {
transient_for = workspace()->findClient(Predicate::WindowMatch, m_transientForId); 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); transient_for->addTransient(this);
} // checkGroup() will check 'check_active_modal' } // checkGroup() will check 'check_active_modal'
setTransientFor(transient_for); setTransientFor(transient_for);
checkGroup(NULL, true); // force, because transiency has changed checkGroup(nullptr, true); // force, because transiency has changed
workspace()->updateClientLayer(this); workspace()->updateClientLayer(this);
workspace()->resetUpdateToolWindowsTimer(); workspace()->resetUpdateToolWindowsTimer();
emit transientChanged(); emit transientChanged();
@ -513,7 +513,7 @@ void Client::cleanGrouping()
// added 'this' to those transient lists :( // added 'this' to those transient lists :(
ClientList group_members = group()->members(); ClientList group_members = group()->members();
group()->removeMember(this); group()->removeMember(this);
in_group = NULL; in_group = nullptr;
for (ClientList::ConstIterator it = group_members.constBegin(); for (ClientList::ConstIterator it = group_members.constBegin();
it != group_members.constEnd(); it != group_members.constEnd();
++it) ++it)
@ -544,7 +544,7 @@ void Client::checkGroupTransients()
if (*it1 == *it2) if (*it1 == *it2)
continue; continue;
for (AbstractClient* cl = (*it2)->transientFor(); for (AbstractClient* cl = (*it2)->transientFor();
cl != NULL; cl != nullptr;
cl = cl->transientFor()) { cl = cl->transientFor()) {
if (cl == *it1) { if (cl == *it1) {
// don't use removeTransient(), that would modify *it2 too // don't use removeTransient(), that would modify *it2 too
@ -628,7 +628,7 @@ xcb_window_t Client::verifyTransientFor(xcb_window_t new_transient_for, bool set
xcb_window_t loop_pos = new_transient_for; xcb_window_t loop_pos = new_transient_for;
while (loop_pos != XCB_WINDOW_NONE && loop_pos != rootWindow()) { while (loop_pos != XCB_WINDOW_NONE && loop_pos != rootWindow()) {
Client* pos = workspace()->findClient(Predicate::WindowMatch, loop_pos); Client* pos = workspace()->findClient(Predicate::WindowMatch, loop_pos);
if (pos == NULL) if (pos == nullptr)
break; break;
loop_pos = pos->m_transientForId; loop_pos = pos->m_transientForId;
if (--count == 0 || pos == this) { if (--count == 0 || pos == this) {
@ -637,7 +637,7 @@ xcb_window_t Client::verifyTransientFor(xcb_window_t new_transient_for, bool set
} }
} }
if (new_transient_for != rootWindow() 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 // it's transient for a specific window, but that window is not mapped
new_transient_for = rootWindow(); new_transient_for = rootWindow();
} }
@ -759,7 +759,7 @@ AbstractClient* Client::findModal(bool allow_itself)
return ret; return ret;
if (isModal() && allow_itself) if (isModal() && allow_itself)
return this; return this;
return NULL; return nullptr;
} }
// Client::window_group only holds the contents of the hint, // Client::window_group only holds the contents of the hint,
@ -768,11 +768,11 @@ AbstractClient* Client::findModal(bool allow_itself)
void Client::checkGroup(Group* set_group, bool force) void Client::checkGroup(Group* set_group, bool force)
{ {
Group* old_group = in_group; Group* old_group = in_group;
if (old_group != NULL) if (old_group != nullptr)
old_group->ref(); // turn off automatic deleting old_group->ref(); // turn off automatic deleting
if (set_group != NULL) { if (set_group != nullptr) {
if (set_group != in_group) { if (set_group != in_group) {
if (in_group != NULL) if (in_group != nullptr)
in_group->removeMember(this); in_group->removeMember(this);
in_group = set_group; in_group = set_group;
in_group->addMember(this); in_group->addMember(this);
@ -780,15 +780,15 @@ void Client::checkGroup(Group* set_group, bool force)
} else if (info->groupLeader() != XCB_WINDOW_NONE) { } else if (info->groupLeader() != XCB_WINDOW_NONE) {
Group* new_group = workspace()->findGroup(info->groupLeader()); Group* new_group = workspace()->findGroup(info->groupLeader());
Client *t = qobject_cast<Client*>(transientFor()); Client *t = qobject_cast<Client*>(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 // 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) // by different app, but transient for this one, so make it part of that group)
new_group = t->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()); new_group = new Group(info->groupLeader());
if (new_group != in_group) { if (new_group != in_group) {
if (in_group != NULL) if (in_group != nullptr)
in_group->removeMember(this); in_group->removeMember(this);
in_group = new_group; in_group = new_group;
in_group->addMember(this); in_group->addMember(this);
@ -799,7 +799,7 @@ void Client::checkGroup(Group* set_group, bool force)
// so make it part of that group // so make it part of that group
Group* new_group = t->group(); Group* new_group = t->group();
if (new_group != in_group) { if (new_group != in_group) {
if (in_group != NULL) if (in_group != nullptr)
in_group->removeMember(this); in_group->removeMember(this);
in_group = t->group(); in_group = t->group();
in_group->addMember(this); in_group->addMember(this);
@ -808,10 +808,10 @@ void Client::checkGroup(Group* set_group, bool force)
// group transient which actually doesn't have a group :( // group transient which actually doesn't have a group :(
// try creating group with other windows with the same client leader // try creating group with other windows with the same client leader
Group* new_group = workspace()->findClientLeaderGroup(this); Group* new_group = workspace()->findClientLeaderGroup(this);
if (new_group == NULL) if (new_group == nullptr)
new_group = new Group(XCB_WINDOW_NONE); new_group = new Group(XCB_WINDOW_NONE);
if (new_group != in_group) { if (new_group != in_group) {
if (in_group != NULL) if (in_group != nullptr)
in_group->removeMember(this); in_group->removeMember(this);
in_group = new_group; in_group = new_group;
in_group->addMember(this); in_group->addMember(this);
@ -821,11 +821,11 @@ void Client::checkGroup(Group* set_group, bool force)
// or minimizing together the whole group, but as long as it is used // 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. // only for dialogs it's better to keep windows from one app in one group.
Group* new_group = workspace()->findClientLeaderGroup(this); 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->removeMember(this);
in_group = NULL; in_group = nullptr;
} }
if (new_group == NULL) if (new_group == nullptr)
new_group = new Group(XCB_WINDOW_NONE); new_group = new Group(XCB_WINDOW_NONE);
if (in_group != new_group) { if (in_group != new_group) {
in_group = new_group; in_group = new_group;
@ -847,7 +847,7 @@ void Client::checkGroup(Group* set_group, bool force)
} }
if (groupTransient()) { if (groupTransient()) {
// no longer transient for ones in the old group // 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(); for (ClientList::ConstIterator it = old_group->members().constBegin();
it != old_group->members().constEnd(); it != old_group->members().constEnd();
++it) ++it)
@ -876,7 +876,7 @@ void Client::checkGroup(Group* set_group, bool force)
addTransient(*it); addTransient(*it);
} }
} }
if (old_group != NULL) if (old_group != nullptr)
old_group->deref(); // can be now deleted if empty old_group->deref(); // can be now deleted if empty
checkGroupTransients(); checkGroupTransients();
checkActiveModal(); checkActiveModal();
@ -887,7 +887,7 @@ void Client::checkGroup(Group* set_group, bool force)
void Client::changeClientLeaderGroup(Group* gr) void Client::changeClientLeaderGroup(Group* gr)
{ {
// transientFor() != NULL are in the group of their mainwindow, so keep them there // transientFor() != NULL are in the group of their mainwindow, so keep them there
if (transientFor() != NULL) if (transientFor() != nullptr)
return; return;
// also don't change the group for window which have group set // also don't change the group for window which have group set
if (info->groupLeader()) if (info->groupLeader())
@ -903,9 +903,9 @@ void Client::checkActiveModal()
// cannot be done in AddTransient(), because there may temporarily // cannot be done in AddTransient(), because there may temporarily
// exist loops, breaking findModal // exist loops, breaking findModal
Client* check_modal = dynamic_cast<Client*>(workspace()->mostRecentlyActivatedClient()); Client* check_modal = dynamic_cast<Client*>(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<Client*>(check_modal->findModal()); Client* new_modal = dynamic_cast<Client*>(check_modal->findModal());
if (new_modal != NULL && new_modal != check_modal) { if (new_modal != nullptr && new_modal != check_modal) {
if (!new_modal->isManaged()) if (!new_modal->isManaged())
return; // postpone check until end of manage() return; // postpone check until end of manage()
workspace()->activateClient(new_modal); workspace()->activateClient(new_modal);

View file

@ -1647,7 +1647,7 @@ InputRedirection::InputRedirection(QObject *parent)
InputRedirection::~InputRedirection() InputRedirection::~InputRedirection()
{ {
s_self = NULL; s_self = nullptr;
qDeleteAll(m_filters); qDeleteAll(m_filters);
qDeleteAll(m_spies); qDeleteAll(m_spies);
} }
@ -2129,7 +2129,7 @@ Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos)
const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked(); const bool isScreenLocked = waylandServer() && waylandServer()->isScreenLocked();
const ToplevelList &stacking = Workspace::self()->stackingOrder(); const ToplevelList &stacking = Workspace::self()->stackingOrder();
if (stacking.isEmpty()) { if (stacking.isEmpty()) {
return NULL; return nullptr;
} }
auto it = stacking.end(); auto it = stacking.end();
do { do {
@ -2156,7 +2156,7 @@ Toplevel *InputRedirection::findManagedToplevel(const QPoint &pos)
return t; return t;
} }
} while (it != stacking.begin()); } while (it != stacking.begin());
return NULL; return nullptr;
} }
Qt::KeyboardModifiers InputRedirection::keyboardModifiers() const Qt::KeyboardModifiers InputRedirection::keyboardModifiers() const

View file

@ -48,7 +48,7 @@ class Compositing : public QObject
Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged) Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged)
Q_PROPERTY(bool compositingRequired READ compositingRequired CONSTANT) Q_PROPERTY(bool compositingRequired READ compositingRequired CONSTANT)
public: public:
explicit Compositing(QObject *parent = 0); explicit Compositing(QObject *parent = nullptr);
Q_INVOKABLE bool OpenGLIsUnsafe() const; Q_INVOKABLE bool OpenGLIsUnsafe() const;
Q_INVOKABLE bool OpenGLIsBroken(); Q_INVOKABLE bool OpenGLIsBroken();
@ -132,7 +132,7 @@ public:
TypeRole = Qt::UserRole +2 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 index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &child) const override; QModelIndex parent(const QModelIndex &child) const override;

View file

@ -33,7 +33,7 @@ class KWinCompositingSettings : public KCModule
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit KWinCompositingSettings(QWidget *parent = 0, const QVariantList &args = QVariantList()); explicit KWinCompositingSettings(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
public Q_SLOTS: public Q_SLOTS:
void load() override; void load() override;

View file

@ -34,7 +34,7 @@ class ButtonsModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ButtonsModel(const QVector< DecorationButtonType > &buttons, QObject *parent = 0); explicit ButtonsModel(const QVector< DecorationButtonType > &buttons, QObject *parent = nullptr);
explicit ButtonsModel(QObject *parent = nullptr); explicit ButtonsModel(QObject *parent = nullptr);
~ButtonsModel() override; ~ButtonsModel() override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;

View file

@ -78,7 +78,7 @@ void PreviewItem::createDecoration()
if (m_bridge.isNull() || m_settings.isNull() || m_decoration) { if (m_bridge.isNull() || m_settings.isNull() || m_decoration) {
return; return;
} }
Decoration *decoration = m_bridge->createDecoration(0); Decoration *decoration = m_bridge->createDecoration(nullptr);
m_client = m_bridge->lastCreatedClient(); m_client = m_bridge->lastCreatedClient();
setDecoration(decoration); setDecoration(decoration);
} }

View file

@ -37,7 +37,7 @@ class BorderSizesModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BorderSizesModel(QObject *parent = 0); explicit BorderSizesModel(QObject *parent = nullptr);
~BorderSizesModel() override; ~BorderSizesModel() override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override;

View file

@ -64,7 +64,7 @@ void createMaxButtonPixmaps()
{ {
char const * maxButtonXpms[][3 + 13] = { char const * maxButtonXpms[][3 + 13] = {
{ {
0, 0, 0, nullptr, nullptr, nullptr,
"...............", "...............",
".......#.......", ".......#.......",
"......###......", "......###......",
@ -80,7 +80,7 @@ void createMaxButtonPixmaps()
"..............." "..............."
}, },
{ {
0, 0, 0, nullptr, nullptr, nullptr,
"...............", "...............",
".......#.......", ".......#.......",
"......###......", "......###......",
@ -96,7 +96,7 @@ void createMaxButtonPixmaps()
"..............." "..............."
}, },
{ {
0, 0, 0, nullptr, nullptr, nullptr,
"...............", "...............",
"...............", "...............",
"...............", "...............",

View file

@ -586,7 +586,7 @@ Rules* RulesWidget::rules() const
rules->wmclassmatch = static_cast< Rules::StringMatch >(wmclass_match->currentIndex()); rules->wmclassmatch = static_cast< Rules::StringMatch >(wmclass_match->currentIndex());
rules->windowrole = role->text().toUtf8(); rules->windowrole = role->text().toUtf8();
rules->windowrolematch = static_cast< Rules::StringMatch >(role_match->currentIndex()); rules->windowrolematch = static_cast< Rules::StringMatch >(role_match->currentIndex());
rules->types = 0; rules->types = nullptr;
bool all_types = true; bool all_types = true;
for (int i = 0; for (int i = 0;
i < types->count(); i < types->count();

View file

@ -100,7 +100,7 @@ protected:
void mousePressEvent(QGraphicsSceneMouseEvent* e) override; void mousePressEvent(QGraphicsSceneMouseEvent* e) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent * e) override; void hoverEnterEvent(QGraphicsSceneHoverEvent * e) override;
void hoverLeaveEvent(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: private:
Monitor* monitor; Monitor* monitor;
Plasma::FrameSvg *button; Plasma::FrameSvg *button;

View file

@ -69,7 +69,7 @@ const char *BrightnessSaturationShader::fragmentShader() const
const char* const *BrightnessSaturationShader::attributeNames() const const char* const *BrightnessSaturationShader::attributeNames() const
{ {
static char const *const names[] = { "vertex", "texCoord", 0 }; static char const *const names[] = { "vertex", "texCoord", nullptr };
return names; return names;
} }

View file

@ -265,7 +265,7 @@ AbstractClient* Workspace::topClientOnDesktop(int desktop, int screen, bool unco
return c; return c;
} }
} }
return 0; return nullptr;
} }
AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const
@ -286,13 +286,13 @@ AbstractClient* Workspace::findDesktop(bool topmost, int desktop) const
return client; return client;
} }
} }
return NULL; return nullptr;
} }
void Workspace::raiseOrLowerClient(AbstractClient *c) void Workspace::raiseOrLowerClient(AbstractClient *c)
{ {
if (!c) return; if (!c) return;
AbstractClient* topmost = NULL; AbstractClient* topmost = nullptr;
// TODO Q_ASSERT( block_stacking_updates == 0 ); // TODO Q_ASSERT( block_stacking_updates == 0 );
if (most_recently_raised && stacking_order.contains(most_recently_raised) && if (most_recently_raised && stacking_order.contains(most_recently_raised) &&
most_recently_raised->isShown(true) && c->isOnCurrentDesktop()) most_recently_raised->isShown(true) && c->isOnCurrentDesktop())
@ -334,7 +334,7 @@ void Workspace::lowerClient(AbstractClient* c, bool nogroup)
} }
if (c == most_recently_raised) if (c == most_recently_raised)
most_recently_raised = 0; most_recently_raised = nullptr;
} }
void Workspace::lowerClientWithinApplication(AbstractClient* c) void Workspace::lowerClientWithinApplication(AbstractClient* c)
@ -454,7 +454,7 @@ void Workspace::restack(AbstractClient* c, AbstractClient* under, bool force)
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) { for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
AbstractClient *other = qobject_cast<AbstractClient*>(unconstrained_stacking_order.at(i)); AbstractClient *other = qobject_cast<AbstractClient*>(unconstrained_stacking_order.at(i));
if (other && other->layer() == c->layer() && AbstractClient::belongToSameApplication(under, other)) { if (other && other->layer() == c->layer() && AbstractClient::belongToSameApplication(under, other)) {
under = (c == other) ? 0 : other; under = (c == other) ? nullptr : other;
break; break;
} }
} }
@ -514,7 +514,7 @@ ToplevelList Workspace::constrainedStackingOrder()
const int screen = (*it)->screen(); const int screen = (*it)->screen();
Client *c = qobject_cast<Client*>(*it); Client *c = qobject_cast<Client*>(*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 (mLayer != minimum_layer[screen].end()) {
// If a window is raised above some other window in the same window group // 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 // which is in the ActiveLayer (i.e. it's fulscreened), make sure it stays
@ -778,7 +778,7 @@ void Workspace::updateXStackingOrder()
void Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource src, xcb_timestamp_t timestamp, bool send_event) 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) { if (detail == XCB_STACK_MODE_OPPOSITE) {
other = workspace()->findClient(Predicate::WindowMatch, above); other = workspace()->findClient(Predicate::WindowMatch, above);
if (!other) { if (!other) {
@ -837,7 +837,7 @@ void Client::restackWindow(xcb_window_t above, int detail, NET::RequestSource sr
if (it != begin && (*(it - 1) == other)) if (it != begin && (*(it - 1) == other))
other = qobject_cast<Client*>(*it); other = qobject_cast<Client*>(*it);
else else
other = 0; other = nullptr;
} }
if (other) if (other)

View file

@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin namespace KWin
{ {
GLPlatform *GLPlatform::s_platform = 0; GLPlatform *GLPlatform::s_platform = nullptr;
static qint64 parseVersionString(const QByteArray &version) static qint64 parseVersionString(const QByteArray &version)
{ {
@ -293,7 +293,7 @@ static ChipClass detectNVidiaClass(const QString &chipset)
{ {
QString name = extract(chipset, QStringLiteral("\\bNV[0-9,A-F]{2}\\b")); // NV followed by two hexadecimal digits QString name = extract(chipset, QStringLiteral("\\bNV[0-9,A-F]{2}\\b")); // NV followed by two hexadecimal digits
if (!name.isEmpty()) { 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) { switch(id & 0xf0) {
case 0x00: case 0x00:

View file

@ -1968,7 +1968,7 @@ void GLVertexBufferPrivate::reallocateBuffer(size_t size)
const size_t minSize = 32768; // Minimum size for streaming buffers const size_t minSize = 32768; // Minimum size for streaming buffers
const size_t alloc = usage != GL_STATIC_DRAW ? align(qMax(size, minSize), 4096) : size; 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; bufferSize = alloc;
} }

View file

@ -223,7 +223,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
desk = NET::OnAllDesktops; desk = NET::OnAllDesktops;
else if (on_current) else if (on_current)
desk = VirtualDesktopManager::self()->current(); desk = VirtualDesktopManager::self()->current();
else if (maincl != NULL) else if (maincl != nullptr)
desk = maincl->desktop(); desk = maincl->desktop();
if (maincl) if (maincl)
@ -517,7 +517,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
updateAllowedActions(true); updateAllowedActions(true);
// Set initial user time directly // 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 group()->updateUserTime(m_userTime); // And do what Client::updateUserTime() does
// This should avoid flicker, because real restacking is done // This should avoid flicker, because real restacking is done
@ -539,7 +539,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
bool allow; bool allow;
if (session) if (session)
allow = session->active && allow = session->active &&
(!workspace()->wasUserInteraction() || workspace()->activeClient() == NULL || (!workspace()->wasUserInteraction() || workspace()->activeClient() == nullptr ||
workspace()->activeClient()->isDesktop()); workspace()->activeClient()->isDesktop());
else else
allow = workspace()->allowClientActivation(this, userTime(), false); allow = workspace()->allowClientActivation(this, userTime(), false);
@ -606,7 +606,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
if (opacity() == 1.0) { if (opacity() == 1.0) {
return; return;
} }
NETWinInfo info(connection(), frameId(), rootWindow(), 0, 0); NETWinInfo info(connection(), frameId(), rootWindow(), nullptr, nullptr);
info.setOpacity(static_cast<unsigned long>(opacity() * 0xffffffff)); info.setOpacity(static_cast<unsigned long>(opacity() * 0xffffffff));
} }
); );

View file

@ -33,7 +33,7 @@ namespace KWin
{ {
extern int screen_number; extern int screen_number;
RootInfo *RootInfo::s_self = NULL; RootInfo *RootInfo::s_self = nullptr;
RootInfo *RootInfo::create() RootInfo *RootInfo::create()
{ {
@ -136,7 +136,7 @@ void RootInfo::destroy()
} }
xcb_window_t supportWindow = s_self->supportWindow(); xcb_window_t supportWindow = s_self->supportWindow();
delete s_self; delete s_self;
s_self = NULL; s_self = nullptr;
xcb_destroy_window(connection(), supportWindow); xcb_destroy_window(connection(), supportWindow);
} }
@ -176,7 +176,7 @@ void RootInfo::changeActiveWindow(xcb_window_t w, NET::RequestSource src, xcb_ti
workspace->activateClient(c); workspace->activateClient(c);
// if activation of the requestor's window would be allowed, allow activation too // if activation of the requestor's window would be allowed, allow activation too
else if (active_window != XCB_WINDOW_NONE else if (active_window != XCB_WINDOW_NONE
&& (c2 = workspace->findClient(Predicate::WindowMatch, active_window)) != NULL && (c2 = workspace->findClient(Predicate::WindowMatch, active_window)) != nullptr
&& workspace->allowClientActivation(c2, && workspace->allowClientActivation(c2,
timestampCompare(timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()), false, true)) { timestampCompare(timestamp, c2->userTime() > 0 ? timestamp : c2->userTime()), false, true)) {
workspace->activateClient(c); workspace->activateClient(c);
@ -299,7 +299,7 @@ void WinInfo::changeState(NET::States state, NET::States mask)
void WinInfo::disable() 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 } // namespace

View file

@ -184,7 +184,7 @@ class KWIN_EXPORT Options : public QObject
Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged) Q_PROPERTY(bool windowsBlockCompositing READ windowsBlockCompositing WRITE setWindowsBlockCompositing NOTIFY windowsBlockCompositingChanged)
public: public:
explicit Options(QObject *parent = NULL); explicit Options(QObject *parent = nullptr);
~Options() override; ~Options() override;
void updateSettings(); void updateSettings();

View file

@ -48,7 +48,7 @@ Placement::Placement(QObject*)
Placement::~Placement() Placement::~Placement()
{ {
s_self = NULL; s_self = nullptr;
} }
/** /**
@ -562,7 +562,7 @@ void Placement::placeOnMainWindow(AbstractClient *c, const QRect &area, Policy n
++mains_count; ++mains_count;
place_on2 = *it; place_on2 = *it;
if ((*it)->isOnCurrentDesktop()) { if ((*it)->isOnCurrentDesktop()) {
if (place_on == NULL) if (place_on == nullptr)
place_on = *it; place_on = *it;
else { else {
// two or more on current desktop -> center // two or more on current desktop -> center
@ -576,7 +576,7 @@ void Placement::placeOnMainWindow(AbstractClient *c, const QRect &area, Policy n
} }
} }
} }
if (place_on == NULL) { if (place_on == nullptr) {
// 'mains_count' is used because it doesn't include ignored mainwindows // 'mains_count' is used because it doesn't include ignored mainwindows
if (mains_count != 1) { if (mains_count != 1) {
place(c, area, Centered); place(c, area, Centered);

View file

@ -82,7 +82,7 @@ QRegion OpenGLBackend::accumulatedDamageHistory(int bufferAge) const
OverlayWindow* OpenGLBackend::overlayWindow() const OverlayWindow* OpenGLBackend::overlayWindow() const
{ {
return NULL; return nullptr;
} }
QRegion OpenGLBackend::prepareRenderingForScreen(int screenId) QRegion OpenGLBackend::prepareRenderingForScreen(int screenId)

View file

@ -461,7 +461,7 @@ void LinuxDmabuf::setSupportedFormatsAndModifiers()
{ {
const EGLDisplay eglDisplay = m_backend->eglDisplay(); const EGLDisplay eglDisplay = m_backend->eglDisplay();
EGLint count = 0; EGLint count = 0;
EGLBoolean success = eglQueryDmaBufFormatsEXT(eglDisplay, 0, NULL, &count); EGLBoolean success = eglQueryDmaBufFormatsEXT(eglDisplay, 0, nullptr, &count);
if (!success || count == 0) { if (!success || count == 0) {
return; return;
@ -479,13 +479,13 @@ void LinuxDmabuf::setSupportedFormatsAndModifiers()
for (auto format : qAsConst(formats)) { for (auto format : qAsConst(formats)) {
if (eglQueryDmaBufModifiersEXT != nullptr) { if (eglQueryDmaBufModifiersEXT != nullptr) {
count = 0; count = 0;
success = eglQueryDmaBufModifiersEXT(eglDisplay, format, 0, NULL, NULL, &count); success = eglQueryDmaBufModifiersEXT(eglDisplay, format, 0, nullptr, nullptr, &count);
if (success && count > 0) { if (success && count > 0) {
QVector<uint64_t> modifiers(count); QVector<uint64_t> modifiers(count);
if (eglQueryDmaBufModifiersEXT(eglDisplay, if (eglQueryDmaBufModifiersEXT(eglDisplay,
format, count, modifiers.data(), format, count, modifiers.data(),
NULL, &count)) { nullptr, &count)) {
QSet<uint64_t> modifiersSet; QSet<uint64_t> modifiersSet;
for (auto mod : qAsConst(modifiers)) { for (auto mod : qAsConst(modifiers)) {
modifiersSet.insert(mod); modifiersSet.insert(mod);

View file

@ -41,7 +41,7 @@ class Poller : public AbstractSystemPoller
Q_INTERFACES(AbstractSystemPoller) Q_INTERFACES(AbstractSystemPoller)
public: public:
Poller(QObject *parent = 0); Poller(QObject *parent = nullptr);
~Poller() override; ~Poller() override;
bool isAvailable() override; bool isAvailable() override;

View file

@ -31,7 +31,7 @@ class KGlobalAccelImpl : public KGlobalAccelInterface
Q_INTERFACES(KGlobalAccelInterface) Q_INTERFACES(KGlobalAccelInterface)
public: public:
KGlobalAccelImpl(QObject *parent = 0); KGlobalAccelImpl(QObject *parent = nullptr);
~KGlobalAccelImpl() override; ~KGlobalAccelImpl() override;
bool grabKey(int key, bool grab) override; bool grabKey(int key, bool grab) override;

View file

@ -209,10 +209,10 @@ void WaylandSubSurfaceCursor::move(const QPointF &globalPosition)
} }
WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend) WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
: QObject(NULL) : QObject(nullptr)
, m_seat(new Seat(this)) , m_seat(new Seat(this))
, m_pointer(NULL) , m_pointer(nullptr)
, m_keyboard(NULL) , m_keyboard(nullptr)
, m_touch(nullptr) , m_touch(nullptr)
, m_enteredSerial(0) , m_enteredSerial(0)
, m_backend(backend) , m_backend(backend)

View file

@ -107,7 +107,7 @@ GlxBackend::GlxBackend(Display *display)
: OpenGLBackend() : OpenGLBackend()
, m_overlayWindow(kwinApp()->platform()->createOverlayWindow()) , m_overlayWindow(kwinApp()->platform()->createOverlayWindow())
, window(None) , window(None)
, fbconfig(NULL) , fbconfig(nullptr)
, glxWindow(None) , glxWindow(None)
, ctx(nullptr) , ctx(nullptr)
, m_bufferAge(0) , m_bufferAge(0)
@ -270,7 +270,7 @@ void GlxBackend::init()
// VirtualBox does not support glxQueryDrawable // VirtualBox does not support glxQueryDrawable
// this should actually be in kwinglutils_funcs, but QueryDrawable seems not to be provided by an extension // 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. // and the GLPlatform has not been initialized at the moment when initGLX() is called.
glXQueryDrawable = NULL; glXQueryDrawable = nullptr;
} }
setIsDirectRendering(bool(glXIsDirect(display(), ctx))); setIsDirectRendering(bool(glXIsDirect(display(), ctx)));
@ -336,7 +336,7 @@ bool GlxBackend::initRenderingContext()
} }
for (auto it = candidates.begin(); it != candidates.end(); it++) { for (auto it = candidates.begin(); it != candidates.end(); it++) {
const auto attribs = it->build(); const auto attribs = it->build();
ctx = glXCreateContextAttribsARB(display(), fbconfig, 0, true, attribs.data()); ctx = glXCreateContextAttribsARB(display(), fbconfig, nullptr, true, attribs.data());
if (ctx) { if (ctx) {
qCDebug(KWIN_X11STANDALONE) << "Created GLX context with attributes:" << &(*it); qCDebug(KWIN_X11STANDALONE) << "Created GLX context with attributes:" << &(*it);
break; break;
@ -345,7 +345,7 @@ bool GlxBackend::initRenderingContext()
} }
if (!ctx) if (!ctx)
ctx = glXCreateNewContext(display(), fbconfig, GLX_RGBA_TYPE, NULL, direct); ctx = glXCreateNewContext(display(), fbconfig, GLX_RGBA_TYPE, nullptr, direct);
if (!ctx) { if (!ctx) {
qCDebug(KWIN_X11STANDALONE) << "Failed to create an OpenGL context."; qCDebug(KWIN_X11STANDALONE) << "Failed to create an OpenGL context.";
@ -355,7 +355,7 @@ bool GlxBackend::initRenderingContext()
if (!glXMakeCurrent(display(), glxWindow, ctx)) { if (!glXMakeCurrent(display(), glxWindow, ctx)) {
qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current."; qCDebug(KWIN_X11STANDALONE) << "Failed to make the OpenGL context current.";
glXDestroyContext(display(), ctx); glXDestroyContext(display(), ctx);
ctx = 0; ctx = nullptr;
return false; return false;
} }
@ -389,7 +389,7 @@ bool GlxBackend::initBuffer()
0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, 0, 0, size.width(), size.height(), 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
visual, XCB_CW_COLORMAP, &colormap); visual, XCB_CW_COLORMAP, &colormap);
glxWindow = glXCreateWindow(display(), fbconfig, window, NULL); glxWindow = glXCreateWindow(display(), fbconfig, window, nullptr);
overlayWindow()->setup(window); overlayWindow()->setup(window);
} else { } else {
qCCritical(KWIN_X11STANDALONE) << "Failed to create overlay window"; qCCritical(KWIN_X11STANDALONE) << "Failed to create overlay window";
@ -884,7 +884,7 @@ void GlxTexture::onDamage()
{ {
if (options->isGlStrictBinding() && m_glxpixmap) { if (options->isGlStrictBinding() && m_glxpixmap) {
glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT); 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(); GLTexturePrivate::onDamage();
} }

View file

@ -88,7 +88,7 @@ void OverlayWindowX11::setup(xcb_window_t window)
void OverlayWindowX11::setupInputShape(xcb_window_t window) void OverlayWindowX11::setupInputShape(xcb_window_t window)
{ {
xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, window, 0, 0, 0, NULL); xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, window, 0, 0, 0, nullptr);
} }
void OverlayWindowX11::setNoneBackgroundPixmap(xcb_window_t window) void OverlayWindowX11::setNoneBackgroundPixmap(xcb_window_t window)

View file

@ -94,7 +94,7 @@ bool WindowSelector::activate(const QByteArray &cursorName)
XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW, XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE, 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) { if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) {
return false; return false;
} }
@ -241,7 +241,7 @@ void WindowSelector::selectWindowId(xcb_window_t window_to_select)
return; return;
} }
xcb_window_t window = window_to_select; xcb_window_t window = window_to_select;
Client* client = NULL; Client* client = nullptr;
while (true) { while (true) {
client = Workspace::self()->findClient(Predicate::FrameIdMatch, window); client = Workspace::self()->findClient(Predicate::FrameIdMatch, window);
if (client) { if (client) {

View file

@ -45,10 +45,10 @@ namespace KWin
LanczosFilter::LanczosFilter(QObject* parent) LanczosFilter::LanczosFilter(QObject* parent)
: QObject(parent) : QObject(parent)
, m_offscreenTex(0) , m_offscreenTex(nullptr)
, m_offscreenTarget(0) , m_offscreenTarget(nullptr)
, m_inited(false) , m_inited(false)
, m_shader(0) , m_shader(nullptr)
, m_uOffsets(0) , m_uOffsets(0)
, m_uKernel(0) , m_uKernel(0)
{ {
@ -240,7 +240,7 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region,
} else { } else {
// offscreen texture not matching - delete // offscreen texture not matching - delete
delete cachedTexture; delete cachedTexture;
cachedTexture = 0; cachedTexture = nullptr;
w->setData(LanczosCacheRole, QVariant()); w->setData(LanczosCacheRole, QVariant());
} }
} }
@ -392,8 +392,8 @@ void LanczosFilter::timerEvent(QTimerEvent *event)
delete m_offscreenTarget; delete m_offscreenTarget;
delete m_offscreenTex; delete m_offscreenTex;
m_offscreenTarget = 0; m_offscreenTarget = nullptr;
m_offscreenTex = 0; m_offscreenTex = nullptr;
foreach (Client *c, Workspace::self()->clientList()) { foreach (Client *c, Workspace::self()->clientList()) {
discardCacheTexture(c->effectWindow()); discardCacheTexture(c->effectWindow());
} }

View file

@ -43,7 +43,7 @@ class LanczosFilter : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit LanczosFilter(QObject* parent = 0); explicit LanczosFilter(QObject* parent = nullptr);
~LanczosFilter() override; ~LanczosFilter() override;
void performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); void performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data);

View file

@ -494,15 +494,15 @@ SceneOpenGL *SceneOpenGL::createScene(QObject *parent)
} }
if (backend->isFailed()) { if (backend->isFailed()) {
delete backend; delete backend;
return NULL; return nullptr;
} }
SceneOpenGL *scene = NULL; SceneOpenGL *scene = nullptr;
// first let's try an OpenGL 2 scene // first let's try an OpenGL 2 scene
if (SceneOpenGL2::supported(backend)) { if (SceneOpenGL2::supported(backend)) {
scene = new SceneOpenGL2(backend, parent); scene = new SceneOpenGL2(backend, parent);
if (scene->initFailed()) { if (scene->initFailed()) {
delete scene; delete scene;
scene = NULL; scene = nullptr;
} else { } else {
return scene; return scene;
} }
@ -918,7 +918,7 @@ bool SceneOpenGL2::supported(OpenGLBackend *backend)
SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent) SceneOpenGL2::SceneOpenGL2(OpenGLBackend *backend, QObject *parent)
: SceneOpenGL(backend, parent) : SceneOpenGL(backend, parent)
, m_lanczosFilter(NULL) , m_lanczosFilter(nullptr)
{ {
if (!init_ok) { if (!init_ok) {
// base ctor already failed // base ctor already failed
@ -1027,7 +1027,7 @@ void SceneOpenGL2::doPaintBackground(const QVector< float >& vertices)
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset(); vbo->reset();
vbo->setUseColor(true); 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); ShaderBinder binder(ShaderTrait::UniformColor);
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, m_projectionMatrix); binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, m_projectionMatrix);
@ -1060,7 +1060,7 @@ void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion reg
connect(screens(), &Screens::changed, this, [this]() { connect(screens(), &Screens::changed, this, [this]() {
makeOpenGLContextCurrent(); makeOpenGLContextCurrent();
delete m_lanczosFilter; delete m_lanczosFilter;
m_lanczosFilter = NULL; m_lanczosFilter = nullptr;
}); });
} }
m_lanczosFilter->performPaint(w, mask, region, data); m_lanczosFilter->performPaint(w, mask, region, data);
@ -1074,7 +1074,7 @@ void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion reg
SceneOpenGL::Window::Window(Toplevel* c) SceneOpenGL::Window::Window(Toplevel* c)
: Scene::Window(c) : Scene::Window(c)
, m_scene(NULL) , m_scene(nullptr)
{ {
} }
@ -1082,11 +1082,11 @@ SceneOpenGL::Window::~Window()
{ {
} }
static SceneOpenGLTexture *s_frameTexture = NULL; static SceneOpenGLTexture *s_frameTexture = nullptr;
// Bind the window pixmap to an OpenGL texture. // Bind the window pixmap to an OpenGL texture.
bool SceneOpenGL::Window::bindTexture() bool SceneOpenGL::Window::bindTexture()
{ {
s_frameTexture = NULL; s_frameTexture = nullptr;
OpenGLWindowPixmap *pixmap = windowPixmap<OpenGLWindowPixmap>(); OpenGLWindowPixmap *pixmap = windowPixmap<OpenGLWindowPixmap>();
if (!pixmap) { if (!pixmap) {
return false; return false;
@ -1293,7 +1293,7 @@ void SceneOpenGL2Window::setupLeafNodes(LeafNode *nodes, const WindowQuadList *q
if (data.crossFadeProgress() != 1.0) { if (data.crossFadeProgress() != 1.0) {
OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>(); OpenGLWindowPixmap *previous = previousWindowPixmap<OpenGLWindowPixmap>();
nodes[PreviousContentLeaf].texture = previous ? previous->texture() : NULL; nodes[PreviousContentLeaf].texture = previous ? previous->texture() : nullptr;
nodes[PreviousContentLeaf].hasAlpha = !isOpaque(); nodes[PreviousContentLeaf].hasAlpha = !isOpaque();
nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress()); nodes[PreviousContentLeaf].opacity = data.opacity() * (1.0 - data.crossFadeProgress());
nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates; nodes[PreviousContentLeaf].coordinateType = NormalizedCoordinates;
@ -1596,19 +1596,19 @@ bool OpenGLWindowPixmap::isValid() const
// SceneOpenGL::EffectFrame // SceneOpenGL::EffectFrame
//**************************************** //****************************************
GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = NULL; GLTexture* SceneOpenGL::EffectFrame::m_unstyledTexture = nullptr;
QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = NULL; QPixmap* SceneOpenGL::EffectFrame::m_unstyledPixmap = nullptr;
SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene) SceneOpenGL::EffectFrame::EffectFrame(EffectFrameImpl* frame, SceneOpenGL *scene)
: Scene::EffectFrame(frame) : Scene::EffectFrame(frame)
, m_texture(NULL) , m_texture(nullptr)
, m_textTexture(NULL) , m_textTexture(nullptr)
, m_oldTextTexture(NULL) , m_oldTextTexture(nullptr)
, m_textPixmap(NULL) , m_textPixmap(nullptr)
, m_iconTexture(NULL) , m_iconTexture(nullptr)
, m_oldIconTexture(NULL) , m_oldIconTexture(nullptr)
, m_selectionTexture(NULL) , m_selectionTexture(nullptr)
, m_unstyledVBO(NULL) , m_unstyledVBO(nullptr)
, m_scene(scene) , m_scene(scene)
{ {
if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) { if (m_effectFrame->style() == EffectFrameUnstyled && !m_unstyledTexture) {
@ -1632,55 +1632,55 @@ void SceneOpenGL::EffectFrame::free()
{ {
glFlush(); glFlush();
delete m_texture; delete m_texture;
m_texture = NULL; m_texture = nullptr;
delete m_textTexture; delete m_textTexture;
m_textTexture = NULL; m_textTexture = nullptr;
delete m_textPixmap; delete m_textPixmap;
m_textPixmap = NULL; m_textPixmap = nullptr;
delete m_iconTexture; delete m_iconTexture;
m_iconTexture = NULL; m_iconTexture = nullptr;
delete m_selectionTexture; delete m_selectionTexture;
m_selectionTexture = NULL; m_selectionTexture = nullptr;
delete m_unstyledVBO; delete m_unstyledVBO;
m_unstyledVBO = NULL; m_unstyledVBO = nullptr;
delete m_oldIconTexture; delete m_oldIconTexture;
m_oldIconTexture = NULL; m_oldIconTexture = nullptr;
delete m_oldTextTexture; delete m_oldTextTexture;
m_oldTextTexture = NULL; m_oldTextTexture = nullptr;
} }
void SceneOpenGL::EffectFrame::freeIconFrame() void SceneOpenGL::EffectFrame::freeIconFrame()
{ {
delete m_iconTexture; delete m_iconTexture;
m_iconTexture = NULL; m_iconTexture = nullptr;
} }
void SceneOpenGL::EffectFrame::freeTextFrame() void SceneOpenGL::EffectFrame::freeTextFrame()
{ {
delete m_textTexture; delete m_textTexture;
m_textTexture = NULL; m_textTexture = nullptr;
delete m_textPixmap; delete m_textPixmap;
m_textPixmap = NULL; m_textPixmap = nullptr;
} }
void SceneOpenGL::EffectFrame::freeSelection() void SceneOpenGL::EffectFrame::freeSelection()
{ {
delete m_selectionTexture; delete m_selectionTexture;
m_selectionTexture = NULL; m_selectionTexture = nullptr;
} }
void SceneOpenGL::EffectFrame::crossFadeIcon() void SceneOpenGL::EffectFrame::crossFadeIcon()
{ {
delete m_oldIconTexture; delete m_oldIconTexture;
m_oldIconTexture = m_iconTexture; m_oldIconTexture = m_iconTexture;
m_iconTexture = NULL; m_iconTexture = nullptr;
} }
void SceneOpenGL::EffectFrame::crossFadeText() void SceneOpenGL::EffectFrame::crossFadeText()
{ {
delete m_oldTextTexture; delete m_oldTextTexture;
m_oldTextTexture = m_textTexture; m_oldTextTexture = m_textTexture;
m_textTexture = NULL; m_textTexture = nullptr;
} }
void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity) void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double frameOpacity)
@ -1951,7 +1951,7 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra
void SceneOpenGL::EffectFrame::updateTexture() void SceneOpenGL::EffectFrame::updateTexture()
{ {
delete m_texture; delete m_texture;
m_texture = 0L; m_texture = nullptr;
if (m_effectFrame->style() == EffectFrameStyled) { if (m_effectFrame->style() == EffectFrameStyled) {
QPixmap pixmap = m_effectFrame->frame().framePixmap(); QPixmap pixmap = m_effectFrame->frame().framePixmap();
m_texture = new GLTexture(pixmap); m_texture = new GLTexture(pixmap);
@ -1961,9 +1961,9 @@ void SceneOpenGL::EffectFrame::updateTexture()
void SceneOpenGL::EffectFrame::updateTextTexture() void SceneOpenGL::EffectFrame::updateTextTexture()
{ {
delete m_textTexture; delete m_textTexture;
m_textTexture = 0L; m_textTexture = nullptr;
delete m_textPixmap; delete m_textPixmap;
m_textPixmap = 0L; m_textPixmap = nullptr;
if (m_effectFrame->text().isEmpty()) if (m_effectFrame->text().isEmpty())
return; return;
@ -1996,9 +1996,9 @@ void SceneOpenGL::EffectFrame::updateTextTexture()
void SceneOpenGL::EffectFrame::updateUnstyledTexture() void SceneOpenGL::EffectFrame::updateUnstyledTexture()
{ {
delete m_unstyledTexture; delete m_unstyledTexture;
m_unstyledTexture = 0L; m_unstyledTexture = nullptr;
delete m_unstyledPixmap; delete m_unstyledPixmap;
m_unstyledPixmap = 0L; m_unstyledPixmap = nullptr;
// Based off circle() from kwinxrenderutils.cpp // Based off circle() from kwinxrenderutils.cpp
#define CS 8 #define CS 8
m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS); m_unstyledPixmap = new QPixmap(2 * CS, 2 * CS);
@ -2016,9 +2016,9 @@ void SceneOpenGL::EffectFrame::updateUnstyledTexture()
void SceneOpenGL::EffectFrame::cleanup() void SceneOpenGL::EffectFrame::cleanup()
{ {
delete m_unstyledTexture; delete m_unstyledTexture;
m_unstyledTexture = NULL; m_unstyledTexture = nullptr;
delete m_unstyledPixmap; delete m_unstyledPixmap;
m_unstyledPixmap = NULL; m_unstyledPixmap = nullptr;
} }
//**************************************** //****************************************

View file

@ -183,7 +183,7 @@ public:
struct LeafNode struct LeafNode
{ {
LeafNode() LeafNode()
: texture(0), : texture(nullptr),
firstVertex(0), firstVertex(0),
vertexCount(0), vertexCount(0),
opacity(1.0), opacity(1.0),

View file

@ -53,7 +53,7 @@ SceneQPainter *SceneQPainter::createScene(QObject *parent)
return nullptr; return nullptr;
} }
if (backend->isFailed()) { if (backend->isFailed()) {
return NULL; return nullptr;
} }
return new SceneQPainter(backend.take(), parent); return new SceneQPainter(backend.take(), parent);
} }

View file

@ -80,7 +80,7 @@ XRenderBackend::~XRenderBackend()
OverlayWindow* XRenderBackend::overlayWindow() OverlayWindow* XRenderBackend::overlayWindow()
{ {
return NULL; return nullptr;
} }
void XRenderBackend::showOverlay() void XRenderBackend::showOverlay()
@ -146,7 +146,7 @@ void X11XRenderBackend::init(bool createOverlay)
if (haveOverlay) { if (haveOverlay) {
m_overlayWindow->setup(XCB_WINDOW_NONE); m_overlayWindow->setup(XCB_WINDOW_NONE);
ScopedCPointer<xcb_get_window_attributes_reply_t> attribs(xcb_get_window_attributes_reply(connection(), ScopedCPointer<xcb_get_window_attributes_reply_t> 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) { if (!attribs) {
setFailed("Failed getting window attributes for overlay window"); setFailed("Failed getting window attributes for overlay window");
return; return;
@ -157,7 +157,7 @@ void X11XRenderBackend::init(bool createOverlay)
return; return;
} }
m_front = xcb_generate_id(connection()); 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 { } else {
// create XRender picture for the root window // create XRender picture for the root window
m_format = XRenderUtils::findPictFormat(defaultScreen()->root_visual); m_format = XRenderUtils::findPictFormat(defaultScreen()->root_visual);
@ -178,7 +178,7 @@ void X11XRenderBackend::createBuffer()
const auto displaySize = screens()->displaySize(); const auto displaySize = screens()->displaySize();
xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displaySize.width(), displaySize.height()); xcb_create_pixmap(connection(), Xcb::defaultDepth(), pixmap, rootWindow(), displaySize.width(), displaySize.height());
xcb_render_picture_t b = xcb_generate_id(connection()); 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 xcb_free_pixmap(connection(), pixmap); // The picture owns the pixmap now
setBuffer(b); setBuffer(b);
} }
@ -224,7 +224,7 @@ SceneXrender* SceneXrender::createScene(QObject *parent)
QScopedPointer<XRenderBackend> backend; QScopedPointer<XRenderBackend> backend;
backend.reset(new X11XRenderBackend); backend.reset(new X11XRenderBackend);
if (backend->isFailed()) { if (backend->isFailed()) {
return NULL; return nullptr;
} }
return new SceneXrender(backend.take(), parent); return new SceneXrender(backend.take(), parent);
} }
@ -312,7 +312,7 @@ Decoration::Renderer *SceneXrender::createDecorationRenderer(Decoration::Decorat
// SceneXrender::Window // SceneXrender::Window
//**************************************** //****************************************
XRenderPicture *SceneXrender::Window::s_tempPicture = 0; XRenderPicture *SceneXrender::Window::s_tempPicture = nullptr;
QRect SceneXrender::Window::temp_visibleRect; QRect SceneXrender::Window::temp_visibleRect;
XRenderPicture *SceneXrender::Window::s_fadeAlphaPicture = nullptr; XRenderPicture *SceneXrender::Window::s_fadeAlphaPicture = nullptr;
@ -331,7 +331,7 @@ SceneXrender::Window::~Window()
void SceneXrender::Window::cleanup() void SceneXrender::Window::cleanup()
{ {
delete s_tempPicture; delete s_tempPicture;
s_tempPicture = NULL; s_tempPicture = nullptr;
delete s_fadeAlphaPicture; delete s_fadeAlphaPicture;
s_fadeAlphaPicture = nullptr; s_fadeAlphaPicture = nullptr;
} }
@ -392,7 +392,7 @@ void SceneXrender::Window::prepareTempPixmap()
temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos()); temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos());
if (s_tempPicture && (oldSize.width() < temp_visibleRect.width() || oldSize.height() < temp_visibleRect.height())) { if (s_tempPicture && (oldSize.width() < temp_visibleRect.width() || oldSize.height() < temp_visibleRect.height())) {
delete s_tempPicture; delete s_tempPicture;
s_tempPicture = NULL; s_tempPicture = nullptr;
scene_setXRenderOffscreenTarget(0); // invalidate, better crash than cause weird results for developers scene_setXRenderOffscreenTarget(0); // invalidate, better crash than cause weird results for developers
} }
if (!s_tempPicture) { if (!s_tempPicture) {
@ -768,7 +768,7 @@ void SceneXrender::Window::setPictureFilter(xcb_render_picture_t pic, Scene::Ima
filterName = QByteArray("good"); filterName = QByteArray("good");
break; 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() WindowPixmap* SceneXrender::Window::createWindowPixmap()
@ -810,22 +810,22 @@ void XRenderWindowPixmap::create()
return; return;
} }
m_picture = xcb_generate_id(connection()); 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 // SceneXrender::EffectFrame
//**************************************** //****************************************
XRenderPicture *SceneXrender::EffectFrame::s_effectFrameCircle = NULL; XRenderPicture *SceneXrender::EffectFrame::s_effectFrameCircle = nullptr;
SceneXrender::EffectFrame::EffectFrame(EffectFrameImpl* frame) SceneXrender::EffectFrame::EffectFrame(EffectFrameImpl* frame)
: Scene::EffectFrame(frame) : Scene::EffectFrame(frame)
{ {
m_picture = NULL; m_picture = nullptr;
m_textPicture = NULL; m_textPicture = nullptr;
m_iconPicture = NULL; m_iconPicture = nullptr;
m_selectionPicture = NULL; m_selectionPicture = nullptr;
} }
SceneXrender::EffectFrame::~EffectFrame() SceneXrender::EffectFrame::~EffectFrame()
@ -839,37 +839,37 @@ SceneXrender::EffectFrame::~EffectFrame()
void SceneXrender::EffectFrame::cleanup() void SceneXrender::EffectFrame::cleanup()
{ {
delete s_effectFrameCircle; delete s_effectFrameCircle;
s_effectFrameCircle = NULL; s_effectFrameCircle = nullptr;
} }
void SceneXrender::EffectFrame::free() void SceneXrender::EffectFrame::free()
{ {
delete m_picture; delete m_picture;
m_picture = NULL; m_picture = nullptr;
delete m_textPicture; delete m_textPicture;
m_textPicture = NULL; m_textPicture = nullptr;
delete m_iconPicture; delete m_iconPicture;
m_iconPicture = NULL; m_iconPicture = nullptr;
delete m_selectionPicture; delete m_selectionPicture;
m_selectionPicture = NULL; m_selectionPicture = nullptr;
} }
void SceneXrender::EffectFrame::freeIconFrame() void SceneXrender::EffectFrame::freeIconFrame()
{ {
delete m_iconPicture; delete m_iconPicture;
m_iconPicture = NULL; m_iconPicture = nullptr;
} }
void SceneXrender::EffectFrame::freeTextFrame() void SceneXrender::EffectFrame::freeTextFrame()
{ {
delete m_textPicture; delete m_textPicture;
m_textPicture = NULL; m_textPicture = nullptr;
} }
void SceneXrender::EffectFrame::freeSelection() void SceneXrender::EffectFrame::freeSelection()
{ {
delete m_selectionPicture; delete m_selectionPicture;
m_selectionPicture = NULL; m_selectionPicture = nullptr;
} }
void SceneXrender::EffectFrame::crossFadeIcon() void SceneXrender::EffectFrame::crossFadeIcon()
@ -1038,7 +1038,7 @@ xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *s_effectFrameCircle
void SceneXrender::EffectFrame::updatePicture() void SceneXrender::EffectFrame::updatePicture()
{ {
delete m_picture; delete m_picture;
m_picture = 0L; m_picture = nullptr;
if (m_effectFrame->style() == EffectFrameStyled) { if (m_effectFrame->style() == EffectFrameStyled) {
const QPixmap pix = m_effectFrame->frame().framePixmap(); const QPixmap pix = m_effectFrame->frame().framePixmap();
if (!pix.isNull()) if (!pix.isNull())
@ -1050,7 +1050,7 @@ void SceneXrender::EffectFrame::updateTextPicture()
{ {
// Mostly copied from SceneOpenGL::EffectFrame::updateTextTexture() above // Mostly copied from SceneOpenGL::EffectFrame::updateTextTexture() above
delete m_textPicture; delete m_textPicture;
m_textPicture = 0L; m_textPicture = nullptr;
if (m_effectFrame->text().isEmpty()) { if (m_effectFrame->text().isEmpty()) {
return; return;
@ -1088,7 +1088,7 @@ SceneXRenderShadow::SceneXRenderShadow(Toplevel *toplevel)
:Shadow(toplevel) :Shadow(toplevel)
{ {
for (int i=0; i<ShadowElementsCount; ++i) { for (int i=0; i<ShadowElementsCount; ++i) {
m_pictures[i] = NULL; m_pictures[i] = nullptr;
} }
} }

View file

@ -461,7 +461,7 @@ void Scene::clearStackingOrder()
stacking_order.clear(); stacking_order.clear();
} }
static Scene::Window *s_recursionCheck = NULL; static Scene::Window *s_recursionCheck = nullptr;
void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quads) void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quads)
{ {
@ -597,7 +597,7 @@ void Scene::paintDesktopThumbnails(Scene::Window *w)
data += QPointF(x, y); data += QPointF(x, y);
const int desktopMask = PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST; const int desktopMask = PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST;
paintDesktop(item->desktop(), desktopMask, clippingRegion, data); paintDesktop(item->desktop(), desktopMask, clippingRegion, data);
s_recursionCheck = NULL; s_recursionCheck = nullptr;
} }
} }
@ -690,13 +690,13 @@ QVector<QByteArray> Scene::openGLPlatformInterfaceExtensions() const
Scene::Window::Window(Toplevel * c) Scene::Window::Window(Toplevel * c)
: toplevel(c) : toplevel(c)
, filter(ImageFilterFast) , filter(ImageFilterFast)
, m_shadow(NULL) , m_shadow(nullptr)
, m_currentPixmap() , m_currentPixmap()
, m_previousPixmap() , m_previousPixmap()
, m_referencePixmapCounter(0) , m_referencePixmapCounter(0)
, disable_painting(0) , disable_painting(0)
, shape_valid(false) , shape_valid(false)
, cached_quad_list(NULL) , cached_quad_list(nullptr)
{ {
} }
@ -841,7 +841,7 @@ void Scene::Window::disablePainting(int reason)
WindowQuadList Scene::Window::buildQuads(bool force) const WindowQuadList Scene::Window::buildQuads(bool force) const
{ {
if (cached_quad_list != NULL && !force) if (cached_quad_list != nullptr && !force)
return *cached_quad_list; return *cached_quad_list;
WindowQuadList ret; WindowQuadList ret;
qreal scale = 1.0; qreal scale = 1.0;

Some files were not shown because too many files have changed in this diff Show more