• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kwindowsystem_win.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE libraries
00003     Copyright (C) 2007 Laurent Montel (montel@kde.org)
00004     Copyright (C) 2007 Christian Ehrlicher (ch.ehrlicher@gmx.de)
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include "kwindowsystem.h"
00023 
00024 #include <QtGui/QDesktopWidget>
00025 #include <QtGui/QIcon>
00026 #include <QtGui/QBitmap>
00027 #include <QtGui/QPixmap>
00028 #include <QtCore/QLibrary>
00029 
00030 #include "kglobal.h"
00031 #include "kdebug.h"
00032 #include "klocalizedstring.h"
00033 
00034 #include <windows.h>
00035 #include <windowsx.h>
00036 
00037 //functions to register us as taskmanager
00038 typedef bool (WINAPI *PtrSetTaskmanWindow)(HWND);
00039 typedef bool (WINAPI *PtrRegisterShellHookWindow)(HWND);
00040 typedef bool (WINAPI *PtrDeregisterShellHookWindow)(HWND);
00041 
00042 
00043 #define RSH_UNREGISTER  0
00044 #define RSH_REGISTER    1
00045 #define RSH_TASKMGR     3
00046 typedef bool (WINAPI *PtrRegisterShellHook)(HWND hWnd, DWORD method);
00047 
00048 
00049 static PtrSetTaskmanWindow pSetTaskmanWindow = 0;
00050 static PtrRegisterShellHookWindow pRegisterShellHookWindow = 0;
00051 static PtrDeregisterShellHookWindow pDeregisterShellHookWindow = 0;
00052 static PtrRegisterShellHook pRegisterShellHook = 0;
00053 static int WM_SHELLHOOK = -1;
00054 
00055 class KWindowSystemStaticContainer {
00056 public:
00057     KWindowSystemStaticContainer() : d(0) {}
00058     KWindowSystem kwm;
00059     KWindowSystemPrivate* d;
00060 };
00061 
00062 K_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
00063 
00064 K_GLOBAL_STATIC(QDesktopWidget, s_deskWidget)
00065 
00066 
00067 struct InternalWindowInfo
00068 {
00069     InternalWindowInfo(){}
00070     QPixmap bigIcon;
00071     QPixmap smallIcon;
00072     QString windowName;
00073 };
00074 
00075 class KWindowSystemPrivate : public QWidget
00076 {
00077     friend class KWindowSystem;
00078     public:
00079         KWindowSystemPrivate ( int what );
00080         ~KWindowSystemPrivate();  
00081         
00082         static bool CALLBACK EnumWindProc (WId hwnd, LPARAM lparam);
00083         static void readWindowInfo  (WId wid  , InternalWindowInfo *winfo);
00084         
00085         void windowAdded        (WId wid);
00086         void windowRemoved      (WId wid);
00087         void windowActivated    (WId wid);
00088         void windowRedraw       (WId wid);
00089         void windowFlash        (WId wid);
00090         void windowStateChanged (WId wid);
00091         void reloadStackList    ( );
00092         void activate           ( );
00093         
00094         
00095     protected:
00096         bool winEvent ( MSG * message, long * result );
00097         
00098     private:
00099         int what;
00100         WId fakeHwnd;
00101         QList<WId> stackingOrder;
00102         QMap<WId,InternalWindowInfo> winInfos;
00103 };
00104 
00105 static HBITMAP QPixmapMask2HBitmap(const QPixmap &pix)
00106 {
00107     QBitmap bm = pix.mask();
00108     if( bm.isNull() ) {
00109         bm = QBitmap( pix.size() );
00110         bm.fill( Qt::color1 );
00111     }
00112     QImage im = bm.toImage().convertToFormat( QImage::Format_Mono );
00113     im.invertPixels();                  // funny blank'n'white games on windows
00114     int w = im.width();
00115     int h = im.height();
00116     int bpl = (( w + 15 ) / 16 ) * 2;   // bpl, 16 bit alignment
00117     QByteArray bits( bpl * h, '\0' );
00118     for (int y=0; y < h; y++)
00119         memcpy( bits.data() + y * bpl, im.scanLine( y ), bpl );
00120     return CreateBitmap( w, h, 1, 1, bits );
00121 }
00122 
00123 static HICON QPixmap2HIcon(const QPixmap &pix)
00124 {
00125     if ( pix.isNull() )
00126         return 0;
00127 
00128     ICONINFO ii;
00129     ii.fIcon    = true;
00130     ii.hbmMask  = QPixmapMask2HBitmap( pix );
00131     ii.hbmColor = pix.toWinHBITMAP( QPixmap::PremultipliedAlpha );
00132     ii.xHotspot = 0;
00133     ii.yHotspot = 0;
00134     HICON result = CreateIconIndirect( &ii );
00135 
00136     DeleteObject( ii.hbmMask );
00137     DeleteObject( ii.hbmColor );
00138 
00139     return result;
00140 }
00141 
00142 static QPixmap HIcon2QPixmap( HICON hIcon )
00143 {
00144     ICONINFO ii;
00145     if( GetIconInfo( hIcon, &ii ) == NULL )
00146         return QPixmap();
00147 
00148     QPixmap pix  = QPixmap::fromWinHBITMAP( ii.hbmColor );
00149     pix.setMask( QPixmap::fromWinHBITMAP( ii.hbmMask ) );
00150 
00151     return pix;
00152 }
00153 
00154 KWindowSystemPrivate::KWindowSystemPrivate(int what) : QWidget(0)
00155 {
00156     //i think there is no difference in windows we always load everything
00157     what = KWindowSystem::INFO_WINDOWS;
00158     setVisible(false);
00159 }
00160 
00161 void KWindowSystemPrivate::activate ( )
00162 {
00163     //resolve winapi stuff
00164     if(!pSetTaskmanWindow) pSetTaskmanWindow = (PtrSetTaskmanWindow)QLibrary::resolve("user32","SetTaskmanWindow");
00165     if(!pRegisterShellHookWindow) pRegisterShellHookWindow = (PtrRegisterShellHookWindow)QLibrary::resolve("user32","RegisterShellHookWindow");
00166     if(!pDeregisterShellHookWindow) pDeregisterShellHookWindow = (PtrDeregisterShellHookWindow)QLibrary::resolve("user32","DeregisterShellHookWindow");
00167     if(!pRegisterShellHook) pRegisterShellHook = (PtrRegisterShellHook)QLibrary::resolve("shell32",(LPCSTR)0xb5);
00168     
00169     //get the id for the shellhook message
00170     if(WM_SHELLHOOK==-1) WM_SHELLHOOK  = RegisterWindowMessage(TEXT("SHELLHOOK"));
00171     
00172     bool shellHookRegistered = false;
00173     if(pRegisterShellHook)
00174         kDebug()<<"use RegisterShellHook";
00175         shellHookRegistered = pRegisterShellHook(winId(),RSH_REGISTER);
00176         if(!shellHookRegistered)
00177             shellHookRegistered = pRegisterShellHook(winId(),RSH_TASKMGR);
00178     else{     
00179         kDebug()<<"use RegisterShellHookWindow";
00180         //i'm not sure if i have to do this, and what happens if some other process uses KWindowSystem
00181         //if(pSetTaskmanWindow)
00182         //    pSetTaskmanWindow(winId());
00183         
00184         if(pRegisterShellHookWindow)
00185             shellHookRegistered = pRegisterShellHookWindow(winId());
00186     }
00187     
00188     if(!shellHookRegistered)
00189         //use a timer and poll the windows ?
00190          kDebug()<<"Could not create shellhook to receive WindowManager Events";
00191             
00192     //fetch window infos
00193     reloadStackList();
00194 }
00195 
00196 KWindowSystemPrivate::~KWindowSystemPrivate()
00197 {
00198     if(pRegisterShellHook){
00199         pRegisterShellHook(winId(),RSH_UNREGISTER);
00200     }else{
00201         if(pDeregisterShellHookWindow)
00202             pDeregisterShellHookWindow(winId());
00203     }
00204 }
00205 
00209 bool KWindowSystemPrivate::winEvent ( MSG * message, long * result )  
00210 {
00211     if (message->message == WM_SHELLHOOK) {
00212         switch(message->wParam) {
00213           case HSHELL_WINDOWCREATED:
00214             KWindowSystem::s_d_func()->windowAdded(reinterpret_cast<WId>(message->lParam));
00215             break;          
00216           case HSHELL_WINDOWDESTROYED:
00217             KWindowSystem::s_d_func()->windowRemoved(reinterpret_cast<WId>(message->lParam));
00218             break;
00219           case HSHELL_WINDOWACTIVATED:
00220           case HSHELL_RUDEAPPACTIVATED:
00221             KWindowSystem::s_d_func()->windowActivated(reinterpret_cast<WId>(message->lParam));
00222             break;
00223           case HSHELL_REDRAW: //the caption has changed 
00224             KWindowSystem::s_d_func()->windowRedraw(reinterpret_cast<WId>(message->lParam));
00225             break;
00226           case HSHELL_FLASH:
00227             KWindowSystem::s_d_func()->windowFlash(reinterpret_cast<WId>(message->lParam));
00228             break;
00229           case HSHELL_GETMINRECT:
00230             KWindowSystem::s_d_func()->windowStateChanged(reinterpret_cast<WId>(message->lParam));
00231             break;
00232         }
00233     }
00234     return QWidget::winEvent(message,result);
00235 }
00236 
00237 bool CALLBACK KWindowSystemPrivate::EnumWindProc(WId hWnd, LPARAM lparam)
00238 {
00239     QByteArray windowText = QByteArray ( GetWindowTextLength(hWnd)+1, 0 ) ;
00240     GetWindowTextA(hWnd, windowText.data(), windowText.size());
00241     DWORD ex_style = GetWindowExStyle(hWnd);
00242     KWindowSystemPrivate *p = KWindowSystem::s_d_func();
00243     
00244     QString add;
00245     if( !QString(windowText).trimmed().isEmpty() && IsWindowVisible( hWnd ) && !(ex_style&WS_EX_TOOLWINDOW) 
00246        && !GetParent(hWnd) && !GetWindow(hWnd,GW_OWNER) && !p->winInfos.contains(hWnd) ) {
00247        
00248 //        kDebug()<<"Adding window to windowList " << add + QString(windowText).trimmed();
00249         
00250         InternalWindowInfo winfo;
00251         KWindowSystemPrivate::readWindowInfo(hWnd,&winfo);
00252         
00253         p->stackingOrder.append(hWnd);
00254         p->winInfos.insert(hWnd,winfo);  
00255     }
00256     return true; 
00257 }
00258 
00259 void KWindowSystemPrivate::readWindowInfo ( WId hWnd , InternalWindowInfo *winfo)
00260 {
00261     QByteArray windowText = QByteArray ( GetWindowTextLength(hWnd)+1, 0 ) ;
00262     GetWindowTextA(hWnd, windowText.data(), windowText.size());
00263      //maybe use SendMessageTimout here?
00264     QPixmap smallIcon;
00265     HICON hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00266     //if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00267     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00268     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00269     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00270     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00271     if(hSmallIcon)  smallIcon  = HIcon2QPixmap(hSmallIcon);
00272     
00273     QPixmap bigIcon;
00274     HICON hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00275     //if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00276     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00277     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00278     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00279     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00280     if(hBigIcon)  bigIcon  = HIcon2QPixmap(hBigIcon);
00281        
00282     winfo->bigIcon    = bigIcon;
00283     winfo->smallIcon  = smallIcon;
00284     winfo->windowName = QString(windowText).trimmed();   
00285 }
00286 
00287 
00288 void KWindowSystemPrivate::windowAdded     (WId wid)
00289 {
00290     KWindowSystem::s_d_func()->reloadStackList();
00291     emit KWindowSystem::self()->windowAdded(wid);
00292     emit KWindowSystem::self()->stackingOrderChanged();
00293 }
00294 
00295 void KWindowSystemPrivate::windowRemoved   (WId wid)
00296 {
00297     KWindowSystem::s_d_func()->reloadStackList();
00298     emit KWindowSystem::self()->windowRemoved(wid);
00299     emit KWindowSystem::self()->stackingOrderChanged();
00300 }
00301 
00302 void KWindowSystemPrivate::windowActivated (WId wid)
00303 {
00304     KWindowSystem::s_d_func()->reloadStackList();
00305     emit KWindowSystem::self()->activeWindowChanged(wid);
00306     emit KWindowSystem::self()->stackingOrderChanged();
00307 }
00308 
00309 void KWindowSystemPrivate::windowRedraw    (WId wid)
00310 {
00311     KWindowSystem::s_d_func()->reloadStackList();
00312 }
00313 
00314 void KWindowSystemPrivate::windowFlash     (WId wid)
00315 {
00316     //emit KWindowSystem::self()->demandAttention( wid );
00317 }
00318 
00319 void KWindowSystemPrivate::windowStateChanged (WId wid)
00320 {
00321     emit KWindowSystem::self()->windowChanged( wid );
00322 }
00323 
00324 void KWindowSystemPrivate::reloadStackList ()
00325 {
00326     KWindowSystem::s_d_func()->stackingOrder.clear();
00327     KWindowSystem::s_d_func()->winInfos.clear();
00328     EnumWindows((WNDENUMPROC)EnumWindProc, 0 );
00329 }
00330 
00331 
00332 
00333 KWindowSystem* KWindowSystem::self()
00334 {
00335     return &(g_kwmInstanceContainer->kwm);
00336 }
00337 
00338 KWindowSystemPrivate* KWindowSystem::s_d_func()
00339 {
00340     return g_kwmInstanceContainer->d;
00341 }
00342 
00343 void KWindowSystem::init(int what)
00344 {
00345     KWindowSystemPrivate* const s_d = s_d_func();
00346 
00347     if (what >= INFO_WINDOWS)
00348        what = INFO_WINDOWS;
00349     else
00350        what = INFO_BASIC;
00351 
00352     if ( !s_d )
00353     {
00354         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00355         g_kwmInstanceContainer->d->activate();
00356     }
00357     else if (s_d->what < what)
00358     {
00359         delete s_d;
00360         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00361         g_kwmInstanceContainer->d->activate();
00362     }
00363 
00364 }
00365 
00366 int KWindowSystem::currentDesktop()
00367 {
00368     return 1;
00369 }
00370 
00371 int KWindowSystem::numberOfDesktops()
00372 {
00373     return 1;
00374 }
00375 
00376 void KWindowSystem::setMainWindow( QWidget* subwindow, WId mainwindow )
00377 {
00378     KWindowSystem::init(INFO_WINDOWS);
00379     SetParent(subwindow->winId(), mainwindow);
00380 }
00381 
00382 void KWindowSystem::setCurrentDesktop( int desktop )
00383 {
00384     KWindowSystem::init(INFO_WINDOWS);
00385     kDebug() << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet implemented!";
00386     //TODO
00387 }
00388 
00389 void KWindowSystem::setOnAllDesktops( WId win, bool b )
00390 {
00391     KWindowSystem::init(INFO_WINDOWS);
00392      kDebug() << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet implemented!";
00393      //TODO
00394 }
00395 
00396 void KWindowSystem::setOnDesktop( WId win, int desktop )
00397 {
00398     KWindowSystem::init(INFO_WINDOWS);
00399      //TODO
00400      kDebug() << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet implemented!";
00401 }
00402 
00403 WId KWindowSystem::activeWindow()
00404 {
00405     KWindowSystem::init(INFO_WINDOWS);
00406     return GetActiveWindow();
00407 }
00408 
00409 void KWindowSystem::activateWindow( WId win, long )
00410 {
00411     KWindowSystem::init(INFO_WINDOWS);
00412     SetActiveWindow( win );
00413 }
00414 
00415 void KWindowSystem::forceActiveWindow( WId win, long time )
00416 {
00417     KWindowSystem::init(INFO_WINDOWS);
00418     SetActiveWindow( win );
00419     SetForegroundWindow( win );
00420 }
00421 
00422 void KWindowSystem::demandAttention( WId win, bool set )
00423 {
00424     KWindowSystem::init(INFO_WINDOWS);
00425     FLASHWINFO fi;
00426     fi.cbSize = sizeof( FLASHWINFO );
00427     fi.hwnd = win;
00428     fi.dwFlags = set ? FLASHW_ALL : FLASHW_STOP;
00429     fi.uCount = 5;
00430     fi.dwTimeout = 0;
00431 
00432     FlashWindowEx( &fi );
00433 }
00434 
00435 
00436 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale )
00437 {
00438     KWindowSystem::init(INFO_WINDOWS);
00439     
00440     QPixmap pm;
00441     if(KWindowSystem::s_d_func()->winInfos.contains(win)){
00442         if( width < 24 || height < 24 )
00443             pm = KWindowSystem::s_d_func()->winInfos[win].smallIcon;
00444         else
00445             pm = KWindowSystem::s_d_func()->winInfos[win].bigIcon;
00446     }
00447     else{
00448         kDebug()<<"KWindowSystem::icon winid not in winInfos";
00449         UINT size = ICON_BIG;
00450         if( width < 24 || height < 24 )
00451             size = ICON_SMALL;
00452         HICON hIcon = (HICON)SendMessage( win, WM_GETICON, size, 0);
00453         pm = HIcon2QPixmap( hIcon );
00454     } 
00455     if( scale )
00456         pm = pm.scaled( width, height );
00457     return pm;
00458 }
00459 
00460 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int )
00461 {
00462     return icon( win, width, height, scale );
00463 }
00464 
00465 void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon )
00466 {
00467     KWindowSystem::init(INFO_WINDOWS);
00468     KWindowSystemPrivate* s_d = s_d_func();
00469     
00470     if(s_d->winInfos.contains(win)){
00471         // is this safe enough or do i have to refresh() the window infos
00472         s_d->winInfos[win].smallIcon = miniIcon;
00473         s_d->winInfos[win].bigIcon   = icon;
00474     }
00475     
00476     HICON hIconBig = QPixmap2HIcon(icon);
00477     HICON hIconSmall = QPixmap2HIcon(miniIcon);
00478 
00479     hIconBig = (HICON)SendMessage( win, WM_SETICON, ICON_BIG,   (LPARAM)hIconBig );
00480     hIconSmall = (HICON)SendMessage( win, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall );
00481     
00482 }
00483 
00484 void KWindowSystem::setState( WId win, unsigned long state )
00485 {
00486     KWindowSystem::init(INFO_WINDOWS);
00487     bool got = false;
00488     if (state & NET::SkipTaskbar) {
00489         got = true;
00490         LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
00491         SetWindowLongPtr(win, GWL_EXSTYLE, lp | WS_EX_TOOLWINDOW);
00492     }
00493     if (state & NET::KeepAbove) {
00494         got = true;
00495         SetWindowPos(win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00496     }
00497     if(state & NET::KeepBelow){
00498         got = true;
00499         SetWindowPos(win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00500     }
00501     if (!got)
00502         kDebug() << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented for the state you requested!";
00503 }
00504 
00505 void KWindowSystem::clearState( WId win, unsigned long state )
00506 {
00507     KWindowSystem::init(INFO_WINDOWS);
00508     //TODO
00509     kDebug() << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
00510 }
00511 
00512 void KWindowSystem::minimizeWindow( WId win, bool animation)
00513 {
00514     Q_UNUSED( animation );
00515     KWindowSystem::init(INFO_WINDOWS);    
00516     ShowWindow( win, SW_MINIMIZE );
00517 }
00518 
00519 void KWindowSystem::unminimizeWindow( WId win, bool animation )
00520 {
00521     Q_UNUSED( animation );
00522     KWindowSystem::init(INFO_WINDOWS);    
00523     ShowWindow( win, SW_RESTORE );
00524 }
00525 
00526 void KWindowSystem::raiseWindow( WId win )
00527 {
00528     KWindowSystem::init(INFO_WINDOWS);
00529     SetWindowPos( win, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
00530 }
00531 
00532 void KWindowSystem::lowerWindow( WId win )
00533 {
00534     KWindowSystem::init(INFO_WINDOWS);
00535     SetWindowPos( win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
00536 }
00537 
00538 bool KWindowSystem::compositingActive()
00539 {
00540     return false;
00541 }
00542 
00543 QRect KWindowSystem::workArea( int desktop )
00544 {
00545     KWindowSystem::init(INFO_WINDOWS);
00546     return s_deskWidget->availableGeometry( desktop );
00547 }
00548 
00549 QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop )
00550 {
00551     //TODO
00552     kDebug() << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop ) isn't yet implemented!";
00553     KWindowSystem::init(INFO_WINDOWS);    
00554     return QRect();
00555 }
00556 
00557 QString KWindowSystem::desktopName( int desktop )
00558 {
00559     return i18n("Desktop %1",  desktop );
00560 }
00561 
00562 void KWindowSystem::setDesktopName( int desktop, const QString& name )
00563 {
00564      kDebug() << "KWindowSystem::setDesktopName( int desktop, const QString& name ) isn't yet implemented!";  
00565     //TODO
00566 }
00567 
00568 bool KWindowSystem::showingDesktop()
00569 {
00570     return false;
00571 }
00572 
00573 void KWindowSystem::setUserTime( WId win, long time )
00574 {
00575     kDebug() << "KWindowSystem::setUserTime( WId win, long time ) isn't yet implemented!";
00576     //TODO
00577 }
00578 
00579 bool KWindowSystem::icccmCompliantMappingState()
00580 {
00581     return false;
00582 }
00583 
00584 // optimalization - create KWindowSystemPrivate only when needed and only for what is needed
00585 void KWindowSystem::connectNotify( const char* signal )
00586 {
00587     int what = INFO_BASIC;
00588     if( QLatin1String( signal ) == SIGNAL(workAreaChanged()))
00589         what = INFO_WINDOWS;
00590     else if( QLatin1String( signal ) == SIGNAL(strutChanged()))
00591         what = INFO_WINDOWS;
00592     else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,const unsigned long*))).constData())
00593         what = INFO_WINDOWS;
00594     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,unsigned int))).constData())
00595         what = INFO_WINDOWS;
00596     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId))).constData())
00597         what = INFO_WINDOWS;
00598 
00599     init( what );
00600     QObject::connectNotify( signal );
00601 }
00602 
00603 void KWindowSystem::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00604         int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00605         int bottom_width, int bottom_start, int bottom_end )
00606 {
00607   kDebug() << "KWindowSystem::setExtendedStrut isn't yet implemented!";
00608   //TODO
00609 }
00610 void KWindowSystem::setStrut( WId win, int left, int right, int top, int bottom )
00611 {
00612   kDebug() << "KWindowSystem::setStrut isn't yet implemented!";
00613   //TODO
00614 }
00615 
00616 QString KWindowSystem::readNameProperty( WId window, unsigned long atom )
00617 {
00618   //TODO
00619   kDebug() << "QString KWindowSystem::readNameProperty( WId window, unsigned long atom ) isn't yet implemented!";
00620   return QString();
00621 }
00622 
00623 void KWindowSystem::doNotManage( const QString& title )
00624 {
00625   //TODO
00626   kDebug() << "KWindowSystem::doNotManage( const QString& title ) isn't yet implemented!";
00627 }
00628 
00629 QList<WId> KWindowSystem::stackingOrder()
00630 {
00631   KWindowSystem::init(INFO_WINDOWS);  
00632   return KWindowSystem::s_d_func()->stackingOrder;
00633 }
00634 
00635 const QList<WId>& KWindowSystem::windows()
00636 {
00637   KWindowSystem::init(INFO_WINDOWS);  
00638   return KWindowSystem::s_d_func()->stackingOrder;
00639 }
00640 
00641 void KWindowSystem::setType( WId win, NET::WindowType windowType )
00642 {
00643  //TODO
00644  KWindowSystem::init(INFO_WINDOWS); 
00645  kDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet implemented!";
00646 }
00647 
00648 KWindowInfo KWindowSystem::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
00649 {
00650     KWindowSystem::init(INFO_WINDOWS);
00651     return KWindowInfo( win, properties, properties2 );
00652 }
00653 
00654 bool KWindowSystem::hasWId(WId w)
00655 {
00656     KWindowSystem::init(INFO_WINDOWS);
00657     return KWindowSystem::s_d_func()->winInfos.contains(w);
00658 }
00659 
00660 #include "kwindowsystem.moc"

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal