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

Skip menu "kdelibs-4.14.38 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