mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
remember last foreground window when switching desktops
svn path=/branches/lean-explorer/; revision=8437
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "../externals.h"
|
||||
|
||||
#include "../taskbar/desktopbar.h"
|
||||
#include "../taskbar/taskbar.h" // for PM_GET_LAST_ACTIVE
|
||||
|
||||
#include "../explorer_intres.h"
|
||||
|
||||
@@ -85,6 +86,7 @@ void Desktops::SwitchToDesktop(int idx)
|
||||
|
||||
windows.clear();
|
||||
EnumWindows(SwitchDesktopEnumFct, (LPARAM)&windows);
|
||||
old_desktop._hwndForeground = (HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_LAST_ACTIVE, 0, 0);
|
||||
|
||||
// hide all windows we found
|
||||
for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it)
|
||||
@@ -94,6 +96,9 @@ void Desktops::SwitchToDesktop(int idx)
|
||||
for(WindowSet::iterator it=desktop._windows.begin(); it!=desktop._windows.end(); ++it)
|
||||
ShowWindowAsync(*it, SW_SHOW);
|
||||
|
||||
if (desktop._hwndForeground)
|
||||
SetForegroundWindow(desktop._hwndForeground);
|
||||
|
||||
desktop._windows.clear();
|
||||
|
||||
_current_desktop = idx;
|
||||
|
||||
@@ -149,6 +149,7 @@ typedef pair<HWND, DWORD> MinimizeStruct;
|
||||
struct Desktop
|
||||
{
|
||||
set<HWND> _windows;
|
||||
WindowHandle _hwndForeground;
|
||||
list<MinimizeStruct> _minimized;
|
||||
};
|
||||
typedef Desktop DesktopRef;
|
||||
|
||||
Reference in New Issue
Block a user