Use nullptr everywhere

Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.

This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, davidedmundson, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23618
This commit is contained in:
Vlad Zahorodnii 2019-09-19 17:46:54 +03:00
parent 6b610927f4
commit 62a7db7028
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()->checkOpacityInactive(qRound(opacity() * 100.0));
setOpacity(ruledOpacity / 100.0);
workspace()->setActiveClient(act ? this : NULL);
workspace()->setActiveClient(act ? this : nullptr);
if (!m_active)
cancelAutoRaise();

View file

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

View file

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

View file

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

View file

@ -100,7 +100,7 @@ public:
AbstractClient* findModal(bool allow_itself = false) override;
const Group* group() const override;
Group* group() override;
void checkGroup(Group* gr = NULL, bool force = false);
void checkGroup(Group* gr = nullptr, bool force = false);
void changeClientLeaderGroup(Group* gr);
void updateWindowRules(Rules::Types selection) override;
void updateFullscreenMonitors(NETFullscreenMonitors topology);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -107,7 +107,7 @@ private:
bool reflectedWindows = false);
void paintWindowCover(EffectWindow* w, bool reflectedWindow, WindowPaintData& data);
void paintFrontWindow(EffectWindow* frontWindow, int width, int leftWindows, int rightWindows, bool reflectedWindow);
void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = NULL);
void paintWindows(const EffectWindowList& windows, bool left, bool reflectedWindows, EffectWindow* additionalWindow = nullptr);
void selectNextOrPreviousWindow(bool forward);
inline void selectNextWindow() { selectNextOrPreviousWindow(true); }
inline void selectPreviousWindow() { selectNextOrPreviousWindow(false); }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,7 +49,7 @@ public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow* w);
void slotWindowClosed(KWin::EffectWindow *w);
void slotWindowDeleted(KWin::EffectWindow *w);
void slotPropertyNotify(KWin::EffectWindow* w, long atom, EffectWindow *addedWindow = NULL);
void slotPropertyNotify(KWin::EffectWindow* w, long atom, EffectWindow *addedWindow = nullptr);
private:
void prepareHighlighting();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -138,7 +138,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
foreach (const QPoint & p, mark) {
verts << p.x() << p.y();
}
vbo->setData(verts.size() / 2, 2, verts.data(), NULL);
vbo->setData(verts.size() / 2, 2, verts.data(), nullptr);
vbo->render(GL_LINE_STRIP);
}
if (!drawing.isEmpty()) {
@ -147,7 +147,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
foreach (const QPoint & p, drawing) {
verts << p.x() << p.y();
}
vbo->setData(verts.size() / 2, 2, verts.data(), NULL);
vbo->setData(verts.size() / 2, 2, verts.data(), nullptr);
vbo->render(GL_LINE_STRIP);
}
glLineWidth(1.0);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -231,7 +231,7 @@ void TouchPointsEffect::drawCircleGl(const QColor& color, float cx, float cy, fl
x = c * x - s * y;
y = s * t + c * y;
}
vbo->setData(verts.size() / 2, 2, verts.data(), NULL);
vbo->setData(verts.size() / 2, 2, verts.data(), nullptr);
vbo->render(GL_LINE_LOOP);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -61,7 +61,7 @@ ZoomEffect::ZoomEffect()
, moveFactor(20.0)
{
initConfig<ZoomConfig>();
QAction* a = 0;
QAction* a = nullptr;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this);
KGlobalAccel::self()->setDefaultShortcut(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)
};
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 = {
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),

View file

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

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

View file

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -100,7 +100,7 @@ protected:
void mousePressEvent(QGraphicsSceneMouseEvent* e) override;
void hoverEnterEvent(QGraphicsSceneHoverEvent * e) override;
void hoverLeaveEvent(QGraphicsSceneHoverEvent * e) override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) override;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
private:
Monitor* monitor;
Plasma::FrameSvg *button;

View file

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

View file

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

View file

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

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 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;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -461,7 +461,7 @@ void Scene::clearStackingOrder()
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)
{
@ -597,7 +597,7 @@ void Scene::paintDesktopThumbnails(Scene::Window *w)
data += QPointF(x, y);
const int desktopMask = PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_BACKGROUND_FIRST;
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)
: toplevel(c)
, filter(ImageFilterFast)
, m_shadow(NULL)
, m_shadow(nullptr)
, m_currentPixmap()
, m_previousPixmap()
, m_referencePixmapCounter(0)
, disable_painting(0)
, shape_valid(false)
, cached_quad_list(NULL)
, cached_quad_list(nullptr)
{
}
@ -841,7 +841,7 @@ void Scene::Window::disablePainting(int reason)
WindowQuadList Scene::Window::buildQuads(bool force) const
{
if (cached_quad_list != NULL && !force)
if (cached_quad_list != nullptr && !force)
return *cached_quad_list;
WindowQuadList ret;
qreal scale = 1.0;

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