• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.11.5 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • windowmanagement
kwindowsystem_win.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 2007 Laurent Montel (montel@kde.org)
4  Copyright (C) 2007 Christian Ehrlicher (ch.ehrlicher@gmx.de)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "kwindowsystem.h"
23 
24 #include <QtGui/QDesktopWidget>
25 #include <QtGui/QIcon>
26 #include <QtGui/QBitmap>
27 #include <QtGui/QPixmap>
28 #include <QtCore/QLibrary>
29 
30 #include "kglobal.h"
31 #include "kdebug.h"
32 #include "klocalizedstring.h"
33 
34 #include <windows.h>
35 #include <windowsx.h>
36 
37 #ifdef __WIN64
38 #define GCL_HICON GCLP_HICON
39 #define GCL_HICONSM GCLP_HICONSM
40 #endif
41 
42 //function to register us as taskmanager
43 #define RSH_UNREGISTER 0
44 #define RSH_REGISTER 1
45 #define RSH_TASKMGR 3
46 typedef bool (WINAPI *PtrRegisterShellHook)(HWND hWnd, DWORD method);
47 
48 static PtrRegisterShellHook pRegisterShellHook = 0;
49 static int WM_SHELLHOOK = -1;
50 
51 class KWindowSystemStaticContainer {
52 public:
53  KWindowSystemStaticContainer() : d(0) {}
54  KWindowSystem kwm;
55  KWindowSystemPrivate* d;
56 };
57 
58 K_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
59 
60 K_GLOBAL_STATIC(QDesktopWidget, s_deskWidget)
61 
62 
63 struct InternalWindowInfo
64 {
65  InternalWindowInfo(){}
66  QPixmap bigIcon;
67  QPixmap smallIcon;
68  QString windowName;
69 };
70 
71 class KWindowSystemPrivate : public QWidget
72 {
73  friend class KWindowSystem;
74  public:
75  KWindowSystemPrivate ( int what );
76  ~KWindowSystemPrivate();
77 
78  static bool CALLBACK EnumWindProc (WId hwnd, LPARAM lparam);
79  static void readWindowInfo (WId wid , InternalWindowInfo *winfo);
80 
81  void windowAdded (WId wid);
82  void windowRemoved (WId wid);
83  void windowActivated (WId wid);
84  void windowRedraw (WId wid);
85  void windowFlash (WId wid);
86  void windowStateChanged (WId wid);
87  void reloadStackList ( );
88  void activate ( );
89 
90 
91  protected:
92  bool winEvent ( MSG * message, long * result );
93 
94  private:
95  bool activated;
96  int what;
97  WId fakeHwnd;
98  QList<WId> stackingOrder;
99  QMap<WId,InternalWindowInfo> winInfos;
100 };
101 
102 static HBITMAP QPixmapMask2HBitmap(const QPixmap &pix)
103 {
104  QBitmap bm = pix.mask();
105  if( bm.isNull() ) {
106  bm = QBitmap( pix.size() );
107  bm.fill( Qt::color1 );
108  }
109  QImage im = bm.toImage().convertToFormat( QImage::Format_Mono );
110  im.invertPixels(); // funny blank'n'white games on windows
111  int w = im.width();
112  int h = im.height();
113  int bpl = (( w + 15 ) / 16 ) * 2; // bpl, 16 bit alignment
114  QByteArray bits( bpl * h, '\0' );
115  for (int y=0; y < h; y++)
116  memcpy( bits.data() + y * bpl, im.scanLine( y ), bpl );
117  return CreateBitmap( w, h, 1, 1, bits );
118 }
119 
120 KWindowSystemPrivate::KWindowSystemPrivate(int what) : QWidget(0),activated(false)
121 {
122  //i think there is no difference in windows we always load everything
123  what = KWindowSystem::INFO_WINDOWS;
124  setVisible(false);
125 }
126 
127 void KWindowSystemPrivate::activate ( )
128 {
129 #if 0
130  //prevent us from doing the same over and over again
131  if(activated)
132  return;
133  activated = true;
134 
135  //resolve winapi stuff
136  if(!pRegisterShellHook) pRegisterShellHook = (PtrRegisterShellHook)QLibrary::resolve("shell32",(LPCSTR)0xb5);
137 
138  //get the id for the shellhook message
139  if(WM_SHELLHOOK==-1) {
140  WM_SHELLHOOK = RegisterWindowMessage(TEXT("SHELLHOOK"));
141  //kDebug() << "WM_SHELLHOOK:" << WM_SHELLHOOK << winId();
142  }
143 
144  bool shellHookRegistered = false;
145  if(pRegisterShellHook)
146  shellHookRegistered = pRegisterShellHook(winId(),RSH_TASKMGR);
147 
148  if(!shellHookRegistered)
149  //use a timer and poll the windows ?
150  kDebug() << "Could not create shellhook to receive WindowManager Events";
151 
152  //fetch window infos
153  reloadStackList();
154 #endif
155 }
156 
157 KWindowSystemPrivate::~KWindowSystemPrivate()
158 {
159  if(pRegisterShellHook)
160  pRegisterShellHook(winId(),RSH_UNREGISTER);
161 }
162 
166 bool KWindowSystemPrivate::winEvent ( MSG * message, long * result )
167 {
168  /*
169  check winuser.h for the following codes
170  HSHELL_WINDOWCREATED 1
171  HSHELL_WINDOWDESTROYED 2
172  HSHELL_ACTIVATESHELLWINDOW 3
173  HSHELL_WINDOWACTIVATED 4
174  HSHELL_GETMINRECT 5
175  HSHELL_RUDEAPPACTIVATED 32768 + 4 = 32772
176  HSHELL_REDRAW 6
177  HSHELL_FLASH 32768 + 6 = 32774
178  HSHELL_TASKMAN 7
179  HSHELL_LANGUAGE 8
180  HSHELL_SYSMENU 9
181  HSHELL_ENDTASK 10
182  HSHELL_ACCESSIBILITYSTATE 11
183  HSHELL_APPCOMMAND 12
184  HSHELL_WINDOWREPLACED 13
185  HSHELL_WINDOWREPLACING 14
186  */
187  if (message->message == WM_SHELLHOOK) {
188 // kDebug() << "what has happened?:" << message->wParam << message->message;
189 
190  switch(message->wParam) {
191  case HSHELL_WINDOWCREATED:
192  KWindowSystem::s_d_func()->windowAdded(reinterpret_cast<WId>(message->lParam));
193  break;
194  case HSHELL_WINDOWDESTROYED:
195  KWindowSystem::s_d_func()->windowRemoved(reinterpret_cast<WId>(message->lParam));
196  break;
197  case HSHELL_WINDOWACTIVATED:
198 #ifndef _WIN32_WCE
199  case HSHELL_RUDEAPPACTIVATED:
200 #endif
201  KWindowSystem::s_d_func()->windowActivated(reinterpret_cast<WId>(message->lParam));
202  break;
203 #ifndef _WIN32_WCE
204  case HSHELL_GETMINRECT:
205  KWindowSystem::s_d_func()->windowStateChanged(reinterpret_cast<WId>(message->lParam));
206  break;
207  case HSHELL_REDRAW: //the caption has changed
208  KWindowSystem::s_d_func()->windowRedraw(reinterpret_cast<WId>(message->lParam));
209  break;
210  case HSHELL_FLASH:
211  KWindowSystem::s_d_func()->windowFlash(reinterpret_cast<WId>(message->lParam));
212  break;
213 #endif
214  }
215  }
216  return QWidget::winEvent(message,result);
217 }
218 
219 bool CALLBACK KWindowSystemPrivate::EnumWindProc(WId hWnd, LPARAM lparam)
220 {
221  QByteArray windowText = QByteArray ( (GetWindowTextLength(hWnd)+1) * sizeof(wchar_t), 0 ) ;
222  GetWindowTextW(hWnd, (LPWSTR)windowText.data(), windowText.size());
223  DWORD ex_style = GetWindowExStyle(hWnd);
224  KWindowSystemPrivate *p = KWindowSystem::s_d_func();
225 
226  QString add;
227  if( !QString::fromWCharArray((wchar_t*)windowText.data()).trimmed().isEmpty() && IsWindowVisible( hWnd ) && !(ex_style&WS_EX_TOOLWINDOW)
228  && !GetParent(hWnd) && !GetWindow(hWnd,GW_OWNER) && !p->winInfos.contains(hWnd) ) {
229 
230 // kDebug()<<"Adding window to windowList " << add + QString(windowText).trimmed();
231 
232  InternalWindowInfo winfo;
233  KWindowSystemPrivate::readWindowInfo(hWnd,&winfo);
234 
235  p->stackingOrder.append(hWnd);
236  p->winInfos.insert(hWnd,winfo);
237  }
238  return true;
239 }
240 
241 void KWindowSystemPrivate::readWindowInfo ( WId hWnd , InternalWindowInfo *winfo)
242 {
243  QByteArray windowText = QByteArray ( (GetWindowTextLength(hWnd)+1) * sizeof(wchar_t), 0 ) ;
244  GetWindowTextW(hWnd, (LPWSTR)windowText.data(), windowText.size());
245  //maybe use SendMessageTimout here?
246  QPixmap smallIcon;
247  HICON hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
248  //if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
249  if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
250 #ifndef _WIN32_WCE
251  if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
252  if(!hSmallIcon) hSmallIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
253 #endif
254  if(!hSmallIcon) hSmallIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
255  if(hSmallIcon) smallIcon = QPixmap::fromWinHICON(hSmallIcon);
256 
257  QPixmap bigIcon;
258  HICON hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0);
259  //if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL2, 0);
260  if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, 0);
261 #ifndef _WIN32_WCE
262  if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICON);
263  if(!hBigIcon) hBigIcon = (HICON)GetClassLong(hWnd, GCL_HICONSM);
264 #endif
265  if(!hBigIcon) hBigIcon = (HICON)SendMessage(hWnd, WM_QUERYDRAGICON, 0, 0);
266  if(hBigIcon) bigIcon = QPixmap::fromWinHICON(hBigIcon);
267 
268  winfo->bigIcon = bigIcon;
269  winfo->smallIcon = smallIcon;
270  winfo->windowName = QString::fromWCharArray((wchar_t*)windowText.data()).trimmed();
271 }
272 
273 
274 void KWindowSystemPrivate::windowAdded (WId wid)
275 {
276 // kDebug() << "window added!";
277  KWindowSystem::s_d_func()->reloadStackList();
278  emit KWindowSystem::self()->windowAdded(wid);
279  emit KWindowSystem::self()->activeWindowChanged(wid);
280  emit KWindowSystem::self()->stackingOrderChanged();
281 }
282 
283 void KWindowSystemPrivate::windowRemoved (WId wid)
284 {
285 // kDebug() << "window removed!";
286  KWindowSystem::s_d_func()->reloadStackList();
287  emit KWindowSystem::self()->windowRemoved(wid);
288  emit KWindowSystem::self()->stackingOrderChanged();
289 }
290 
291 void KWindowSystemPrivate::windowActivated (WId wid)
292 {
293 // kDebug() << "window activated!";
294  if (!wid) {
295  return;
296  }
297 
298  KWindowSystem::s_d_func()->reloadStackList();
299  emit KWindowSystem::self()->activeWindowChanged(wid);
300  emit KWindowSystem::self()->stackingOrderChanged();
301 }
302 
303 void KWindowSystemPrivate::windowRedraw (WId wid)
304 {
305  KWindowSystem::s_d_func()->reloadStackList();
306 }
307 
308 void KWindowSystemPrivate::windowFlash (WId wid)
309 {
310  //emit KWindowSystem::self()->demandAttention( wid );
311 }
312 
313 void KWindowSystemPrivate::windowStateChanged (WId wid)
314 {
315  emit KWindowSystem::self()->windowChanged( wid );
316 }
317 
318 void KWindowSystemPrivate::reloadStackList ()
319 {
320  KWindowSystem::s_d_func()->stackingOrder.clear();
321  KWindowSystem::s_d_func()->winInfos.clear();
322 // EnumWindows((WNDENUMPROC)EnumWindProc, 0 );
323 }
324 
325 
326 
327 KWindowSystem* KWindowSystem::self()
328 {
329  return &(g_kwmInstanceContainer->kwm);
330 }
331 
332 KWindowSystemPrivate* KWindowSystem::s_d_func()
333 {
334  return g_kwmInstanceContainer->d;
335 }
336 
337 void KWindowSystem::init(int what)
338 {
339  KWindowSystemPrivate* const s_d = s_d_func();
340 
341  if (what >= INFO_WINDOWS)
342  what = INFO_WINDOWS;
343  else
344  what = INFO_BASIC;
345 
346  if ( !s_d )
347  {
348  g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
349  g_kwmInstanceContainer->d->activate();
350  }
351  else if (s_d->what < what)
352  {
353  delete s_d;
354  g_kwmInstanceContainer->d = new KWindowSystemPrivate(what); // invalidates s_d
355  g_kwmInstanceContainer->d->activate();
356  }
357 
358 }
359 
360 bool KWindowSystem::allowedActionsSupported()
361 {
362  return false;
363 }
364 
365 int KWindowSystem::currentDesktop()
366 {
367  return 1;
368 }
369 
370 int KWindowSystem::numberOfDesktops()
371 {
372  return 1;
373 }
374 
375 void KWindowSystem::setMainWindow( QWidget* subwindow, WId mainwindow )
376 {
377  SetForegroundWindow(subwindow->winId());
378 }
379 
380 void KWindowSystem::setCurrentDesktop( int desktop )
381 {
382  kDebug() << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet implemented!";
383  //TODO
384 }
385 
386 void KWindowSystem::setOnAllDesktops( WId win, bool b )
387 {
388  kDebug() << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet implemented!";
389  //TODO
390 }
391 
392 void KWindowSystem::setOnDesktop( WId win, int desktop )
393 {
394  //TODO
395  kDebug() << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet implemented!";
396 }
397 
398 WId KWindowSystem::activeWindow()
399 {
400  return GetActiveWindow();
401 }
402 
403 void KWindowSystem::activateWindow( WId win, long )
404 {
405  SetActiveWindow( win );
406 }
407 
408 void KWindowSystem::forceActiveWindow( WId win, long time )
409 {
410  // FIXME restoring a hidden window doesn't work: the window contents just appear white.
411  // But the mouse cursor still acts as if the widgets were there (e.g. button clicking works),
412  // which indicates the issue is at the window/backingstore level.
413  // This is probably a side effect of bypassing Qt's internal window state handling.
414 #ifndef _WIN32_WCE
415  if ( IsIconic( win ) /*|| !IsWindowVisible( win ) */) {
416  // Do not activate the window as we restore it,
417  // otherwise the window appears see-through (contents not updated).
418  ShowWindow( win, SW_SHOWNOACTIVATE );
419  }
420 #endif
421  // Puts the window in front and activates it.
422  //to bring a window to the front while the user is active in a different apllication we
423  //have to atach our self to the current active window
424  HWND hwndActiveWin = GetForegroundWindow();
425  int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL);
426  if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
427  {
428  SetForegroundWindow( win );
429  SetFocus( win );
430  AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
431  }
432 
433 }
434 
435 void KWindowSystem::demandAttention( WId win, bool set )
436 {
437 // One can not flash a windows in wince
438 #ifndef _WIN32_WCE
439  FLASHWINFO fi;
440  fi.cbSize = sizeof( FLASHWINFO );
441  fi.hwnd = win;
442  fi.dwFlags = set ? FLASHW_ALL : FLASHW_STOP;
443  fi.uCount = 5;
444  fi.dwTimeout = 0;
445 
446  FlashWindowEx( &fi );
447 #endif
448 }
449 
450 
451 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale )
452 {
453  KWindowSystem::init(INFO_WINDOWS);
454 
455  QPixmap pm;
456  if(KWindowSystem::s_d_func()->winInfos.contains(win)){
457  if( width < 24 || height < 24 )
458  pm = KWindowSystem::s_d_func()->winInfos[win].smallIcon;
459  else
460  pm = KWindowSystem::s_d_func()->winInfos[win].bigIcon;
461  }
462  else{
463  kDebug()<<"KWindowSystem::icon winid not in winInfos";
464  UINT size = ICON_BIG;
465  if( width < 24 || height < 24 )
466  size = ICON_SMALL;
467  HICON hIcon = (HICON)SendMessage( win, WM_GETICON, size, 0);
468  if(hIcon != NULL)
469  pm = QPixmap::fromWinHICON( hIcon );
470  }
471  if( scale )
472  pm = pm.scaled( width, height );
473  return pm;
474 }
475 
476 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int )
477 {
478  return icon( win, width, height, scale );
479 }
480 
481 void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon )
482 {
483  KWindowSystem::init(INFO_WINDOWS);
484  KWindowSystemPrivate* s_d = s_d_func();
485 
486  if(s_d->winInfos.contains(win)){
487  // is this safe enough or do i have to refresh() the window infos
488  s_d->winInfos[win].smallIcon = miniIcon;
489  s_d->winInfos[win].bigIcon = icon;
490  }
491 
492  HICON hIconBig = icon.toWinHICON();
493  HICON hIconSmall = miniIcon.toWinHICON();
494 
495  hIconBig = (HICON)SendMessage( win, WM_SETICON, ICON_BIG, (LPARAM)hIconBig );
496  hIconSmall = (HICON)SendMessage( win, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall );
497 
498 }
499 
500 void KWindowSystem::setState( WId win, unsigned long state )
501 {
502  bool got = false;
503 #ifndef _WIN32_WCE
504  if (state & NET::SkipTaskbar) {
505  got = true;
506  LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
507  SetWindowLongPtr(win, GWL_EXSTYLE, lp | WS_EX_TOOLWINDOW);
508  }
509 #endif
510  if (state & NET::KeepAbove) {
511  got = true;
512  SetWindowPos(win, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
513  }
514  if(state & NET::KeepBelow){
515  got = true;
516  SetWindowPos(win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
517  }
518  if(state & NET::Max){
519  got = true;
520  ShowWindow( win, SW_MAXIMIZE );
521  }
522  if (!got)
523  kDebug() << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented for the state you requested!";
524 }
525 
526 void KWindowSystem::clearState( WId win, unsigned long state )
527 {
528  bool got = false;
529 
530 #ifndef _WIN32_WCE
531  if (state & NET::SkipTaskbar) {
532  got = true;
533  LONG_PTR lp = GetWindowLongPtr(win, GWL_EXSTYLE);
534  SetWindowLongPtr(win, GWL_EXSTYLE, lp & ~WS_EX_TOOLWINDOW);
535  }
536 #endif
537  if (state & NET::KeepAbove) {
538  got = true;
539  //lets hope this remove the topmost
540  SetWindowPos(win, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
541  }
542  if(state & NET::Max){
543  got = true;
544  ShowWindow( win, SW_RESTORE );
545  }
546  if (!got)
547  kDebug() << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
548 }
549 
550 void KWindowSystem::minimizeWindow( WId win, bool animation)
551 {
552  Q_UNUSED( animation );
553  ShowWindow( win, SW_MINIMIZE );
554 }
555 
556 void KWindowSystem::unminimizeWindow( WId win, bool animation )
557 {
558  Q_UNUSED( animation );
559  ShowWindow( win, SW_RESTORE );
560 }
561 
562 void KWindowSystem::raiseWindow( WId win )
563 {
564 
565  //to bring a window to the front while the user is active in a different apllication we
566  //have to atach our self to the current active window
567  HWND hwndActiveWin = GetForegroundWindow();
568  int idActive = GetWindowThreadProcessId(hwndActiveWin, NULL);
569  if ( AttachThreadInput(GetCurrentThreadId(), idActive, TRUE) )
570  {
571  SetForegroundWindow( win );
572  AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
573  }
574 }
575 
576 void KWindowSystem::lowerWindow( WId win )
577 {
578  SetWindowPos( win, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE ); // mhhh?
579 }
580 
581 bool KWindowSystem::compositingActive()
582 {
583  return true;
584 }
585 
586 QRect KWindowSystem::workArea( int desktop )
587 {
588  return s_deskWidget->availableGeometry( desktop );
589 }
590 
591 QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop )
592 {
593  //TODO
594  kDebug() << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop ) isn't yet implemented!";
595  return QRect();
596 }
597 
598 QString KWindowSystem::desktopName( int desktop )
599 {
600  return i18n("Desktop %1", desktop );
601 }
602 
603 void KWindowSystem::setDesktopName( int desktop, const QString& name )
604 {
605  kDebug() << "KWindowSystem::setDesktopName( int desktop, const QString& name ) isn't yet implemented!";
606  //TODO
607 }
608 
609 bool KWindowSystem::showingDesktop()
610 {
611  return false;
612 }
613 
614 void KWindowSystem::setUserTime( WId win, long time )
615 {
616  kDebug() << "KWindowSystem::setUserTime( WId win, long time ) isn't yet implemented!";
617  //TODO
618 }
619 
620 bool KWindowSystem::icccmCompliantMappingState()
621 {
622  return false;
623 }
624 
625 // optimalization - create KWindowSystemPrivate only when needed and only for what is needed
626 void KWindowSystem::connectNotify( const char* signal )
627 {
628  int what = INFO_BASIC;
629  if( QLatin1String( signal ) == SIGNAL(workAreaChanged()))
630  what = INFO_WINDOWS;
631  else if( QLatin1String( signal ) == SIGNAL(strutChanged()))
632  what = INFO_WINDOWS;
633  else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,const ulong*))).constData())
634  what = INFO_WINDOWS;
635  else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId,uint))).constData())
636  what = INFO_WINDOWS;
637  else if( QLatin1String( signal ) == QMetaObject::normalizedSignature(SIGNAL(windowChanged(WId))).constData())
638  what = INFO_WINDOWS;
639 
640  init( what );
641  QObject::connectNotify( signal );
642 }
643 
644 void KWindowSystem::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
645  int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
646  int bottom_width, int bottom_start, int bottom_end )
647 {
648  kDebug() << "KWindowSystem::setExtendedStrut isn't yet implemented!";
649  //TODO
650 }
651 void KWindowSystem::setStrut( WId win, int left, int right, int top, int bottom )
652 {
653  kDebug() << "KWindowSystem::setStrut isn't yet implemented!";
654  //TODO
655 }
656 
657 QString KWindowSystem::readNameProperty( WId window, unsigned long atom )
658 {
659  //TODO
660  kDebug() << "QString KWindowSystem::readNameProperty( WId window, unsigned long atom ) isn't yet implemented!";
661  return QString();
662 }
663 
664 void KWindowSystem::doNotManage( const QString& title )
665 {
666  //TODO
667  kDebug() << "KWindowSystem::doNotManage( const QString& title ) isn't yet implemented!";
668 }
669 
670 QList<WId> KWindowSystem::stackingOrder()
671 {
672  KWindowSystem::init(INFO_WINDOWS);
673  return KWindowSystem::s_d_func()->stackingOrder;
674 }
675 
676 const QList<WId>& KWindowSystem::windows()
677 {
678  KWindowSystem::init(INFO_WINDOWS);
679  return KWindowSystem::s_d_func()->stackingOrder;
680 }
681 
682 void KWindowSystem::setType( WId win, NET::WindowType windowType )
683 {
684  //TODO
685  kDebug() << "setType( WId win, NET::WindowType windowType ) isn't yet implemented!";
686 }
687 
688 KWindowInfo KWindowSystem::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
689 {
690  KWindowSystem::init(INFO_WINDOWS);
691  return KWindowInfo( win, properties, properties2 );
692 }
693 
694 bool KWindowSystem::hasWId(WId w)
695 {
696  KWindowSystem::init(INFO_WINDOWS);
697  return KWindowSystem::s_d_func()->winInfos.contains(w);
698 }
699 
700 void KWindowSystem::allowExternalProcessWindowActivation( int pid )
701 {
702 #ifndef _WIN32_WCE
703  AllowSetForegroundWindow( pid == -1 ? ASFW_ANY : pid );
704 #endif
705 }
706 
707 void KWindowSystem::setBlockingCompositing( WId window, bool active )
708 {
709  //TODO
710  kDebug() << "setBlockingCompositing( WId window, bool active ) isn't yet implemented!";
711 }
712 
713 #include "kwindowsystem.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Sep 23 2014 09:57:49 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs-4.11.5 API Reference

Skip menu "kdelibs-4.11.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal