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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • windowmanagement
kwindowsystem_mac.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) 2008 Marijn Kruisselbrink (m.kruisselbrink@student.tue.nl)
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 #include "kwindowinfo_mac_p.h"
24 
25 #include <kiconloader.h>
26 #include <klocale.h>
27 #include <kxerrorhandler.h>
28 #include <QtGui/QBitmap>
29 #include <QDesktopWidget>
30 #include <QtGui/QDialog>
31 #include <QtDBus/QtDBus>
32 #include <kdebug.h>
33 
34 #include <Carbon/Carbon.h>
35 
36 // Uncomment the following line to enable the experimental (and not fully functional) window tracking code. Without this
37 // only the processes/applications are tracked, not the individual windows. This currently is quite broken as I can't
38 // seem to be able to convince the build system to generate a mov file from both the public header file, and also for this
39 // private class
40 // #define EXPERIMENTAL_WINDOW_TRACKING
41 
42 static bool operator<(const ProcessSerialNumber& a, const ProcessSerialNumber& b)
43 {
44  if (a.lowLongOfPSN != b.lowLongOfPSN) return a.lowLongOfPSN < b.lowLongOfPSN;
45  return a.highLongOfPSN < b.highLongOfPSN;
46 }
47 
48 class KWindowSystemPrivate : QObject
49 {
50 #ifdef EXPERIMENTAL_WINDOW_TRACKING
51  Q_OBJECT
52 #endif
53 public:
54  KWindowSystemPrivate();
55 
56  QMap<WId, KWindowInfo> windows;
57  QList<WId> winids; // bah, because KWindowSystem::windows() returns a const reference, we need to keep this separate...
58  QMap<pid_t, AXObserverRef> newWindowObservers;
59  QMap<pid_t, AXObserverRef> windowClosedObservers;
60  QMap<ProcessSerialNumber, WId> processes;
61 #ifdef EXPERIMENTAL_WINDOW_TRACKING
62  QList<KWindowInfo> nonProcessedWindows;
63 #endif
64 
65  EventTargetRef m_eventTarget;
66  EventHandlerUPP m_eventHandler;
67  EventTypeSpec m_eventType[2];
68  EventHandlerRef m_curHandler;
69 
70  void applicationLaunched(const ProcessSerialNumber& psn);
71  void applicationTerminated(const ProcessSerialNumber& psn);
72 
73  bool m_noEmit;
74  bool waitingForTimer;
75 
76 #ifdef EXPERIMENTAL_WINDOW_TRACKING
77  void newWindow(AXUIElementRef element, void* windowInfoPrivate);
78  void windowClosed(AXUIElementRef element, void* windowInfoPrivate);
79 #endif
80 
81  static KWindowSystemPrivate* self() { return KWindowSystem::s_d_func(); }
82 #ifdef EXPERIMENTAL_WINDOW_TRACKING
83 public slots:
84  void tryRegisterProcess();
85 #endif
86 };
87 
88 class KWindowSystemStaticContainer {
89 public:
90  KWindowSystemStaticContainer() : d (new KWindowSystemPrivate) { }
91  KWindowSystem kwm;
92  KWindowSystemPrivate* d;
93 };
94 
95 K_GLOBAL_STATIC(KWindowSystemStaticContainer, g_kwmInstanceContainer)
96 
97 static OSStatus applicationEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void * inUserData)
98 {
99  KWindowSystemPrivate* d = (KWindowSystemPrivate*) inUserData;
100 
101  UInt32 kind;
102 
103  kind = GetEventKind(inEvent);
104  ProcessSerialNumber psn;
105  if (GetEventParameter(inEvent, kEventParamProcessID, typeProcessSerialNumber, NULL, sizeof psn, NULL, &psn) != noErr) {
106  kWarning() << "Error getting event parameter in application event";
107  return eventNotHandledErr;
108  }
109 
110  if (kind == kEventAppLaunched) {
111  d->applicationLaunched(psn);
112  } else if (kind == kEventAppTerminated) {
113  d->applicationTerminated(psn);
114  }
115 
116  return noErr;
117 }
118 
119 #ifdef EXPERIMENTAL_WINDOW_TRACKING
120 static void windowClosedObserver(AXObserverRef observer, AXUIElementRef element, CFStringRef notification, void* refcon)
121 {
122  KWindowSystemPrivate::self()->windowClosed(element, refcon);
123 }
124 
125 static void newWindowObserver(AXObserverRef observer, AXUIElementRef element, CFStringRef notification, void* refcon)
126 {
127  KWindowSystemPrivate::self()->newWindow(element, refcon);
128 }
129 #endif
130 
131 KWindowSystemPrivate::KWindowSystemPrivate()
132  : QObject(0), m_noEmit(true), waitingForTimer(false)
133 {
134  // find all existing windows
135  ProcessSerialNumber psn = {0, kNoProcess};
136  while (GetNextProcess(&psn) == noErr) {
137  kDebug(240) << "calling appLaunched for " << psn.lowLongOfPSN << ":" << psn.highLongOfPSN;
138  applicationLaunched(psn);
139  }
140 
141  m_noEmit = false;
142 
143 #ifdef Q_OS_MAC32
144  // register callbacks for application launches/quits
145  m_eventTarget = GetApplicationEventTarget();
146  m_eventHandler = NewEventHandlerUPP(applicationEventHandler);
147  m_eventType[0].eventClass = kEventClassApplication;
148  m_eventType[0].eventKind = kEventAppLaunched;
149  m_eventType[1].eventClass = kEventClassApplication;
150  m_eventType[1].eventKind = kEventAppTerminated;
151  if (InstallEventHandler(m_eventTarget, m_eventHandler, 2, m_eventType, this, &m_curHandler) != noErr) {
152  kDebug(240) << "Installing event handler failed!\n";
153  }
154 #else
155 #warning port me to Mac64
156 #endif
157 }
158 
159 void KWindowSystemPrivate::applicationLaunched(const ProcessSerialNumber& psn) {
160 #ifdef Q_OS_MAC32
161  kDebug(240) << "new app: " << psn.lowLongOfPSN << ":" << psn.highLongOfPSN;
162  ProcessInfoRec pinfo;
163  FSSpec appSpec;
164  pinfo.processInfoLength = sizeof pinfo;
165  pinfo.processName = 0;
166  pinfo.processAppSpec = &appSpec;
167  GetProcessInformation(&psn, &pinfo);
168  if ((pinfo.processMode & modeOnlyBackground) != 0) return;
169  // found a process, create a pseudo-window for it
170 
171  KWindowInfo winfo(0, 0);
172  windows[winfo.win()] = winfo;
173  winids.append(winfo.win());
174  winfo.d->setProcessSerialNumber(psn);
175  pid_t pid = winfo.d->pid();
176  processes[psn] = winfo.win();
177  kDebug(240) << " pid:" << pid;
178  AXUIElementRef app = AXUIElementCreateApplication(pid);
179  winfo.d->setAxElement(app);
180  if (!m_noEmit) emit KWindowSystem::self()->windowAdded(winfo.win());
181 
182 #ifdef EXPERIMENTAL_WINDOW_TRACKING
183  // create an observer and listen for new window events
184  AXObserverRef observer, newObserver;
185  OSStatus err;
186  if (AXObserverCreate(pid, windowClosedObserver, &observer) == noErr) {
187  CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(observer), kCFRunLoopCommonModes);
188  windowClosedObservers[pid] = observer;
189  }
190  if ((err = AXObserverCreate(pid, newWindowObserver, &newObserver)) == noErr) {
191  CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(newObserver), kCFRunLoopCommonModes);
192  newWindowObservers[pid] = newObserver;
193  if ((err = AXObserverAddNotification(newObserver, app, kAXWindowCreatedNotification, winfo.d)) != noErr) {
194  kDebug(240) << "Error " << err << " adding notification to observer";
195  // adding notifier failed, apparently app isn't responding to accesability messages yet
196  // try it one more time later, and for now just return
197  QTimer::singleShot(500, this, SLOT(tryRegisterProcess()));
198  nonProcessedWindows.append(winfo);
199  return;
200  } else
201  kDebug(240) << "Added notification and observer";
202  } else {
203  kDebug(240) << "Error creating observer";
204  }
205 
206 
207  CFIndex windowsInApp;
208  AXUIElementGetAttributeValueCount(app, kAXWindowsAttribute, &windowsInApp);
209  CFArrayRef array;
210  AXUIElementCopyAttributeValue(app, kAXWindowsAttribute, (CFTypeRef*)&array);
211  for (CFIndex j = 0; j < windowsInApp; j++) {
212  AXUIElementRef win = (AXUIElementRef) CFArrayGetValueAtIndex(array, j);
213  newWindow(win, winfo.d);
214  }
215 #endif
216 #else
217 #warning Port me to Mac64
218 #endif
219 }
220 
221 #ifdef EXPERIMENTAL_WINDOW_TRACKING
222 void KWindowSystemPrivate::tryRegisterProcess()
223 {
224  kDebug(240) << "Single-shot timer, trying to register processes";
225  while (!nonProcessedWindows.empty()) {
226  KWindowInfo winfo = nonProcessedWindows.takeLast();
227  pid_t pid = winfo.d->pid();
228  AXUIElementRef app = winfo.d->axElement();
229  ProcessSerialNumber psn = winfo.d->psn();
230 
231  // create an observer and listen for new window events
232  AXObserverRef observer;
233  OSStatus err;
234  observer = newWindowObservers[pid];
235  if ((err = AXObserverAddNotification(observer, app, kAXWindowCreatedNotification, winfo.d)) != noErr) {
236  kDebug(240) << "Error " << err << " adding notification to observer";
237  } else
238  kDebug(240) << "Added notification and observer";
239 
240  observer = windowClosedObservers[pid];
241 
242  CFIndex windowsInApp;
243  AXUIElementGetAttributeValueCount(app, kAXWindowsAttribute, &windowsInApp);
244  CFArrayRef array;
245  AXUIElementCopyAttributeValue(app, kAXWindowsAttribute, (CFTypeRef*)&array);
246  for (CFIndex j = 0; j < windowsInApp; j++) {
247  AXUIElementRef win = (AXUIElementRef) CFArrayGetValueAtIndex(array, j);
248  newWindow(win, winfo.d);
249  }
250  }
251 }
252 #endif
253 
254 void KWindowSystemPrivate::applicationTerminated(const ProcessSerialNumber& psn)
255 {
256  kDebug(240) << "Terminated PSN: " << psn.lowLongOfPSN << ":" << psn.highLongOfPSN;
257  WId id = processes[psn];
258  if (windows.contains(id)) {
259  KWindowInfo winfo = windows[id];
260  foreach (KWindowInfo::Private* wi, winfo.d->children) {
261  winids.removeAll(wi->win);
262  emit KWindowSystem::self()->windowRemoved(wi->win);
263  }
264  winids.removeAll(id);
265  emit KWindowSystem::self()->windowRemoved(winfo.win());
266  }
267 }
268 
269 #ifdef EXPERIMENTAL_WINDOW_TRACKING
270 void KWindowSystemPrivate::windowClosed(AXUIElementRef element, void* refcon)
271 {
272  kDebug(240) << "Received window closed notification";
273 
274  KWindowInfo::Private* wind = (KWindowInfo::Private*) refcon; // window being closed
275  KWindowInfo::Private* parent = wind->parent;
276  parent->children.removeAll(wind);
277  winids.removeAll(wind->win);
278  if (!m_noEmit) emit KWindowSystem::self()->windowRemoved(wind->win);
279 }
280 
281 void KWindowSystemPrivate::newWindow(AXUIElementRef win, void* refcon)
282 {
283  kDebug(240) << "Received new window notification";
284 
285  KWindowInfo::Private* winfod = (KWindowInfo::Private*) refcon;
286  pid_t pid = winfod->pid();
287  ProcessSerialNumber psn = winfod->psn();
288  AXObserverRef observer = windowClosedObservers[pid];
289 
290  KWindowInfo win2(0, 0);
291  // listen for closed events for this window
292  if (AXObserverAddNotification(observer, win, kAXUIElementDestroyedNotification, win2.d) != noErr) {
293  // when we can't receive close events, the window should not be added
294  kDebug(240) "error adding closed observer to window.";
295  return;
296  }
297 
298  windows[win2.win()] = win2;
299  winids.append(win2.win());
300  win2.d->setProcessSerialNumber(psn);
301  win2.d->setAxElement(win);
302  winfod->children.append(win2.d);
303  win2.d->parent = winfod;
304  if (!m_noEmit) emit KWindowSystem::self()->windowAdded(win2.win());
305 }
306 #endif
307 
308 KWindowSystem* KWindowSystem::self()
309 {
310  return &(g_kwmInstanceContainer->kwm);
311 }
312 
313 KWindowSystemPrivate* KWindowSystem::s_d_func()
314 {
315  return g_kwmInstanceContainer->d;
316 }
317 
318 const QList<WId>& KWindowSystem::windows()
319 {
320  KWindowSystemPrivate *d = KWindowSystem::s_d_func();
321  return d->winids;
322 }
323 
324 bool KWindowSystem::hasWId(WId id)
325 {
326  KWindowSystemPrivate *d = KWindowSystem::s_d_func();
327  return d->windows.contains(id);
328 }
329 
330 KWindowInfo KWindowSystem::windowInfo( WId win, unsigned long properties, unsigned long properties2 )
331 {
332  KWindowSystemPrivate *d = KWindowSystem::s_d_func();
333  if (d->windows.contains(win)) {
334  return d->windows[win];
335  } else {
336  return KWindowInfo( win, properties, properties2 );
337  }
338 }
339 
340 QList<WId> KWindowSystem::stackingOrder()
341 {
342  //TODO
343  QList<WId> lst;
344  kDebug(240) << "QList<WId> KWindowSystem::stackingOrder() isn't yet implemented!";
345  return lst;
346 }
347 
348 WId KWindowSystem::activeWindow()
349 {
350  //return something
351  kDebug(240) << "WId KWindowSystem::activeWindow() isn't yet implemented!";
352  return 0;
353 }
354 
355 void KWindowSystem::activateWindow( WId win, long time )
356 {
357  //TODO
358  kDebug(240) << "KWindowSystem::activateWindow( WId win, long time )isn't yet implemented!";
359  KWindowSystemPrivate *d = KWindowSystem::s_d_func();
360  if (d->windows.contains(win)) {
361  ProcessSerialNumber psn = d->windows[win].d->psn();
362  SetFrontProcess(&psn);
363  }
364 }
365 
366 void KWindowSystem::forceActiveWindow( WId win, long time )
367 {
368  //TODO
369  kDebug(240) << "KWindowSystem::forceActiveWindow( WId win, long time ) isn't yet implemented!";
370  activateWindow(win, time);
371 }
372 
373 void KWindowSystem::demandAttention( WId win, bool set )
374 {
375  //TODO
376  kDebug(240) << "KWindowSystem::demandAttention( WId win, bool set ) isn't yet implemented!";
377 }
378 
379 bool KWindowSystem::compositingActive()
380 {
381  return true;
382 }
383 
384 int KWindowSystem::currentDesktop()
385 {
386  return 1;
387 }
388 
389 int KWindowSystem::numberOfDesktops()
390 {
391  return 1;
392 }
393 
394 void KWindowSystem::setCurrentDesktop( int desktop )
395 {
396  kDebug(240) << "KWindowSystem::setCurrentDesktop( int desktop ) isn't yet implemented!";
397  //TODO
398 }
399 
400 void KWindowSystem::setOnAllDesktops( WId win, bool b )
401 {
402  kDebug(240) << "KWindowSystem::setOnAllDesktops( WId win, bool b ) isn't yet implemented!";
403  //TODO
404 }
405 
406 void KWindowSystem::setOnDesktop( WId win, int desktop )
407 {
408  //TODO
409  kDebug(240) << "KWindowSystem::setOnDesktop( WId win, int desktop ) isn't yet implemented!";
410 }
411 
412 void KWindowSystem::setMainWindow( QWidget* subwindow, WId id )
413 {
414  kDebug(240) << "KWindowSystem::setMainWindow( QWidget*, WId ) isn't yet implemented!";
415  //TODO
416 }
417 
418 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale )
419 {
420  if (hasWId(win)) {
421  KWindowInfo info = windowInfo(win, 0);
422  if (!info.d->loadedData) {
423  info.d->updateData();
424  }
425  IconRef icon;
426  SInt16 label;
427 #ifdef Q_OS_MAC32
428  OSErr err = GetIconRefFromFile(&info.d->iconSpec, &icon, &label);
429 #else
430  OSStatus err = GetIconRefFromFileInfo(&info.d->iconSpec, 0, 0,
431  kIconServicesCatalogInfoMask, 0, kIconServicesNormalUsageFlag, &icon, &label);
432 #endif
433  if (err != noErr) {
434  kDebug(240) << "Error getting icon from application";
435  return QPixmap();
436  } else {
437  QPixmap ret(width, height);
438  ret.fill(QColor(0, 0, 0, 0));
439 
440  CGRect rect = CGRectMake(0, 0, width, height);
441 
442  CGContextRef ctx = qt_mac_cg_context(&ret);
443  CGAffineTransform old_xform = CGContextGetCTM(ctx);
444  CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
445  CGContextConcatCTM(ctx, CGAffineTransformIdentity);
446 
447  ::RGBColor b;
448  b.blue = b.green = b.red = 255*255;
449  PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
450  CGContextRelease(ctx);
451 
452  ReleaseIconRef(icon);
453  return ret;
454  }
455  } else {
456  kDebug(240) << "QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale ) isn't yet implemented for local windows!";
457  return QPixmap();
458  }
459 }
460 
461 QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int flags )
462 {
463  return icon(win, width, height, scale);
464 // kDebug(240) << "QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int flags ) isn't yet implemented!";
465 }
466 
467 void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon )
468 {
469  //TODO
470  kDebug(240) << "KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniIcon ) isn't yet implemented!";
471 }
472 
473 void KWindowSystem::setType( WId winid, NET::WindowType windowType )
474 {
475 #ifdef Q_OS_MAC32
476  // not supported for 'global' windows; only for windows in the current process
477  if (hasWId(winid)) return;
478 
479  static WindowGroupRef desktopGroup = 0;
480  static WindowGroupRef dockGroup = 0;
481 
482  WindowRef win = HIViewGetWindow( (HIViewRef) winid );
483  //TODO: implement other types than Desktop and Dock
484  if (windowType != NET::Desktop && windowType != NET::Dock) {
485  kDebug(240) << "setType( WId win, NET::WindowType windowType ) isn't yet implemented for the type you requested!";
486  }
487  if (windowType == NET::Desktop) {
488  if (!desktopGroup) {
489  CreateWindowGroup(0, &desktopGroup);
490  SetWindowGroupLevel(desktopGroup, kCGDesktopIconWindowLevel);
491  }
492  SetWindowGroup(win, desktopGroup);
493  } else if (windowType == NET::Dock) {
494  if (!dockGroup) {
495  CreateWindowGroup(0, &dockGroup);
496  SetWindowGroupLevel(dockGroup, kCGDockWindowLevel);
497  }
498  SetWindowGroup(win, dockGroup);
499  ChangeWindowAttributes(win, kWindowNoTitleBarAttribute, kWindowNoAttributes);
500  }
501 #else
502 #warning port me to Mac64
503 #endif
504 }
505 
506 void KWindowSystem::setState( WId win, unsigned long state )
507 {
508  //TODO
509  kDebug(240) << "KWindowSystem::setState( WId win, unsigned long state ) isn't yet implemented!";
510 }
511 
512 void KWindowSystem::clearState( WId win, unsigned long state )
513 {
514  //TODO
515  kDebug(240) << "KWindowSystem::clearState( WId win, unsigned long state ) isn't yet implemented!";
516 }
517 
518 void KWindowSystem::minimizeWindow( WId win, bool animation)
519 {
520  //TODO
521  kDebug(240) << "KWindowSystem::minimizeWindow( WId win, bool animation) isn't yet implemented!";
522 }
523 
524 void KWindowSystem::unminimizeWindow( WId win, bool animation )
525 {
526  //TODO
527  kDebug(240) << "KWindowSystem::unminimizeWindow( WId win, bool animation ) isn't yet implemented!";
528 }
529 
530 void KWindowSystem::raiseWindow( WId win )
531 {
532  //TODO
533  kDebug(240) << "KWindowSystem::raiseWindow( WId win ) isn't yet implemented!";
534 }
535 
536 void KWindowSystem::lowerWindow( WId win )
537 {
538  //TODO
539  kDebug(240) << "KWindowSystem::lowerWindow( WId win ) isn't yet implemented!";
540 }
541 
542 bool KWindowSystem::icccmCompliantMappingState()
543 {
544  return false;
545 }
546 
547 QRect KWindowSystem::workArea( int desktop )
548 {
549  //TODO
550  kDebug(240) << "QRect KWindowSystem::workArea( int desktop ) isn't yet implemented!";
551  return QRect();
552 }
553 
554 QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop )
555 {
556  //TODO
557  kDebug(240) << "QRect KWindowSystem::workArea( const QList<WId>& exclude, int desktop ) isn't yet implemented!";
558  return QRect();
559 }
560 
561 QString KWindowSystem::desktopName( int desktop )
562 {
563  return i18n("Desktop %1", desktop );
564 }
565 
566 void KWindowSystem::setDesktopName( int desktop, const QString& name )
567 {
568  kDebug(240) << "KWindowSystem::setDesktopName( int desktop, const QString& name ) isn't yet implemented!";
569  //TODO
570 }
571 
572 bool KWindowSystem::showingDesktop()
573 {
574  return false;
575 }
576 
577 void KWindowSystem::setUserTime( WId win, long time )
578 {
579  kDebug(240) << "KWindowSystem::setUserTime( WId win, long time ) isn't yet implemented!";
580  //TODO
581 }
582 
583 void KWindowSystem::setExtendedStrut( WId win, int left_width, int left_start, int left_end,
584  int right_width, int right_start, int right_end, int top_width, int top_start, int top_end,
585  int bottom_width, int bottom_start, int bottom_end )
586 {
587  kDebug(240) << "KWindowSystem::setExtendedStrut isn't yet implemented!";
588  //TODO
589 }
590 
591 void KWindowSystem::setStrut( WId win, int left, int right, int top, int bottom )
592 {
593  kDebug(240) << "KWindowSystem::setStrut isn't yet implemented!";
594  //TODO
595 }
596 
597 bool KWindowSystem::allowedActionsSupported()
598 {
599  return false;
600 }
601 
602 QString KWindowSystem::readNameProperty( WId window, unsigned long atom )
603 {
604  //TODO
605  kDebug(240) << "QString KWindowSystem::readNameProperty( WId window, unsigned long atom ) isn't yet implemented!";
606  return QString();
607 }
608 
609 void KWindowSystem::doNotManage( const QString& title )
610 {
611  //TODO
612  kDebug(240) << "KWindowSystem::doNotManage( const QString& title ) isn't yet implemented!";
613 }
614 
615 
616 void KWindowSystem::connectNotify( const char* signal )
617 {
618  kDebug(240) << "connectNotify( const char* signal ) isn't yet implemented!";
619  //TODO
620 }
621 
622 void KWindowSystem::allowExternalProcessWindowActivation( int pid )
623 {
624  // Needed on mac ?
625 }
626 
627 void KWindowSystem::setBlockingCompositing( WId window, bool active )
628 {
629  //TODO
630  kDebug() << "setBlockingCompositing( WId window, bool active ) isn't yet implemented!";
631 }
632 
633 #include "moc_kwindowsystem.cpp"
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
i18n
QString i18n(const char *text)
QWidget
KWindowSystem::lowerWindow
static void lowerWindow(WId win)
Lowers the given window.
Definition: kwindowsystem_mac.cpp:536
KWindowSystem::KWindowSystemPrivate
friend class KWindowSystemPrivate
Definition: kwindowsystem.h:651
kdebug.h
QPixmap::fill
void fill(const QColor &color)
KWindowSystem::desktopName
static QString desktopName(int desktop)
Returns the name of the specified desktop.
Definition: kwindowsystem_mac.cpp:561
KWindowSystem
Convenience access to certain properties and features of the window manager.
Definition: kwindowsystem.h:55
KWindowSystem::setOnDesktop
static void setOnDesktop(WId win, int desktop)
Moves window win to desktop desktop.
Definition: kwindowsystem_mac.cpp:406
KStandardShortcut::label
QString label(StandardShortcut id)
Returns a localized label for user-visible display.
Definition: kstandardshortcut.cpp:267
K_GLOBAL_STATIC
#define K_GLOBAL_STATIC(TYPE, NAME)
QMap< WId, KWindowInfo >
KWindowSystem::windowInfo
static KWindowInfo windowInfo(WId win, unsigned long properties, unsigned long properties2=0)
Returns information about window win.
Definition: kwindowsystem_mac.cpp:330
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KWindowInfo
Information about a window.
Definition: kwindowinfo.h:35
kiconloader.h
KWindowSystem::setUserTime
static void setUserTime(WId win, long time)
Sets user timestamp time on window win.
Definition: kwindowsystem_mac.cpp:577
KWindowSystem::raiseWindow
static void raiseWindow(WId win)
Raises the given window.
Definition: kwindowsystem_mac.cpp:530
KWindowSystem::forceActiveWindow
static void forceActiveWindow(WId win, long time=0)
Sets window win to be the active window.
Definition: kwindowsystem_mac.cpp:366
KWindowSystem::clearState
static void clearState(WId win, unsigned long state)
Clears the state of window win from state.
Definition: kwindowsystem_mac.cpp:512
KWindowSystem::setType
static void setType(WId win, NET::WindowType windowType)
Sets the type of window win to windowType.
Definition: kwindowsystem_mac.cpp:473
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
klocale.h
KWindowSystem::connectNotify
virtual void connectNotify(const char *signal)
Definition: kwindowsystem_mac.cpp:616
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::activateWindow
static void activateWindow(WId win, long time=0)
Requests that window win is activated.
Definition: kwindowsystem_mac.cpp:355
QRect
KWindowSystem::currentDesktop
static int currentDesktop()
Returns the current virtual desktop.
Definition: kwindowsystem_mac.cpp:384
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::activeWindow
static WId activeWindow()
Returns the currently active window, or 0 if no window is active.
Definition: kwindowsystem_mac.cpp:348
KWindowSystem::minimizeWindow
static void minimizeWindow(WId win, bool animation=true)
Iconifies a window.
Definition: kwindowsystem_mac.cpp:518
NET::Desktop
indicates a desktop feature.
Definition: netwm_def.h:320
NET::WindowType
WindowType
Window type.
Definition: netwm_def.h:305
KWindowSystem::icccmCompliantMappingState
static bool icccmCompliantMappingState()
Definition: kwindowsystem_mac.cpp:542
QObject
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::windowAdded
void windowAdded(WId id)
A window has been added.
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
operator<
static bool operator<(const ProcessSerialNumber &a, const ProcessSerialNumber &b)
Definition: kwindowsystem_mac.cpp:42
QString
QList< WId >
QColor
KWindowSystem::unminimizeWindow
static void unminimizeWindow(WId win, bool animation=true)
DeIconifies a window.
Definition: kwindowsystem_mac.cpp:524
kxerrorhandler.h
KWindowSystem::setCurrentDesktop
static void setCurrentDesktop(int desktop)
Convenience function to set the current desktop to desktop.
Definition: kwindowsystem_mac.cpp:394
QPixmap
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::setState
static void setState(WId win, unsigned long state)
Sets the state of window win to state.
Definition: kwindowsystem_mac.cpp:506
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::windowRemoved
void windowRemoved(WId id)
A window has been removed.
KWindowSystem::self
static KWindowSystem * self()
Access to the singleton instance.
Definition: kwindowsystem_mac.cpp:308
KWindowSystem::setMainWindow
static void setMainWindow(QWidget *subwindow, WId mainwindow)
Sets the parent window of subwindow to be mainwindow.
Definition: kwindowsystem_mac.cpp:412
KWindowSystem::allowExternalProcessWindowActivation
static void allowExternalProcessWindowActivation(int pid=-1)
Allows a window from another process to raise and activate itself.
Definition: kwindowsystem_mac.cpp:622
KWindowInfo::win
WId win() const
Returns the window identifier.
Definition: kwindowinfo_mac.cpp:170
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::hasWId
static bool hasWId(WId id)
Test to see if id still managed at present.
Definition: kwindowsystem_mac.cpp:324
KWindowSystem::showingDesktop
static bool showingDesktop()
Returns the state of showing the desktop.
Definition: kwindowsystem_mac.cpp:572
NET::Dock
indicates a dock or panel feature
Definition: netwm_def.h:324
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::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::numberOfDesktops
static int numberOfDesktops()
Returns the number of virtual desktops.
Definition: kwindowsystem_mac.cpp:389
KStandardGuiItem::properties
KGuiItem properties()
Returns the 'Properties' gui item.
Definition: kstandardguiitem.cpp:299
KWindowSystem::allowedActionsSupported
static bool allowedActionsSupported()
Returns true if the WM announces which actions it allows for windows.
Definition: kwindowsystem_mac.cpp:597
KWindowSystem::compositingActive
static bool compositingActive()
Returns true if a compositing manager is running (i.e.
Definition: kwindowsystem_mac.cpp:379
applicationEventHandler
static OSStatus applicationEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)
Definition: kwindowsystem_mac.cpp:97
kwindowsystem.h
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
kWarning
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
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::setDesktopName
static void setDesktopName(int desktop, const QString &name)
Sets the name of the specified desktop.
Definition: kwindowsystem_mac.cpp:566
QTimer::singleShot
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 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 API Reference

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

Search



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