1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "nsBaseAppShell.h"
12 #include "mozilla/TimeStamp.h"
13 #include "mozilla/Mutex.h"
15 // The maximum time we allow before forcing a native event callback.
17 #define NATIVE_EVENT_STARVATION_LIMIT 1
20 * Native Win32 Application shell wrapper
22 class nsAppShell final
: public nsBaseAppShell
{
26 mNativeCallbackPending(false),
27 mLastNativeEventScheduledMutex(
28 "nsAppShell::mLastNativeEventScheduledMutex") {}
29 typedef mozilla::TimeStamp TimeStamp
;
30 typedef mozilla::Mutex Mutex
;
32 static bool PrecacheEventWindow();
35 void DoProcessMoreGeckoEvents();
37 static UINT
GetTaskbarButtonCreatedMessage();
39 NS_IMETHOD
AfterProcessNextEvent(nsIThreadInternal
* thread
,
40 bool eventWasProcessed
) final
;
43 NS_IMETHOD
Run() override
;
44 NS_IMETHOD
Observe(nsISupports
* aSubject
, const char* aTopic
,
45 const char16_t
* aData
) override
;
47 virtual void ScheduleNativeEventCallback();
48 virtual bool ProcessNextNativeEvent(bool mayWait
);
49 virtual ~nsAppShell();
51 static LRESULT CALLBACK
EventWindowProc(HWND
, UINT
, WPARAM
, LPARAM
);
54 static HWND
StaticCreateEventWindow();
55 static HWND sPrecachedEventWnd
;
56 nsresult
InitEventWindow();
58 bool mNativeCallbackPending
;
60 Mutex mLastNativeEventScheduledMutex MOZ_UNANNOTATED
;
61 TimeStamp mLastNativeEventScheduled
;
62 std::vector
<MSG
> mMsgsToRepost
;
65 wchar_t mTimezoneName
[128];
68 #endif // nsAppShell_h__