1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/windows/nsWindow.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,596 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef Window_h__ 1.10 +#define Window_h__ 1.11 + 1.12 +/* 1.13 + * nsWindow - Native window management and event handling. 1.14 + */ 1.15 + 1.16 +#include "nsAutoPtr.h" 1.17 +#include "nsBaseWidget.h" 1.18 +#include "nsWindowBase.h" 1.19 +#include "nsdefs.h" 1.20 +#include "nsIdleService.h" 1.21 +#include "nsToolkit.h" 1.22 +#include "nsString.h" 1.23 +#include "nsTArray.h" 1.24 +#include "gfxWindowsPlatform.h" 1.25 +#include "gfxWindowsSurface.h" 1.26 +#include "nsWindowDbg.h" 1.27 +#include "cairo.h" 1.28 +#include "nsITimer.h" 1.29 +#include "nsRegion.h" 1.30 +#include "mozilla/EventForwards.h" 1.31 +#include "mozilla/MouseEvents.h" 1.32 +#include "mozilla/TimeStamp.h" 1.33 +#include "nsMargin.h" 1.34 + 1.35 +#include "nsWinGesture.h" 1.36 + 1.37 +#include "WindowHook.h" 1.38 +#include "TaskbarWindowPreview.h" 1.39 + 1.40 +#ifdef ACCESSIBILITY 1.41 +#include "oleacc.h" 1.42 +#include "mozilla/a11y/Accessible.h" 1.43 +#endif 1.44 + 1.45 +#include "nsUXThemeData.h" 1.46 + 1.47 +#include "nsIDOMMouseEvent.h" 1.48 + 1.49 +#include "nsIIdleServiceInternal.h" 1.50 + 1.51 +/** 1.52 + * Forward class definitions 1.53 + */ 1.54 + 1.55 +class nsNativeDragTarget; 1.56 +class nsIRollupListener; 1.57 +class nsIFile; 1.58 +class nsIntRegion; 1.59 +class imgIContainer; 1.60 + 1.61 +namespace mozilla { 1.62 +namespace widget { 1.63 +class NativeKey; 1.64 +class ModifierKeyState; 1.65 +struct MSGResult; 1.66 +} // namespace widget 1.67 +} // namespacw mozilla; 1.68 + 1.69 +/** 1.70 + * Native WIN32 window wrapper. 1.71 + */ 1.72 + 1.73 +class nsWindow : public nsWindowBase 1.74 +{ 1.75 + typedef mozilla::TimeStamp TimeStamp; 1.76 + typedef mozilla::TimeDuration TimeDuration; 1.77 + typedef mozilla::widget::WindowHook WindowHook; 1.78 + typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview; 1.79 + typedef mozilla::widget::NativeKey NativeKey; 1.80 + typedef mozilla::widget::MSGResult MSGResult; 1.81 +public: 1.82 + nsWindow(); 1.83 + virtual ~nsWindow(); 1.84 + 1.85 + NS_DECL_ISUPPORTS_INHERITED 1.86 + 1.87 + friend class nsWindowGfx; 1.88 + 1.89 + // nsWindowBase 1.90 + virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent, 1.91 + nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE; 1.92 + virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; 1.93 + virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; 1.94 + virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; 1.95 + virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE; 1.96 + virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; } 1.97 + 1.98 + // nsIWidget interface 1.99 + NS_IMETHOD Create(nsIWidget *aParent, 1.100 + nsNativeWidget aNativeParent, 1.101 + const nsIntRect &aRect, 1.102 + nsDeviceContext *aContext, 1.103 + nsWidgetInitData *aInitData = nullptr); 1.104 + NS_IMETHOD Destroy(); 1.105 + NS_IMETHOD SetParent(nsIWidget *aNewParent); 1.106 + virtual nsIWidget* GetParent(void); 1.107 + virtual float GetDPI(); 1.108 + virtual double GetDefaultScaleInternal(); 1.109 + NS_IMETHOD Show(bool bState); 1.110 + virtual bool IsVisible() const; 1.111 + NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY); 1.112 + virtual void SetSizeConstraints(const SizeConstraints& aConstraints); 1.113 + NS_IMETHOD Move(double aX, double aY); 1.114 + NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint); 1.115 + NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint); 1.116 + NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent, 1.117 + int32_t aHorizontal, 1.118 + int32_t aVertical); 1.119 + NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate); 1.120 + NS_IMETHOD SetSizeMode(int32_t aMode); 1.121 + NS_IMETHOD Enable(bool aState); 1.122 + virtual bool IsEnabled() const; 1.123 + NS_IMETHOD SetFocus(bool aRaise); 1.124 + NS_IMETHOD GetBounds(nsIntRect &aRect); 1.125 + NS_IMETHOD GetScreenBounds(nsIntRect &aRect); 1.126 + NS_IMETHOD GetClientBounds(nsIntRect &aRect); 1.127 + virtual nsIntPoint GetClientOffset(); 1.128 + void SetBackgroundColor(const nscolor &aColor); 1.129 + NS_IMETHOD SetCursor(imgIContainer* aCursor, 1.130 + uint32_t aHotspotX, uint32_t aHotspotY); 1.131 + NS_IMETHOD SetCursor(nsCursor aCursor); 1.132 + virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations); 1.133 + NS_IMETHOD MakeFullScreen(bool aFullScreen); 1.134 + NS_IMETHOD HideWindowChrome(bool aShouldHide); 1.135 + NS_IMETHOD Invalidate(bool aEraseBackground = false, 1.136 + bool aUpdateNCArea = false, 1.137 + bool aIncludeChildren = false); 1.138 + NS_IMETHOD Invalidate(const nsIntRect & aRect); 1.139 + virtual void* GetNativeData(uint32_t aDataType); 1.140 + virtual void FreeNativeData(void * data, uint32_t aDataType); 1.141 + NS_IMETHOD SetTitle(const nsAString& aTitle); 1.142 + NS_IMETHOD SetIcon(const nsAString& aIconSpec); 1.143 + virtual nsIntPoint WidgetToScreenOffset(); 1.144 + virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize); 1.145 + NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, 1.146 + nsEventStatus& aStatus); 1.147 + NS_IMETHOD EnableDragDrop(bool aEnable); 1.148 + NS_IMETHOD CaptureMouse(bool aCapture); 1.149 + NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, 1.150 + bool aDoCapture); 1.151 + NS_IMETHOD GetAttention(int32_t aCycleCount); 1.152 + virtual bool HasPendingInputEvent(); 1.153 + virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, 1.154 + LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, 1.155 + LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, 1.156 + bool* aAllowRetaining = nullptr); 1.157 + gfxASurface *GetThebesSurface(); 1.158 + NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect); 1.159 + NS_IMETHOD OverrideSystemMouseScrollSpeed(double aOriginalDeltaX, 1.160 + double aOriginalDeltaY, 1.161 + double& aOverriddenDeltaX, 1.162 + double& aOverriddenDeltaY); 1.163 + 1.164 + virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout, 1.165 + int32_t aNativeKeyCode, 1.166 + uint32_t aModifierFlags, 1.167 + const nsAString& aCharacters, 1.168 + const nsAString& aUnmodifiedCharacters); 1.169 + virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint, 1.170 + uint32_t aNativeMessage, 1.171 + uint32_t aModifierFlags); 1.172 + 1.173 + virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) 1.174 + { return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); } 1.175 + 1.176 + virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint, 1.177 + uint32_t aNativeMessage, 1.178 + double aDeltaX, 1.179 + double aDeltaY, 1.180 + double aDeltaZ, 1.181 + uint32_t aModifierFlags, 1.182 + uint32_t aAdditionalFlags); 1.183 + NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) MOZ_OVERRIDE; 1.184 + NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, 1.185 + const InputContextAction& aAction); 1.186 + NS_IMETHOD_(InputContext) GetInputContext(); 1.187 + NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState); 1.188 + NS_IMETHOD RegisterTouchWindow(); 1.189 + NS_IMETHOD UnregisterTouchWindow(); 1.190 +#ifdef MOZ_XUL 1.191 + virtual void SetTransparencyMode(nsTransparencyMode aMode); 1.192 + virtual nsTransparencyMode GetTransparencyMode(); 1.193 + virtual void UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion); 1.194 +#endif // MOZ_XUL 1.195 + virtual nsIMEUpdatePreference GetIMEUpdatePreference(); 1.196 + NS_IMETHOD GetNonClientMargins(nsIntMargin &margins); 1.197 + NS_IMETHOD SetNonClientMargins(nsIntMargin &margins); 1.198 + void SetDrawsInTitlebar(bool aState); 1.199 + mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE; 1.200 + virtual void EndRemoteDrawing() MOZ_OVERRIDE; 1.201 + 1.202 + virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) MOZ_OVERRIDE; 1.203 + 1.204 + /** 1.205 + * Event helpers 1.206 + */ 1.207 + virtual bool DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, 1.208 + LPARAM lParam, 1.209 + bool aIsContextMenuKey = false, 1.210 + int16_t aButton = mozilla::WidgetMouseEvent::eLeftButton, 1.211 + uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE); 1.212 + virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent, 1.213 + nsEventStatus& aStatus); 1.214 + void DispatchPendingEvents(); 1.215 + bool DispatchPluginEvent(UINT aMessage, 1.216 + WPARAM aWParam, 1.217 + LPARAM aLParam, 1.218 + bool aDispatchPendingEvents); 1.219 + 1.220 + void SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker 1.221 + bool BlurEventsSuppressed(); 1.222 +#ifdef ACCESSIBILITY 1.223 + /** 1.224 + * Return an accessible associated with the window. 1.225 + */ 1.226 + mozilla::a11y::Accessible* GetAccessible(); 1.227 +#endif // ACCESSIBILITY 1.228 + 1.229 + /** 1.230 + * Window utilities 1.231 + */ 1.232 + nsWindow* GetTopLevelWindow(bool aStopOnDialogOrPopup); 1.233 + WNDPROC GetPrevWindowProc() { return mPrevWndProc; } 1.234 + WindowHook& GetWindowHook() { return mWindowHook; } 1.235 + nsWindow* GetParentWindow(bool aIncludeOwner); 1.236 + // Get an array of all nsWindow*s on the main thread. 1.237 + typedef void (WindowEnumCallback)(nsWindow*); 1.238 + static void EnumAllWindows(WindowEnumCallback aCallback); 1.239 + 1.240 + /** 1.241 + * Misc. 1.242 + */ 1.243 + virtual bool AutoErase(HDC dc); 1.244 + 1.245 + /** 1.246 + * Start allowing Direct3D9 to be used by widgets when GetLayerManager is 1.247 + * called. 1.248 + * 1.249 + * @param aReinitialize Call GetLayerManager on widgets to ensure D3D9 is 1.250 + * initialized, this is usually called when this function 1.251 + * is triggered by timeout and not user/web interaction. 1.252 + */ 1.253 + static void StartAllowingD3D9(bool aReinitialize); 1.254 + 1.255 + /** 1.256 + * AssociateDefaultIMC() associates or disassociates the default IMC for 1.257 + * the window. 1.258 + * 1.259 + * @param aAssociate TRUE, associates the default IMC with the window. 1.260 + * Otherwise, disassociates the default IMC from the 1.261 + * window. 1.262 + * @return TRUE if this method associated the default IMC with 1.263 + * disassociated window or disassociated the default IMC 1.264 + * from associated window. 1.265 + * Otherwise, i.e., if this method did nothing actually, 1.266 + * FALSE. 1.267 + */ 1.268 + bool AssociateDefaultIMC(bool aAssociate); 1.269 + 1.270 + bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; } 1.271 + // Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window 1.272 + // has its icon placed on the taskbar. 1.273 + void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; } 1.274 + 1.275 + // Getter/setter for the nsITaskbarWindowPreview for this nsWindow 1.276 + already_AddRefed<nsITaskbarWindowPreview> GetTaskbarPreview() { 1.277 + nsCOMPtr<nsITaskbarWindowPreview> preview(do_QueryReferent(mTaskbarPreview)); 1.278 + return preview.forget(); 1.279 + } 1.280 + void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { mTaskbarPreview = do_GetWeakReference(preview); } 1.281 + 1.282 + NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); 1.283 + 1.284 + // Open file picker tracking 1.285 + void PickerOpen(); 1.286 + void PickerClosed(); 1.287 + 1.288 + bool const DestroyCalled() { return mDestroyCalled; } 1.289 + 1.290 + virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints); 1.291 + 1.292 + virtual bool ShouldUseOffMainThreadCompositing(); 1.293 + 1.294 +protected: 1.295 + 1.296 + virtual void WindowUsesOMTC() MOZ_OVERRIDE; 1.297 + 1.298 + // A magic number to identify the FAKETRACKPOINTSCROLLABLE window created 1.299 + // when the trackpoint hack is enabled. 1.300 + enum { eFakeTrackPointScrollableID = 0x46545053 }; 1.301 + 1.302 + /** 1.303 + * Callbacks 1.304 + */ 1.305 + static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 1.306 + static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 1.307 + 1.308 + static BOOL CALLBACK BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg); 1.309 + static BOOL CALLBACK BroadcastMsg(HWND aTopWindow, LPARAM aMsg); 1.310 + static BOOL CALLBACK DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg); 1.311 + static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg); 1.312 + static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg); 1.313 + static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam); 1.314 + static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam); 1.315 + static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam); 1.316 + static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ); 1.317 + static BOOL CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam); 1.318 + static BOOL CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam); 1.319 + static BOOL CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam); 1.320 + static void AllowD3D9Callback(nsWindow *aWindow); 1.321 + static void AllowD3D9WithReinitializeCallback(nsWindow *aWindow); 1.322 + 1.323 + /** 1.324 + * Window utilities 1.325 + */ 1.326 + LPARAM lParamToScreen(LPARAM lParam); 1.327 + LPARAM lParamToClient(LPARAM lParam); 1.328 + virtual void SubclassWindow(BOOL bState); 1.329 + bool CanTakeFocus(); 1.330 + bool UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true); 1.331 + void UpdateGetWindowInfoCaptionStatus(bool aActiveCaption); 1.332 + void ResetLayout(); 1.333 + void InvalidateNonClientRegion(); 1.334 + HRGN ExcludeNonClientFromPaintRegion(HRGN aRegion); 1.335 + static void GetMainWindowClass(nsAString& aClass); 1.336 + bool HasGlass() const { 1.337 + return mTransparencyMode == eTransparencyGlass || 1.338 + mTransparencyMode == eTransparencyBorderlessGlass; 1.339 + } 1.340 + HWND GetOwnerWnd() const 1.341 + { 1.342 + return ::GetWindow(mWnd, GW_OWNER); 1.343 + } 1.344 + bool IsOwnerForegroundWindow() const 1.345 + { 1.346 + HWND owner = GetOwnerWnd(); 1.347 + return owner && owner == ::GetForegroundWindow(); 1.348 + } 1.349 + bool IsPopup() const 1.350 + { 1.351 + return mWindowType == eWindowType_popup; 1.352 + } 1.353 + 1.354 + 1.355 + /** 1.356 + * Event processing helpers 1.357 + */ 1.358 + void DispatchFocusToTopLevelWindow(bool aIsActivate); 1.359 + bool DispatchStandardEvent(uint32_t aMsg); 1.360 + void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam); 1.361 + virtual bool ProcessMessage(UINT msg, WPARAM &wParam, 1.362 + LPARAM &lParam, LRESULT *aRetValue); 1.363 + bool ExternalHandlerProcessMessage( 1.364 + UINT aMessage, WPARAM& aWParam, 1.365 + LPARAM& aLParam, MSGResult& aResult); 1.366 + bool ProcessMessageForPlugin(const MSG &aMsg, 1.367 + MSGResult& aResult); 1.368 + LRESULT ProcessCharMessage(const MSG &aMsg, 1.369 + bool *aEventDispatched); 1.370 + LRESULT ProcessKeyUpMessage(const MSG &aMsg, 1.371 + bool *aEventDispatched); 1.372 + LRESULT ProcessKeyDownMessage(const MSG &aMsg, 1.373 + bool *aEventDispatched); 1.374 + static bool EventIsInsideWindow(nsWindow* aWindow); 1.375 + // Convert nsEventStatus value to a windows boolean 1.376 + static bool ConvertStatus(nsEventStatus aStatus); 1.377 + static void PostSleepWakeNotification(const bool aIsSleepMode); 1.378 + int32_t ClientMarginHitTestPoint(int32_t mx, int32_t my); 1.379 + 1.380 + /** 1.381 + * Event handlers 1.382 + */ 1.383 + virtual void OnDestroy(); 1.384 + virtual bool OnResize(nsIntRect &aWindowRect); 1.385 + bool OnGesture(WPARAM wParam, LPARAM lParam); 1.386 + bool OnTouch(WPARAM wParam, LPARAM lParam); 1.387 + bool OnHotKey(WPARAM wParam, LPARAM lParam); 1.388 + bool OnPaint(HDC aDC, uint32_t aNestingLevel); 1.389 + void OnWindowPosChanged(WINDOWPOS* wp); 1.390 + void OnWindowPosChanging(LPWINDOWPOS& info); 1.391 + void OnSysColorChanged(); 1.392 + 1.393 + /** 1.394 + * Function that registers when the user has been active (used for detecting 1.395 + * when the user is idle). 1.396 + */ 1.397 + void UserActivity(); 1.398 + 1.399 + int32_t GetHeight(int32_t aProposedHeight); 1.400 + void GetWindowClass(nsString& aWindowClass); 1.401 + void GetWindowPopupClass(nsString& aWindowClass); 1.402 + virtual DWORD WindowStyle(); 1.403 + DWORD WindowExStyle(); 1.404 + 1.405 + void RegisterWindowClass(const nsString& aClassName, 1.406 + UINT aExtraStyle, 1.407 + LPWSTR aIconID); 1.408 + 1.409 + /** 1.410 + * XP and Vista theming support for windows with rounded edges 1.411 + */ 1.412 + void ClearThemeRegion(); 1.413 + void SetThemeRegion(); 1.414 + 1.415 + /** 1.416 + * Popup hooks 1.417 + */ 1.418 + static void ScheduleHookTimer(HWND aWnd, UINT aMsgId); 1.419 + static void RegisterSpecialDropdownHooks(); 1.420 + static void UnregisterSpecialDropdownHooks(); 1.421 + static bool GetPopupsToRollup(nsIRollupListener* aRollupListener, 1.422 + uint32_t* aPopupsToRollup); 1.423 + static bool NeedsToHandleNCActivateDelayed(HWND aWnd); 1.424 + static bool DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult); 1.425 + 1.426 + /** 1.427 + * Window transparency helpers 1.428 + */ 1.429 +#ifdef MOZ_XUL 1.430 +private: 1.431 + void SetWindowTranslucencyInner(nsTransparencyMode aMode); 1.432 + nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; } 1.433 + void ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bool force = false); 1.434 + nsresult UpdateTranslucentWindow(); 1.435 + void ClearTranslucentWindow(); 1.436 + void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode); 1.437 + void UpdateGlass(); 1.438 +protected: 1.439 +#endif // MOZ_XUL 1.440 + 1.441 + static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult); 1.442 + void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam); 1.443 + 1.444 + /** 1.445 + * Misc. 1.446 + */ 1.447 + void StopFlashing(); 1.448 + static bool IsTopLevelMouseExit(HWND aWnd); 1.449 + nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects, 1.450 + bool aIntersectWithExisting); 1.451 + nsIntRegion GetRegionToPaint(bool aForceFullRepaint, 1.452 + PAINTSTRUCT ps, HDC aDC); 1.453 + static void ActivateOtherWindowHelper(HWND aWnd); 1.454 + void ClearCachedResources(); 1.455 + nsIWidgetListener* GetPaintListener(); 1.456 + static bool IsRenderMode(gfxWindowsPlatform::RenderMode aMode); 1.457 + 1.458 +protected: 1.459 + nsCOMPtr<nsIWidget> mParent; 1.460 + nsIntSize mLastSize; 1.461 + nsIntPoint mLastPoint; 1.462 + HWND mWnd; 1.463 + WNDPROC mPrevWndProc; 1.464 + HBRUSH mBrush; 1.465 + bool mIsTopWidgetWindow; 1.466 + bool mInDtor; 1.467 + bool mIsVisible; 1.468 + bool mUnicodeWidget; 1.469 + bool mPainting; 1.470 + bool mTouchWindow; 1.471 + bool mDisplayPanFeedback; 1.472 + bool mHideChrome; 1.473 + bool mIsRTL; 1.474 + bool mFullscreenMode; 1.475 + bool mMousePresent; 1.476 + bool mDestroyCalled; 1.477 + uint32_t mBlurSuppressLevel; 1.478 + DWORD_PTR mOldStyle; 1.479 + DWORD_PTR mOldExStyle; 1.480 + nsNativeDragTarget* mNativeDragTarget; 1.481 + HKL mLastKeyboardLayout; 1.482 + nsSizeMode mOldSizeMode; 1.483 + nsSizeMode mLastSizeMode; 1.484 + WindowHook mWindowHook; 1.485 + DWORD mAssumeWheelIsZoomUntil; 1.486 + uint32_t mPickerDisplayCount; 1.487 + HICON mIconSmall; 1.488 + HICON mIconBig; 1.489 + static bool sDropShadowEnabled; 1.490 + static uint32_t sInstanceCount; 1.491 + static TriStateBool sCanQuit; 1.492 + static nsWindow* sCurrentWindow; 1.493 + static BOOL sIsOleInitialized; 1.494 + static HCURSOR sHCursor; 1.495 + static imgIContainer* sCursorImgContainer; 1.496 + static bool sSwitchKeyboardLayout; 1.497 + static bool sJustGotDeactivate; 1.498 + static bool sJustGotActivate; 1.499 + static bool sIsInMouseCapture; 1.500 + static int sTrimOnMinimize; 1.501 + static const char* sDefaultMainWindowClass; 1.502 + static bool sAllowD3D9; 1.503 + 1.504 + // Always use the helper method to read this property. See bug 603793. 1.505 + static TriStateBool sHasBogusPopupsDropShadowOnMultiMonitor; 1.506 + static bool HasBogusPopupsDropShadowOnMultiMonitor(); 1.507 + 1.508 + static uint32_t sOOPPPluginFocusEvent; 1.509 + 1.510 + // Non-client margin settings 1.511 + // Pre-calculated outward offset applied to default frames 1.512 + nsIntMargin mNonClientOffset; 1.513 + // Margins set by the owner 1.514 + nsIntMargin mNonClientMargins; 1.515 + 1.516 + // Indicates custom frames are enabled 1.517 + bool mCustomNonClient; 1.518 + // Cached copy of L&F's resize border 1.519 + int32_t mHorResizeMargin; 1.520 + int32_t mVertResizeMargin; 1.521 + // Height of the caption plus border 1.522 + int32_t mCaptionHeight; 1.523 + 1.524 + nsCOMPtr<nsIIdleServiceInternal> mIdleService; 1.525 + 1.526 + // Hook Data Memebers for Dropdowns. sProcessHook Tells the 1.527 + // hook methods whether they should be processing the hook 1.528 + // messages. 1.529 + static HHOOK sMsgFilterHook; 1.530 + static HHOOK sCallProcHook; 1.531 + static HHOOK sCallMouseHook; 1.532 + static bool sProcessHook; 1.533 + static UINT sRollupMsgId; 1.534 + static HWND sRollupMsgWnd; 1.535 + static UINT sHookTimerId; 1.536 + 1.537 + // Mouse Clicks - static variable definitions for figuring 1.538 + // out 1 - 3 Clicks. 1.539 + static POINT sLastMousePoint; 1.540 + static POINT sLastMouseMovePoint; 1.541 + static LONG sLastMouseDownTime; 1.542 + static LONG sLastClickCount; 1.543 + static BYTE sLastMouseButton; 1.544 + 1.545 + // Graphics 1.546 + HDC mPaintDC; // only set during painting 1.547 + HDC mCompositeDC; // only set during StartRemoteDrawing 1.548 + 1.549 + nsIntRect mLastPaintBounds; 1.550 + 1.551 + // Transparency 1.552 +#ifdef MOZ_XUL 1.553 + // Use layered windows to support full 256 level alpha translucency 1.554 + nsRefPtr<gfxASurface> mTransparentSurface; 1.555 + HDC mMemoryDC; 1.556 + nsTransparencyMode mTransparencyMode; 1.557 + nsIntRegion mPossiblyTransparentRegion; 1.558 + MARGINS mGlassMargins; 1.559 +#endif // MOZ_XUL 1.560 + 1.561 + // Win7 Gesture processing and management 1.562 + nsWinGesture mGesture; 1.563 + 1.564 + // Weak ref to the nsITaskbarWindowPreview associated with this window 1.565 + nsWeakPtr mTaskbarPreview; 1.566 + // True if the taskbar (possibly through the tab preview) tells us that the 1.567 + // icon has been created on the taskbar. 1.568 + bool mHasTaskbarIconBeenCreated; 1.569 + 1.570 + // Indicates that mouse events should be ignored and pass through to the 1.571 + // window below. This is currently only used for popups. 1.572 + bool mMouseTransparent; 1.573 + 1.574 + // The point in time at which the last paint completed. We use this to avoid 1.575 + // painting too rapidly in response to frequent input events. 1.576 + TimeStamp mLastPaintEndTime; 1.577 + 1.578 + // Caching for hit test results 1.579 + POINT mCachedHitTestPoint; 1.580 + TimeStamp mCachedHitTestTime; 1.581 + int32_t mCachedHitTestResult; 1.582 + 1.583 + static bool sNeedsToInitMouseWheelSettings; 1.584 + static void InitMouseWheelScrollData(); 1.585 +}; 1.586 + 1.587 +/** 1.588 + * A child window is a window with different style. 1.589 + */ 1.590 +class ChildWindow : public nsWindow { 1.591 + 1.592 +public: 1.593 + ChildWindow() {} 1.594 + 1.595 +protected: 1.596 + virtual DWORD WindowStyle(); 1.597 +}; 1.598 + 1.599 +#endif // Window_h__