Bug 1152353: Repost printer properties completion messages after nsAppShell::ProcessNextNativeEvent. r=jimm

This commit is contained in:
Bob Owen 2017-03-15 15:55:50 +00:00
Родитель d36c4c59f4
Коммит c454d35621
2 изменённых файлов: 33 добавлений и 0 удалений

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

@ -25,6 +25,12 @@
#include "nsComponentManagerUtils.h"
#include "nsITimer.h"
// These are two messages that the code in winspool.drv on Windows 7 explicitly
// waits for while it is pumping other Windows messages, during display of the
// Printer Properties dialog.
#define MOZ_WM_PRINTER_PROPERTIES_COMPLETION 0x5b7a
#define MOZ_WM_PRINTER_PROPERTIES_FAILURE 0x5b7f
using namespace mozilla;
using namespace mozilla::widget;
@ -372,6 +378,15 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
continue; // the message is consumed.
}
// Store Printer Properties messages for reposting, because they are not
// processed by a window procedure, but are explicitly waited for in the
// winspool.drv code that will be further up the stack.
if (msg.message == MOZ_WM_PRINTER_PROPERTIES_COMPLETION ||
msg.message == MOZ_WM_PRINTER_PROPERTIES_FAILURE) {
mMsgsToRepost.push_back(msg);
continue;
}
::TranslateMessage(&msg);
::DispatchMessageW(&msg);
}
@ -407,3 +422,16 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
return gotMessage;
}
nsresult
nsAppShell::AfterProcessNextEvent(nsIThreadInternal* /* unused */,
bool /* unused */)
{
if (!mMsgsToRepost.empty()) {
for (MSG msg : mMsgsToRepost) {
::PostMessageW(msg.hwnd, msg.message, msg.wParam, msg.lParam);
}
mMsgsToRepost.clear();
}
return NS_OK;
}

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

@ -8,6 +8,7 @@
#include "nsBaseAppShell.h"
#include <windows.h>
#include <vector>
#include "mozilla/TimeStamp.h"
#include "mozilla/Mutex.h"
@ -34,6 +35,9 @@ public:
static UINT GetTaskbarButtonCreatedMessage();
NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal* thread,
bool eventWasProcessed) final;
protected:
NS_IMETHOD Run();
NS_IMETHOD Exit();
@ -49,6 +53,7 @@ protected:
Mutex mLastNativeEventScheduledMutex;
TimeStamp mLastNativeEventScheduled;
std::vector<MSG> mMsgsToRepost;
};
#endif // nsAppShell_h__