Bug 574454 - Implement frame rendering and metrics in native themeing. r=vlad.
[mozilla-central.git] / widget / src / windows / nsWindow.h
blob9b4cd79dad32f0eb72a8bc038bc37ac6401686d7
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Robert O'Callahan <roc+moz@cs.cmu.edu>
24 * Dean Tessman <dean_tessman@hotmail.com>
25 * Makoto Kato <m_kato@ga2.so-net.ne.jp>
26 * Dainis Jonitis <Dainis_Jonitis@swh-t.lv>
27 * Masayuki Nakano <masayuki@d-toybox.com>
28 * Ningjie Chen <chenn@email.uc.edu>
29 * Jim Mathies <jmathies@mozilla.com>.
30 * Mats Palmgren <matspal@gmail.com>
32 * Alternatively, the contents of this file may be used under the terms of
33 * either the GNU General Public License Version 2 or later (the "GPL"), or
34 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
35 * in which case the provisions of the GPL or the LGPL are applicable instead
36 * of those above. If you wish to allow use of your version of this file only
37 * under the terms of either the GPL or the LGPL, and not to allow others to
38 * use your version of this file under the terms of the MPL, indicate your
39 * decision by deleting the provisions above and replace them with the notice
40 * and other provisions required by the GPL or the LGPL. If you do not delete
41 * the provisions above, a recipient may use your version of this file under
42 * the terms of any one of the MPL, the GPL or the LGPL.
44 * ***** END LICENSE BLOCK ***** */
46 #ifndef Window_h__
47 #define Window_h__
50 * nsWindow - Native window management and event handling.
53 #include "nsBaseWidget.h"
54 #include "nsdefs.h"
55 #include "nsIdleService.h"
56 #include "nsToolkit.h"
57 #include "nsString.h"
58 #include "nsTArray.h"
59 #include "gfxWindowsSurface.h"
60 #include "nsWindowDbg.h"
61 #include "cairo.h"
62 #ifdef CAIRO_HAS_D2D_SURFACE
63 #include "gfxD2DSurface.h"
64 #endif
66 #if !defined(WINCE)
67 #include "nsWinGesture.h"
68 #endif
70 #if defined(WINCE)
71 #include "nsWindowCE.h"
72 #endif
74 #include "WindowHook.h"
75 #include "TaskbarWindowPreview.h"
77 #ifdef ACCESSIBILITY
78 #include "OLEACC.H"
79 #include "nsAccessible.h"
80 #endif
82 #if !defined(WINCE)
83 #include "nsUXThemeData.h"
84 #endif // !defined(WINCE)
85 /**
86 * Forward class definitions
89 class nsNativeDragTarget;
90 class nsIRollupListener;
91 class nsIFile;
92 class imgIContainer;
94 /**
95 * Native WIN32 window wrapper.
98 class nsWindow : public nsBaseWidget
100 typedef mozilla::widget::WindowHook WindowHook;
101 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
102 typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
103 #endif
104 public:
105 nsWindow();
106 virtual ~nsWindow();
108 NS_DECL_ISUPPORTS_INHERITED
110 friend class nsWindowGfx;
113 * nsIWidget interface
115 NS_IMETHOD Create(nsIWidget *aParent,
116 nsNativeWidget aNativeParent,
117 const nsIntRect &aRect,
118 EVENT_CALLBACK aHandleEventFunction,
119 nsIDeviceContext *aContext,
120 nsIAppShell *aAppShell = nsnull,
121 nsIToolkit *aToolkit = nsnull,
122 nsWidgetInitData *aInitData = nsnull);
123 NS_IMETHOD Destroy();
124 NS_IMETHOD SetParent(nsIWidget *aNewParent);
125 virtual nsIWidget* GetParent(void);
126 NS_IMETHOD Show(PRBool bState);
127 NS_IMETHOD IsVisible(PRBool & aState);
128 NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
129 NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
130 NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
131 NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
132 NS_IMETHOD ResizeClient(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
133 #if !defined(WINCE)
134 NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
135 #endif
136 NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, PRBool aActivate);
137 NS_IMETHOD SetSizeMode(PRInt32 aMode);
138 NS_IMETHOD Enable(PRBool aState);
139 NS_IMETHOD IsEnabled(PRBool *aState);
140 NS_IMETHOD SetFocus(PRBool aRaise);
141 NS_IMETHOD GetBounds(nsIntRect &aRect);
142 NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
143 NS_IMETHOD GetClientBounds(nsIntRect &aRect);
144 virtual nsIntPoint GetClientOffset();
145 NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
146 NS_IMETHOD SetCursor(imgIContainer* aCursor,
147 PRUint32 aHotspotX, PRUint32 aHotspotY);
148 NS_IMETHOD SetCursor(nsCursor aCursor);
149 virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
150 NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
151 NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
152 NS_IMETHOD Invalidate(PRBool aIsSynchronous);
153 NS_IMETHOD Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous);
154 NS_IMETHOD Update();
155 virtual void Scroll(const nsIntPoint& aDelta,
156 const nsTArray<nsIntRect>& aDestRects,
157 const nsTArray<Configuration>& aReconfigureChildren);
158 virtual void* GetNativeData(PRUint32 aDataType);
159 virtual void FreeNativeData(void * data, PRUint32 aDataType);
160 NS_IMETHOD SetTitle(const nsAString& aTitle);
161 NS_IMETHOD SetIcon(const nsAString& aIconSpec);
162 virtual nsIntPoint WidgetToScreenOffset();
163 virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize);
164 NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
165 NS_IMETHOD EnableDragDrop(PRBool aEnable);
166 NS_IMETHOD CaptureMouse(PRBool aCapture);
167 NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, nsIMenuRollup * aMenuRollup,
168 PRBool aDoCapture, PRBool aConsumeRollupEvent);
169 NS_IMETHOD GetAttention(PRInt32 aCycleCount);
170 virtual PRBool HasPendingInputEvent();
171 virtual LayerManager* GetLayerManager();
172 gfxASurface *GetThebesSurface();
173 NS_IMETHOD OnDefaultButtonLoaded(const nsIntRect &aButtonRect);
174 NS_IMETHOD OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta, PRBool aIsHorizontal, PRInt32 &aOverriddenDelta);
176 virtual nsresult SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
177 PRInt32 aNativeKeyCode,
178 PRUint32 aModifierFlags,
179 const nsAString& aCharacters,
180 const nsAString& aUnmodifiedCharacters);
181 virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
182 PRUint32 aNativeMessage,
183 PRUint32 aModifierFlags);
184 NS_IMETHOD ResetInputState();
185 NS_IMETHOD SetIMEOpenState(PRBool aState);
186 NS_IMETHOD GetIMEOpenState(PRBool* aState);
187 NS_IMETHOD SetIMEEnabled(PRUint32 aState);
188 NS_IMETHOD GetIMEEnabled(PRUint32* aState);
189 NS_IMETHOD CancelIMEComposition();
190 NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
191 NS_IMETHOD RegisterTouchWindow();
192 NS_IMETHOD UnregisterTouchWindow();
193 #ifdef MOZ_XUL
194 virtual void SetTransparencyMode(nsTransparencyMode aMode);
195 virtual nsTransparencyMode GetTransparencyMode();
196 virtual void UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion, const nsIntRegion& aPossiblyTransparentRegion);
197 #endif // MOZ_XUL
198 #ifdef NS_ENABLE_TSF
199 NS_IMETHOD OnIMEFocusChange(PRBool aFocus);
200 NS_IMETHOD OnIMETextChange(PRUint32 aStart, PRUint32 aOldEnd, PRUint32 aNewEnd);
201 NS_IMETHOD OnIMESelectionChange(void);
202 #endif // NS_ENABLE_TSF
203 NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
204 NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
205 void SetDrawsInTitlebar(PRBool aState);
208 * Statics used in other classes
210 static PRInt32 GetWindowsVersion();
213 * Event helpers
215 void InitEvent(nsGUIEvent& event, nsIntPoint* aPoint = nsnull);
216 virtual PRBool DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam,
217 LPARAM lParam,
218 PRBool aIsContextMenuKey = PR_FALSE,
219 PRInt16 aButton = nsMouseEvent::eLeftButton,
220 PRUint16 aInputSource = nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE);
221 virtual PRBool DispatchWindowEvent(nsGUIEvent* event);
222 virtual PRBool DispatchWindowEvent(nsGUIEvent*event, nsEventStatus &aStatus);
223 virtual PRBool DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode,
224 const nsTArray<nsAlternativeCharCode>* aAlternativeChars,
225 UINT aVirtualCharCode, const MSG *aMsg,
226 const nsModifierKeyState &aModKeyState,
227 PRUint32 aFlags = 0);
228 void DispatchPendingEvents();
229 PRBool DispatchPluginEvent(UINT aMessage,
230 WPARAM aWParam,
231 LPARAM aLParam,
232 PRBool aDispatchPendingEvents);
234 void SuppressBlurEvents(PRBool aSuppress); // Called from nsFilePicker
235 PRBool BlurEventsSuppressed();
236 #ifdef ACCESSIBILITY
237 nsAccessible* DispatchAccessibleEvent(PRUint32 aEventType);
238 nsAccessible* GetRootAccessible();
239 #endif // ACCESSIBILITY
242 * Window utilities
244 static void GlobalMsgWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
245 nsWindow* GetTopLevelWindow(PRBool aStopOnDialogOrPopup);
246 static HWND GetTopLevelHWND(HWND aWnd, PRBool aStopOnDialogOrPopup = PR_FALSE);
247 HWND GetWindowHandle() { return mWnd; }
248 WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
249 static nsWindow* GetNSWindowPtr(HWND aWnd);
250 WindowHook& GetWindowHook() { return mWindowHook; }
251 nsWindow* GetParentWindow(PRBool aIncludeOwner);
254 * Misc.
256 virtual PRBool AutoErase(HDC dc);
257 nsIntPoint* GetLastPoint() { return &mLastPoint; }
258 PRBool GetIMEEnabled() { return mIMEEnabled; }
259 // needed in nsIMM32Handler.cpp
260 PRBool PluginHasFocus() { return mIMEEnabled == nsIWidget::IME_STATUS_PLUGIN; }
261 PRBool IsTopLevelWidget() { return mIsTopWidgetWindow; }
263 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
264 PRBool HasTaskbarIconBeenCreated() { return mHasTaskbarIconBeenCreated; }
265 // Called when either the nsWindow or an nsITaskbarTabPreview receives the noticiation that this window
266 // has its icon placed on the taskbar.
267 void SetHasTaskbarIconBeenCreated(PRBool created = PR_TRUE) { mHasTaskbarIconBeenCreated = created; }
269 // Getter/setter for the nsITaskbarWindowPreview for this nsWindow
270 already_AddRefed<nsITaskbarWindowPreview> GetTaskbarPreview() {
271 nsCOMPtr<nsITaskbarWindowPreview> preview(do_QueryReferent(mTaskbarPreview));
272 return preview.forget();
274 void SetTaskbarPreview(nsITaskbarWindowPreview *preview) { mTaskbarPreview = do_GetWeakReference(preview); }
275 #endif
277 protected:
280 * Callbacks
282 static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
283 static BOOL CALLBACK BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg);
284 static BOOL CALLBACK BroadcastMsg(HWND aTopWindow, LPARAM aMsg);
285 static BOOL CALLBACK DispatchStarvedPaints(HWND aTopWindow, LPARAM aMsg);
286 #if !defined(WINCE)
287 static BOOL CALLBACK RegisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
288 static BOOL CALLBACK UnregisterTouchForDescendants(HWND aTopWindow, LPARAM aMsg);
289 #endif
290 static LRESULT CALLBACK MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM lParam);
291 static LRESULT CALLBACK MozSpecialWndProc(int code, WPARAM wParam, LPARAM lParam);
292 static LRESULT CALLBACK MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam);
293 static VOID CALLBACK HookTimerForPopups( HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime );
296 * Window utilities
298 static BOOL SetNSWindowPtr(HWND aWnd, nsWindow * ptr);
299 LPARAM lParamToScreen(LPARAM lParam);
300 LPARAM lParamToClient(LPARAM lParam);
301 virtual void SubclassWindow(BOOL bState);
302 PRBool CanTakeFocus();
303 PRBool UpdateNonClientMargins(PRInt32 aSizeMode = -1, PRBool aReflowWindow = PR_TRUE);
304 void ResetLayout();
305 #if !defined(WINCE)
306 static void InitTrackPointHack();
307 #endif
310 * Event processing helpers
312 PRBool DispatchPluginEvent(const MSG &aMsg);
313 PRBool DispatchFocusToTopLevelWindow(PRUint32 aEventType);
314 PRBool DispatchFocus(PRUint32 aEventType);
315 PRBool DispatchStandardEvent(PRUint32 aMsg);
316 PRBool DispatchCommandEvent(PRUint32 aEventCommand);
317 void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
318 void RemoveMessageAndDispatchPluginEvent(UINT aFirstMsg, UINT aLastMsg);
319 static MSG InitMSG(UINT aMessage, WPARAM wParam, LPARAM lParam);
320 virtual PRBool ProcessMessage(UINT msg, WPARAM &wParam,
321 LPARAM &lParam, LRESULT *aRetValue);
322 PRBool ProcessMessageForPlugin(const MSG &aMsg,
323 LRESULT *aRetValue, PRBool &aCallDefWndProc);
324 LRESULT ProcessCharMessage(const MSG &aMsg,
325 PRBool *aEventDispatched);
326 LRESULT ProcessKeyUpMessage(const MSG &aMsg,
327 PRBool *aEventDispatched);
328 LRESULT ProcessKeyDownMessage(const MSG &aMsg,
329 PRBool *aEventDispatched);
330 static PRBool EventIsInsideWindow(UINT Msg, nsWindow* aWindow);
331 // Convert nsEventStatus value to a windows boolean
332 static PRBool ConvertStatus(nsEventStatus aStatus);
333 static void PostSleepWakeNotification(const char* aNotification);
334 PRBool HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
335 LPARAM aLParam,
336 PRBool& aResult,
337 LRESULT* aRetValue,
338 PRBool& aQuitProcessing);
339 PRInt32 ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my);
342 * Event handlers
344 virtual void OnDestroy();
345 virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
346 virtual PRBool OnResize(nsIntRect &aWindowRect);
347 LRESULT OnChar(const MSG &aMsg,
348 nsModifierKeyState &aModKeyState,
349 PRBool *aEventDispatched,
350 PRUint32 aFlags = 0);
351 LRESULT OnKeyDown(const MSG &aMsg,
352 nsModifierKeyState &aModKeyState,
353 PRBool *aEventDispatched,
354 nsFakeCharMessage* aFakeCharMessage);
355 LRESULT OnKeyUp(const MSG &aMsg,
356 nsModifierKeyState &aModKeyState,
357 PRBool *aEventDispatched);
358 LRESULT OnCharRaw(UINT charCode, UINT aScanCode,
359 nsModifierKeyState &aModKeyState,
360 PRUint32 aFlags = 0,
361 const MSG *aMsg = nsnull,
362 PRBool *aEventDispatched = nsnull);
363 virtual PRBool OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam);
364 PRBool OnGesture(WPARAM wParam, LPARAM lParam);
365 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
366 PRBool OnTouch(WPARAM wParam, LPARAM lParam);
367 #endif
368 PRBool OnHotKey(WPARAM wParam, LPARAM lParam);
369 BOOL OnInputLangChange(HKL aHKL);
370 void OnSettingsChange(WPARAM wParam, LPARAM lParam);
371 PRBool OnPaint(HDC aDC, PRUint32 aNestingLevel);
372 void OnWindowPosChanged(WINDOWPOS *wp, PRBool& aResult);
373 #if defined(CAIRO_HAS_DDRAW_SURFACE)
374 PRBool OnPaintImageDDraw16();
375 #endif // defined(CAIRO_HAS_DDRAW_SURFACE)
376 PRBool OnMouseWheel(UINT msg, WPARAM wParam, LPARAM lParam,
377 PRBool& result, PRBool& getWheelInfo,
378 LRESULT *aRetValue);
379 #if !defined(WINCE)
380 void OnWindowPosChanging(LPWINDOWPOS& info);
381 #endif // !defined(WINCE)
384 * Function that registers when the user has been active (used for detecting
385 * when the user is idle).
387 void UserActivity();
390 * Methods for derived classes
392 virtual PRInt32 GetHeight(PRInt32 aProposedHeight);
393 virtual LPCWSTR WindowClass();
394 virtual LPCWSTR WindowPopupClass();
395 virtual DWORD WindowStyle();
396 virtual DWORD WindowExStyle();
399 * XP and Vista theming support for windows with rounded edges
401 void ClearThemeRegion();
402 void SetThemeRegion();
405 * Popup hooks
407 static void ScheduleHookTimer(HWND aWnd, UINT aMsgId);
408 static void RegisterSpecialDropdownHooks();
409 static void UnregisterSpecialDropdownHooks();
410 static BOOL DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLParam, LRESULT* outResult);
413 * Window transparency helpers
415 #ifdef MOZ_XUL
416 private:
417 void SetWindowTranslucencyInner(nsTransparencyMode aMode);
418 nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
419 void ResizeTranslucentWindow(PRInt32 aNewWidth, PRInt32 aNewHeight, PRBool force = PR_FALSE);
420 nsresult UpdateTranslucentWindow();
421 void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
422 void UpdateGlass();
423 protected:
424 #endif // MOZ_XUL
426 #ifdef MOZ_IPC
427 static bool IsAsyncResponseEvent(UINT aMsg, LRESULT& aResult);
428 void IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam);
429 #endif // MOZ_IPC
432 * Misc.
434 UINT MapFromNativeToDOM(UINT aNativeKeyCode);
435 void StopFlashing();
436 static PRBool IsTopLevelMouseExit(HWND aWnd);
437 static void SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray, PRUint32 aModifiers);
438 nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
439 PRBool aIntersectWithExisting);
440 nsIntRegion GetRegionToPaint(PRBool aForceFullRepaint,
441 PAINTSTRUCT ps, HDC aDC);
442 #if !defined(WINCE)
443 static void ActivateOtherWindowHelper(HWND aWnd);
444 static PRUint16 GetMouseInputSource();
445 #endif
446 #ifdef ACCESSIBILITY
447 static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
448 #endif // ACCESSIBILITY
450 protected:
451 nsCOMPtr<nsIWidget> mParent;
452 nsIntSize mLastSize;
453 nsIntPoint mLastPoint;
454 HWND mWnd;
455 WNDPROC mPrevWndProc;
456 HBRUSH mBrush;
457 PRPackedBool mIsTopWidgetWindow;
458 PRPackedBool mInDtor;
459 PRPackedBool mIsVisible;
460 PRPackedBool mIsInMouseCapture;
461 PRPackedBool mUnicodeWidget;
462 PRPackedBool mPainting;
463 PRPackedBool mExitToNonClientArea;
464 PRPackedBool mTouchWindow;
465 PRUint32 mBlurSuppressLevel;
466 nsContentType mContentType;
467 DWORD_PTR mOldStyle;
468 DWORD_PTR mOldExStyle;
469 HIMC mOldIMC;
470 PRUint32 mIMEEnabled;
471 nsNativeDragTarget* mNativeDragTarget;
472 HKL mLastKeyboardLayout;
473 nsPopupType mPopupType;
474 PRPackedBool mDisplayPanFeedback;
475 PRPackedBool mHideChrome;
476 nsSizeMode mOldSizeMode;
477 WindowHook mWindowHook;
478 static PRUint32 sInstanceCount;
479 static TriStateBool sCanQuit;
480 static nsWindow* sCurrentWindow;
481 static BOOL sIsRegistered;
482 static BOOL sIsPopupClassRegistered;
483 static BOOL sIsOleInitialized;
484 static HCURSOR sHCursor;
485 static imgIContainer* sCursorImgContainer;
486 static PRBool sSwitchKeyboardLayout;
487 static PRBool sJustGotDeactivate;
488 static PRBool sJustGotActivate;
489 static int sTrimOnMinimize;
490 static PRBool sTrackPointHack;
491 #ifdef MOZ_IPC
492 static PRUint32 sOOPPPluginFocusEvent;
493 #endif
495 // Non-client margin settings
496 // Pre-calculated outward offset applied to default frames
497 nsIntMargin mNonClientOffset;
498 // Margins set by the owner
499 nsIntMargin mNonClientMargins;
500 // Indicates custom frames are enabled
501 PRPackedBool mCustomNonClient;
502 // Disable non client margins on non-comsitor desktops
503 PRPackedBool mCompositorFlag;
504 // Cached copy of L&F's resize border
505 PRInt32 mHorResizeMargin;
506 PRInt32 mVertResizeMargin;
507 // Height of the caption plus border
508 PRInt32 mCaptionHeight;
510 nsCOMPtr<nsIdleService> mIdleService;
512 // Hook Data Memebers for Dropdowns. sProcessHook Tells the
513 // hook methods whether they should be processing the hook
514 // messages.
515 static HHOOK sMsgFilterHook;
516 static HHOOK sCallProcHook;
517 static HHOOK sCallMouseHook;
518 static PRPackedBool sProcessHook;
519 static UINT sRollupMsgId;
520 static HWND sRollupMsgWnd;
521 static UINT sHookTimerId;
523 // Rollup Listener
524 static nsIWidget* sRollupWidget;
525 static PRBool sRollupConsumeEvent;
526 static nsIRollupListener* sRollupListener;
527 static nsIMenuRollup* sMenuRollup;
529 // Mouse Clicks - static variable definitions for figuring
530 // out 1 - 3 Clicks.
531 static POINT sLastMousePoint;
532 static POINT sLastMouseMovePoint;
533 static LONG sLastMouseDownTime;
534 static LONG sLastClickCount;
535 static BYTE sLastMouseButton;
537 // Graphics
538 HDC mPaintDC; // only set during painting
540 #ifdef CAIRO_HAS_D2D_SURFACE
541 nsRefPtr<gfxD2DSurface> mD2DWindowSurface; // Surface for this window.
542 #endif
544 // Transparency
545 #ifdef MOZ_XUL
546 // Use layered windows to support full 256 level alpha translucency
547 nsRefPtr<gfxASurface> mTransparentSurface;
548 HDC mMemoryDC;
549 nsTransparencyMode mTransparencyMode;
550 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
551 nsIntRegion mPossiblyTransparentRegion;
552 MARGINS mGlassMargins;
553 #endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
554 #endif // MOZ_XUL
556 // Win7 Gesture processing and management
557 #if !defined(WINCE)
558 nsWinGesture mGesture;
559 #endif // !defined(WINCE)
561 #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
562 // Weak ref to the nsITaskbarWindowPreview associated with this window
563 nsWeakPtr mTaskbarPreview;
564 // True if the taskbar (possibly through the tab preview) tells us that the
565 // icon has been created on the taskbar.
566 PRBool mHasTaskbarIconBeenCreated;
567 #endif
569 #if defined(WINCE_HAVE_SOFTKB)
570 static PRBool sSoftKeyboardState;
571 #endif // defined(WINCE_HAVE_SOFTKB)
573 #ifdef ACCESSIBILITY
574 static BOOL sIsAccessibilityOn;
575 static HINSTANCE sAccLib;
576 static LPFNLRESULTFROMOBJECT sLresultFromObject;
577 #endif // ACCESSIBILITY
581 * A child window is a window with different style.
583 class ChildWindow : public nsWindow {
585 public:
586 ChildWindow() {}
588 protected:
589 virtual DWORD WindowStyle();
592 #endif // Window_h__