From c6393a936b92abc96eb43888d8e32959aa532427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Wed, 12 Aug 2020 15:41:30 +0200 Subject: [PATCH] Screenshot effect: factorize code --- effects/screenshot/screenshot.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index 0a606fc596..f1912029f7 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -322,22 +322,8 @@ void ScreenShotEffect::postPaintScreen() const xcb_pixmap_t xpix = xpixmapFromImage(img); emit screenshotCreated(xpix); m_windowMode = WindowMode::NoCapture; - } else if (m_windowMode == WindowMode::File) { + } else if (m_windowMode == WindowMode::File || m_windowMode == WindowMode::FileDescriptor) { sendReplyImage(img); - } else if (m_windowMode == WindowMode::FileDescriptor) { - QtConcurrent::run( - [] (int fd, const QImage &img) { - QFile file; - if (file.open(fd, QIODevice::WriteOnly, QFileDevice::AutoCloseHandle)) { - QDataStream ds(&file); - ds << img; - file.close(); - } else { - close(fd); - } - }, m_fd, img); - m_windowMode = WindowMode::NoCapture; - m_fd = -1; } #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (xImage) {