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
This commit is contained in:
parent
65e6a1b03b
commit
713fe54e3c
3 changed files with 0 additions and 69 deletions
|
@ -214,8 +214,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
a->setText( i18n("Miscellaneous") );
|
a->setText( i18n("Miscellaneous") );
|
||||||
DEF( I18N_NOOP("Mouse Emulation"), Qt::ALT+Qt::Key_F12, slotMouseEmulation() );
|
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("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("Block Global Shortcuts"), 0, slotDisableGlobalShortcuts());
|
||||||
DEF( I18N_NOOP("Suspend Compositing"), Qt::SHIFT+Qt::ALT+Qt::Key_F12, slotToggleCompositing());
|
DEF( I18N_NOOP("Suspend Compositing"), Qt::SHIFT+Qt::ALT+Qt::Key_F12, slotToggleCompositing());
|
||||||
|
|
||||||
|
|
|
@ -1990,70 +1990,6 @@ void Workspace::sendTakeActivity( Client* c, Time timestamp, long flags )
|
||||||
pending_take_activity = c;
|
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<QRect> 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
|
* Invokes keyboard mouse emulation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -698,9 +698,6 @@ class Workspace : public QObject, public KDecorationDefines
|
||||||
|
|
||||||
void slotKillWindow();
|
void slotKillWindow();
|
||||||
|
|
||||||
void slotGrabWindow();
|
|
||||||
void slotGrabDesktop();
|
|
||||||
|
|
||||||
void slotSetupWindowShortcut();
|
void slotSetupWindowShortcut();
|
||||||
void setupWindowShortcutDone( bool );
|
void setupWindowShortcutDone( bool );
|
||||||
void slotToggleCompositing();
|
void slotToggleCompositing();
|
||||||
|
|
Loading…
Reference in a new issue