Window grabbing stuff for linuxtag

svn path=/trunk/kdebase/kwin/; revision=104070
This commit is contained in:
Richard J. Moore 2001-06-26 23:30:52 +00:00
parent 331ab7fb82
commit 2cd059894a
3 changed files with 39 additions and 0 deletions

View file

@ -113,3 +113,6 @@ This belongs in taskbar rather than here, so it'll have to wait until after 2.2
#endif
keys->insertItem(i18n("Mouse Emulation"), "Mouse emulation", KKey("ALT+F12"), KKey());
keys->insertItem(i18n("Kill Window"), "Kill Window", KKey("CTRL+ALT+Escape"), KKey("Meta+Ctrl+Delete"));
keys->insertItem(i18n("Window Screenshot"), "Screenshot of active window", KKey("Print"), KKey());
keys->insertItem(i18n("Desktop Screenshot"), "Screenshot of desktop", KKey("CTRL+PrtSc"), KKey());

View file

@ -16,6 +16,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qwhatsthis.h>
#include <qdatastream.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <kapp.h>
#include <dcopclient.h>
#include <kprocess.h>
@ -2572,6 +2573,10 @@ void Workspace::createKeybindings(){
keys->connectItem( "Mouse emulation", this, SLOT( slotMouseEmulation() ) );
keys->connectItem( "Kill Window", this, SLOT( slotKillWindow() ) );
keys->connectItem( "Screenshot of active window", this, SLOT( slotGrabWindow() ) );
keys->connectItem( "Screenshot of desktop", this, SLOT( slotGrabDesktop() ) );
keys->readSettings();
walkThroughDesktopsKeycode = keys->currentKey( "Walk through desktops" );
walkBackThroughDesktopsKeycode = keys->currentKey( "Walk back through desktops" );
@ -2858,6 +2863,34 @@ void Workspace::killWindowAtPosition(int x, int y)
}
}
/*!
Takes a screenshot of the current window and puts it in the clipboard.
*/
void Workspace::slotGrabWindow()
{
qWarning( "grabbing window!!!\n" );
if ( active_client ) {
QPixmap p = QPixmap::grabWindow( active_client->window() );
QClipboard *cb = QApplication::clipboard();
cb->setPixmap( p );
}
else
slotGrabDesktop();
}
/*!
Takes a screenshot of the whole desktop and puts it in the clipboard.
*/
void Workspace::slotGrabDesktop()
{
qWarning( "grabbing desktop!!!\n" );
QPixmap p = QPixmap::grabWindow( qt_xrootwin() );
QClipboard *cb = QApplication::clipboard();
cb->setPixmap( p );
}
/*!
Adjusts the desktop popup to the current values and the location of
the popup client.

View file

@ -288,6 +288,9 @@ public slots:
void slotKillWindow();
void slotGrabWindow();
void slotGrabDesktop();
private slots:
void desktopPopupAboutToShow();
void clientPopupAboutToShow();