michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef Window_h__ michael@0: #define Window_h__ michael@0: michael@0: /* michael@0: * nsWindow - Native window management and event handling. michael@0: */ michael@0: michael@0: #include "nsAutoPtr.h" michael@0: #include "nsBaseWidget.h" michael@0: #include "nsWindowBase.h" michael@0: #include "nsdefs.h" michael@0: #include "nsIdleService.h" michael@0: #include "nsToolkit.h" michael@0: #include "nsString.h" michael@0: #include "nsTArray.h" michael@0: #include "gfxWindowsPlatform.h" michael@0: #include "gfxWindowsSurface.h" michael@0: #include "nsWindowDbg.h" michael@0: #include "cairo.h" michael@0: #include "nsITimer.h" michael@0: #include "nsRegion.h" michael@0: #include "mozilla/EventForwards.h" michael@0: #include "mozilla/MouseEvents.h" michael@0: #include "mozilla/TimeStamp.h" michael@0: #include "nsMargin.h" michael@0: michael@0: #include "nsWinGesture.h" michael@0: michael@0: #include "WindowHook.h" michael@0: #include "TaskbarWindowPreview.h" michael@0: michael@0: #ifdef ACCESSIBILITY michael@0: #include "oleacc.h" michael@0: #include "mozilla/a11y/Accessible.h" michael@0: #endif michael@0: michael@0: #include "nsUXThemeData.h" michael@0: michael@0: #include "nsIDOMMouseEvent.h" michael@0: michael@0: #include "nsIIdleServiceInternal.h" michael@0: michael@0: /** michael@0: * Forward class definitions michael@0: */ michael@0: michael@0: class nsNativeDragTarget; michael@0: class nsIRollupListener; michael@0: class nsIFile; michael@0: class nsIntRegion; michael@0: class imgIContainer; michael@0: michael@0: namespace mozilla { michael@0: namespace widget { michael@0: class NativeKey; michael@0: class ModifierKeyState; michael@0: struct MSGResult; michael@0: } // namespace widget michael@0: } // namespacw mozilla; michael@0: michael@0: /** michael@0: * Native WIN32 window wrapper. michael@0: */ michael@0: michael@0: class nsWindow : public nsWindowBase michael@0: { michael@0: typedef mozilla::TimeStamp TimeStamp; michael@0: typedef mozilla::TimeDuration TimeDuration; michael@0: typedef mozilla::widget::WindowHook WindowHook; michael@0: typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview; michael@0: typedef mozilla::widget::NativeKey NativeKey; michael@0: typedef mozilla::widget::MSGResult MSGResult; michael@0: public: michael@0: nsWindow(); michael@0: virtual ~nsWindow(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: friend class nsWindowGfx; michael@0: michael@0: // nsWindowBase michael@0: virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent, michael@0: nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE; michael@0: virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; michael@0: virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; michael@0: virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; michael@0: virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE; michael@0: virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; } michael@0: michael@0: // nsIWidget interface michael@0: NS_IMETHOD Create(nsIWidget *aParent, michael@0: nsNativeWidget aNativeParent, michael@0: const nsIntRect &aRect, michael@0: nsDeviceContext *aContext, michael@0: nsWidgetInitData *aInitData = nullptr); michael@0: NS_IMETHOD Destroy(); michael@0: NS_IMETHOD SetParent(nsIWidget *aNewParent); michael@0: virtual nsIWidget* GetParent(void); michael@0: virtual float GetDPI(); michael@0: virtual double GetDefaultScaleInternal(); michael@0: NS_IMETHOD Show(bool bState); michael@0: virtual bool IsVisible() const; michael@0: NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY); michael@0: virtual void SetSizeConstraints(const SizeConstraints& aConstraints); michael@0: NS_IMETHOD Move(double aX, double aY); michael@0: NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint); michael@0: NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint); michael@0: NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent, michael@0: int32_t aHorizontal, michael@0: int32_t aVertical); michael@0: NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate); michael@0: NS_IMETHOD SetSizeMode(int32_t aMode); michael@0: NS_IMETHOD Enable(bool aState); michael@0: virtual bool IsEnabled() const; michael@0: NS_IMETHOD SetFocus(bool aRaise); michael@0: NS_IMETHOD GetBounds(nsIntRect &aRect); michael@0: NS_IMETHOD GetScreenBounds(nsIntRect &aRect); michael@0: NS_IMETHOD GetClientBounds(nsIntRect &aRect); michael@0: virtual nsIntPoint GetClientOffset(); michael@0: void SetBackgroundColor(const nscolor &aColor); michael@0: NS_IMETHOD SetCursor(imgIContainer* aCursor, michael@0: uint32_t aHotspotX, uint32_t aHotspotY); michael@0: NS_IMETHOD SetCursor(nsCursor aCursor); michael@0: virtual nsresult ConfigureChildren(const nsTArray& aConfigurations); michael@0: NS_IMETHOD MakeFullScreen(bool aFullScreen); michael@0: NS_IMETHOD HideWindowChrome(bool aShouldHide); michael@0: NS_IMETHOD Invalidate(bool aEraseBackground = false, michael@0: bool aUpdateNCArea = false, michael@0: bool aIncludeChildren = false); michael@0: NS_IMETHOD Invalidate(const nsIntRect & aRect); michael@0: virtual void* GetNativeData(uint32_t aDataType); michael@0: virtual void FreeNativeData(void * data, uint32_t aDataType); michael@0: NS_IMETHOD SetTitle(const nsAString& aTitle); michael@0: NS_IMETHOD SetIcon(const nsAString& aIconSpec); michael@0: virtual nsIntPoint WidgetToScreenOffset(); michael@0: virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize); michael@0: NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus& aStatus); michael@0: NS_IMETHOD EnableDragDrop(bool aEnable); michael@0: NS_IMETHOD CaptureMouse(bool aCapture); michael@0: NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, michael@0: bool aDoCapture); michael@0: NS_IMETHOD GetAttention(int32_t aCycleCount); michael@0: virtual bool HasPendingInputEvent(); michael@0: virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, michael@0: LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, michael@0: LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, michael@0: bool* aAllowRetaining = nullptr); michael@0: gfxASurface *GetThebesSurface(); michael@0: NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect); michael@0: NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX, michael@0: double aOriginalDeltaY, michael@0: double& aOverriddenDeltaX, michael@0: double& aOverriddenDeltaY); michael@0: michael@0: virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout, michael@0: int32_t aNativeKeyCode, michael@0: uint32_t aModifierFlags, michael@0: const nsAString& aCharacters, michael@0: const nsAString& aUnmodifiedCharacters); michael@0: virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint, michael@0: uint32_t aNativeMessage, michael@0: uint32_t aModifierFlags); michael@0: michael@0: virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) michael@0: { return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); } michael@0: michael@0: virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint, michael@0: uint32_t aNativeMessage, michael@0: double aDeltaX, michael@0: double aDeltaY, michael@0: double aDeltaZ, michael@0: uint32_t aModifierFlags, michael@0: uint32_t aAdditionalFlags); michael@0: NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) MOZ_OVERRIDE; michael@0: NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, michael@0: const InputContextAction& aAction); michael@0: NS_IMETHOD_(InputContext) GetInputContext(); michael@0: NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState); michael@0: NS_IMETHOD RegisterTouchWindow(); michael@0: NS_IMETHOD UnregisterTouchWindow(); michael@0: #ifdef MOZ_XUL michael@0: virtual void SetTransparencyMode(nsTransparencyMode aMode); michael@0: virtual nsTransparencyMode GetTransparencyMode(); michael@0: virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion); michael@0: #endif // MOZ_XUL michael@0: virtual nsIMEUpdatePreference GetIMEUpdatePreference(); michael@0: NS_IMETHOD GetNonClientMargins(nsIntMargin &margins); michael@0: NS_IMETHOD SetNonClientMargins(nsIntMargin &margins); michael@0: void SetDrawsInTitlebar(bool aState); michael@0: mozilla::TemporaryRef StartRemoteDrawing() MOZ_OVERRIDE; michael@0: virtual void EndRemoteDrawing() MOZ_OVERRIDE; michael@0: michael@0: virtual void UpdateThemeGeometries(const nsTArray& aThemeGeometries) MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * Event helpers michael@0: */ michael@0: virtual bool DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, michael@0: LPARAM lParam, michael@0: bool aIsContextMenuKey = false, michael@0: int16_t aButton = mozilla::WidgetMouseEvent::eLeftButton, michael@0: uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE); michael@0: virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus& aStatus); michael@0: void DispatchPendingEvents(); michael@0: bool DispatchPluginEvent(UINT aMessage, michael@0: WPARAM aWParam, michael@0: LPARAM aLParam, michael@0: bool aDispatchPendingEvents); michael@0: michael@0: void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker michael@0: bool BlurEventsSuppressed(); michael@0: #ifdef ACCESSIBILITY michael@0: /** michael@0: * Return an accessible associated with the window. michael@0: */ michael@0: mozilla::a11y::Accessible* GetAccessible(); michael@0: #endif // ACCESSIBILITY michael@0: michael@0: /** michael@0: * Window utilities michael@0: */ michael@0: nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup); michael@0: WNDPROC GetPrevWindowProc() { return mPrevWndProc; } michael@0: WindowHook& GetWindowHook() { return mWindowHook; } michael@0: nsWindow* GetParentWindow(bool aIncludeOwner); michael@0: // Get an array of all nsWindow*s on the main thread. michael@0: typedef void (WindowEnumCallback)(nsWindow*); michael@0: static void EnumAllWindows(WindowEnumCallback aCallback); michael@0: michael@0: /** michael@0: * Misc. michael@0: */ michael@0: virtual bool AutoErase(HDC dc); michael@0: michael@0: /** michael@0: * Start allowing Direct3D9 to be used by widgets when GetLayerManager is michael@0: * called. michael@0: * michael@0: * @param aReinitialize Call GetLayerManager on widgets to ensure D3D9 is michael@0: * initialized, this is usually called when this function michael@0: * is triggered by timeout and not user/web interaction. michael@0: */ michael@0: static void StartAllowingD3D9(bool aReinitialize); michael@0: michael@0: /** michael@0: * AssociateDefaultIMC() associates or disassociates the default IMC for michael@0: * the window. michael@0: * michael@0: * @param aAssociate TRUE, associates the default IMC with the window. michael@0: * Otherwise, disassociates the default IMC from the michael@0: * window. michael@0: * @return TRUE if this method associated the default IMC with michael@0: * disassociated window or disassociated the default IMC michael@0: * from associated window. michael@0: * Otherwise, i.e., if this method did nothing actually, michael@0: * FALSE. michael@0: */ michael@0: bool AssociateDefaultIMC(bool aAssociate); michael@0: michael@0: bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; } michael@0: // Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window michael@0: // has its icon placed on the taskbar. michael@0: void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; } michael@0: michael@0: // Getter/setter for the nsITaskbarWindowPreview for this nsWindow michael@0: already_AddRefed GetTaskbarPreview() { michael@0: nsCOMPtr preview(do_QueryReferent(mTaskbarPreview)); michael@0: return preview.forget(); michael@0: } michael@0: void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { mTaskbarPreview = do_GetWeakReference(preview); } michael@0: michael@0: NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); michael@0: michael@0: // Open file picker tracking michael@0: void PickerOpen(); michael@0: void PickerClosed(); michael@0: michael@0: bool const DestroyCalled() { return mDestroyCalled; } michael@0: michael@0: virtual void GetPreferredCompositorBackends(nsTArray& aHints); michael@0: michael@0: virtual bool ShouldUseOffMainThreadCompositing(); michael@0: michael@0: protected: michael@0: michael@0: virtual void WindowUsesOMTC() MOZ_OVERRIDE; michael@0: michael@0: // A magic number to identify the FAKETRACKPOINTSCROLLABLE window created michael@0: // when the trackpoint hack is enabled. michael@0: enum { eFakeTrackPointScrollableID = 0x46545053 }; michael@0: michael@0: /** michael@0: * Callbacks michael@0: */ michael@0: static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); michael@0: static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); michael@0: michael@0: static BOOL CALLBACK BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg); michael@0: static BOOL CALLBACK BroadcastMsg(HWND aTopWindow, LPARAM aMsg); michael@0: static BOOL CALLBACK DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg); michael@0: static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg); michael@0: static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg); michael@0: static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam); michael@0: static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam); michael@0: static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam); michael@0: static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ); michael@0: static BOOL CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam); michael@0: static BOOL CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam); michael@0: static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam); michael@0: static void AllowD3D9Callback(nsWindow *aWindow); michael@0: static void AllowD3D9WithReinitializeCallback(nsWindow *aWindow); michael@0: michael@0: /** michael@0: * Window utilities michael@0: */ michael@0: LPARAM lParamToScreen(LPARAM lParam); michael@0: LPARAM lParamToClient(LPARAM lParam); michael@0: virtual void SubclassWindow(BOOL bState); michael@0: bool CanTakeFocus(); michael@0: bool UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true); michael@0: void UpdateGetWindowInfoCaptionStatus(bool aActiveCaption); michael@0: void ResetLayout(); michael@0: void InvalidateNonClientRegion(); michael@0: HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion); michael@0: static void GetMainWindowClass(nsAString& aClass); michael@0: bool HasGlass() const { michael@0: return mTransparencyMode == eTransparencyGlass || michael@0: mTransparencyMode == eTransparencyBorderlessGlass; michael@0: } michael@0: HWND GetOwnerWnd() const michael@0: { michael@0: return ::GetWindow(mWnd, GW_OWNER); michael@0: } michael@0: bool IsOwnerForegroundWindow() const michael@0: { michael@0: HWND owner = GetOwnerWnd(); michael@0: return owner && owner == ::GetForegroundWindow(); michael@0: } michael@0: bool IsPopup() const michael@0: { michael@0: return mWindowType == eWindowType_popup; michael@0: } michael@0: michael@0: michael@0: /** michael@0: * Event processing helpers michael@0: */ michael@0: void DispatchFocusToTopLevelWindow(bool aIsActivate); michael@0: bool DispatchStandardEvent(uint32_t aMsg); michael@0: void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam); michael@0: virtual bool ProcessMessage(UINT msg, WPARAM &wParam, michael@0: LPARAM &lParam, LRESULT *aRetValue); michael@0: bool ExternalHandlerProcessMessage( michael@0: UINT aMessage, WPARAM& aWParam, michael@0: LPARAM& aLParam, MSGResult& aResult); michael@0: bool ProcessMessageForPlugin(const MSG &aMsg, michael@0: MSGResult& aResult); michael@0: LRESULT ProcessCharMessage(const MSG &aMsg, michael@0: bool *aEventDispatched); michael@0: LRESULT ProcessKeyUpMessage(const MSG &aMsg, michael@0: bool *aEventDispatched); michael@0: LRESULT ProcessKeyDownMessage(const MSG &aMsg, michael@0: bool *aEventDispatched); michael@0: static bool EventIsInsideWindow(nsWindow* aWindow); michael@0: // Convert nsEventStatus value to a windows boolean michael@0: static bool ConvertStatus(nsEventStatus aStatus); michael@0: static void PostSleepWakeNotification(const bool aIsSleepMode); michael@0: int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my); michael@0: michael@0: /** michael@0: * Event handlers michael@0: */ michael@0: virtual void OnDestroy(); michael@0: virtual bool OnResize(nsIntRect &aWindowRect); michael@0: bool OnGesture(WPARAM wParam, LPARAM lParam); michael@0: bool OnTouch(WPARAM wParam, LPARAM lParam); michael@0: bool OnHotKey(WPARAM wParam, LPARAM lParam); michael@0: bool OnPaint(HDC aDC, uint32_t aNestingLevel); michael@0: void OnWindowPosChanged(WINDOWPOS* wp); michael@0: void OnWindowPosChanging(LPWINDOWPOS& info); michael@0: void OnSysColorChanged(); michael@0: michael@0: /** michael@0: * Function that registers when the user has been active (used for detecting michael@0: * when the user is idle). michael@0: */ michael@0: void UserActivity(); michael@0: michael@0: int32_t GetHeight(int32_t aProposedHeight); michael@0: void GetWindowClass(nsString& aWindowClass); michael@0: void GetWindowPopupClass(nsString& aWindowClass); michael@0: virtual DWORD WindowStyle(); michael@0: DWORD WindowExStyle(); michael@0: michael@0: void RegisterWindowClass(const nsString& aClassName, michael@0: UINT aExtraStyle, michael@0: LPWSTR aIconID); michael@0: michael@0: /** michael@0: * XP and Vista theming support for windows with rounded edges michael@0: */ michael@0: void ClearThemeRegion(); michael@0: void SetThemeRegion(); michael@0: michael@0: /** michael@0: * Popup hooks michael@0: */ michael@0: static void ScheduleHookTimer(HWND aWnd, UINT aMsgId); michael@0: static void RegisterSpecialDropdownHooks(); michael@0: static void UnregisterSpecialDropdownHooks(); michael@0: static bool GetPopupsToRollup(nsIRollupListener* aRollupListener, michael@0: uint32_t* aPopupsToRollup); michael@0: static bool NeedsToHandleNCActivateDelayed(HWND aWnd); michael@0: static bool DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult); michael@0: michael@0: /** michael@0: * Window transparency helpers michael@0: */ michael@0: #ifdef MOZ_XUL michael@0: private: michael@0: void SetWindowTranslucencyInner(nsTransparencyMode aMode); michael@0: nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; } michael@0: void ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bool force = false); michael@0: nsresult UpdateTranslucentWindow(); michael@0: void ClearTranslucentWindow(); michael@0: void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode); michael@0: void UpdateGlass(); michael@0: protected: michael@0: #endif // MOZ_XUL michael@0: michael@0: static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult); michael@0: void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam); michael@0: michael@0: /** michael@0: * Misc. michael@0: */ michael@0: void StopFlashing(); michael@0: static bool IsTopLevelMouseExit(HWND aWnd); michael@0: nsresult SetWindowClipRegion(const nsTArray& aRects, michael@0: bool aIntersectWithExisting); michael@0: nsIntRegion GetRegionToPaint(bool aForceFullRepaint, michael@0: PAINTSTRUCT ps, HDC aDC); michael@0: static void ActivateOtherWindowHelper(HWND aWnd); michael@0: void ClearCachedResources(); michael@0: nsIWidgetListener* GetPaintListener(); michael@0: static bool IsRenderMode(gfxWindowsPlatform::RenderMode aMode); michael@0: michael@0: protected: michael@0: nsCOMPtr mParent; michael@0: nsIntSize mLastSize; michael@0: nsIntPoint mLastPoint; michael@0: HWND mWnd; michael@0: WNDPROC mPrevWndProc; michael@0: HBRUSH mBrush; michael@0: bool mIsTopWidgetWindow; michael@0: bool mInDtor; michael@0: bool mIsVisible; michael@0: bool mUnicodeWidget; michael@0: bool mPainting; michael@0: bool mTouchWindow; michael@0: bool mDisplayPanFeedback; michael@0: bool mHideChrome; michael@0: bool mIsRTL; michael@0: bool mFullscreenMode; michael@0: bool mMousePresent; michael@0: bool mDestroyCalled; michael@0: uint32_t mBlurSuppressLevel; michael@0: DWORD_PTR mOldStyle; michael@0: DWORD_PTR mOldExStyle; michael@0: nsNativeDragTarget* mNativeDragTarget; michael@0: HKL mLastKeyboardLayout; michael@0: nsSizeMode mOldSizeMode; michael@0: nsSizeMode mLastSizeMode; michael@0: WindowHook mWindowHook; michael@0: DWORD mAssumeWheelIsZoomUntil; michael@0: uint32_t mPickerDisplayCount; michael@0: HICON mIconSmall; michael@0: HICON mIconBig; michael@0: static bool sDropShadowEnabled; michael@0: static uint32_t sInstanceCount; michael@0: static TriStateBool sCanQuit; michael@0: static nsWindow* sCurrentWindow; michael@0: static BOOL sIsOleInitialized; michael@0: static HCURSOR sHCursor; michael@0: static imgIContainer* sCursorImgContainer; michael@0: static bool sSwitchKeyboardLayout; michael@0: static bool sJustGotDeactivate; michael@0: static bool sJustGotActivate; michael@0: static bool sIsInMouseCapture; michael@0: static int sTrimOnMinimize; michael@0: static const char* sDefaultMainWindowClass; michael@0: static bool sAllowD3D9; michael@0: michael@0: // Always use the helper method to read this property. See bug 603793. michael@0: static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor; michael@0: static bool HasBogusPopupsDropShadowOnMultiMonitor(); michael@0: michael@0: static uint32_t sOOPPPluginFocusEvent; michael@0: michael@0: // Non-client margin settings michael@0: // Pre-calculated outward offset applied to default frames michael@0: nsIntMargin mNonClientOffset; michael@0: // Margins set by the owner michael@0: nsIntMargin mNonClientMargins; michael@0: michael@0: // Indicates custom frames are enabled michael@0: bool mCustomNonClient; michael@0: // Cached copy of L&F's resize border michael@0: int32_t mHorResizeMargin; michael@0: int32_t mVertResizeMargin; michael@0: // Height of the caption plus border michael@0: int32_t mCaptionHeight; michael@0: michael@0: nsCOMPtr mIdleService; michael@0: michael@0: // Hook Data Memebers for Dropdowns. sProcessHook Tells the michael@0: // hook methods whether they should be processing the hook michael@0: // messages. michael@0: static HHOOK sMsgFilterHook; michael@0: static HHOOK sCallProcHook; michael@0: static HHOOK sCallMouseHook; michael@0: static bool sProcessHook; michael@0: static UINT sRollupMsgId; michael@0: static HWND sRollupMsgWnd; michael@0: static UINT sHookTimerId; michael@0: michael@0: // Mouse Clicks - static variable definitions for figuring michael@0: // out 1 - 3 Clicks. michael@0: static POINT sLastMousePoint; michael@0: static POINT sLastMouseMovePoint; michael@0: static LONG sLastMouseDownTime; michael@0: static LONG sLastClickCount; michael@0: static BYTE sLastMouseButton; michael@0: michael@0: // Graphics michael@0: HDC mPaintDC; // only set during painting michael@0: HDC mCompositeDC; // only set during StartRemoteDrawing michael@0: michael@0: nsIntRect mLastPaintBounds; michael@0: michael@0: // Transparency michael@0: #ifdef MOZ_XUL michael@0: // Use layered windows to support full 256 level alpha translucency michael@0: nsRefPtr mTransparentSurface; michael@0: HDC mMemoryDC; michael@0: nsTransparencyMode mTransparencyMode; michael@0: nsIntRegion mPossiblyTransparentRegion; michael@0: MARGINS mGlassMargins; michael@0: #endif // MOZ_XUL michael@0: michael@0: // Win7 Gesture processing and management michael@0: nsWinGesture mGesture; michael@0: michael@0: // Weak ref to the nsITaskbarWindowPreview associated with this window michael@0: nsWeakPtr mTaskbarPreview; michael@0: // True if the taskbar (possibly through the tab preview) tells us that the michael@0: // icon has been created on the taskbar. michael@0: bool mHasTaskbarIconBeenCreated; michael@0: michael@0: // Indicates that mouse events should be ignored and pass through to the michael@0: // window below. This is currently only used for popups. michael@0: bool mMouseTransparent; michael@0: michael@0: // The point in time at which the last paint completed. We use this to avoid michael@0: // painting too rapidly in response to frequent input events. michael@0: TimeStamp mLastPaintEndTime; michael@0: michael@0: // Caching for hit test results michael@0: POINT mCachedHitTestPoint; michael@0: TimeStamp mCachedHitTestTime; michael@0: int32_t mCachedHitTestResult; michael@0: michael@0: static bool sNeedsToInitMouseWheelSettings; michael@0: static void InitMouseWheelScrollData(); michael@0: }; michael@0: michael@0: /** michael@0: * A child window is a window with different style. michael@0: */ michael@0: class ChildWindow : public nsWindow { michael@0: michael@0: public: michael@0: ChildWindow() {} michael@0: michael@0: protected: michael@0: virtual DWORD WindowStyle(); michael@0: }; michael@0: michael@0: #endif // Window_h__