Bug 1006765: Ensure that Win32 widget handles terminal services messages; r=jimm

--HG--
extra : rebase_source : a25ad41fb20aa3b52207a78f42d51fb870246bf4
This commit is contained in:
Aaron Klotz 2014-05-12 13:30:31 -06:00
Родитель 2be270c749
Коммит 501e7a5f1b
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -207,7 +207,7 @@ OS_LIBS += $(call EXPAND_LIBNAME,util)
endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet wbemuuid wintrust)
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet wbemuuid wintrust wtsapi32)
ifdef ACCESSIBILITY
OS_LIBS += $(call EXPAND_LIBNAME,oleacc)
endif

Просмотреть файл

@ -66,6 +66,7 @@
#include <shellapi.h>
#include <windows.h>
#include <wtsapi32.h>
#include <process.h>
#include <commctrl.h>
#include <unknwn.h>
@ -606,6 +607,14 @@ nsWindow::Create(nsIWidget *aParent,
SubclassWindow(TRUE);
// Starting with Windows XP, a process always runs within a terminal services
// session. In order to play nicely with RDP, fast user switching, and the
// lock screen, we should be handling WM_WTSSESSION_CHANGE. We must register
// our HWND in order to receive this message.
DebugOnly<BOOL> wtsRegistered = ::WTSRegisterSessionNotification(mWnd,
NOTIFY_FOR_THIS_SESSION);
NS_ASSERTION(wtsRegistered, "WTSRegisterSessionNotification failed!\n");
IMEHandler::InitInputContext(this, mInputContext);
// If the internal variable set by the config.trim_on_minimize pref has not
@ -4569,6 +4578,21 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
}
break;
case WM_WTSSESSION_CHANGE:
{
switch (wParam) {
case WTS_CONSOLE_CONNECT:
case WTS_REMOTE_CONNECT:
case WTS_SESSION_UNLOCK:
// When a session becomes visible, we should invalidate.
Invalidate(true, true, true);
break;
default:
break;
}
}
break;
case WM_FONTCHANGE:
{
// We only handle this message for the hidden window,
@ -6401,6 +6425,9 @@ void nsWindow::OnDestroy()
mWidgetListener = nullptr;
mAttachedWidgetListener = nullptr;
// Unregister notifications from terminal services
::WTSUnRegisterSessionNotification(mWnd);
// Free our subclass and clear |this| stored in the window props. We will no longer
// receive events from Windows after this point.
SubclassWindow(FALSE);