From 74f10d0cdf0e14a7f8919d3d1fd2fd5e041c0816 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 10 Aug 2023 18:53:37 +0200 Subject: [PATCH] port most uses of the reset(new ...) pattern to std::make_unique --- autotests/integration/kwin_wayland_test.cpp | 6 +++--- .../integration/xdgshellwindow_rules_test.cpp | 4 ++-- src/debug_console.cpp | 2 +- src/helpers/wayland_wrapper/kwin_wrapper.cpp | 2 +- src/libkwineffects/kwinglutils.cpp | 2 +- src/libkwineffects/kwinoffscreeneffect.cpp | 2 +- src/libkwineffects/kwinoffscreenquickview.cpp | 8 ++++---- src/libkwineffects/kwinquickeffect.cpp | 2 +- src/main_x11.cpp | 2 +- src/netinfo.cpp | 2 +- src/netinfo.h | 4 ++-- src/onscreennotification.cpp | 6 +++--- .../opengl/basiceglsurfacetexture_wayland.cpp | 2 +- src/plugins/kdecorations/aurorae/src/aurorae.cpp | 4 ++-- .../screencast/regionscreencastsource.cpp | 2 +- src/plugins/screenshot/screenshot.cpp | 2 +- src/plugins/screentransform/screentransform.cpp | 4 ++-- src/plugins/startupfeedback/startupfeedback.cpp | 2 +- src/scripting/windowthumbnailitem.cpp | 2 +- src/tabbox/tabbox.cpp | 2 +- src/tabbox/tabboxhandler.cpp | 4 ++-- src/tiles/tilemanager.cpp | 2 +- src/useractions.cpp | 2 +- src/utils/udev.cpp | 8 ++------ src/wayland/linuxdmabufv1clientbuffer.cpp | 2 +- src/workspace.cpp | 13 ++++++------- src/x11window.cpp | 2 +- src/xdgactivationv1.cpp | 2 +- src/xdgactivationv1.h | 16 ++++++++-------- src/xwayland/xwayland.cpp | 4 ++-- src/xwayland/xwaylandlauncher.cpp | 2 +- 31 files changed, 57 insertions(+), 62 deletions(-) diff --git a/autotests/integration/kwin_wayland_test.cpp b/autotests/integration/kwin_wayland_test.cpp index 47e80f1f76..b151e0a614 100644 --- a/autotests/integration/kwin_wayland_test.cpp +++ b/autotests/integration/kwin_wayland_test.cpp @@ -95,15 +95,15 @@ WaylandTestApplication::~WaylandTestApplication() void WaylandTestApplication::createVirtualInputDevices() { - m_virtualKeyboard.reset(new Test::VirtualInputDevice()); + m_virtualKeyboard = std::make_unique(); m_virtualKeyboard->setName(QStringLiteral("Virtual Keyboard 1")); m_virtualKeyboard->setKeyboard(true); - m_virtualPointer.reset(new Test::VirtualInputDevice()); + m_virtualPointer = std::make_unique(); m_virtualPointer->setName(QStringLiteral("Virtual Pointer 1")); m_virtualPointer->setPointer(true); - m_virtualTouch.reset(new Test::VirtualInputDevice()); + m_virtualTouch = std::make_unique(); m_virtualTouch->setName(QStringLiteral("Virtual Touch 1")); m_virtualTouch->setTouch(true); diff --git a/autotests/integration/xdgshellwindow_rules_test.cpp b/autotests/integration/xdgshellwindow_rules_test.cpp index 5fb167b456..25181a8bd8 100644 --- a/autotests/integration/xdgshellwindow_rules_test.cpp +++ b/autotests/integration/xdgshellwindow_rules_test.cpp @@ -233,8 +233,8 @@ void TestXdgShellWindowRules::createTestWindow(ClientFlags flags) Test::XdgToplevelDecorationV1 *decoration = Test::createXdgToplevelDecorationV1(m_shellSurface.get(), m_shellSurface.get()); // Add signal watchers - m_toplevelConfigureRequestedSpy.reset(new QSignalSpy(m_shellSurface.get(), &Test::XdgToplevel::configureRequested)); - m_surfaceConfigureRequestedSpy.reset(new QSignalSpy(m_shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested)); + m_toplevelConfigureRequestedSpy = std::make_unique(m_shellSurface.get(), &Test::XdgToplevel::configureRequested); + m_surfaceConfigureRequestedSpy = std::make_unique(m_shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested); m_shellSurface->set_app_id(QStringLiteral("org.kde.foo")); decoration->set_mode(decorationMode); diff --git a/src/debug_console.cpp b/src/debug_console.cpp index da97ae2093..380b39dc01 100644 --- a/src/debug_console.cpp +++ b/src/debug_console.cpp @@ -622,7 +622,7 @@ DebugConsole::DebugConsole() connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, [this](int index) { // delay creation of input event filter until the tab is selected if (index == 2 && !m_inputFilter) { - m_inputFilter.reset(new DebugConsoleFilter(m_ui->inputTextEdit)); + m_inputFilter = std::make_unique(m_ui->inputTextEdit); input()->installInputEventSpy(m_inputFilter.get()); } if (index == 5) { diff --git a/src/helpers/wayland_wrapper/kwin_wrapper.cpp b/src/helpers/wayland_wrapper/kwin_wrapper.cpp index 1fd7022159..9f08261faf 100644 --- a/src/helpers/wayland_wrapper/kwin_wrapper.cpp +++ b/src/helpers/wayland_wrapper/kwin_wrapper.cpp @@ -64,7 +64,7 @@ KWinWrapper::KWinWrapper(QObject *parent) } if (qApp->arguments().contains(QLatin1String("--xwayland"))) { - m_xwlSocket.reset(new KWin::XwaylandSocket(KWin::XwaylandSocket::OperationMode::TransferFdsOnExec)); + m_xwlSocket = std::make_unique(KWin::XwaylandSocket::OperationMode::TransferFdsOnExec); if (!m_xwlSocket->isValid()) { qCWarning(KWIN_WRAPPER) << "Failed to create Xwayland connection sockets"; m_xwlSocket.reset(); diff --git a/src/libkwineffects/kwinglutils.cpp b/src/libkwineffects/kwinglutils.cpp index 7d76260f46..cf65dd84bb 100644 --- a/src/libkwineffects/kwinglutils.cpp +++ b/src/libkwineffects/kwinglutils.cpp @@ -677,7 +677,7 @@ std::unique_ptr ShaderManager::s_shaderManager; ShaderManager *ShaderManager::instance() { if (!s_shaderManager) { - s_shaderManager.reset(new ShaderManager()); + s_shaderManager = std::make_unique(); } return s_shaderManager.get(); } diff --git a/src/libkwineffects/kwinoffscreeneffect.cpp b/src/libkwineffects/kwinoffscreeneffect.cpp index 46f1249b99..15b78cfa81 100644 --- a/src/libkwineffects/kwinoffscreeneffect.cpp +++ b/src/libkwineffects/kwinoffscreeneffect.cpp @@ -102,7 +102,7 @@ void OffscreenData::maybeRender(EffectWindow *window) } m_texture->setFilter(GL_LINEAR); m_texture->setWrapMode(GL_CLAMP_TO_EDGE); - m_fbo.reset(new GLFramebuffer(m_texture.get())); + m_fbo = std::make_unique(m_texture.get()); m_isDirty = true; } diff --git a/src/libkwineffects/kwinoffscreenquickview.cpp b/src/libkwineffects/kwinoffscreenquickview.cpp index f0fe103868..ed5942bbfb 100644 --- a/src/libkwineffects/kwinoffscreenquickview.cpp +++ b/src/libkwineffects/kwinoffscreenquickview.cpp @@ -108,13 +108,13 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, ExportMode exportMode) d->m_view->setFormat(format); auto shareContext = QOpenGLContext::globalShareContext(); - d->m_glcontext.reset(new QOpenGLContext); + d->m_glcontext = std::make_unique(); d->m_glcontext->setShareContext(shareContext); d->m_glcontext->setFormat(format); d->m_glcontext->create(); // and the offscreen surface - d->m_offscreenSurface.reset(new QOffscreenSurface); + d->m_offscreenSurface = std::make_unique(); d->m_offscreenSurface->setFormat(d->m_glcontext->format()); d->m_offscreenSurface->create(); @@ -217,7 +217,7 @@ void OffscreenQuickView::update() const QSize nativeSize = d->m_view->size() * d->m_view->effectiveDevicePixelRatio(); if (!d->m_fbo || d->m_fbo->size() != nativeSize) { d->m_textureExport.reset(nullptr); - d->m_fbo.reset(new QOpenGLFramebufferObject(nativeSize, QOpenGLFramebufferObject::CombinedDepthStencil)); + d->m_fbo = std::make_unique(nativeSize, QOpenGLFramebufferObject::CombinedDepthStencil); if (!d->m_fbo->isValid()) { d->m_fbo.reset(); d->m_glcontext->doneCurrent(); @@ -542,7 +542,7 @@ void OffscreenQuickScene::setSource(const QUrl &source) void OffscreenQuickScene::setSource(const QUrl &source, const QVariantMap &initialProperties) { if (!d->qmlComponent) { - d->qmlComponent.reset(new QQmlComponent(effects->qmlEngine())); + d->qmlComponent = std::make_unique(effects->qmlEngine()); } d->qmlComponent->loadUrl(source); diff --git a/src/libkwineffects/kwinquickeffect.cpp b/src/libkwineffects/kwinquickeffect.cpp index e5b6a5c344..389e370e94 100644 --- a/src/libkwineffects/kwinquickeffect.cpp +++ b/src/libkwineffects/kwinquickeffect.cpp @@ -437,7 +437,7 @@ void QuickSceneEffect::startInternal() } if (!d->qmlComponent) { - d->qmlComponent.reset(new QQmlComponent(effects->qmlEngine())); + d->qmlComponent = std::make_unique(effects->qmlEngine()); d->qmlComponent->loadUrl(d->source); if (d->qmlComponent->isError()) { qWarning().nospace() << "Failed to load " << d->source << ": " << d->qmlComponent->errors(); diff --git a/src/main_x11.cpp b/src/main_x11.cpp index 572819937d..a4e21be176 100644 --- a/src/main_x11.cpp +++ b/src/main_x11.cpp @@ -251,7 +251,7 @@ void ApplicationX11::performStartup() { crashChecking(); - owner.reset(new KWinSelectionOwner()); + owner = std::make_unique(); connect(owner.get(), &KSelectionOwner::failedToClaimOwnership, [] { fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit().constData(), stderr); ::exit(1); diff --git a/src/netinfo.cpp b/src/netinfo.cpp index c37c9203ba..2daad57318 100644 --- a/src/netinfo.cpp +++ b/src/netinfo.cpp @@ -115,7 +115,7 @@ RootInfo *RootInfo::create() | NET::ActionChangeDesktop | NET::ActionClose; - s_self.reset(new RootInfo(supportWindow, "KWin", properties, types, states, properties2, actions)); + s_self = std::make_unique(supportWindow, "KWin", properties, types, states, properties2, actions); return s_self.get(); } diff --git a/src/netinfo.h b/src/netinfo.h index 3dd4cc6266..d70c9eca22 100644 --- a/src/netinfo.h +++ b/src/netinfo.h @@ -31,6 +31,8 @@ class RootInfo : public NETRootInfo public: static RootInfo *create(); static void destroy(); + RootInfo(xcb_window_t w, const char *name, NET::Properties properties, NET::WindowTypes types, + NET::States states, NET::Properties2 properties2, NET::Actions actions, int scr = -1); void setActiveClient(Window *client); @@ -47,8 +49,6 @@ protected: void changeShowingDesktop(bool showing) override; private: - RootInfo(xcb_window_t w, const char *name, NET::Properties properties, NET::WindowTypes types, - NET::States states, NET::Properties2 properties2, NET::Actions actions, int scr = -1); static std::unique_ptr s_self; friend RootInfo *rootInfo(); diff --git a/src/onscreennotification.cpp b/src/onscreennotification.cpp index 40503e0a58..5a0da65406 100644 --- a/src/onscreennotification.cpp +++ b/src/onscreennotification.cpp @@ -160,7 +160,7 @@ void OnScreenNotification::ensureQmlContext() if (m_qmlContext) { return; } - m_qmlContext.reset(new QQmlContext(m_qmlEngine)); + m_qmlContext = std::make_unique(m_qmlEngine); m_qmlContext->setContextProperty(QStringLiteral("osd"), this); } @@ -171,7 +171,7 @@ void OnScreenNotification::ensureQmlComponent() if (m_qmlComponent) { return; } - m_qmlComponent.reset(new QQmlComponent(m_qmlEngine)); + m_qmlComponent = std::make_unique(m_qmlEngine); const QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, m_config->group(QStringLiteral("OnScreenNotification")).readEntry("QmlPath", QStringLiteral("kwin/onscreennotification/plasma/main.qml"))); if (fileName.isEmpty()) { @@ -189,7 +189,7 @@ void OnScreenNotification::createInputSpy() { Q_ASSERT(!m_spy); if (auto w = qobject_cast(m_mainItem.get())) { - m_spy.reset(new OnScreenNotificationInputEventSpy(this)); + m_spy = std::make_unique(this); input()->installInputEventSpy(m_spy.get()); if (!m_animation) { m_animation = new QPropertyAnimation(w, "opacity", this); diff --git a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp index 79f84e5ed0..6b0d63214d 100644 --- a/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp +++ b/src/platformsupport/scenes/opengl/basiceglsurfacetexture_wayland.cpp @@ -102,7 +102,7 @@ bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(GraphicsBuffer *buffer) return false; } - m_texture.reset(new GLTexture(GL_TEXTURE_2D)); + m_texture = std::make_unique(GL_TEXTURE_2D); m_texture->setSize(buffer->size()); m_texture->create(); m_texture->setWrapMode(GL_CLAMP_TO_EDGE); diff --git a/src/plugins/kdecorations/aurorae/src/aurorae.cpp b/src/plugins/kdecorations/aurorae/src/aurorae.cpp index 07de79aa03..f7fcb26c86 100644 --- a/src/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/src/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -85,7 +85,7 @@ void Helper::ref() { m_refCount++; if (m_refCount == 1) { - m_engine.reset(new QQmlEngine); + m_engine = std::make_unique(); init(); } } @@ -117,7 +117,7 @@ QQmlComponent *Helper::component(const QString &themeName) while (paths.hasPrevious()) { m_engine->addImportPath(paths.previous()); } - m_svgComponent.reset(new QQmlComponent(m_engine.get())); + m_svgComponent = std::make_unique(m_engine.get()); m_svgComponent->loadUrl(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/aurorae/aurorae.qml")))); } // verify that the theme exists diff --git a/src/plugins/screencast/regionscreencastsource.cpp b/src/plugins/screencast/regionscreencastsource.cpp index c4f9b1aa55..52da31b731 100644 --- a/src/plugins/screencast/regionscreencastsource.cpp +++ b/src/plugins/screencast/regionscreencastsource.cpp @@ -82,7 +82,7 @@ void RegionScreenCastSource::ensureTexture() if (!m_renderedTexture) { return; } - m_target.reset(new GLFramebuffer(m_renderedTexture.get())); + m_target = std::make_unique(m_renderedTexture.get()); const auto allOutputs = workspace()->outputs(); for (auto output : allOutputs) { if (output->geometry().intersects(m_region)) { diff --git a/src/plugins/screenshot/screenshot.cpp b/src/plugins/screenshot/screenshot.cpp index ab7a736cf5..ec3629258c 100644 --- a/src/plugins/screenshot/screenshot.cpp +++ b/src/plugins/screenshot/screenshot.cpp @@ -246,7 +246,7 @@ void ScreenShotEffect::takeScreenShot(ScreenShotWindowData *screenshot) } offscreenTexture->setFilter(GL_LINEAR); offscreenTexture->setWrapMode(GL_CLAMP_TO_EDGE); - target.reset(new GLFramebuffer(offscreenTexture.get())); + target = std::make_unique(offscreenTexture.get()); validTarget = target->valid(); } if (validTarget) { diff --git a/src/plugins/screentransform/screentransform.cpp b/src/plugins/screentransform/screentransform.cpp index b5ba085cba..c1ac6d7b80 100644 --- a/src/plugins/screentransform/screentransform.cpp +++ b/src/plugins/screentransform/screentransform.cpp @@ -89,7 +89,7 @@ void ScreenTransformEffect::addScreen(EffectScreen *screen) m_states.remove(screen); return; } - state.m_prev.framebuffer.reset(new GLFramebuffer(state.m_prev.texture.get())); + state.m_prev.framebuffer = std::make_unique(state.m_prev.texture.get()); // Rendering the current scene into a texture GLFramebuffer::pushFramebuffer(state.m_prev.framebuffer.get()); @@ -202,7 +202,7 @@ void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const m_states.remove(screen); return; } - it->m_current.framebuffer.reset(new GLFramebuffer(it->m_current.texture.get())); + it->m_current.framebuffer = std::make_unique(it->m_current.texture.get()); } RenderTarget fboRenderTarget(it->m_current.framebuffer.get()); diff --git a/src/plugins/startupfeedback/startupfeedback.cpp b/src/plugins/startupfeedback/startupfeedback.cpp index b737b6b97b..422c64e8b1 100644 --- a/src/plugins/startupfeedback/startupfeedback.cpp +++ b/src/plugins/startupfeedback/startupfeedback.cpp @@ -264,7 +264,7 @@ void StartupFeedbackEffect::gotNewStartup(const QString &id, const QIcon &icon) Startup &startup = m_startups[id]; startup.icon = icon; - startup.expiredTimer.reset(new QTimer()); + startup.expiredTimer = std::make_unique(); // Stop the animation if the startup doesn't finish within reasonable interval. connect(startup.expiredTimer.get(), &QTimer::timeout, this, [this, id]() { gotRemoveStartup(id); diff --git a/src/scripting/windowthumbnailitem.cpp b/src/scripting/windowthumbnailitem.cpp index ff0c59e9b8..b7234c4283 100644 --- a/src/scripting/windowthumbnailitem.cpp +++ b/src/scripting/windowthumbnailitem.cpp @@ -386,7 +386,7 @@ void WindowThumbnailItem::updateOffscreenTexture() } m_offscreenTexture->setFilter(GL_LINEAR); m_offscreenTexture->setWrapMode(GL_CLAMP_TO_EDGE); - m_offscreenTarget.reset(new GLFramebuffer(m_offscreenTexture.get())); + m_offscreenTarget = std::make_unique(m_offscreenTexture.get()); } RenderTarget offscreenRenderTarget(m_offscreenTarget.get()); diff --git a/src/tabbox/tabbox.cpp b/src/tabbox/tabbox.cpp index 076884f64b..abe080904f 100644 --- a/src/tabbox/tabbox.cpp +++ b/src/tabbox/tabbox.cpp @@ -1198,7 +1198,7 @@ bool TabBox::establishTabBoxGrab() if (Workspace::self()->activeWindow() != nullptr) { Workspace::self()->activeWindow()->updateMouseGrab(); } - m_x11EventFilter.reset(new X11Filter); + m_x11EventFilter = std::make_unique(); return true; } diff --git a/src/tabbox/tabboxhandler.cpp b/src/tabbox/tabboxhandler.cpp index 13d5901202..74c5783bc8 100644 --- a/src/tabbox/tabboxhandler.cpp +++ b/src/tabbox/tabboxhandler.cpp @@ -286,10 +286,10 @@ void TabBoxHandlerPrivate::show() #ifndef KWIN_UNIT_TEST if (!m_qmlContext) { qmlRegisterType("org.kde.kwin", 3, 0, "TabBoxSwitcher"); - m_qmlContext.reset(new QQmlContext(Scripting::self()->qmlEngine())); + m_qmlContext = std::make_unique(Scripting::self()->qmlEngine()); } if (!m_qmlComponent) { - m_qmlComponent.reset(new QQmlComponent(Scripting::self()->qmlEngine())); + m_qmlComponent = std::make_unique(Scripting::self()->qmlEngine()); } auto findMainItem = [this](const QMap &tabBoxes) -> QObject * { auto it = tabBoxes.constFind(config.layoutName()); diff --git a/src/tiles/tilemanager.cpp b/src/tiles/tilemanager.cpp index c65d283015..618aeac09b 100644 --- a/src/tiles/tilemanager.cpp +++ b/src/tiles/tilemanager.cpp @@ -58,7 +58,7 @@ TileManager::TileManager(Output *parent) , m_output(parent) , m_tileModel(new TileModel(this)) { - m_saveTimer.reset(new QTimer(this)); + m_saveTimer = std::make_unique(this); m_saveTimer->setSingleShot(true); m_saveTimer->setInterval(2000); connect(m_saveTimer.get(), &QTimer::timeout, this, &TileManager::saveSettings); diff --git a/src/useractions.cpp b/src/useractions.cpp index d88180164a..604f5e0254 100644 --- a/src/useractions.cpp +++ b/src/useractions.cpp @@ -1612,7 +1612,7 @@ void Workspace::slotWindowToDesktopDown() void Workspace::slotKillWindow() { if (!m_windowKiller) { - m_windowKiller.reset(new KillWindow()); + m_windowKiller = std::make_unique(); } m_windowKiller->start(); } diff --git a/src/utils/udev.cpp b/src/utils/udev.cpp index ae032d83dc..df723ccf19 100644 --- a/src/utils/udev.cpp +++ b/src/utils/udev.cpp @@ -156,7 +156,7 @@ UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath) qCWarning(KWIN_CORE) << "failed to retrieve device for" << syspath << strerror(errno); return {}; } - return UdevDevice::Ptr(new UdevDevice(dev)); + return std::make_unique(dev); } std::unique_ptr Udev::monitor() @@ -288,11 +288,7 @@ UdevDevice::Ptr UdevMonitor::getDevice() return UdevDevice::Ptr(); } auto dev = udev_monitor_receive_device(m_monitor); - if (!dev) { - return {}; - } - - return UdevDevice::Ptr(new UdevDevice(dev)); + return dev ? std::make_unique(dev) : nullptr; } } diff --git a/src/wayland/linuxdmabufv1clientbuffer.cpp b/src/wayland/linuxdmabufv1clientbuffer.cpp index e51c4727c3..6e5687e358 100644 --- a/src/wayland/linuxdmabufv1clientbuffer.cpp +++ b/src/wayland/linuxdmabufv1clientbuffer.cpp @@ -322,7 +322,7 @@ void LinuxDmaBufV1ClientBufferIntegration::setSupportedFormatsWithModifiers(cons } d->supportedModifiers = set; d->mainDevice = tranches.first().device; - d->table.reset(new LinuxDmaBufV1FormatTable(set)); + d->table = std::make_unique(set); d->defaultFeedback->setTranches(tranches); } } diff --git a/src/workspace.cpp b/src/workspace.cpp index 832f852707..784a02b5af 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -307,27 +307,26 @@ void Workspace::initializeX11() // first initialize the extensions Xcb::Extensions::self(); - m_colorMapper.reset(new ColorMapper(this)); + m_colorMapper = std::make_unique(this); connect(this, &Workspace::windowActivated, m_colorMapper.get(), &ColorMapper::update); // Call this before XSelectInput() on the root window - m_startup.reset(new KStartupInfo( - KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this)); + m_startup = std::make_unique(KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this); // Select windowmanager privileges selectWmInputEventMask(); if (kwinApp()->operationMode() == Application::OperationModeX11) { - m_wasUserInteractionFilter.reset(new WasUserInteractionX11Filter); - m_movingClientFilter.reset(new MovingClientX11Filter); + m_wasUserInteractionFilter = std::make_unique(); + m_movingClientFilter = std::make_unique(); } if (Xcb::Extensions::self()->isSyncAvailable()) { - m_syncAlarmFilter.reset(new SyncAlarmX11Filter); + m_syncAlarmFilter = std::make_unique(); } kwinApp()->updateXTime(); // Needed for proper initialization of user_time in Client ctor const uint32_t nullFocusValues[] = {true}; - m_nullFocus.reset(new Xcb::Window(QRect(-1, -1, 1, 1), XCB_WINDOW_CLASS_INPUT_ONLY, XCB_CW_OVERRIDE_REDIRECT, nullFocusValues)); + m_nullFocus = std::make_unique(QRect(-1, -1, 1, 1), XCB_WINDOW_CLASS_INPUT_ONLY, XCB_CW_OVERRIDE_REDIRECT, nullFocusValues); m_nullFocus->map(); RootInfo *rootInfo = RootInfo::create(); diff --git a/src/x11window.cpp b/src/x11window.cpp index 3046644080..6937e4b6dc 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -1361,7 +1361,7 @@ void X11Window::maybeCreateX11DecorationRenderer() return; } if (!Compositor::compositing() && decoratedClient()) { - m_decorationRenderer.reset(new X11DecorationRenderer(decoratedClient())); + m_decorationRenderer = std::make_unique(decoratedClient()); decoration()->update(); } } diff --git a/src/xdgactivationv1.cpp b/src/xdgactivationv1.cpp index ac7b520256..d64ecd8aca 100644 --- a/src/xdgactivationv1.cpp +++ b/src/xdgactivationv1.cpp @@ -108,7 +108,7 @@ QString XdgActivationV1Integration::requestToken(bool isPrivileged, SurfaceInter if (showNotify) { activation = waylandServer()->plasmaActivationFeedback()->createActivation(appId); } - m_currentActivationToken.reset(new ActivationToken{newToken, isPrivileged, surface, serial, seat, appId, showNotify, std::move(activation)}); + m_currentActivationToken = std::make_unique(ActivationToken{newToken, isPrivileged, surface, serial, seat, appId, showNotify, std::move(activation)}); if (showNotify) { Q_EMIT effects->startupAdded(m_currentActivationToken->token, icon); } diff --git a/src/xdgactivationv1.h b/src/xdgactivationv1.h index 3a17652572..b62faa5e81 100644 --- a/src/xdgactivationv1.h +++ b/src/xdgactivationv1.h @@ -42,14 +42,14 @@ private: struct ActivationToken { - const QString token; - const bool isPrivileged; - const QPointer surface; - const uint serial; - const KWaylandServer::SeatInterface *seat; - const QString applicationId; - const bool showNotify; - const std::unique_ptr activation; + QString token; + bool isPrivileged; + QPointer surface; + uint serial; + KWaylandServer::SeatInterface *seat; + QString applicationId; + bool showNotify; + std::unique_ptr activation; }; std::unique_ptr m_currentActivationToken; }; diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index b9dde1ea6d..d79a3c4640 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -309,7 +309,7 @@ void Xwayland::handleXwaylandReady() qCInfo(KWIN_XWL) << "Xwayland server started on display" << m_launcher->displayName(); // create selection owner for WM_S0 - magic X display number expected by XWayland - m_selectionOwner.reset(new KSelectionOwner("WM_S0", kwinApp()->x11Connection(), kwinApp()->x11RootWindow())); + m_selectionOwner = std::make_unique("WM_S0", kwinApp()->x11Connection(), kwinApp()->x11RootWindow()); connect(m_selectionOwner.get(), &KSelectionOwner::lostOwnership, this, &Xwayland::handleSelectionLostOwnership); connect(m_selectionOwner.get(), &KSelectionOwner::claimedOwnership, @@ -347,7 +347,7 @@ void Xwayland::refreshEavesdropping() } if (enabled) { - m_inputSpy.reset(new XwaylandInputSpy); + m_inputSpy = std::make_unique(); input()->installInputEventSpy(m_inputSpy.get()); m_inputSpy->setMode(options->xwaylandEavesdrops()); } else { diff --git a/src/xwayland/xwaylandlauncher.cpp b/src/xwayland/xwaylandlauncher.cpp index a8a38092b0..72ec712307 100644 --- a/src/xwayland/xwaylandlauncher.cpp +++ b/src/xwayland/xwaylandlauncher.cpp @@ -80,7 +80,7 @@ void XwaylandLauncher::enable() if (!m_listenFds.isEmpty()) { Q_ASSERT(!m_displayName.isEmpty()); } else { - m_socket.reset(new XwaylandSocket(XwaylandSocket::OperationMode::CloseFdsOnExec)); + m_socket = std::make_unique(XwaylandSocket::OperationMode::CloseFdsOnExec); if (!m_socket->isValid()) { qFatal("Failed to establish X11 socket"); }