⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showdesktop.cpp

📁 thes is veer good (ksmoutTool)
💻 CPP
字号:
/*****************************************************************Copyright (c) 1996-2001,2002 the kicker authors. See file AUTHORS.Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THEAUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER INAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.******************************************************************/#include <kwinmodule.h>#include <netwm.h>#include <kwin.h>#include "showdesktop.h"#include "showdesktop.moc"ShowDesktop* ShowDesktop::the(){    static ShowDesktop showDesktop;    return &showDesktop;}ShowDesktop::ShowDesktop()  : QObject()  , showingDesktop( false )  , kWinModule( 0 ){    kWinModule = new KWinModule( this );    // on desktop changes or when a window is deiconified, we abort the show desktop mode    connect( kWinModule, SIGNAL(currentDesktopChanged(int)),             SLOT(slotCurrentDesktopChanged(int)));    connect( kWinModule, SIGNAL(windowChanged(WId,unsigned int)),             SLOT(slotWindowChanged(WId,unsigned int)));}void ShowDesktop::slotCurrentDesktopChanged(int){    //showDesktop( false ); // this will cause a bunch of attention-demanding tasks}void ShowDesktop::slotWindowChanged(WId w, unsigned int dirty){    if ( !showingDesktop )	return;    // SELI this needs checking for kwin_iii (_NET_SHOWING_DESKTOP)    if ( dirty & NET::XAWMState ) {    KWin::WindowInfo info(w, 0, 0);    NET::WindowType type = info.windowType(0xffff);	if ( (type == NET::Normal || type == NET::Unknown )	     && info.mappingState() == NET::Visible ) {	    // a window was deiconified, abort the show desktop mode.	    iconifiedList.clear();	    showingDesktop = false;	    emit desktopShown( false );	}    }}void ShowDesktop::showDesktop( bool b ){    if( b == showingDesktop ) return;    showingDesktop = b;    if ( b ) {        // this code should move to KWin after supporting NETWM1.2        KWinModule wm;        activeWin = wm.activeWindow();            iconifiedList.clear();        const QValueList<WId> windows = kWinModule->windows();        QValueList<WId>::ConstIterator it;                for ( it=windows.begin(); it!=windows.end(); ++it ) {            WId w = *it;            NETWinInfo info( qt_xdisplay(), w, qt_xrootwin(),		  NET::XAWMState | NET::WMDesktop );            if ( info.mappingState() == NET::Visible &&                    ( info.desktop() == NETWinInfo::OnAllDesktops            || info.desktop() == (int) kWinModule->currentDesktop() )            ) {                iconifiedList.append( w );            }        }        // find first, hide later, otherwise transients may get minimized        // with the window they're transient for        for ( it=iconifiedList.begin(); it!=iconifiedList.end(); ++it ) {            KWin::iconifyWindow( *it, false );        }    } else {        QValueList<WId>::ConstIterator it;        for ( it=iconifiedList.begin(); it!=iconifiedList.end(); ++it ) {	   KWin::deIconifyWindow( *it, false  );        }        KWin::activateWindow(activeWin);    }    emit desktopShown( showingDesktop );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -