• Skip to content
  • Skip to link menu
KDE 4.3 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 ) == 0 )
00146         return QPixmap();
00147 
00148     QPixmap pix  = QPixmap::fromWinHBITMAP( ii.hbmColor );
00149     pix.setMask( QPixmap::fromWinHBITMAP( ii.hbmMask ) );
00150 
00151     DeleteObject( ii.hbmMask );
00152     DeleteObject( ii.hbmColor );
00153 
00154     return pix;
00155 }
00156 
00157 KWindowSystemPrivate::KWindowSystemPrivate(int what) : QWidget(0)
00158 {
00159     //i think there is no difference in windows we always load everything
00160     what = KWindowSystem::INFO_WINDOWS;
00161     setVisible(false);
00162 }
00163 
00164 void KWindowSystemPrivate::activate ( )
00165 {
00166     //resolve winapi stuff
00167     if(!pSetTaskmanWindow) pSetTaskmanWindow = (PtrSetTaskmanWindow)QLibrary::resolve("user32","SetTaskmanWindow");
00168     if(!pRegisterShellHookWindow) pRegisterShellHookWindow = (PtrRegisterShellHookWindow)QLibrary::resolve("user32","RegisterShellHookWindow");
00169     if(!pDeregisterShellHookWindow) pDeregisterShellHookWindow = (PtrDeregisterShellHookWindow)QLibrary::resolve("user32","DeregisterShellHookWindow");
00170     if(!pRegisterShellHook) pRegisterShellHook = (PtrRegisterShellHook)QLibrary::resolve("shell32",(LPCSTR)0xb5);
00171 
00172     //get the id for the shellhook message
00173     if(WM_SHELLHOOK==-1) WM_SHELLHOOK  = RegisterWindowMessage(TEXT("SHELLHOOK"));
00174 
00175     bool shellHookRegistered = false;
00176     if(pRegisterShellHook) {
00177         kDebug()<<"use RegisterShellHook";
00178         shellHookRegistered = pRegisterShellHook(winId(),RSH_REGISTER);
00179         if(!shellHookRegistered)
00180             shellHookRegistered = pRegisterShellHook(winId(),RSH_TASKMGR);
00181     } else {
00182         kDebug()<<"use RegisterShellHookWindow";
00183         //i'm not sure if i have to do this, and what happens if some other process uses KWindowSystem
00184         //if(pSetTaskmanWindow)
00185         //    pSetTaskmanWindow(winId());
00186 
00187         if(pRegisterShellHookWindow)
00188             shellHookRegistered = pRegisterShellHookWindow(winId());
00189     }
00190 
00191     if(!shellHookRegistered)
00192         //use a timer and poll the windows ?
00193          kDebug()<<"Could not create shellhook to receive WindowManager Events";
00194 
00195     //fetch window infos
00196     reloadStackList();
00197 }
00198 
00199 KWindowSystemPrivate::~KWindowSystemPrivate()
00200 {
00201     if(pRegisterShellHook){
00202         pRegisterShellHook(winId(),RSH_UNREGISTER);
00203     }else{
00204         if(pDeregisterShellHookWindow)
00205             pDeregisterShellHookWindow(winId());
00206     }
00207 }
00208 
00212 bool KWindowSystemPrivate::winEvent ( MSG * message, long * result )
00213 {
00214     if (message->message == WM_SHELLHOOK) {
00215         switch(message->wParam) {
00216           case HSHELL_WINDOWCREATED:
00217             KWindowSystem::s_d_func()->windowAdded(reinterpret_cast<WId>(message->lParam));
00218             break;
00219           case HSHELL_WINDOWDESTROYED:
00220             KWindowSystem::s_d_func()->windowRemoved(reinterpret_cast<WId>(message->lParam));
00221             break;
00222           case HSHELL_WINDOWACTIVATED:
00223           case HSHELL_RUDEAPPACTIVATED:
00224             KWindowSystem::s_d_func()->windowActivated(reinterpret_cast<WId>(message->lParam));
00225             break;
00226           case HSHELL_REDRAW: //the caption has changed
00227             KWindowSystem::s_d_func()->windowRedraw(reinterpret_cast<WId>(message->lParam));
00228             break;
00229           case HSHELL_FLASH:
00230             KWindowSystem::s_d_func()->windowFlash(reinterpret_cast<WId>(message->lParam));
00231             break;
00232           case HSHELL_GETMINRECT:
00233             KWindowSystem::s_d_func()->windowStateChanged(reinterpret_cast<WId>(message->lParam));
00234             break;
00235         }
00236     }
00237     return QWidget::winEvent(message,result);
00238 }
00239 
00240 bool CALLBACK KWindowSystemPrivate::EnumWindProc(WId hWnd, LPARAM lparam)
00241 {
00242     QByteArray windowText = QByteArray ( GetWindowTextLength(hWnd)+1, 0 ) ;
00243     GetWindowTextA(hWnd, windowText.data(), windowText.size());
00244     DWORD ex_style = GetWindowExStyle(hWnd);
00245     KWindowSystemPrivate *p = KWindowSystem::s_d_func();
00246 
00247     QString add;
00248     if( !QString(windowText).trimmed().isEmpty() && IsWindowVisible( hWnd ) && !(ex_style&WS_EX_TOOLWINDOW)
00249        && !GetParent(hWnd) && !GetWindow(hWnd,GW_OWNER) && !p->winInfos.contains(hWnd) ) {
00250 
00251 //        kDebug()<<"Adding window to windowList " << add + QString(windowText).trimmed();
00252 
00253         InternalWindowInfo winfo;
00254         KWindowSystemPrivate::readWindowInfo(hWnd,&winfo);
00255 
00256         p->stackingOrder.append(hWnd);
00257         p->winInfos.insert(hWnd,winfo);
00258     }
00259     return true;
00260 }
00261 
00262 void KWindowSystemPrivate::readWindowInfo ( WId hWnd , InternalWindowInfo *winfo)
00263 {
00264     QByteArray windowText = QByteArray ( GetWindowTextLength(hWnd)+1, 0 ) ;
00265     GetWindowTextA(hWnd, windowText.data(), windowText.size());
00266      //maybe use SendMessageTimout here?
00267     QPixmap smallIcon;
00268     HICON hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00269     //if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00270     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00271     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00272     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00273     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00274     if(hSmallIcon)  smallIcon  = HIcon2QPixmap(hSmallIcon);
00275 
00276     QPixmap bigIcon;
00277     HICON hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00278     //if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00279     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00280     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00281     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00282     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00283     if(hBigIcon)  bigIcon  = HIcon2QPixmap(hBigIcon);
00284 
00285     winfo->bigIcon    = bigIcon;
00286     winfo->smallIcon  = smallIcon;
00287     winfo->windowName = QString(windowText).trimmed();
00288 }
00289 
00290 
00291 void KWindowSystemPrivate::windowAdded     (WId wid)
00292 {
00293     KWindowSystem::s_d_func()->reloadStackList();
00294     emit KWindowSystem::self()->windowAdded(wid);
00295     emit KWindowSystem::self()->stackingOrderChanged();
00296 }
00297 
00298 void KWindowSystemPrivate::windowRemoved   (WId wid)
00299 {
00300     KWindowSystem::s_d_func()->reloadStackList();
00301     emit KWindowSystem::self()->windowRemoved(wid);
00302     emit KWindowSystem::self()->stackingOrderChanged();
00303 }
00304 
00305 void KWindowSystemPrivate::windowActivated (WId wid)
00306 {
00307     KWindowSystem::s_d_func()->reloadStackList();
00308     emit KWindowSystem::self()->activeWindowChanged(wid);
00309     emit KWindowSystem::self()->stackingOrderChanged();
00310 }
00311 
00312 void KWindowSystemPrivate::windowRedraw    (WId wid)
00313 {
00314     KWindowSystem::s_d_func()->reloadStackList();
00315 }
00316 
00317 void KWindowSystemPrivate::windowFlash     (WId wid)
00318 {
00319     //emit KWindowSystem::self()->demandAttention( wid );
00320 }
00321 
00322 void KWindowSystemPrivate::windowStateChanged (WId wid)
00323 {
00324     emit KWindowSystem::self()->windowChanged( wid );
00325 }
00326 
00327 void KWindowSystemPrivate::reloadStackList ()
00328 {
00329     KWindowSystem::s_d_func()->stackingOrder.clear();
00330     KWindowSystem::s_d_func()->winInfos.clear();
00331     EnumWindows((WNDENUMPROC)EnumWindProc, 0 );
00332 }
00333 
00334 
00335 
00336 KWindowSystem* KWindowSystem::self()
00337 {
00338     return &(g_kwmInstanceContainer->kwm);
00339 }
00340 
00341 KWindowSystemPrivate* KWindowSystem::s_d_func()
00342 {
00343     return g_kwmInstanceContainer->d;
00344 }
00345 
00346 void KWindowSystem::init(int what)
00347 {
00348     KWindowSystemPrivate* const s_d = s_d_func();
00349 
00350     if (what >= INFO_WINDOWS)
00351        what = INFO_WINDOWS;
00352     else
00353        what = INFO_BASIC;
00354 
00355     if ( !s_d )
00356     {
00357         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00358         g_kwmInstanceContainer->d->activate();
00359     }
00360     else if (s_d->what < what)
00361     {
00362         delete s_d;
00363         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00364         g_kwmInstanceContainer->d->activate();
00365     }
00366 
00367 }
00368 
00369 bool KWindowSystem::allowedActionsSupported()
00370 {
00371     return false;
00372 }
00373 
00374 int KWindowSystem::currentDesktop()
00375 {
00376     return 1;
00377 }
00378 
00379 int KWindowSystem::numberOfDesktops()
00380 {
00381     return 1;
00382 }
00383 
00384 void KWindowSystem::setMainWindow( QWidget* subwindow, WId mainwindow )
00385 {
00386     SetForegroundWindow(subwindow->winId());
00387 }
00388 
00389 void KWindowSystem::setCurrentDesktop( int desktop )
00390 {
00391     kDebug() << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet implemented!";
00392     //TODO
00393 }
00394 
00395 void KWindowSystem::setOnAllDesktops( WId win, bool b )
00396 {
00397      kDebug() << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet implemented!";
00398      //TODO
00399 }
00400 
00401 void KWindowSystem::setOnDesktop( WId win, int desktop )
00402 {
00403      //TODO
00404      kDebug() << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet implemented!";
00405 }
00406 
00407 WId KWindowSystem::activeWindow()
00408 {
00409     return GetActiveWindow();
00410 }
00411 
00412 void KWindowSystem::activateWindow( WId win, long )
00413 {
00414     SetActiveWindow( win );
00415 }
00416 
00417 void KWindowSystem::forceActiveWindow( WId win, long time )
00418 {
00419     BringWindowToTop( win );
00420     SetForegroundWindow( win );
00421 }
00422 
00423 void KWindowSystem::demandAttention( WId win, bool set )
00424 {
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     bool got = false;
00487     if (state & NET::SkipTaskbar) {
00488         got = true;
00489         LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
00490         SetWindowLongPtr(win, GWL_EXSTYLE, lp | WS_EX_TOOLWINDOW);
00491     }
00492     if (state & NET::KeepAbove) {
00493         got = true;
00494         SetWindowPos(win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00495     }
00496     if(state & NET::KeepBelow){
00497         got = true;
00498         SetWindowPos(win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00499     }
00500     if(state & NET::Max){
00501         got = true;
00502         ShowWindow( win, SW_MAXIMIZE );
00503     }
00504     if (!got)
00505         kDebug() << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented for the state you requested!";
00506 }
00507 
00508 void KWindowSystem::clearState( WId win, unsigned long state )
00509 {
00510     bool got = false;
00511 
00512     if (state & NET::SkipTaskbar) {
00513         got = true;
00514         LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
00515         SetWindowLongPtr(win, GWL_EXSTYLE, lp & ~WS_EX_TOOLWINDOW);
00516     }
00517     if (state & NET::KeepAbove) {
00518         got = true;
00519         //lets hope this remove the topmost
00520         SetWindowPos(win, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00521     }
00522     if(state & NET::Max){
00523         got = true;
00524         ShowWindow( win, SW_RESTORE );
00525     }
00526     if (!got)
00527         kDebug() << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
00528 }
00529 
00530 void KWindowSystem::minimizeWindow( WId win, bool animation)
00531 {
00532     Q_UNUSED( animation );
00533     ShowWindow( win, SW_MINIMIZE );
00534 }
00535 
00536 void KWindowSystem::unminimizeWindow( WId win, bool animation )
00537 {
00538     Q_UNUSED( animation );
00539     ShowWindow( win, SW_RESTORE );
00540 }
00541 
00542 void KWindowSystem::raiseWindow( WId win )
00543 {
00544     SetWindowPos( win, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
00545 }
00546 
00547 void KWindowSystem::lowerWindow( WId win )
00548 {
00549     SetWindowPos( win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
00550 }
00551 
00552 bool KWindowSystem::compositingActive()
00553 {
00554     return true;
00555 }
00556 
00557 QRect KWindowSystem::workArea( int desktop )
00558 {
00559     return s_deskWidget->availableGeometry( desktop );
00560 }
00561 
00562 QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop )
00563 {
00564     //TODO
00565     kDebug() << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop ) isn't yet implemented!";
00566     return QRect();
00567 }
00568 
00569 QString KWindowSystem::desktopName( int desktop )
00570 {
00571     return i18n("Desktop %1",  desktop );
00572 }
00573 
00574 void KWindowSystem::setDesktopName( int desktop, const QString& name )
00575 {
00576      kDebug() << "KWindowSystem::setDesktopName( int desktop, const QString& name ) isn't yet implemented!";
00577     //TODO
00578 }
00579 
00580 bool KWindowSystem::showingDesktop()
00581 {
00582     return false;
00583 }
00584 
00585 void KWindowSystem::setUserTime( WId win, long time )
00586 {
00587     kDebug() << "KWindowSystem::setUserTime( WId win, long time ) isn't yet implemented!";
00588     //TODO
00589 }
00590 
00591 bool KWindowSystem::icccmCompliantMappingState()
00592 {
00593     return false;
00594 }
00595 
00596 // optimalization - create KWindowSystemPrivate only when needed and only for what is needed
00597 void KWindowSystem::connectNotify( const char* signal )
00598 {
00599     int what = INFO_BASIC;
00600     if( QLatin1String( signal ) == SIGNAL(workAreaChanged()))
00601         what = INFO_WINDOWS;
00602     else if( QLatin1String( signal ) == SIGNAL(strutChanged()))
00603         what = INFO_WINDOWS;
00604     else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,const unsigned long*))).constData())
00605         what = INFO_WINDOWS;
00606     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,unsigned int))).constData())
00607         what = INFO_WINDOWS;
00608     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId))).constData())
00609         what = INFO_WINDOWS;
00610 
00611     init( what );
00612     QObject::connectNotify( signal );
00613 }
00614 
00615 void KWindowSystem::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00616         int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00617         int bottom_width, int bottom_start, int bottom_end )
00618 {
00619   kDebug() << "KWindowSystem::setExtendedStrut isn't yet implemented!";
00620   //TODO
00621 }
00622 void KWindowSystem::setStrut( WId win, int left, int right, int top, int bottom )
00623 {
00624   kDebug() << "KWindowSystem::setStrut isn't yet implemented!";
00625   //TODO
00626 }
00627 
00628 QString KWindowSystem::readNameProperty( WId window, unsigned long atom )
00629 {
00630   //TODO
00631   kDebug() << "QString KWindowSystem::readNameProperty( WId window, unsigned long atom ) isn't yet implemented!";
00632   return QString();
00633 }
00634 
00635 void KWindowSystem::doNotManage( const QString& title )
00636 {
00637   //TODO
00638   kDebug() << "KWindowSystem::doNotManage( const QString& title ) isn't yet implemented!";
00639 }
00640 
00641 QList<WId> KWindowSystem::stackingOrder()
00642 {
00643   KWindowSystem::init(INFO_WINDOWS);
00644   return KWindowSystem::s_d_func()->stackingOrder;
00645 }
00646 
00647 const QList<WId>& KWindowSystem::windows()
00648 {
00649   KWindowSystem::init(INFO_WINDOWS);
00650   return KWindowSystem::s_d_func()->stackingOrder;
00651 }
00652 
00653 void KWindowSystem::setType( WId win, NET::WindowType windowType )
00654 {
00655  //TODO
00656  kDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet implemented!";
00657 }
00658 
00659 KWindowInfo KWindowSystem::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
00660 {
00661     KWindowSystem::init(INFO_WINDOWS);
00662     return KWindowInfo( win, properties, properties2 );
00663 }
00664 
00665 bool KWindowSystem::hasWId(WId w)
00666 {
00667     KWindowSystem::init(INFO_WINDOWS);
00668     return KWindowSystem::s_d_func()->winInfos.contains(w);
00669 }
00670 
00671 void KWindowSystem::allowExternalProcessWindowActivation( int pid )
00672 {
00673     AllowSetForegroundWindow( pid == -1 ? ASFW_ANY : pid );
00674 }
00675 
00676 #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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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