Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / widget / windows / nsAppShell.h
blobc16b51037946e682680ec85fc6df19a1b6939781
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/. */
6 #ifndef nsAppShell_h__
7 #define nsAppShell_h__
9 #include "nsBaseAppShell.h"
10 #include <windows.h>
11 #include <vector>
12 #include "mozilla/TimeStamp.h"
13 #include "mozilla/Mutex.h"
15 // The maximum time we allow before forcing a native event callback.
16 // In seconds.
17 #define NATIVE_EVENT_STARVATION_LIMIT 1
19 /**
20 * Native Win32 Application shell wrapper
22 class nsAppShell final : public nsBaseAppShell {
23 public:
24 nsAppShell()
25 : mEventWnd(nullptr),
26 mNativeCallbackPending(false),
27 mLastNativeEventScheduledMutex(
28 "nsAppShell::mLastNativeEventScheduledMutex") {}
29 typedef mozilla::TimeStamp TimeStamp;
30 typedef mozilla::Mutex Mutex;
32 static bool PrecacheEventWindow();
34 nsresult Init();
35 void DoProcessMoreGeckoEvents();
37 static UINT GetTaskbarButtonCreatedMessage();
39 NS_IMETHOD AfterProcessNextEvent(nsIThreadInternal* thread,
40 bool eventWasProcessed) final;
42 protected:
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);
53 protected:
54 static HWND StaticCreateEventWindow();
55 static HWND sPrecachedEventWnd;
56 nsresult InitEventWindow();
57 HWND mEventWnd;
58 bool mNativeCallbackPending;
60 Mutex mLastNativeEventScheduledMutex MOZ_UNANNOTATED;
61 TimeStamp mLastNativeEventScheduled;
62 std::vector<MSG> mMsgsToRepost;
64 private:
65 wchar_t mTimezoneName[128];
68 #endif // nsAppShell_h__