• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • 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 #ifdef __WIN64
00038 #define GCL_HICON GCLP_HICON
00039 #define GCL_HICONSM GCLP_HICONSM
00040 #endif
00041 
00042 //function to register us as taskmanager
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 static PtrRegisterShellHook pRegisterShellHook = 0;
00049 static int WM_SHELLHOOK = -1;
00050 
00051 class KWindowSystemStaticContainer {
00052 public:
00053     KWindowSystemStaticContainer() : d(0) {}
00054     KWindowSystem kwm;
00055     KWindowSystemPrivate* d;
00056 };
00057 
00058 K_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
00059 
00060 K_GLOBAL_STATIC(QDesktopWidget, s_deskWidget)
00061 
00062 
00063 struct InternalWindowInfo
00064 {
00065     InternalWindowInfo(){}
00066     QPixmap bigIcon;
00067     QPixmap smallIcon;
00068     QString windowName;
00069 };
00070 
00071 class KWindowSystemPrivate : public QWidget
00072 {
00073     friend class KWindowSystem;
00074     public:
00075         KWindowSystemPrivate ( int what );
00076         ~KWindowSystemPrivate();
00077 
00078         static bool CALLBACK EnumWindProc (WId hwnd, LPARAM lparam);
00079         static void readWindowInfo  (WId wid  , InternalWindowInfo *winfo);
00080 
00081         void windowAdded        (WId wid);
00082         void windowRemoved      (WId wid);
00083         void windowActivated    (WId wid);
00084         void windowRedraw       (WId wid);
00085         void windowFlash        (WId wid);
00086         void windowStateChanged (WId wid);
00087         void reloadStackList    ( );
00088         void activate           ( );
00089 
00090 
00091     protected:
00092         bool winEvent ( MSG * message, long * result );
00093 
00094     private:
00095         bool activated; 
00096         int what;
00097         WId fakeHwnd;
00098         QList<WId> stackingOrder;
00099         QMap<WId,InternalWindowInfo> winInfos;
00100 };
00101 
00102 static HBITMAP QPixmapMask2HBitmap(const QPixmap &pix)
00103 {
00104     QBitmap bm = pix.mask();
00105     if( bm.isNull() ) {
00106         bm = QBitmap( pix.size() );
00107         bm.fill( Qt::color1 );
00108     }
00109     QImage im = bm.toImage().convertToFormat( QImage::Format_Mono );
00110     im.invertPixels();                  // funny blank'n'white games on windows
00111     int w = im.width();
00112     int h = im.height();
00113     int bpl = (( w + 15 ) / 16 ) * 2;   // bpl, 16 bit alignment
00114     QByteArray bits( bpl * h, '\0' );
00115     for (int y=0; y < h; y++)
00116         memcpy( bits.data() + y * bpl, im.scanLine( y ), bpl );
00117     return CreateBitmap( w, h, 1, 1, bits );
00118 }
00119 
00120 KWindowSystemPrivate::KWindowSystemPrivate(int what) : QWidget(0),activated(false)
00121 {
00122     //i think there is no difference in windows we always load everything
00123     what = KWindowSystem::INFO_WINDOWS;
00124     setVisible(false);
00125 }
00126 
00127 void KWindowSystemPrivate::activate ( )
00128 {
00129     //prevent us from doing the same over and over again
00130     if(activated)
00131         return;
00132     activated = true;
00133     
00134     //resolve winapi stuff
00135     if(!pRegisterShellHook) pRegisterShellHook = (PtrRegisterShellHook)QLibrary::resolve("shell32",(LPCSTR)0xb5);
00136 
00137     //get the id for the shellhook message
00138     if(WM_SHELLHOOK==-1) {
00139         WM_SHELLHOOK = RegisterWindowMessage(TEXT("SHELLHOOK"));
00140         //kDebug() << "WM_SHELLHOOK:" << WM_SHELLHOOK << winId();
00141     }
00142 
00143     bool shellHookRegistered = false;
00144     if(pRegisterShellHook)
00145         shellHookRegistered = pRegisterShellHook(winId(),RSH_TASKMGR);
00146  
00147     if(!shellHookRegistered)
00148         //use a timer and poll the windows ?
00149           kDebug() << "Could not create shellhook to receive WindowManager Events";
00150 
00151     //fetch window infos
00152     reloadStackList();
00153 }
00154 
00155 KWindowSystemPrivate::~KWindowSystemPrivate()
00156 {
00157     if(pRegisterShellHook)
00158         pRegisterShellHook(winId(),RSH_UNREGISTER);     
00159 }
00160 
00164 bool KWindowSystemPrivate::winEvent ( MSG * message, long * result )
00165 {
00166     /* 
00167         check winuser.h for the following codes
00168         HSHELL_WINDOWCREATED        1
00169         HSHELL_WINDOWDESTROYED      2
00170         HSHELL_ACTIVATESHELLWINDOW  3
00171         HSHELL_WINDOWACTIVATED      4
00172         HSHELL_GETMINRECT           5
00173         HSHELL_RUDEAPPACTIVATED     32768 + 4 = 32772
00174         HSHELL_REDRAW               6
00175         HSHELL_FLASH                32768 + 6 = 32774
00176         HSHELL_TASKMAN              7
00177         HSHELL_LANGUAGE             8
00178         HSHELL_SYSMENU              9
00179         HSHELL_ENDTASK              10
00180         HSHELL_ACCESSIBILITYSTATE   11
00181         HSHELL_APPCOMMAND           12
00182         HSHELL_WINDOWREPLACED       13
00183         HSHELL_WINDOWREPLACING      14
00184        */
00185     if (message->message == WM_SHELLHOOK) {
00186 //         kDebug() << "what has happened?:" << message->wParam << message->message;
00187 
00188         switch(message->wParam) {
00189           case HSHELL_WINDOWCREATED:
00190             KWindowSystem::s_d_func()->windowAdded(reinterpret_cast<WId>(message->lParam));
00191             break;
00192           case HSHELL_WINDOWDESTROYED:
00193             KWindowSystem::s_d_func()->windowRemoved(reinterpret_cast<WId>(message->lParam));
00194             break;
00195           case HSHELL_WINDOWACTIVATED:
00196 #ifndef _WIN32_WCE
00197           case HSHELL_RUDEAPPACTIVATED:
00198 #endif
00199             KWindowSystem::s_d_func()->windowActivated(reinterpret_cast<WId>(message->lParam));
00200             break;
00201 #ifndef _WIN32_WCE
00202           case HSHELL_GETMINRECT:
00203             KWindowSystem::s_d_func()->windowStateChanged(reinterpret_cast<WId>(message->lParam));
00204             break;
00205           case HSHELL_REDRAW: //the caption has changed
00206             KWindowSystem::s_d_func()->windowRedraw(reinterpret_cast<WId>(message->lParam));
00207             break;
00208           case HSHELL_FLASH:
00209             KWindowSystem::s_d_func()->windowFlash(reinterpret_cast<WId>(message->lParam));
00210             break;
00211 #endif
00212         }
00213     }
00214     return QWidget::winEvent(message,result);
00215 }
00216 
00217 bool CALLBACK KWindowSystemPrivate::EnumWindProc(WId hWnd, LPARAM lparam)
00218 {
00219     QByteArray windowText = QByteArray ( (GetWindowTextLength(hWnd)+1) * sizeof(wchar_t), 0 ) ;
00220     GetWindowTextW(hWnd, (LPWSTR)windowText.data(), windowText.size());
00221     DWORD ex_style = GetWindowExStyle(hWnd);
00222     KWindowSystemPrivate *p = KWindowSystem::s_d_func();
00223 
00224     QString add;
00225     if( !QString::fromWCharArray((wchar_t*)windowText.data()).trimmed().isEmpty() && IsWindowVisible( hWnd ) && !(ex_style&WS_EX_TOOLWINDOW)
00226        && !GetParent(hWnd) && !GetWindow(hWnd,GW_OWNER) && !p->winInfos.contains(hWnd) ) {
00227 
00228 //        kDebug()<<"Adding window to windowList " << add + QString(windowText).trimmed();
00229 
00230         InternalWindowInfo winfo;
00231         KWindowSystemPrivate::readWindowInfo(hWnd,&winfo);
00232 
00233         p->stackingOrder.append(hWnd);
00234         p->winInfos.insert(hWnd,winfo);
00235     }
00236     return true;
00237 }
00238 
00239 void KWindowSystemPrivate::readWindowInfo ( WId hWnd , InternalWindowInfo *winfo)
00240 {
00241     QByteArray windowText = QByteArray ( (GetWindowTextLength(hWnd)+1) * sizeof(wchar_t), 0 ) ;
00242     GetWindowTextW(hWnd, (LPWSTR)windowText.data(), windowText.size());
00243      //maybe use SendMessageTimout here?
00244     QPixmap smallIcon;
00245     HICON hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00246     //if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00247     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00248 #ifndef _WIN32_WCE
00249     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00250     if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00251 #endif
00252     if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00253     if(hSmallIcon)  smallIcon  = QPixmap::fromWinHICON(hSmallIcon);
00254 
00255     QPixmap bigIcon;
00256     HICON hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
00257     //if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
00258     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
00259 #ifndef _WIN32_WCE
00260     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
00261     if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
00262 #endif
00263     if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
00264     if(hBigIcon)  bigIcon  = QPixmap::fromWinHICON(hBigIcon);
00265 
00266     winfo->bigIcon    = bigIcon;
00267     winfo->smallIcon  = smallIcon;
00268     winfo->windowName = QString::fromWCharArray((wchar_t*)windowText.data()).trimmed();
00269 }
00270 
00271 
00272 void KWindowSystemPrivate::windowAdded     (WId wid)
00273 {
00274 //     kDebug() << "window added!";
00275     KWindowSystem::s_d_func()->reloadStackList();
00276     emit KWindowSystem::self()->windowAdded(wid);
00277     emit KWindowSystem::self()->activeWindowChanged(wid);
00278     emit KWindowSystem::self()->stackingOrderChanged();
00279 }
00280 
00281 void KWindowSystemPrivate::windowRemoved   (WId wid)
00282 {
00283 //     kDebug() << "window removed!";
00284     KWindowSystem::s_d_func()->reloadStackList();
00285     emit KWindowSystem::self()->windowRemoved(wid);
00286     emit KWindowSystem::self()->stackingOrderChanged();
00287 }
00288 
00289 void KWindowSystemPrivate::windowActivated (WId wid)
00290 {
00291 //     kDebug() << "window activated!";
00292     if (!wid) {
00293         return;
00294     }
00295 
00296     KWindowSystem::s_d_func()->reloadStackList();
00297     emit KWindowSystem::self()->activeWindowChanged(wid);
00298     emit KWindowSystem::self()->stackingOrderChanged();
00299 }
00300 
00301 void KWindowSystemPrivate::windowRedraw    (WId wid)
00302 {
00303     KWindowSystem::s_d_func()->reloadStackList();
00304 }
00305 
00306 void KWindowSystemPrivate::windowFlash     (WId wid)
00307 {
00308     //emit KWindowSystem::self()->demandAttention( wid );
00309 }
00310 
00311 void KWindowSystemPrivate::windowStateChanged (WId wid)
00312 {
00313     emit KWindowSystem::self()->windowChanged( wid );
00314 }
00315 
00316 void KWindowSystemPrivate::reloadStackList ()
00317 {
00318     KWindowSystem::s_d_func()->stackingOrder.clear();
00319     KWindowSystem::s_d_func()->winInfos.clear();
00320     EnumWindows((WNDENUMPROC)EnumWindProc, 0 );
00321 }
00322 
00323 
00324 
00325 KWindowSystem* KWindowSystem::self()
00326 {
00327     return &(g_kwmInstanceContainer->kwm);
00328 }
00329 
00330 KWindowSystemPrivate* KWindowSystem::s_d_func()
00331 {
00332     return g_kwmInstanceContainer->d;
00333 }
00334 
00335 void KWindowSystem::init(int what)
00336 {
00337     KWindowSystemPrivate* const s_d = s_d_func();
00338 
00339     if (what >= INFO_WINDOWS)
00340        what = INFO_WINDOWS;
00341     else
00342        what = INFO_BASIC;
00343 
00344     if ( !s_d )
00345     {
00346         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00347         g_kwmInstanceContainer->d->activate();
00348     }
00349     else if (s_d->what < what)
00350     {
00351         delete s_d;
00352         g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
00353         g_kwmInstanceContainer->d->activate();
00354     }
00355 
00356 }
00357 
00358 bool KWindowSystem::allowedActionsSupported()
00359 {
00360     return false;
00361 }
00362 
00363 int KWindowSystem::currentDesktop()
00364 {
00365     return 1;
00366 }
00367 
00368 int KWindowSystem::numberOfDesktops()
00369 {
00370     return 1;
00371 }
00372 
00373 void KWindowSystem::setMainWindow( QWidget* subwindow, WId mainwindow )
00374 {
00375     SetForegroundWindow(subwindow->winId());
00376 }
00377 
00378 void KWindowSystem::setCurrentDesktop( int desktop )
00379 {
00380     kDebug() << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet implemented!";
00381     //TODO
00382 }
00383 
00384 void KWindowSystem::setOnAllDesktops( WId win, bool b )
00385 {
00386      kDebug() << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet implemented!";
00387      //TODO
00388 }
00389 
00390 void KWindowSystem::setOnDesktop( WId win, int desktop )
00391 {
00392      //TODO
00393      kDebug() << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet implemented!";
00394 }
00395 
00396 WId KWindowSystem::activeWindow()
00397 {
00398     return GetActiveWindow();
00399 }
00400 
00401 void KWindowSystem::activateWindow( WId win, long )
00402 {
00403     SetActiveWindow( win );
00404 }
00405 
00406 void KWindowSystem::forceActiveWindow( WId win, long time )
00407 {
00408     // FIXME restoring a hidden window doesn't work: the window contents just appear white.
00409     // But the mouse cursor still acts as if the widgets were there (e.g. button clicking works),
00410     // which indicates the issue is at the window/backingstore level.
00411     // This is probably a side effect of bypassing Qt's internal window state handling.
00412 #ifndef _WIN32_WCE
00413     if ( IsIconic( win ) /*|| !IsWindowVisible( win ) */) {
00414         // Do not activate the window as we restore it,
00415         // otherwise the window appears see-through (contents not updated).
00416         ShowWindow( win, SW_SHOWNOACTIVATE );
00417     }
00418 #endif
00419     // Puts the window in front and activates it.
00420     //to bring a window to the front while the user is active in a different apllication we
00421     //have to atach our self to the current active window
00422     HWND hwndActiveWin = GetForegroundWindow();
00423     int  idActive      = GetWindowThreadProcessId(hwndActiveWin, NULL);
00424     if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
00425     {
00426         SetForegroundWindow( win );
00427         SetFocus( win ); 
00428         AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
00429     }
00430     
00431 }
00432 
00433 void KWindowSystem::demandAttention( WId win, bool set )
00434 {
00435 // One can not flash a windows in wince
00436 #ifndef _WIN32_WCE
00437     FLASHWINFO fi;
00438     fi.cbSize = sizeof( FLASHWINFO );
00439     fi.hwnd = win;
00440     fi.dwFlags = set ? FLASHW_ALL : FLASHW_STOP;
00441     fi.uCount = 5;
00442     fi.dwTimeout = 0;
00443 
00444     FlashWindowEx( &fi );
00445 #endif
00446 }
00447 
00448 
00449 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale )
00450 {
00451     KWindowSystem::init(INFO_WINDOWS);
00452 
00453     QPixmap pm;
00454     if(KWindowSystem::s_d_func()->winInfos.contains(win)){
00455         if( width < 24 || height < 24 )
00456             pm = KWindowSystem::s_d_func()->winInfos[win].smallIcon;
00457         else
00458             pm = KWindowSystem::s_d_func()->winInfos[win].bigIcon;
00459     }
00460     else{
00461         kDebug()<<"KWindowSystem::icon winid not in winInfos";
00462         UINT size = ICON_BIG;
00463         if( width < 24 || height < 24 )
00464             size = ICON_SMALL;
00465         HICON hIcon = (HICON)SendMessage( win, WM_GETICON, size, 0);
00466         pm = QPixmap::fromWinHICON( hIcon );
00467     }
00468     if( scale )
00469         pm = pm.scaled( width, height );
00470     return pm;
00471 }
00472 
00473 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int )
00474 {
00475     return icon( win, width, height, scale );
00476 }
00477 
00478 void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon )
00479 {
00480     KWindowSystem::init(INFO_WINDOWS);
00481     KWindowSystemPrivate* s_d = s_d_func();
00482 
00483     if(s_d->winInfos.contains(win)){
00484         // is this safe enough or do i have to refresh() the window infos
00485         s_d->winInfos[win].smallIcon = miniIcon;
00486         s_d->winInfos[win].bigIcon   = icon;
00487     }
00488 
00489     HICON hIconBig = icon.toWinHICON();
00490     HICON hIconSmall = miniIcon.toWinHICON();
00491 
00492     hIconBig = (HICON)SendMessage( win, WM_SETICON, ICON_BIG,   (LPARAM)hIconBig );
00493     hIconSmall = (HICON)SendMessage( win, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall );
00494 
00495 }
00496 
00497 void KWindowSystem::setState( WId win, unsigned long state )
00498 {
00499     bool got = false;
00500 #ifndef _WIN32_WCE
00501     if (state & NET::SkipTaskbar) {
00502         got = true;
00503         LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
00504         SetWindowLongPtr(win, GWL_EXSTYLE, lp | WS_EX_TOOLWINDOW);
00505     }
00506 #endif
00507     if (state & NET::KeepAbove) {
00508         got = true;
00509         SetWindowPos(win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00510     }
00511     if(state & NET::KeepBelow){
00512         got = true;
00513         SetWindowPos(win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00514     }
00515     if(state & NET::Max){
00516         got = true;
00517         ShowWindow( win, SW_MAXIMIZE );
00518     }
00519     if (!got)
00520         kDebug() << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented for the state you requested!";
00521 }
00522 
00523 void KWindowSystem::clearState( WId win, unsigned long state )
00524 {
00525     bool got = false;
00526 
00527 #ifndef _WIN32_WCE
00528     if (state & NET::SkipTaskbar) {
00529         got = true;
00530         LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
00531         SetWindowLongPtr(win, GWL_EXSTYLE, lp & ~WS_EX_TOOLWINDOW);
00532     }
00533 #endif
00534     if (state & NET::KeepAbove) {
00535         got = true;
00536         //lets hope this remove the topmost
00537         SetWindowPos(win, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
00538     }
00539     if(state & NET::Max){
00540         got = true;
00541         ShowWindow( win, SW_RESTORE );
00542     }
00543     if (!got)
00544         kDebug() << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
00545 }
00546 
00547 void KWindowSystem::minimizeWindow( WId win, bool animation)
00548 {
00549     Q_UNUSED( animation );
00550     ShowWindow( win, SW_MINIMIZE );
00551 }
00552 
00553 void KWindowSystem::unminimizeWindow( WId win, bool animation )
00554 {
00555     Q_UNUSED( animation );
00556     ShowWindow( win, SW_RESTORE );
00557 }
00558 
00559 void KWindowSystem::raiseWindow( WId win )
00560 {
00561 
00562     //to bring a window to the front while the user is active in a different apllication we
00563     //have to atach our self to the current active window
00564     HWND hwndActiveWin = GetForegroundWindow();
00565     int  idActive      = GetWindowThreadProcessId(hwndActiveWin, NULL);
00566     if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
00567     {
00568         SetForegroundWindow( win );
00569         AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
00570     }
00571 }
00572 
00573 void KWindowSystem::lowerWindow( WId win )
00574 {
00575     SetWindowPos( win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
00576 }
00577 
00578 bool KWindowSystem::compositingActive()
00579 {
00580     return true;
00581 }
00582 
00583 QRect KWindowSystem::workArea( int desktop )
00584 {
00585     return s_deskWidget->availableGeometry( desktop );
00586 }
00587 
00588 QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop )
00589 {
00590     //TODO
00591     kDebug() << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop ) isn't yet implemented!";
00592     return QRect();
00593 }
00594 
00595 QString KWindowSystem::desktopName( int desktop )
00596 {
00597     return i18n("Desktop %1",  desktop );
00598 }
00599 
00600 void KWindowSystem::setDesktopName( int desktop, const QString& name )
00601 {
00602      kDebug() << "KWindowSystem::setDesktopName( int desktop, const QString& name ) isn't yet implemented!";
00603     //TODO
00604 }
00605 
00606 bool KWindowSystem::showingDesktop()
00607 {
00608     return false;
00609 }
00610 
00611 void KWindowSystem::setUserTime( WId win, long time )
00612 {
00613     kDebug() << "KWindowSystem::setUserTime( WId win, long time ) isn't yet implemented!";
00614     //TODO
00615 }
00616 
00617 bool KWindowSystem::icccmCompliantMappingState()
00618 {
00619     return false;
00620 }
00621 
00622 // optimalization - create KWindowSystemPrivate only when needed and only for what is needed
00623 void KWindowSystem::connectNotify( const char* signal )
00624 {
00625     int what = INFO_BASIC;
00626     if( QLatin1String( signal ) == SIGNAL(workAreaChanged()))
00627         what = INFO_WINDOWS;
00628     else if( QLatin1String( signal ) == SIGNAL(strutChanged()))
00629         what = INFO_WINDOWS;
00630     else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,const unsigned long*))).constData())
00631         what = INFO_WINDOWS;
00632     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,unsigned int))).constData())
00633         what = INFO_WINDOWS;
00634     else if( QLatin1String( signal ) ==  QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId))).constData())
00635         what = INFO_WINDOWS;
00636 
00637     init( what );
00638     QObject::connectNotify( signal );
00639 }
00640 
00641 void KWindowSystem::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
00642         int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
00643         int bottom_width, int bottom_start, int bottom_end )
00644 {
00645   kDebug() << "KWindowSystem::setExtendedStrut isn't yet implemented!";
00646   //TODO
00647 }
00648 void KWindowSystem::setStrut( WId win, int left, int right, int top, int bottom )
00649 {
00650   kDebug() << "KWindowSystem::setStrut isn't yet implemented!";
00651   //TODO
00652 }
00653 
00654 QString KWindowSystem::readNameProperty( WId window, unsigned long atom )
00655 {
00656   //TODO
00657   kDebug() << "QString KWindowSystem::readNameProperty( WId window, unsigned long atom ) isn't yet implemented!";
00658   return QString();
00659 }
00660 
00661 void KWindowSystem::doNotManage( const QString& title )
00662 {
00663   //TODO
00664   kDebug() << "KWindowSystem::doNotManage( const QString& title ) isn't yet implemented!";
00665 }
00666 
00667 QList<WId> KWindowSystem::stackingOrder()
00668 {
00669   KWindowSystem::init(INFO_WINDOWS);
00670   return KWindowSystem::s_d_func()->stackingOrder;
00671 }
00672 
00673 const QList<WId>& KWindowSystem::windows()
00674 {
00675   KWindowSystem::init(INFO_WINDOWS);
00676   return KWindowSystem::s_d_func()->stackingOrder;
00677 }
00678 
00679 void KWindowSystem::setType( WId win, NET::WindowType windowType )
00680 {
00681  //TODO
00682  kDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet implemented!";
00683 }
00684 
00685 KWindowInfo KWindowSystem::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
00686 {
00687     KWindowSystem::init(INFO_WINDOWS);
00688     return KWindowInfo( win, properties, properties2 );
00689 }
00690 
00691 bool KWindowSystem::hasWId(WId w)
00692 {
00693     KWindowSystem::init(INFO_WINDOWS);
00694     return KWindowSystem::s_d_func()->winInfos.contains(w);
00695 }
00696 
00697 void KWindowSystem::allowExternalProcessWindowActivation( int pid )
00698 {
00699 #ifndef _WIN32_WCE
00700     AllowSetForegroundWindow( pid == -1 ? ASFW_ANY : pid );
00701 #endif
00702 }
00703 
00704 #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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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