ReactOS 0.4.15-dev-7906-g1b85a5f
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
 

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.

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}
_Rep_type::iterator iterator
Definition: _set.h:73
GLuint GLuint end
Definition: gl.h:1545
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
#define SW_SHOW
Definition: winuser.h:775
static clock_t begin
Definition: xmllint.c:458

Member Function Documentation

◆ init()

void Desktops::init ( )

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 FALSE
Definition: types.h:117
#define DESKTOP_COUNT
Definition: globals.h:238
HDESK WINAPI OpenInputDesktop(_In_ DWORD, _In_ BOOL, _In_ DWORD)
#define DESKTOP_SWITCHDESKTOP
Definition: winuser.h:223

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
183 old_desktop._hwndForeground = (HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_LAST_ACTIVE, 0, 0);
184
185 // hide all windows of the previous desktop
186 for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it)
188
189 // show all windows of the new desktop
190 for(WindowSet::iterator it=desktop._windows.begin(); it!=desktop._windows.end(); ++it)
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}
Definition: _set.h:50
iterator end()
Definition: _set.h:152
iterator begin()
Definition: _set.h:151
pair< iterator, bool > insert(const value_type &__x)
Definition: _set.h:168
_Rep_type::const_iterator const_iterator
Definition: _set.h:74
unsigned int idx
Definition: utils.c:41
HANDLE HWND
Definition: compat.h:19
static BOOL CALLBACK SwitchDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:152
struct ExplorerGlobals g_Globals
static struct testwindow_info windows[3]
Definition: appbar.c:46
set< HWND > _windows
Definition: globals.h:229
WindowHandle _hwndForeground
Definition: globals.h:230
#define PM_GET_LAST_ACTIVE
Definition: taskbar.h:46
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define SendMessage
Definition: winuser.h:5843

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}
Definition: list.h:37
reverse_iterator rend()
Definition: _list.h:376
reverse_iterator rbegin()
Definition: _list.h:373
void clear()
Definition: _list.h:352
bool empty() const
Definition: _list.h:177
static BOOL CALLBACK MinimizeDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:209
#define WS_MAXIMIZE
Definition: pedump.c:623
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define SW_RESTORE
Definition: winuser.h:779
#define SW_MAXIMIZE
Definition: winuser.h:772

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: