ReactOS  0.4.14-dev-57-g333b8f1
Desktops Struct Reference

#include <globals.h>

Inheritance diagram for Desktops:
Collaboration diagram for Desktops:

Public Member Functions

 Desktops ()
 
 ~Desktops ()
 
void init ()
 
void SwitchToDesktop (int idx)
 
void ToggleMinimize ()
 minimize/restore all windows on the desktop More...
 

Public Attributes

int _current_desktop
 

Detailed Description

Definition at line 240 of file globals.h.

Constructor & Destructor Documentation

◆ Desktops()

Desktops::Desktops ( )

Definition at line 64 of file desktop.cpp.

65  : _current_desktop(0)
66 {
67 }
int _current_desktop
Definition: globals.h:253

◆ ~Desktops()

Desktops::~Desktops ( )

Definition at line 69 of file desktop.cpp.

70 {
71  // show all hidden windows
72  for(iterator it_dsk=begin(); it_dsk!=end(); ++it_dsk)
73  for(WindowSet::iterator it=it_dsk->_windows.begin(); it!=it_dsk->_windows.end(); ++it)
75 }
GLuint GLuint end
Definition: gl.h:1545
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
#define SW_SHOW
Definition: winuser.h:769
static clock_t begin
Definition: xmllint.c:466
_Rep_type::iterator iterator
Definition: _set.h:73

Member Function Documentation

◆ init()

void Desktops::init ( void  )

Definition at line 77 of file desktop.cpp.

78 {
79  resize(DESKTOP_COUNT);
80 
81 #ifdef _USE_HDESK
82  DesktopPtr& desktop = (*this)[0];
83 
84  desktop = DesktopPtr(new Desktop(OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP)));
85 #endif
86 }
#define DESKTOP_SWITCHDESKTOP
Definition: winuser.h:223
HDESK WINAPI OpenInputDesktop(_In_ DWORD, _In_ BOOL, _In_ DWORD)
#define DESKTOP_COUNT
Definition: globals.h:238
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256

Referenced by _tWinMain().

◆ SwitchToDesktop()

void Desktops::SwitchToDesktop ( int  idx)

Definition at line 163 of file desktop.cpp.

164 {
165  if (_current_desktop == idx)
166  return;
167 
168  Desktop& old_desktop = (*this)[_current_desktop];
169  WindowSet& windows = old_desktop._windows;
170  Desktop& desktop = (*this)[idx];
171 
172  windows.clear();
173 
174  // collect window handles of all other desktops
175  WindowSet other_wnds;
176  for(const_iterator it1=begin(); it1!=end(); ++it1)
177  for(WindowSet::const_iterator it2=it1->_windows.begin(); it2!=it1->_windows.end(); ++it2)
178  other_wnds.insert(*it2);
179 
180  // save currently visible application windows
182 
184 
185  // hide all windows of the previous desktop
186  for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it)
187  ShowWindowAsync(*it, SW_HIDE);
188 
189  // show all windows of the new desktop
190  for(WindowSet::iterator it=desktop._windows.begin(); it!=desktop._windows.end(); ++it)
191  ShowWindowAsync(*it, SW_SHOW);
192 
193  if (desktop._hwndForeground)
195 
196  // remove the window handles of the other desktops from what we found on the previous desktop
197  for(WindowSet::const_iterator it=other_wnds.begin(); it!=other_wnds.end(); ++it)
198  windows.erase(*it);
199 
200  // We don't need to store the window handles of what's now visible the now current desktop.
201  desktop._windows.clear();
202 
204 }
#define SW_HIDE
Definition: winuser.h:762
GLuint GLuint end
Definition: gl.h:1545
set< HWND > _windows
Definition: globals.h:229
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
int _current_desktop
Definition: globals.h:253
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
#define SW_SHOW
Definition: winuser.h:769
static clock_t begin
Definition: xmllint.c:466
_Rep_type::iterator iterator
Definition: _set.h:73
HWND _hwndDesktopBar
Definition: globals.h:287
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
static HWND
Definition: desktop.cpp:36
static struct testwindow_info windows[3]
Definition: appbar.c:46
WindowHandle _hwndForeground
Definition: globals.h:230
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
iterator begin()
Definition: _set.h:151
#define PM_GET_LAST_ACTIVE
Definition: taskbar.h:46
static BOOL CALLBACK SwitchDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:152
#define SendMessage
Definition: winuser.h:5744
iterator end()
Definition: _set.h:152
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
BOOL WINAPI SetForegroundWindow(_In_ HWND)
Definition: _set.h:46

Referenced by DesktopBar::Command().

◆ ToggleMinimize()

void Desktops::ToggleMinimize ( )

minimize/restore all windows on the desktop

Definition at line 229 of file desktop.cpp.

230 {
231  list<MinimizeStruct>& minimized = (*this)[_current_desktop]._minimized;
232 
233  if (minimized.empty()) {
235  } else {
236  const list<MinimizeStruct>& cminimized = minimized;
238  it!=cminimized.rend(); ++it) {
239  ShowWindowAsync(it->first, it->second&WS_MAXIMIZE? SW_MAXIMIZE: SW_RESTORE);
240  Sleep(20);
241  }
242 
243  minimized.clear();
244  }
245 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define SW_RESTORE
Definition: winuser.h:773
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
int _current_desktop
Definition: globals.h:253
LONG_PTR LPARAM
Definition: windef.h:208
void clear()
Definition: _list.h:352
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
Definition: _list.h:228
reverse_iterator rend()
Definition: _list.h:376
reverse_iterator rbegin()
Definition: _list.h:373
bool empty() const
Definition: _list.h:177
static BOOL CALLBACK MinimizeDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:209
#define SW_MAXIMIZE
Definition: winuser.h:766
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by DesktopBar::Command(), and DesktopBar::ProcessHotKey().

Member Data Documentation

◆ _current_desktop

int Desktops::_current_desktop

Definition at line 253 of file globals.h.

Referenced by QuickLaunchBar::AddShortcuts(), SwitchToDesktop(), and ToggleMinimize().


The documentation for this struct was generated from the following files: