widget/windows/nsWindow.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     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 Window_h__
     7 #define Window_h__
     9 /*
    10  * nsWindow - Native window management and event handling.
    11  */
    13 #include "nsAutoPtr.h"
    14 #include "nsBaseWidget.h"
    15 #include "nsWindowBase.h"
    16 #include "nsdefs.h"
    17 #include "nsIdleService.h"
    18 #include "nsToolkit.h"
    19 #include "nsString.h"
    20 #include "nsTArray.h"
    21 #include "gfxWindowsPlatform.h"
    22 #include "gfxWindowsSurface.h"
    23 #include "nsWindowDbg.h"
    24 #include "cairo.h"
    25 #include "nsITimer.h"
    26 #include "nsRegion.h"
    27 #include "mozilla/EventForwards.h"
    28 #include "mozilla/MouseEvents.h"
    29 #include "mozilla/TimeStamp.h"
    30 #include "nsMargin.h"
    32 #include "nsWinGesture.h"
    34 #include "WindowHook.h"
    35 #include "TaskbarWindowPreview.h"
    37 #ifdef ACCESSIBILITY
    38 #include "oleacc.h"
    39 #include "mozilla/a11y/Accessible.h"
    40 #endif
    42 #include "nsUXThemeData.h"
    44 #include "nsIDOMMouseEvent.h"
    46 #include "nsIIdleServiceInternal.h"
    48 /**
    49  * Forward class definitions
    50  */
    52 class nsNativeDragTarget;
    53 class nsIRollupListener;
    54 class nsIFile;
    55 class nsIntRegion;
    56 class imgIContainer;
    58 namespace mozilla {
    59 namespace widget {
    60 class NativeKey;
    61 class ModifierKeyState;
    62 struct MSGResult;
    63 } // namespace widget
    64 } // namespacw mozilla;
    66 /**
    67  * Native WIN32 window wrapper.
    68  */
    70 class nsWindow : public nsWindowBase
    71 {
    72   typedef mozilla::TimeStamp TimeStamp;
    73   typedef mozilla::TimeDuration TimeDuration;
    74   typedef mozilla::widget::WindowHook WindowHook;
    75   typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
    76   typedef mozilla::widget::NativeKey NativeKey;
    77   typedef mozilla::widget::MSGResult MSGResult;
    78 public:
    79   nsWindow();
    80   virtual ~nsWindow();
    82   NS_DECL_ISUPPORTS_INHERITED
    84   friend class nsWindowGfx;
    86   // nsWindowBase
    87   virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
    88                          nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
    89   virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
    90   virtual bool DispatchKeyboardEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
    91   virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
    92   virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
    93   virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
    95   // nsIWidget interface
    96   NS_IMETHOD              Create(nsIWidget *aParent,
    97                                  nsNativeWidget aNativeParent,
    98                                  const nsIntRect &aRect,
    99                                  nsDeviceContext *aContext,
   100                                  nsWidgetInitData *aInitData = nullptr);
   101   NS_IMETHOD              Destroy();
   102   NS_IMETHOD              SetParent(nsIWidget *aNewParent);
   103   virtual nsIWidget*      GetParent(void);
   104   virtual float           GetDPI();
   105   virtual double          GetDefaultScaleInternal();
   106   NS_IMETHOD              Show(bool bState);
   107   virtual bool            IsVisible() const;
   108   NS_IMETHOD              ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY);
   109   virtual void            SetSizeConstraints(const SizeConstraints& aConstraints);
   110   NS_IMETHOD              Move(double aX, double aY);
   111   NS_IMETHOD              Resize(double aWidth, double aHeight, bool aRepaint);
   112   NS_IMETHOD              Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
   113   NS_IMETHOD              BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
   114                                           int32_t aHorizontal,
   115                                           int32_t aVertical);
   116   NS_IMETHOD              PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
   117   NS_IMETHOD              SetSizeMode(int32_t aMode);
   118   NS_IMETHOD              Enable(bool aState);
   119   virtual bool            IsEnabled() const;
   120   NS_IMETHOD              SetFocus(bool aRaise);
   121   NS_IMETHOD              GetBounds(nsIntRect &aRect);
   122   NS_IMETHOD              GetScreenBounds(nsIntRect &aRect);
   123   NS_IMETHOD              GetClientBounds(nsIntRect &aRect);
   124   virtual nsIntPoint      GetClientOffset();
   125   void                    SetBackgroundColor(const nscolor &aColor);
   126   NS_IMETHOD              SetCursor(imgIContainer* aCursor,
   127                                     uint32_t aHotspotX, uint32_t aHotspotY);
   128   NS_IMETHOD              SetCursor(nsCursor aCursor);
   129   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
   130   NS_IMETHOD              MakeFullScreen(bool aFullScreen);
   131   NS_IMETHOD              HideWindowChrome(bool aShouldHide);
   132   NS_IMETHOD              Invalidate(bool aEraseBackground = false,
   133                                      bool aUpdateNCArea = false,
   134                                      bool aIncludeChildren = false);
   135   NS_IMETHOD              Invalidate(const nsIntRect & aRect);
   136   virtual void*           GetNativeData(uint32_t aDataType);
   137   virtual void            FreeNativeData(void * data, uint32_t aDataType);
   138   NS_IMETHOD              SetTitle(const nsAString& aTitle);
   139   NS_IMETHOD              SetIcon(const nsAString& aIconSpec);
   140   virtual nsIntPoint      WidgetToScreenOffset();
   141   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize);
   142   NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
   143                                         nsEventStatus& aStatus);
   144   NS_IMETHOD              EnableDragDrop(bool aEnable);
   145   NS_IMETHOD              CaptureMouse(bool aCapture);
   146   NS_IMETHOD              CaptureRollupEvents(nsIRollupListener * aListener,
   147                                               bool aDoCapture);
   148   NS_IMETHOD              GetAttention(int32_t aCycleCount);
   149   virtual bool            HasPendingInputEvent();
   150   virtual LayerManager*   GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
   151                                           LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
   152                                           LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
   153                                           bool* aAllowRetaining = nullptr);
   154   gfxASurface             *GetThebesSurface();
   155   NS_IMETHOD              OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
   156   NS_IMETHOD              OverrideSystemMouseScrollSpeed(double aOriginalDeltaX,
   157                                                          double aOriginalDeltaY,
   158                                                          double& aOverriddenDeltaX,
   159                                                          double& aOverriddenDeltaY);
   161   virtual nsresult        SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
   162                                                    int32_t aNativeKeyCode,
   163                                                    uint32_t aModifierFlags,
   164                                                    const nsAString& aCharacters,
   165                                                    const nsAString& aUnmodifiedCharacters);
   166   virtual nsresult        SynthesizeNativeMouseEvent(nsIntPoint aPoint,
   167                                                      uint32_t aNativeMessage,
   168                                                      uint32_t aModifierFlags);
   170   virtual nsresult        SynthesizeNativeMouseMove(nsIntPoint aPoint)
   171                           { return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
   173   virtual nsresult        SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
   174                                                            uint32_t aNativeMessage,
   175                                                            double aDeltaX,
   176                                                            double aDeltaY,
   177                                                            double aDeltaZ,
   178                                                            uint32_t aModifierFlags,
   179                                                            uint32_t aAdditionalFlags);
   180   NS_IMETHOD              NotifyIME(const IMENotification& aIMENotification) MOZ_OVERRIDE;
   181   NS_IMETHOD_(void)       SetInputContext(const InputContext& aContext,
   182                                           const InputContextAction& aAction);
   183   NS_IMETHOD_(InputContext) GetInputContext();
   184   NS_IMETHOD              GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
   185   NS_IMETHOD              RegisterTouchWindow();
   186   NS_IMETHOD              UnregisterTouchWindow();
   187 #ifdef MOZ_XUL
   188   virtual void            SetTransparencyMode(nsTransparencyMode aMode);
   189   virtual nsTransparencyMode GetTransparencyMode();
   190   virtual void            UpdateOpaqueRegion(const nsIntRegion& aOpaqueRegion);
   191 #endif // MOZ_XUL
   192   virtual nsIMEUpdatePreference GetIMEUpdatePreference();
   193   NS_IMETHOD              GetNonClientMargins(nsIntMargin &margins);
   194   NS_IMETHOD              SetNonClientMargins(nsIntMargin &margins);
   195   void                    SetDrawsInTitlebar(bool aState);
   196   mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE;
   197   virtual void            EndRemoteDrawing() MOZ_OVERRIDE;
   199   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) MOZ_OVERRIDE;
   201   /**
   202    * Event helpers
   203    */
   204   virtual bool            DispatchMouseEvent(uint32_t aEventType, WPARAM wParam,
   205                                              LPARAM lParam,
   206                                              bool aIsContextMenuKey = false,
   207                                              int16_t aButton = mozilla::WidgetMouseEvent::eLeftButton,
   208                                              uint16_t aInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE);
   209   virtual bool            DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent,
   210                                               nsEventStatus& aStatus);
   211   void                    DispatchPendingEvents();
   212   bool                    DispatchPluginEvent(UINT aMessage,
   213                                               WPARAM aWParam,
   214                                               LPARAM aLParam,
   215                                               bool aDispatchPendingEvents);
   217   void                    SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
   218   bool                    BlurEventsSuppressed();
   219 #ifdef ACCESSIBILITY
   220   /**
   221    * Return an accessible associated with the window.
   222    */
   223   mozilla::a11y::Accessible* GetAccessible();
   224 #endif // ACCESSIBILITY
   226   /**
   227    * Window utilities
   228    */
   229   nsWindow*               GetTopLevelWindow(bool aStopOnDialogOrPopup);
   230   WNDPROC                 GetPrevWindowProc() { return mPrevWndProc; }
   231   WindowHook&             GetWindowHook() { return mWindowHook; }
   232   nsWindow*               GetParentWindow(bool aIncludeOwner);
   233   // Get an array of all nsWindow*s on the main thread.
   234   typedef void            (WindowEnumCallback)(nsWindow*);
   235   static void             EnumAllWindows(WindowEnumCallback aCallback);
   237   /**
   238    * Misc.
   239    */
   240   virtual bool            AutoErase(HDC dc);
   242   /**
   243    * Start allowing Direct3D9 to be used by widgets when GetLayerManager is
   244    * called.
   245    *
   246    * @param aReinitialize Call GetLayerManager on widgets to ensure D3D9 is
   247    *                      initialized, this is usually called when this function
   248    *                      is triggered by timeout and not user/web interaction.
   249    */
   250   static void             StartAllowingD3D9(bool aReinitialize);
   252   /**
   253    * AssociateDefaultIMC() associates or disassociates the default IMC for
   254    * the window.
   255    *
   256    * @param aAssociate    TRUE, associates the default IMC with the window.
   257    *                      Otherwise, disassociates the default IMC from the
   258    *                      window.
   259    * @return              TRUE if this method associated the default IMC with
   260    *                      disassociated window or disassociated the default IMC
   261    *                      from associated window.
   262    *                      Otherwise, i.e., if this method did nothing actually,
   263    *                      FALSE.
   264    */
   265   bool                    AssociateDefaultIMC(bool aAssociate);
   267   bool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; }
   268   // Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window
   269   // has its icon placed on the taskbar.
   270   void SetHasTaskbarIconBeenCreated(bool created = true) { mHasTaskbarIconBeenCreated = created; }
   272   // Getter/setter for the nsITaskbarWindowPreview for this nsWindow
   273   already_AddRefed<nsITaskbarWindowPreview> GetTaskbarPreview() {
   274     nsCOMPtr<nsITaskbarWindowPreview> preview(do_QueryReferent(mTaskbarPreview));
   275     return preview.forget();
   276   }
   277   void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { mTaskbarPreview = do_GetWeakReference(preview); }
   279   NS_IMETHOD              ReparentNativeWidget(nsIWidget* aNewParent);
   281   // Open file picker tracking
   282   void                    PickerOpen();
   283   void                    PickerClosed();
   285   bool                    const DestroyCalled() { return mDestroyCalled; }
   287   virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints);
   289   virtual bool ShouldUseOffMainThreadCompositing();
   291 protected:
   293   virtual void WindowUsesOMTC() MOZ_OVERRIDE;
   295   // A magic number to identify the FAKETRACKPOINTSCROLLABLE window created
   296   // when the trackpoint hack is enabled.
   297   enum { eFakeTrackPointScrollableID = 0x46545053 };
   299   /**
   300    * Callbacks
   301    */
   302   static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
   303   static LRESULT CALLBACK WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
   305   static BOOL CALLBACK    BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg);
   306   static BOOL CALLBACK    BroadcastMsg(HWND aTopWindow, LPARAM aMsg);
   307   static BOOL CALLBACK    DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg);
   308   static BOOL CALLBACK    RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
   309   static BOOL CALLBACK    UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
   310   static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
   311   static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
   312   static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
   313   static VOID    CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
   314   static BOOL    CALLBACK ClearResourcesCallback(HWND aChild, LPARAM aParam);
   315   static BOOL    CALLBACK EnumAllChildWindProc(HWND aWnd, LPARAM aParam);
   316   static BOOL    CALLBACK EnumAllThreadWindowProc(HWND aWnd, LPARAM aParam);
   317   static void             AllowD3D9Callback(nsWindow *aWindow);
   318   static void             AllowD3D9WithReinitializeCallback(nsWindow *aWindow);
   320   /**
   321    * Window utilities
   322    */
   323   LPARAM                  lParamToScreen(LPARAM lParam);
   324   LPARAM                  lParamToClient(LPARAM lParam);
   325   virtual void            SubclassWindow(BOOL bState);
   326   bool                    CanTakeFocus();
   327   bool                    UpdateNonClientMargins(int32_t aSizeMode = -1, bool aReflowWindow = true);
   328   void                    UpdateGetWindowInfoCaptionStatus(bool aActiveCaption);
   329   void                    ResetLayout();
   330   void                    InvalidateNonClientRegion();
   331   HRGN                    ExcludeNonClientFromPaintRegion(HRGN aRegion);
   332   static void             GetMainWindowClass(nsAString& aClass);
   333   bool                    HasGlass() const {
   334     return mTransparencyMode == eTransparencyGlass ||
   335            mTransparencyMode == eTransparencyBorderlessGlass;
   336   }
   337   HWND                    GetOwnerWnd() const
   338   {
   339     return ::GetWindow(mWnd, GW_OWNER);
   340   }
   341   bool                    IsOwnerForegroundWindow() const
   342   {
   343     HWND owner = GetOwnerWnd();
   344     return owner && owner == ::GetForegroundWindow();
   345   }
   346   bool                    IsPopup() const
   347   {
   348     return mWindowType == eWindowType_popup;
   349   }
   352   /**
   353    * Event processing helpers
   354    */
   355   void                    DispatchFocusToTopLevelWindow(bool aIsActivate);
   356   bool                    DispatchStandardEvent(uint32_t aMsg);
   357   void                    RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
   358   virtual bool            ProcessMessage(UINT msg, WPARAM &wParam,
   359                                          LPARAM &lParam, LRESULT *aRetValue);
   360   bool                    ExternalHandlerProcessMessage(
   361                                          UINT aMessage, WPARAM& aWParam,
   362                                          LPARAM& aLParam, MSGResult& aResult);
   363   bool                    ProcessMessageForPlugin(const MSG &aMsg,
   364                                                   MSGResult& aResult);
   365   LRESULT                 ProcessCharMessage(const MSG &aMsg,
   366                                              bool *aEventDispatched);
   367   LRESULT                 ProcessKeyUpMessage(const MSG &aMsg,
   368                                               bool *aEventDispatched);
   369   LRESULT                 ProcessKeyDownMessage(const MSG &aMsg,
   370                                                 bool *aEventDispatched);
   371   static bool             EventIsInsideWindow(nsWindow* aWindow);
   372   // Convert nsEventStatus value to a windows boolean
   373   static bool             ConvertStatus(nsEventStatus aStatus);
   374   static void             PostSleepWakeNotification(const bool aIsSleepMode);
   375   int32_t                 ClientMarginHitTestPoint(int32_t mx, int32_t my);
   377   /**
   378    * Event handlers
   379    */
   380   virtual void            OnDestroy();
   381   virtual bool            OnResize(nsIntRect &aWindowRect);
   382   bool                    OnGesture(WPARAM wParam, LPARAM lParam);
   383   bool                    OnTouch(WPARAM wParam, LPARAM lParam);
   384   bool                    OnHotKey(WPARAM wParam, LPARAM lParam);
   385   bool                    OnPaint(HDC aDC, uint32_t aNestingLevel);
   386   void                    OnWindowPosChanged(WINDOWPOS* wp);
   387   void                    OnWindowPosChanging(LPWINDOWPOS& info);
   388   void                    OnSysColorChanged();
   390   /**
   391    * Function that registers when the user has been active (used for detecting
   392    * when the user is idle).
   393    */
   394   void                    UserActivity();
   396   int32_t                 GetHeight(int32_t aProposedHeight);
   397   void                    GetWindowClass(nsString& aWindowClass);
   398   void                    GetWindowPopupClass(nsString& aWindowClass);
   399   virtual DWORD           WindowStyle();
   400   DWORD                   WindowExStyle();
   402   void                    RegisterWindowClass(const nsString& aClassName,
   403                                               UINT aExtraStyle,
   404                                               LPWSTR aIconID);
   406   /**
   407    * XP and Vista theming support for windows with rounded edges
   408    */
   409   void                    ClearThemeRegion();
   410   void                    SetThemeRegion();
   412   /**
   413    * Popup hooks
   414    */
   415   static void             ScheduleHookTimer(HWND aWnd, UINT aMsgId);
   416   static void             RegisterSpecialDropdownHooks();
   417   static void             UnregisterSpecialDropdownHooks();
   418   static bool             GetPopupsToRollup(nsIRollupListener* aRollupListener,
   419                                             uint32_t* aPopupsToRollup);
   420   static bool             NeedsToHandleNCActivateDelayed(HWND aWnd);
   421   static bool             DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult);
   423   /**
   424    * Window transparency helpers
   425    */
   426 #ifdef MOZ_XUL
   427 private:
   428   void                    SetWindowTranslucencyInner(nsTransparencyMode aMode);
   429   nsTransparencyMode      GetWindowTranslucencyInner() const { return mTransparencyMode; }
   430   void                    ResizeTranslucentWindow(int32_t aNewWidth, int32_t aNewHeight, bool force = false);
   431   nsresult                UpdateTranslucentWindow();
   432   void                    ClearTranslucentWindow();
   433   void                    SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
   434   void                    UpdateGlass();
   435 protected:
   436 #endif // MOZ_XUL
   438   static bool             IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
   439   void                    IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
   441   /**
   442    * Misc.
   443    */
   444   void                    StopFlashing();
   445   static bool             IsTopLevelMouseExit(HWND aWnd);
   446   nsresult                SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
   447                                               bool aIntersectWithExisting);
   448   nsIntRegion             GetRegionToPaint(bool aForceFullRepaint, 
   449                                            PAINTSTRUCT ps, HDC aDC);
   450   static void             ActivateOtherWindowHelper(HWND aWnd);
   451   void                    ClearCachedResources();
   452   nsIWidgetListener*      GetPaintListener();
   453   static bool             IsRenderMode(gfxWindowsPlatform::RenderMode aMode);
   455 protected:
   456   nsCOMPtr<nsIWidget>   mParent;
   457   nsIntSize             mLastSize;
   458   nsIntPoint            mLastPoint;
   459   HWND                  mWnd;
   460   WNDPROC               mPrevWndProc;
   461   HBRUSH                mBrush;
   462   bool                  mIsTopWidgetWindow;
   463   bool                  mInDtor;
   464   bool                  mIsVisible;
   465   bool                  mUnicodeWidget;
   466   bool                  mPainting;
   467   bool                  mTouchWindow;
   468   bool                  mDisplayPanFeedback;
   469   bool                  mHideChrome;
   470   bool                  mIsRTL;
   471   bool                  mFullscreenMode;
   472   bool                  mMousePresent;
   473   bool                  mDestroyCalled;
   474   uint32_t              mBlurSuppressLevel;
   475   DWORD_PTR             mOldStyle;
   476   DWORD_PTR             mOldExStyle;
   477   nsNativeDragTarget*   mNativeDragTarget;
   478   HKL                   mLastKeyboardLayout;
   479   nsSizeMode            mOldSizeMode;
   480   nsSizeMode            mLastSizeMode;
   481   WindowHook            mWindowHook;
   482   DWORD                 mAssumeWheelIsZoomUntil;
   483   uint32_t              mPickerDisplayCount;
   484   HICON                 mIconSmall;
   485   HICON                 mIconBig;
   486   static bool           sDropShadowEnabled;
   487   static uint32_t       sInstanceCount;
   488   static TriStateBool   sCanQuit;
   489   static nsWindow*      sCurrentWindow;
   490   static BOOL           sIsOleInitialized;
   491   static HCURSOR        sHCursor;
   492   static imgIContainer* sCursorImgContainer;
   493   static bool           sSwitchKeyboardLayout;
   494   static bool           sJustGotDeactivate;
   495   static bool           sJustGotActivate;
   496   static bool           sIsInMouseCapture;
   497   static int            sTrimOnMinimize;
   498   static const char*    sDefaultMainWindowClass;
   499   static bool           sAllowD3D9;
   501   // Always use the helper method to read this property.  See bug 603793.
   502   static TriStateBool   sHasBogusPopupsDropShadowOnMultiMonitor;
   503   static bool           HasBogusPopupsDropShadowOnMultiMonitor();
   505   static uint32_t       sOOPPPluginFocusEvent;
   507   // Non-client margin settings
   508   // Pre-calculated outward offset applied to default frames
   509   nsIntMargin           mNonClientOffset;
   510   // Margins set by the owner
   511   nsIntMargin           mNonClientMargins;
   513   // Indicates custom frames are enabled
   514   bool                  mCustomNonClient;
   515   // Cached copy of L&F's resize border  
   516   int32_t               mHorResizeMargin;
   517   int32_t               mVertResizeMargin;
   518   // Height of the caption plus border
   519   int32_t               mCaptionHeight;
   521   nsCOMPtr<nsIIdleServiceInternal> mIdleService;
   523   // Hook Data Memebers for Dropdowns. sProcessHook Tells the
   524   // hook methods whether they should be processing the hook
   525   // messages.
   526   static HHOOK          sMsgFilterHook;
   527   static HHOOK          sCallProcHook;
   528   static HHOOK          sCallMouseHook;
   529   static bool           sProcessHook;
   530   static UINT           sRollupMsgId;
   531   static HWND           sRollupMsgWnd;
   532   static UINT           sHookTimerId;
   534   // Mouse Clicks - static variable definitions for figuring
   535   // out 1 - 3 Clicks.
   536   static POINT          sLastMousePoint;
   537   static POINT          sLastMouseMovePoint;
   538   static LONG           sLastMouseDownTime;
   539   static LONG           sLastClickCount;
   540   static BYTE           sLastMouseButton;
   542   // Graphics
   543   HDC                   mPaintDC; // only set during painting
   544   HDC                   mCompositeDC; // only set during StartRemoteDrawing
   546   nsIntRect             mLastPaintBounds;
   548   // Transparency
   549 #ifdef MOZ_XUL
   550   // Use layered windows to support full 256 level alpha translucency
   551   nsRefPtr<gfxASurface> mTransparentSurface;
   552   HDC                   mMemoryDC;
   553   nsTransparencyMode    mTransparencyMode;
   554   nsIntRegion           mPossiblyTransparentRegion;
   555   MARGINS               mGlassMargins;
   556 #endif // MOZ_XUL
   558   // Win7 Gesture processing and management
   559   nsWinGesture          mGesture;
   561   // Weak ref to the nsITaskbarWindowPreview associated with this window
   562   nsWeakPtr             mTaskbarPreview;
   563   // True if the taskbar (possibly through the tab preview) tells us that the
   564   // icon has been created on the taskbar.
   565   bool                  mHasTaskbarIconBeenCreated;
   567   // Indicates that mouse events should be ignored and pass through to the
   568   // window below. This is currently only used for popups.
   569   bool                  mMouseTransparent;
   571   // The point in time at which the last paint completed. We use this to avoid
   572   //  painting too rapidly in response to frequent input events.
   573   TimeStamp mLastPaintEndTime;
   575   // Caching for hit test results
   576   POINT mCachedHitTestPoint;
   577   TimeStamp mCachedHitTestTime;
   578   int32_t mCachedHitTestResult;
   580   static bool sNeedsToInitMouseWheelSettings;
   581   static void InitMouseWheelScrollData();
   582 };
   584 /**
   585  * A child window is a window with different style.
   586  */
   587 class ChildWindow : public nsWindow {
   589 public:
   590   ChildWindow() {}
   592 protected:
   593   virtual DWORD WindowStyle();
   594 };
   596 #endif // Window_h__

mercurial