ReactOS 0.4.15-dev-7788-g1ad9096
desktop.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2003, 2004, 2005 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // desktop.cpp
24 //
25 // Martin Fuchs, 09.08.2003
26 //
27
28
29#include <precomp.h>
30
31#include "../taskbar/desktopbar.h"
32#include "../taskbar/taskbar.h" // for PM_GET_LAST_ACTIVE
33
34
37
38
39#ifdef _USE_HDESK
40
41Desktop::Desktop(HDESK hdesktop/*, HWINSTA hwinsta*/)
42 : _hdesktop(hdesktop)
43// _hwinsta(hwinsta)
44{
45}
46
47Desktop::~Desktop()
48{
49 if (_hdesktop)
50 CloseDesktop(_hdesktop);
51
52// if (_hwinsta)
53// CloseWindowStation(_hwinsta);
54
55 if (_pThread.get()) {
56 _pThread->Stop();
57 _pThread.release();
58 }
59}
60
61#endif
62
63
65 : _current_desktop(0)
66{
67}
68
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}
76
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}
87
88#ifdef _USE_HDESK
89
91{
92 if (_current_desktop == idx)
93 return;
94
95 DesktopPtr& desktop = (*this)[idx];
96
97 DesktopThread* pThread = NULL;
98
99 if (desktop.get()) {
100 if (desktop->_hdesktop)
101 if (!SwitchDesktop(desktop->_hdesktop))
102 return;
103 } else {
104 FmtString desktop_name(TEXT("Desktop %d"), idx);
105
106 SECURITY_ATTRIBUTES saAttr = {sizeof(SECURITY_ATTRIBUTES), 0, TRUE};
107/*
108 HWINSTA hwinsta = CreateWindowStation(TEXT("ExplorerWinStation"), 0, GENERIC_ALL, &saAttr);
109
110 if (!SetProcessWindowStation(hwinsta))
111 return;
112*/
113 HDESK hdesktop = CreateDesktop(desktop_name, NULL, NULL, 0, GENERIC_ALL, &saAttr);
114 if (!hdesktop)
115 return;
116
117 desktop = DesktopPtr(new Desktop(hdesktop/*, hwinsta*/));
118
119 pThread = new DesktopThread(*desktop);
120 }
121
123
124 if (pThread) {
125 desktop->_pThread = DesktopThreadPtr(pThread);
126 pThread->Start();
127 }
128}
129
130int DesktopThread::Run()
131{
132 if (!SetThreadDesktop(_desktop._hdesktop))
133 return -1;
134
135 HDESK hDesk_old = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
136
137 if (!SwitchDesktop(_desktop._hdesktop))
138 return -1;
139
140 if (!_desktop._hwndDesktop)
141 _desktop._hwndDesktop = DesktopWindow::Create();
142
143 int ret = Window::MessageLoop();
144
145 SwitchDesktop(hDesk_old);
146
147 return ret;
148}
149
150#else // _USE_HDESK
151
153{
155
158 windows.insert(hwnd);
159
160 return TRUE;
161}
162
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}
205
206#endif // _USE_HDESK
207
208
210{
212
214 if (IsWindowVisible(hwnd) && !IsIconic(hwnd)) {
215 RECT rect;
216
217 if (GetWindowRect(hwnd,&rect))
218 if (rect.right>0 && rect.bottom>0 &&
219 rect.right>rect.left && rect.bottom>rect.top) {
222 }
223 }
224
225 return TRUE;
226}
227
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}
246
247
249{
250 HINSTANCE hUser32 = GetModuleHandle(TEXT("user32"));
251
252 SetShellWindow = (BOOL(WINAPI*)(HWND)) GetProcAddress(hUser32, "SetShellWindow");
253 SetShellWindowEx = (BOOL(WINAPI*)(HWND,HWND)) GetProcAddress(hUser32, "SetShellWindowEx");
254
255 return GetShellWindow() != 0;
256}
257
258
260 : super(hwnd)
261{
262 // set background brush for the short moment of displaying the
263 // background color while moving foreground windows
265
266 _display_version = RegGetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), 1);
267}
268
270{
271 switch(nmsg) {
272 case WM_ERASEBKGND:
274 return TRUE;
275
276 case WM_MBUTTONDBLCLK:
277 /* Imagelist icons are missing if MainFrame::Create() is called directly from here!
278 explorer_show_frame(SW_SHOWNORMAL); */
280 break;
281
283 if (lparam || wparam) {
284 DWORD or_mask = wparam;
285 DWORD reset_mask = LOWORD(lparam);
286 DWORD xor_mask = HIWORD(lparam);
287 _display_version = ((_display_version&~reset_mask) | or_mask) ^ xor_mask;
288 RegSetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), _display_version);
290 InvalidateRect(_hwnd, NULL, TRUE);
291 }
292 return _display_version;
293
294 default:
295 return super::WndProc(nmsg, wparam, lparam);
296 }
297
298 return 0;
299}
300
302{
304
305/* special solid background
306 HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
307 FillRect(hdc, &rect, bkgndBrush);
308 DeleteBrush(bkgndBrush);
309*/
310}
311
312
314 : super(hwnd)
315{
317}
318
320{
321 if (_pShellView)
323}
324
325
327{
328 static IconWindowClass wcDesktop(TEXT("Progman"), IDI_REACTOS, CS_DBLCLKS);
329 /* (disabled because of small ugly temporary artefacts when hiding start menu)
330 wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1); */
331
334
336 WS_EX_TOOLWINDOW, wcDesktop, TEXT("Program Manager"), WS_POPUP|WS_VISIBLE, //|WS_CLIPCHILDREN for SDI frames
337 0, 0, width, height, 0);
338
339 // work around to display desktop bar in Wine
341
342 // work around for Windows NT, Win 98, ...
343 // Without this the desktop has mysteriously only a size of 800x600 pixels.
344 MoveWindow(hwndDesktop, 0, 0, width, height, TRUE);
345
346 return hwndDesktop;
347}
348
349
351{
352 if (super::Init(pcs))
353 return 1;
354
355 HRESULT hr = GetDesktopFolder()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
356/* also possible:
357 SFV_CREATE sfv_create;
358
359 sfv_create.cbSize = sizeof(SFV_CREATE);
360 sfv_create.pshf = GetDesktopFolder();
361 sfv_create.psvOuter = NULL;
362 sfv_create.psfvcb = NULL;
363
364 HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView);
365*/
366 HWND hWndView = 0;
367
368 if (SUCCEEDED(hr)) {
370
371 fs.ViewMode = FVM_ICON;
373
374 ClientRect rect(_hwnd);
375
376 hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView);
377
379
380 if (SUCCEEDED(hr)) {
381 g_Globals._hwndShellView = hWndView;
382
383 // subclass shellview window
384 new DesktopShellView(hWndView, _pShellView);
385
386 _pShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
387
388 /*
389 IShellView2* pShellView2;
390
391 hr = _pShellView->QueryInterface(IID_IShellView2, (void**)&pShellView2);
392
393 SV2CVW2_PARAMS params;
394 params.cbSize = sizeof(SV2CVW2_PARAMS);
395 params.psvPrev = _pShellView;
396 params.pfs = &fs;
397 params.psbOwner = this;
398 params.prcView = &rect;
399 params.pvid = params.pvid;//@@
400
401 hr = pShellView2->CreateViewWindow2(&params);
402 params.pvid;
403 */
404
405 /*
406 IFolderView* pFolderView;
407
408 hr = _pShellView->QueryInterface(IID_IFolderView, (void**)&pFolderView);
409
410 if (SUCCEEDED(hr)) {
411 hr = pFolderView->GetAutoArrange();
412 hr = pFolderView->SetCurrentViewMode(FVM_DETAILS);
413 }
414 */
415 }
416 }
417
418 if (hWndView && SetShellWindowEx)
419 SetShellWindowEx(_hwnd, hWndView);
420 else if (SetShellWindow)
421 SetShellWindow(_hwnd);
422
423 // create the explorer bar
426
427 return 0;
428}
429
430
432{
433 switch(nmsg) {
434 case WM_LBUTTONDBLCLK:
435 case WM_RBUTTONDBLCLK:
436 case WM_MBUTTONDBLCLK:
438 break;
439
440 case WM_DISPLAYCHANGE:
441 MoveWindow(_hwnd, 0, 0, LOWORD(lparam), HIWORD(lparam), TRUE);
444 break;
445
447 return (LRESULT)static_cast<IShellBrowser*>(this);
448
449 case WM_DESTROY:
450
452
453 if (SetShellWindow)
455 break;
456
457 case WM_CLOSE:
459 break;
460
461 case WM_SYSCOMMAND:
462 if (wparam == SC_TASKLIST) {
463 if (_desktopBar)
465 }
466 goto def;
467
469 // redraw background window - it's done by system
470 //InvalidateRect(g_Globals._hwndShellView, NULL, TRUE);
471
472 // forward message to common controls
475 break;
476
477 case WM_SETTINGCHANGE:
479 break;
480
481 case PM_TRANSLATE_MSG:
482 {
483 /* TranslateAccelerator is called for all explorer windows that are open
484 so we have to decide if this is the correct recipient */
485 LPMSG lpmsg = (LPMSG)lparam;
486 HWND hwnd = lpmsg->hwnd;
487
488 while(hwnd)
489 {
490 if(hwnd == _hwnd)
491 break;
492
494 }
495
496 if (hwnd)
497 return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
498 return false;
499 }
500
501 default: def:
502 return super::WndProc(nmsg, wparam, lparam);
503 }
504
505 return 0;
506}
507
508
510{
511#ifndef ROSSHELL // in shell-only-mode fall through and let shell32 handle the command
513 return S_OK;
514#endif
515
516 return E_NOTIMPL;
517}
518
519
521 : super(hwnd),
522 _pShellView(pShellView)
523{
525
526 // work around for Windows NT, Win 98, ...
527 // Without this the desktop has mysteriously only a size of 800x600 pixels.
528 ClientRect rect(hwnd);
529 MoveWindow(_hwndListView, 0, 0, rect.right, rect.bottom, TRUE);
530
531 // subclass background window
533
534 _icon_algo = 0; // default icon arrangement
535
536 InitDragDrop();
537}
538
539
541{
542 if (FAILED(RevokeDragDrop(_hwnd)))
543 assert(0);
544}
545
546
548{
549 CONTEXT("DesktopShellView::InitDragDrop()");
550
551 DesktopDropTarget * pDropTarget = new DesktopDropTarget(_hwnd);
552
553 if (!pDropTarget)
554 return false;
555
556 pDropTarget->AddRef();
557
558 if (FAILED(RegisterDragDrop(_hwnd, pDropTarget))) {
559 pDropTarget->Release();
560 return false;
561 }
562
563 FORMATETC ftetc;
564
565 ftetc.dwAspect = DVASPECT_CONTENT;
566 ftetc.lindex = -1;
567 ftetc.tymed = TYMED_HGLOBAL;
568 ftetc.cfFormat = CF_HDROP;
569
570 pDropTarget->AddSuportedFormat(ftetc);
571 pDropTarget->Release();
572
573 return true;
574}
575
577{
578 switch(nmsg) {
579 case WM_CONTEXTMENU:
582 break;
583
587 break;
588
590 return _icon_algo;
591
593 return SendMessage(_hwndListView, nmsg, wparam, lparam);
594
595 default:
596 return super::WndProc(nmsg, wparam, lparam);
597 }
598
599 return 0;
600}
601
603{
604 return super::Command(id, code);
605}
606
608{
609 return super::Notify(id, pnmh);
610}
611
613{
615
616 HRESULT hr = _pShellView->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (void**)&selection);
617 if (FAILED(hr))
618 return false;
619
620 PIDList pidList;
621
622 hr = pidList.GetData(selection);
623 if (FAILED(hr)) {
624 selection->Release();
625 //CHECKERROR(hr);
626 return false;
627 }
628
629 LPIDA pida = pidList;
630 if (!pida->cidl) {
631 selection->Release();
632 return false;
633 }
634
635 LPCITEMIDLIST parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
636
637 LPCITEMIDLIST* apidl = (LPCITEMIDLIST*) alloca(pida->cidl*sizeof(LPCITEMIDLIST));
638
639 for(int i=pida->cidl; i>0; --i)
640 apidl[i-1] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
641
642 hr = ShellFolderContextMenu(ShellFolder(parent_pidl), _hwnd, pida->cidl, apidl, x, y, _cm_ifs);
643
644 selection->Release();
645
646 if (SUCCEEDED(hr))
647 refresh();
648 else
649 CHECKERROR(hr);
650
651 return true;
652}
653
655{
656 IContextMenu* pcm;
657
658 HRESULT hr = DesktopFolder()->GetUIObjectOf(_hwnd, 0, NULL, IID_IContextMenu, NULL, (LPVOID*)&pcm);
659
660 if (SUCCEEDED(hr)) {
661 pcm = _cm_ifs.query_interfaces(pcm);
662
664
665 if (hmenu) {
666 hr = pcm->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST-1, CMF_NORMAL|CMF_EXPLORE);
667
668 if (SUCCEEDED(hr)) {
671
673
674 _cm_ifs.reset();
675
676 if (idCmd == FCIDM_SHVIEWLAST-1) {
677 explorer_about(_hwnd);
678 } else if (idCmd) {
679 CMINVOKECOMMANDINFO cmi;
680
681 cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
682 cmi.fMask = 0;
683 cmi.hwnd = _hwnd;
684 cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST);
685 cmi.lpParameters = NULL;
686 cmi.lpDirectory = NULL;
687 cmi.nShow = SW_SHOWNORMAL;
688 cmi.dwHotKey = 0;
689 cmi.hIcon = 0;
690
691 hr = pcm->InvokeCommand(&cmi);
692 }
693 } else
694 _cm_ifs.reset();
696 }
697
698 pcm->Release();
699 }
700
701 return hr;
702}
703
704
705#define ARRANGE_BORDER_DOWN 8
706#define ARRANGE_BORDER_HV 9
707#define ARRANGE_ROUNDABOUT 10
708
709static const POINTS s_align_start[] = {
710 {0, 0}, // left/top
711 {0, 0},
712 {1, 0}, // right/top
713 {1, 0},
714 {0, 1}, // left/bottom
715 {0, 1},
716 {1, 1}, // right/bottom
717 {1, 1},
718
719 {0, 0}, // left/top
720 {0, 0},
721 {0, 0}
722};
723
724static const POINTS s_align_dir1[] = {
725 { 0, +1}, // down
726 {+1, 0}, // right
727 {-1, 0}, // left
728 { 0, +1}, // down
729 { 0, -1}, // up
730 {+1, 0}, // right
731 {-1, 0}, // left
732 { 0, -1}, // up
733
734 { 0, +1}, // down
735 {+1, 0}, // right
736 {+1, 0} // right
737};
738
739static const POINTS s_align_dir2[] = {
740 {+1, 0}, // right
741 { 0, +1}, // down
742 { 0, +1}, // down
743 {-1, 0}, // left
744 {+1, 0}, // right
745 { 0, -1}, // up
746 { 0, -1}, // up
747 {-1, 0}, // left
748
749 {+1, 0}, // right
750 { 0, +1}, // down
751 { 0, +1} // down
752};
753
756
758{
760
761 RECT work_area;
762 SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0);
763
764 /* disable default allignment */
765 SetWindowStyle(_hwndListView, GetWindowStyle(_hwndListView)&~LVS_ALIGNMASK);//|LVS_ALIGNTOP|LVS_AUTOARRANGE);
766
767 const POINTS& dir1 = s_align_dir1[_icon_algo];
768 const POINTS& dir2 = s_align_dir2[_icon_algo];
769 const POINTS& start_pos = s_align_start[_icon_algo];
770
771 int dir_x1 = dir1.x;
772 int dir_y1 = dir1.y;
773 int dir_x2 = dir2.x;
774 int dir_y2 = dir2.y;
775
776 int cx = LOWORD(spacing);
777 int cy = HIWORD(spacing);
778
779 int dx1 = dir_x1 * cx;
780 int dy1 = dir_y1 * cy;
781 int dx2 = dir_x2 * cx;
782 int dy2 = dir_y2 * cy;
783
784 int xoffset = (cx-32)/2;
785 int yoffset = 4/*(cy-32)/2*/;
786
787 int start_x = start_pos.x * (work_area.right - cx) + xoffset;
788 int start_y = start_pos.y * (work_area.bottom - cy) + yoffset;
789
790 int x = start_x;
791 int y = start_y;
792
794 int i1, i2;
795
796 if (dir > 0) {
797 i1 = 0;
798 i2 = all;
799 } else {
800 i1 = all-1;
801 i2 = -1;
802 }
803
804 IconMap pos_idx;
805 int cnt = 0;
806 int xhv = start_x;
807 int yhv = start_y;
808
809 for(int idx=i1; idx!=i2; idx+=dir) {
810 pos_idx[IconPos(y, x)] = idx;
811
813 if (++cnt & 1)
814 x = work_area.right - x - cx + 2*xoffset;
815 else {
816 y += dy1;
817
818 if (y + cy - 2 * yoffset > work_area.bottom) {
819 y = start_y;
820 start_x += dx2;
821 x = start_x;
822 }
823 }
824
825 continue;
826 }
827 else if (_icon_algo == ARRANGE_BORDER_HV) {
828 if (++cnt & 1)
829 x = work_area.right - x - cx + 2*xoffset;
830 else if (cnt & 2) {
831 yhv += cy;
832 y = yhv;
833 x = start_x;
834
835 if (y + cy - 2 * yoffset > work_area.bottom) {
836 start_x += cx;
837 xhv = start_x;
838 x = xhv;
839 start_y += cy;
840 yhv = start_y;
841 y = yhv;
842 }
843 } else {
844 xhv += cx;
845 x = xhv;
846 y = start_y;
847
848 if (x + cx - 2 * xoffset > work_area.right) {
849 start_x += cx;
850 xhv = start_x;
851 x = xhv;
852 start_y += cy;
853 yhv = start_y;
854 y = yhv;
855 }
856 }
857
858 continue;
859 }
860 else if (_icon_algo == ARRANGE_ROUNDABOUT) {
861
863
864 }
865
866 x += dx1;
867 y += dy1;
868
869 if (x<0 || x+cx-2*xoffset>work_area.right) {
870 x = start_x;
871 y += dy2;
872 } else if (y<0 || y+cy-2*yoffset>work_area.bottom) {
873 y = start_y;
874 x += dx2;
875 }
876 }
877
878 // use a little trick to get the icons where we want them to be...
879
880 //for(IconMap::const_iterator it=pos_idx.end(); --it!=pos_idx.begin(); ) {
881 // const IconPos& pos = it->first;
882
883 // ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first);
884 //}
885
886 for(IconMap::const_iterator it=pos_idx.begin(); it!=pos_idx.end(); ++it) {
887 const IconPos& pos = it->first;
888
889 ListView_SetItemPosition32(_hwndListView, it->second, pos.second, pos.first);
890 }
891}
892
893
895{
897}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
static int start_x
Definition: maze.c:118
static int start_y
Definition: maze.c:118
unsigned int dir
Definition: maze.c:112
#define CF_HDROP
Definition: constants.h:410
OLE drop target for the desktop window.
Definition: desktop.h:96
void AddSuportedFormat(FORMATETC &ftetc)
Definition: dragdropimpl.h:184
virtual ULONG STDMETHODCALLTYPE AddRef()
Definition: dragdropimpl.h:192
virtual ULONG STDMETHODCALLTYPE Release()
Definition: list.h:37
void push_back(const_reference __x)
Definition: _list.h:509
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
Definition: _map.h:48
iterator end()
Definition: _map.h:165
iterator begin()
Definition: _map.h:163
_Rep_type::const_iterator const_iterator
Definition: _map.h:86
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
_Rep_type::iterator iterator
Definition: _set.h:73
int selection
Definition: ctm.c:92
#define E_NOTIMPL
Definition: ddrawi.h:99
#define DESKTOPBARBAR_HEIGHT
Definition: desktopbar.h:33
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
#define WM_GETISHELLBROWSER
Definition: filedlg.c:200
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define CALLBACK
Definition: compat.h:35
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
#define assert(x)
Definition: debug.h:53
void ShowExitWindowsDialog(HWND hwndOwner)
Definition: startmenu.cpp:2128
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint xoffset
Definition: gl.h:1547
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLint GLint GLint yoffset
Definition: gl.h:1547
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define fs
Definition: i386-dis.c:444
HRESULT InvokeCommand([in] LPCMINVOKECOMMANDINFO lpici)
HRESULT QueryContextMenu([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
HRESULT CreateViewWindow([in] IShellView *psvPrevious, [in] LPCFOLDERSETTINGS lpfs, [in] IShellBrowser *psb, [out] RECT *prcView, [out] HWND *phWnd)
HRESULT UIActivate([in] UINT uState)
HRESULT TranslateAccelerator([in] MSG *pmsg)
HRESULT GetItemObject([in] UINT uItem, [in] REFIID riid, [out, iid_is(riid)] void **ppv)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define TEXT(s)
Definition: k32.h:26
#define alloca
Definition: malloc.h:357
static const POINTS s_align_dir1[]
Definition: desktop.cpp:724
pair< int, int > IconPos
Definition: desktop.cpp:754
static const POINTS s_align_dir2[]
Definition: desktop.cpp:739
static BOOL CALLBACK SwitchDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:152
static HWND
Definition: desktop.cpp:36
static BOOL CALLBACK MinimizeDesktopEnumFct(HWND hwnd, LPARAM lparam)
Definition: desktop.cpp:209
#define ARRANGE_BORDER_HV
Definition: desktop.cpp:706
#define ARRANGE_ROUNDABOUT
Definition: desktop.cpp:707
static const POINTS s_align_start[]
Definition: desktop.cpp:709
map< IconPos, int > IconMap
Definition: desktop.cpp:755
#define ARRANGE_BORDER_DOWN
Definition: desktop.cpp:705
BOOL IsAnyDesktopRunning()
Definition: desktop.cpp:248
#define PM_DISPLAY_VERSION
Definition: desktop.h:31
#define PM_SET_ICON_ALGORITHM
Definition: desktop.h:29
#define PM_GET_ICON_ALGORITHM
Definition: desktop.h:30
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
void explorer_show_frame(int cmdShow, LPTSTR lpCmdLine)
Definition: explorer.cpp:707
void explorer_about(HWND hwndParent)
Definition: explorer.cpp:934
pair< HWND, DWORD > MinimizeStruct
desktop management
Definition: globals.h:225
#define DESKTOP_COUNT
Definition: globals.h:238
struct ExplorerGlobals g_Globals
#define IDS_ABOUT_EXPLORER
Definition: resource.h:31
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
#define GET_WINDOW(CLASS, hwnd)
Definition: window.h:88
#define PM_TRANSLATE_MSG
Definition: window.h:266
#define WINDOW_CREATOR(WND_CLASS)
Definition: window.h:202
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static struct testwindow_info windows[3]
Definition: appbar.c:46
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
struct _CONTEXT CONTEXT
#define GENERIC_ALL
Definition: nt_native.h:92
const GUID IID_IDataObject
#define IDI_REACTOS
Definition: osk_res.h:21
#define LOWORD(l)
Definition: pedump.c:82
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define ListView_SetItemPosition32(hwndLV, i, x0, y0)
Definition: commctrl.h:2706
#define LVS_ALIGNMASK
Definition: commctrl.h:2281
#define ListView_GetItemSpacing(hwndLV, fSmall)
Definition: commctrl.h:2712
LONG RegSetDWORDValue(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValue OPTIONAL, IN BOOL bCreateKeyIfDoesntExist, IN DWORD dwData)
Definition: regutils.c:162
LONG RegGetDWORDValue(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValue OPTIONAL, OUT LPDWORD lpData OPTIONAL)
Definition: regutils.c:95
#define WM_CONTEXTMENU
Definition: richedit.h:64
ShellFolder & GetDesktopFolder()
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)
#define CHECKERROR(hr)
Definition: shellclasses.h:162
HRESULT hr
Definition: shlfolder.c:183
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:573
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:607
@ FWF_SNAPTOGRID
Definition: shobjidl.idl:633
@ FWF_NOSCROLL
Definition: shobjidl.idl:641
@ FWF_NOCLIENTEDGE
Definition: shobjidl.idl:640
@ FWF_BESTFITWINDOW
Definition: shobjidl.idl:635
@ FWF_DESKTOP
Definition: shobjidl.idl:636
@ FVM_ICON
Definition: shobjidl.idl:668
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
& rect
Definition: startmenu.cpp:1413
subclassed background window behind the visible desktop window
Definition: desktop.h:36
int _display_version
Definition: desktop.h:46
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:269
void DrawDesktopBkgnd(HDC hdc)
Definition: desktop.cpp:301
BackgroundWindow(HWND hwnd)
Definition: desktop.cpp:259
Definition: shlobj.h:565
UINT aoffset[1]
Definition: shlobj.h:566
UINT cidl
Definition: shlobj.h:565
IContextMenu * query_interfaces(IContextMenu *pcm1)
static HWND Create()
Definition: desktopbar.cpp:64
Shell folder of the desktop.
subclassed ShellView window
Definition: desktop.h:170
int Notify(int id, NMHDR *pnmh)
Definition: desktop.cpp:607
bool DoContextMenu(int x, int y)
Definition: desktop.cpp:612
HRESULT DoDesktopContextMenu(int x, int y)
Definition: desktop.cpp:654
DesktopShellView(HWND hwnd, IShellView *pShellView)
Definition: desktop.cpp:520
void PositionIcons(int dir=1)
Definition: desktop.cpp:757
bool InitDragDrop()
Definition: desktop.cpp:547
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:576
HWND _hwndListView
Definition: desktop.h:191
int Command(int id, int code)
Definition: desktop.cpp:602
IShellView * _pShellView
Definition: desktop.h:179
Implementation of the Explorer desktop window.
Definition: desktop.h:52
virtual HRESULT OnDefaultCommand(LPIDA pida)
Definition: desktop.cpp:509
static HWND Create()
Definition: desktop.cpp:326
DesktopWindow(HWND hwnd)
Definition: desktop.cpp:313
IShellView * _pShellView
Definition: desktop.h:87
LRESULT Init(LPCREATESTRUCT pcs)
Definition: desktop.cpp:350
WindowHandle _desktopBar
Definition: desktop.h:88
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:431
set< HWND > _windows
Definition: globals.h:229
WindowHandle _hwndForeground
Definition: globals.h:230
void SwitchToDesktop(int idx)
Definition: desktop.cpp:163
void ToggleMinimize()
minimize/restore all windows on the desktop
Definition: desktop.cpp:229
void init()
Definition: desktop.cpp:77
Desktops()
Definition: desktop.cpp:64
int _current_desktop
Definition: globals.h:253
~Desktops()
Definition: desktop.cpp:69
HWND _hwndDesktopBar
Definition: globals.h:287
HWND _hwndShellView
Definition: globals.h:288
HWND _hwndDesktop
Definition: globals.h:289
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
window class with specified icon from resources
Definition: window.h:259
static int OpenShellFolders(LPIDA pida, HWND hFrameWnd)
Definition: mainframe.cpp:77
list of PIDLs
HRESULT GetData(IDataObject *selection)
convenient loading of string resources
Definition: globals.h:304
IShellFolder smart pointer.
Definition: shellclasses.h:594
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:343
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: window.cpp:280
static HWND Create(CREATORFUNC creator, DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int w, int h, HWND hwndParent=0, HMENU hMenu=0)
Definition: window.cpp:87
static int MessageLoop()
Definition: window.cpp:629
virtual int Command(int id, int code)
Definition: window.cpp:285
virtual LRESULT Init(LPCREATESTRUCT pcs)
Definition: window.cpp:241
virtual int Notify(int id, NMHDR *pnmh)
Definition: window.cpp:290
Definition: inflate.c:139
Definition: ffs.h:70
Definition: _pair.h:47
HWND hwnd
Definition: winuser.h:3114
SHORT y
Definition: windef.h:343
SHORT x
Definition: windef.h:342
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define PM_GET_LAST_ACTIVE
Definition: taskbar.h:46
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI SetShellWindow(HWND)
Definition: desktop.c:641
BOOL WINAPI SetShellWindowEx(HWND, HWND)
Definition: ntwrapper.h:58
int ret
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
static HMENU hmenu
Definition: win.c:66
#define GetModuleHandle
Definition: winbase.h:3762
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define GetWindowStyle(hwnd)
Definition: windowsx.h:315
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define WM_ERASEBKGND
Definition: winuser.h:1625
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define WM_SYSCOMMAND
Definition: winuser.h:1741
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SM_CYSCREEN
Definition: winuser.h:960
BOOL WINAPI SwitchDesktop(_In_ HDESK)
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
#define AppendMenu
Definition: winuser.h:5731
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SW_MINIMIZE
Definition: winuser.h:776
HDESK WINAPI OpenInputDesktop(_In_ DWORD, _In_ BOOL, _In_ DWORD)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
BOOL WINAPI PaintDesktop(_In_ HDC)
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1781
#define SC_TASKLIST
Definition: winuser.h:2599
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
BOOL WINAPI IsIconic(_In_ HWND)
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
#define DESKTOP_SWITCHDESKTOP
Definition: winuser.h:223
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define MF_SEPARATOR
Definition: winuser.h:137
#define TPM_LEFTALIGN
Definition: winuser.h:2377
#define SendMessage
Definition: winuser.h:5843
#define WM_MBUTTONDBLCLK
Definition: winuser.h:1784
#define GCL_HBRBACKGROUND
Definition: winuser.h:664
struct tagMSG * LPMSG
#define PostMessage
Definition: winuser.h:5832
#define GetNextWindow(h, c)
Definition: winuser.h:4727
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define SW_RESTORE
Definition: winuser.h:779
#define SetClassLongPtr
Definition: winuser.h:5848
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define WM_DESTROY
Definition: winuser.h:1609
#define SM_CXSCREEN
Definition: winuser.h:959
#define GW_CHILD
Definition: winuser.h:763
BOOL WINAPI CloseDesktop(_In_ HDESK)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define TPM_RETURNCMD
Definition: winuser.h:2387
#define SW_MAXIMIZE
Definition: winuser.h:772
#define SystemParametersInfo
Definition: winuser.h:5858
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_BACKGROUND
Definition: winuser.h:913
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
static clock_t begin
Definition: xmllint.c:458
const char * LPCSTR
Definition: xmlstorage.h:183