From 713fe54e3c6e8a1ddf48c455021e6cdf0a69013e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 29 Jan 2011 15:11:23 +0100 Subject: [PATCH] Removing screenshot to clipboard functionality. We have ksnapshot for that which uses a KWin effect to get screenshots including shadows, which was not possible with KWin's own implementation. This invalidates bugs about this functionality. BUG: 263409 FIXED-IN: 4.7.0 --- kwinbindings.cpp | 2 -- workspace.cpp | 64 ------------------------------------------------ workspace.h | 3 --- 3 files changed, 69 deletions(-) diff --git a/kwinbindings.cpp b/kwinbindings.cpp index c6f3d05eb3..576ffa93d8 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -214,8 +214,6 @@ along with this program. If not, see . a->setText( i18n("Miscellaneous") ); DEF( I18N_NOOP("Mouse Emulation"), Qt::ALT+Qt::Key_F12, slotMouseEmulation() ); DEF( I18N_NOOP("Kill Window"), Qt::CTRL+Qt::ALT+Qt::Key_Escape, slotKillWindow() ); - DEF( I18N_NOOP("Window Screenshot to Clipboard"), Qt::ALT+Qt::Key_Print, slotGrabWindow() ); - DEF( I18N_NOOP("Desktop Screenshot to Clipboard"), Qt::CTRL+Qt::Key_Print, slotGrabDesktop() ); DEF( I18N_NOOP("Block Global Shortcuts"), 0, slotDisableGlobalShortcuts()); DEF( I18N_NOOP("Suspend Compositing"), Qt::SHIFT+Qt::ALT+Qt::Key_F12, slotToggleCompositing()); diff --git a/workspace.cpp b/workspace.cpp index e624230d41..9984536a5c 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1990,70 +1990,6 @@ void Workspace::sendTakeActivity( Client* c, Time timestamp, long flags ) pending_take_activity = c; } -/** - * Takes a screenshot of the current window and puts it in the clipboard. - */ -void Workspace::slotGrabWindow() - { - if ( active_client ) - { - QPixmap snapshot = QPixmap::grabWindow( active_client->frameId() ); - - // No XShape - no work. - if( Extensions::shapeAvailable() ) - { - // As the first step, get the mask from XShape. - int count, order; - XRectangle* rects = XShapeGetRectangles( display(), active_client->frameId(), - ShapeBounding, &count, &order); - // The ShapeBounding region is the outermost shape of the window; - // ShapeBounding - ShapeClipping is defined to be the border. - // Since the border area is part of the window, we use bounding - // to limit our work region - if( rects ) - { - // Create a QRegion from the rectangles describing the bounding mask. - QRegion contents; - for( int pos = 0; pos < count; pos++ ) - contents += QRegion( rects[pos].x, rects[pos].y, - rects[pos].width, rects[pos].height); - XFree( rects ); - - // Create the bounding box. - QRegion bbox( 0, 0, snapshot.width(), snapshot.height() ); - - // Get the masked away area. - QRegion maskedAway = bbox - contents; - QVector maskedAwayRects = maskedAway.rects(); - - // Construct a bitmap mask from the rectangles - QBitmap mask( snapshot.width(), snapshot.height() ); - QPainter p( &mask ); - p.fillRect( 0, 0, mask.width(), mask.height(), Qt::color1 ); - for( int pos = 0; pos < maskedAwayRects.count(); pos++ ) - p.fillRect( maskedAwayRects[pos], Qt::color0 ); - p.end(); - snapshot.setMask( mask ); - } - } - - QClipboard* cb = QApplication::clipboard(); - cb->setPixmap( snapshot ); - } - else - slotGrabDesktop(); - } - -/** - * Takes a screenshot of the whole desktop and puts it in the clipboard. - */ -void Workspace::slotGrabDesktop() - { - QPixmap p = QPixmap::grabWindow( rootWindow() ); - QClipboard* cb = QApplication::clipboard(); - cb->setPixmap( p ); - } - /** * Invokes keyboard mouse emulation */ diff --git a/workspace.h b/workspace.h index 0c371dddeb..8b6340de2a 100644 --- a/workspace.h +++ b/workspace.h @@ -698,9 +698,6 @@ class Workspace : public QObject, public KDecorationDefines void slotKillWindow(); - void slotGrabWindow(); - void slotGrabDesktop(); - void slotSetupWindowShortcut(); void setupWindowShortcutDone( bool ); void slotToggleCompositing();