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

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
showdesktop.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
3  * Copyright (c) 2005 Ryan Nickell <p0z3r@earthlink.net>
4  *
5  * This file is part of SuperKaramba.
6  *
7  * SuperKaramba is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * SuperKaramba is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with SuperKaramba; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  ****************************************************************************/
21 #include "showdesktop.h"
22 #include "showdesktop.moc"
23 
24 #include "karambaapp.h"
25 
26 #include <KWindowSystem>
27 
28 ShowDesktop* ShowDesktop::self()
29 {
30  static ShowDesktop showDesktop;
31  return &showDesktop;
32 }
33 
34 ShowDesktop::ShowDesktop()
35  : QObject()
36  , showingDesktop(false)
37  , kWinModule(0)
38 {
39  kWinModule = KWindowSystem::self();
40 
41  // on desktop changes or when a window is deiconified, we abort the show desktop mode
42  connect(kWinModule, SIGNAL(currentDesktopChanged(int)),
43  SLOT(slotCurrentDesktopChanged(int)));
44  connect(kWinModule, SIGNAL(windowChanged(WId,uint)),
45  SLOT(slotWindowChanged(WId,uint)));
46 }
47 
48 void ShowDesktop::slotCurrentDesktopChanged(int)
49 {
50  showDesktop(false);
51 }
52 
53 #ifdef KDE_3_3
54 #define NET_ALL_TYPES_MASK (NET::AllTypesMask)
55 #else
56 #define NET_ALL_TYPES_MASK (-1LU)
57 #endif
58 
59 void ShowDesktop::slotWindowChanged(WId w, unsigned int dirty)
60 {
61  if (!showingDesktop)
62  return;
63 
64  // SELI this needs checking for kwin_iii (_NET_SHOWING_DESKTOP)
65  if (dirty & NET::XAWMState) {
66  NETWinInfo inf(QX11Info::display(), w, QX11Info::appRootWindow(),
67  NET::XAWMState | NET::WMWindowType);
68  NET::WindowType windowType = inf.windowType(NET_ALL_TYPES_MASK);
69 
70  if ((windowType == NET::Normal || windowType == NET::Unknown)
71  && inf.mappingState() == NET::Visible) {
72  // a window was deiconified, abort the show desktop mode.
73  iconifiedList.clear();
74  showingDesktop = false;
75  emit desktopShown(false);
76  }
77  }
78 }
79 
80 void ShowDesktop::showDesktop(bool b)
81 {
82  if (b == showingDesktop) return;
83  showingDesktop = b;
84 
85  if (b) {
86  // this code should move to KWindowSystem after supporting NETWM1.2
87  iconifiedList.clear();
88  const QList<WId> windows = kWinModule->windows();
89  foreach(WId w, windows) {
90  NETWinInfo info(QX11Info::display(), w, QX11Info::appRootWindow(),
91  NET::XAWMState | NET::WMDesktop);
92  if (info.mappingState() == NET::Visible &&
93  (info.desktop() == NETWinInfo::OnAllDesktops
94  || info.desktop() == (int) kWinModule->currentDesktop())
95  ) {
96  iconifiedList.append(w);
97  }
98  }
99  // find first, hide later, otherwise transients may get minimized
100  // with the window they're transient for
101  foreach(WId w, iconifiedList) {
102  KWindowSystem::minimizeWindow(w, false);
103  }
104  } else {
105  foreach(WId w, iconifiedList) {
106  KWindowSystem::unminimizeWindow(w, false);
107  }
108  }
109 
110  emit desktopShown(showingDesktop);
111 }
ShowDesktop::self
static ShowDesktop * self()
Definition: showdesktop.cpp:28
NET_ALL_TYPES_MASK
#define NET_ALL_TYPES_MASK
Definition: showdesktop.cpp:56
ShowDesktop::showDesktop
void showDesktop(bool show)
Definition: showdesktop.cpp:80
QObject
ShowDesktop
Singleton class that handles desktop access (minimizing all windows)
Definition: showdesktop.h:34
ShowDesktop::desktopShown
void desktopShown(bool shown)
karambaapp.h
showdesktop.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

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