Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim:expandtab:shiftwidth=4:tabstop=4: |
michael@0 | 3 | */ |
michael@0 | 4 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef __nsWindow_h__ |
michael@0 | 9 | #define __nsWindow_h__ |
michael@0 | 10 | |
michael@0 | 11 | #include "mozilla/ipc/SharedMemorySysV.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "nsAutoPtr.h" |
michael@0 | 14 | |
michael@0 | 15 | #include "mozcontainer.h" |
michael@0 | 16 | #include "nsWeakReference.h" |
michael@0 | 17 | |
michael@0 | 18 | #include "nsIDragService.h" |
michael@0 | 19 | #include "nsITimer.h" |
michael@0 | 20 | #include "nsGkAtoms.h" |
michael@0 | 21 | |
michael@0 | 22 | #include "nsBaseWidget.h" |
michael@0 | 23 | #include <gdk/gdk.h> |
michael@0 | 24 | #include <gtk/gtk.h> |
michael@0 | 25 | |
michael@0 | 26 | #ifdef MOZ_X11 |
michael@0 | 27 | #include <gdk/gdkx.h> |
michael@0 | 28 | #endif /* MOZ_X11 */ |
michael@0 | 29 | |
michael@0 | 30 | #ifdef ACCESSIBILITY |
michael@0 | 31 | #include "mozilla/a11y/Accessible.h" |
michael@0 | 32 | #endif |
michael@0 | 33 | #include "mozilla/EventForwards.h" |
michael@0 | 34 | |
michael@0 | 35 | #include "nsGtkIMModule.h" |
michael@0 | 36 | |
michael@0 | 37 | #undef LOG |
michael@0 | 38 | #ifdef MOZ_LOGGING |
michael@0 | 39 | |
michael@0 | 40 | // make sure that logging is enabled before including prlog.h |
michael@0 | 41 | #define FORCE_PR_LOG |
michael@0 | 42 | |
michael@0 | 43 | #include "prlog.h" |
michael@0 | 44 | #include "nsTArray.h" |
michael@0 | 45 | |
michael@0 | 46 | extern PRLogModuleInfo *gWidgetLog; |
michael@0 | 47 | extern PRLogModuleInfo *gWidgetFocusLog; |
michael@0 | 48 | extern PRLogModuleInfo *gWidgetDragLog; |
michael@0 | 49 | extern PRLogModuleInfo *gWidgetDrawLog; |
michael@0 | 50 | |
michael@0 | 51 | #define LOG(args) PR_LOG(gWidgetLog, 4, args) |
michael@0 | 52 | #define LOGFOCUS(args) PR_LOG(gWidgetFocusLog, 4, args) |
michael@0 | 53 | #define LOGDRAG(args) PR_LOG(gWidgetDragLog, 4, args) |
michael@0 | 54 | #define LOGDRAW(args) PR_LOG(gWidgetDrawLog, 4, args) |
michael@0 | 55 | |
michael@0 | 56 | #else |
michael@0 | 57 | |
michael@0 | 58 | #define LOG(args) |
michael@0 | 59 | #define LOGFOCUS(args) |
michael@0 | 60 | #define LOGDRAG(args) |
michael@0 | 61 | #define LOGDRAW(args) |
michael@0 | 62 | |
michael@0 | 63 | #endif /* MOZ_LOGGING */ |
michael@0 | 64 | |
michael@0 | 65 | class gfxASurface; |
michael@0 | 66 | class gfxPattern; |
michael@0 | 67 | class nsDragService; |
michael@0 | 68 | #if defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV) |
michael@0 | 69 | # define MOZ_HAVE_SHMIMAGE |
michael@0 | 70 | |
michael@0 | 71 | class nsShmImage; |
michael@0 | 72 | #endif |
michael@0 | 73 | |
michael@0 | 74 | class nsWindow : public nsBaseWidget, public nsSupportsWeakReference |
michael@0 | 75 | { |
michael@0 | 76 | public: |
michael@0 | 77 | nsWindow(); |
michael@0 | 78 | virtual ~nsWindow(); |
michael@0 | 79 | |
michael@0 | 80 | static void ReleaseGlobals(); |
michael@0 | 81 | |
michael@0 | 82 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 83 | |
michael@0 | 84 | void CommonCreate(nsIWidget *aParent, bool aListenForResizes); |
michael@0 | 85 | |
michael@0 | 86 | virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 87 | nsEventStatus& aStatus); |
michael@0 | 88 | |
michael@0 | 89 | // called when we are destroyed |
michael@0 | 90 | void OnDestroy(void); |
michael@0 | 91 | |
michael@0 | 92 | // called to check and see if a widget's dimensions are sane |
michael@0 | 93 | bool AreBoundsSane(void); |
michael@0 | 94 | |
michael@0 | 95 | // nsIWidget |
michael@0 | 96 | NS_IMETHOD Create(nsIWidget *aParent, |
michael@0 | 97 | nsNativeWidget aNativeParent, |
michael@0 | 98 | const nsIntRect &aRect, |
michael@0 | 99 | nsDeviceContext *aContext, |
michael@0 | 100 | nsWidgetInitData *aInitData); |
michael@0 | 101 | NS_IMETHOD Destroy(void); |
michael@0 | 102 | virtual nsIWidget *GetParent(); |
michael@0 | 103 | virtual float GetDPI(); |
michael@0 | 104 | virtual nsresult SetParent(nsIWidget* aNewParent); |
michael@0 | 105 | NS_IMETHOD SetModal(bool aModal); |
michael@0 | 106 | virtual bool IsVisible() const; |
michael@0 | 107 | NS_IMETHOD ConstrainPosition(bool aAllowSlop, |
michael@0 | 108 | int32_t *aX, |
michael@0 | 109 | int32_t *aY); |
michael@0 | 110 | virtual void SetSizeConstraints(const SizeConstraints& aConstraints); |
michael@0 | 111 | NS_IMETHOD Move(double aX, |
michael@0 | 112 | double aY); |
michael@0 | 113 | NS_IMETHOD Show (bool aState); |
michael@0 | 114 | NS_IMETHOD Resize (double aWidth, |
michael@0 | 115 | double aHeight, |
michael@0 | 116 | bool aRepaint); |
michael@0 | 117 | NS_IMETHOD Resize (double aX, |
michael@0 | 118 | double aY, |
michael@0 | 119 | double aWidth, |
michael@0 | 120 | double aHeight, |
michael@0 | 121 | bool aRepaint); |
michael@0 | 122 | virtual bool IsEnabled() const; |
michael@0 | 123 | |
michael@0 | 124 | |
michael@0 | 125 | NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, |
michael@0 | 126 | nsIWidget *aWidget, |
michael@0 | 127 | bool aActivate); |
michael@0 | 128 | void SetZIndex(int32_t aZIndex); |
michael@0 | 129 | NS_IMETHOD SetSizeMode(int32_t aMode); |
michael@0 | 130 | NS_IMETHOD Enable(bool aState); |
michael@0 | 131 | NS_IMETHOD SetFocus(bool aRaise = false); |
michael@0 | 132 | NS_IMETHOD GetScreenBounds(nsIntRect &aRect); |
michael@0 | 133 | NS_IMETHOD GetClientBounds(nsIntRect &aRect); |
michael@0 | 134 | virtual nsIntPoint GetClientOffset(); |
michael@0 | 135 | NS_IMETHOD SetCursor(nsCursor aCursor); |
michael@0 | 136 | NS_IMETHOD SetCursor(imgIContainer* aCursor, |
michael@0 | 137 | uint32_t aHotspotX, uint32_t aHotspotY); |
michael@0 | 138 | NS_IMETHOD Invalidate(const nsIntRect &aRect); |
michael@0 | 139 | virtual void* GetNativeData(uint32_t aDataType); |
michael@0 | 140 | NS_IMETHOD SetTitle(const nsAString& aTitle); |
michael@0 | 141 | NS_IMETHOD SetIcon(const nsAString& aIconSpec); |
michael@0 | 142 | NS_IMETHOD SetWindowClass(const nsAString& xulWinType); |
michael@0 | 143 | virtual nsIntPoint WidgetToScreenOffset(); |
michael@0 | 144 | NS_IMETHOD EnableDragDrop(bool aEnable); |
michael@0 | 145 | NS_IMETHOD CaptureMouse(bool aCapture); |
michael@0 | 146 | NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, |
michael@0 | 147 | bool aDoCapture); |
michael@0 | 148 | NS_IMETHOD GetAttention(int32_t aCycleCount); |
michael@0 | 149 | |
michael@0 | 150 | virtual bool HasPendingInputEvent(); |
michael@0 | 151 | |
michael@0 | 152 | NS_IMETHOD MakeFullScreen(bool aFullScreen); |
michael@0 | 153 | NS_IMETHOD HideWindowChrome(bool aShouldHide); |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * GetLastUserInputTime returns a timestamp for the most recent user input |
michael@0 | 157 | * event. This is intended for pointer grab requests (including drags). |
michael@0 | 158 | */ |
michael@0 | 159 | static guint32 GetLastUserInputTime(); |
michael@0 | 160 | |
michael@0 | 161 | // utility method, -1 if no change should be made, otherwise returns a |
michael@0 | 162 | // value that can be passed to gdk_window_set_decorations |
michael@0 | 163 | gint ConvertBorderStyles(nsBorderStyle aStyle); |
michael@0 | 164 | |
michael@0 | 165 | // event callbacks |
michael@0 | 166 | #if (MOZ_WIDGET_GTK == 2) |
michael@0 | 167 | gboolean OnExposeEvent(GdkEventExpose *aEvent); |
michael@0 | 168 | #else |
michael@0 | 169 | gboolean OnExposeEvent(cairo_t *cr); |
michael@0 | 170 | #endif |
michael@0 | 171 | gboolean OnConfigureEvent(GtkWidget *aWidget, |
michael@0 | 172 | GdkEventConfigure *aEvent); |
michael@0 | 173 | void OnContainerUnrealize(); |
michael@0 | 174 | void OnSizeAllocate(GtkAllocation *aAllocation); |
michael@0 | 175 | void OnDeleteEvent(); |
michael@0 | 176 | void OnEnterNotifyEvent(GdkEventCrossing *aEvent); |
michael@0 | 177 | void OnLeaveNotifyEvent(GdkEventCrossing *aEvent); |
michael@0 | 178 | void OnMotionNotifyEvent(GdkEventMotion *aEvent); |
michael@0 | 179 | void OnButtonPressEvent(GdkEventButton *aEvent); |
michael@0 | 180 | void OnButtonReleaseEvent(GdkEventButton *aEvent); |
michael@0 | 181 | void OnContainerFocusInEvent(GdkEventFocus *aEvent); |
michael@0 | 182 | void OnContainerFocusOutEvent(GdkEventFocus *aEvent); |
michael@0 | 183 | gboolean OnKeyPressEvent(GdkEventKey *aEvent); |
michael@0 | 184 | gboolean OnKeyReleaseEvent(GdkEventKey *aEvent); |
michael@0 | 185 | void OnScrollEvent(GdkEventScroll *aEvent); |
michael@0 | 186 | void OnVisibilityNotifyEvent(GdkEventVisibility *aEvent); |
michael@0 | 187 | void OnWindowStateEvent(GtkWidget *aWidget, |
michael@0 | 188 | GdkEventWindowState *aEvent); |
michael@0 | 189 | void OnDragDataReceivedEvent(GtkWidget *aWidget, |
michael@0 | 190 | GdkDragContext *aDragContext, |
michael@0 | 191 | gint aX, |
michael@0 | 192 | gint aY, |
michael@0 | 193 | GtkSelectionData*aSelectionData, |
michael@0 | 194 | guint aInfo, |
michael@0 | 195 | guint aTime, |
michael@0 | 196 | gpointer aData); |
michael@0 | 197 | |
michael@0 | 198 | mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE; |
michael@0 | 199 | |
michael@0 | 200 | private: |
michael@0 | 201 | void UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect); |
michael@0 | 202 | |
michael@0 | 203 | void NativeResize(int32_t aWidth, |
michael@0 | 204 | int32_t aHeight, |
michael@0 | 205 | bool aRepaint); |
michael@0 | 206 | |
michael@0 | 207 | void NativeResize(int32_t aX, |
michael@0 | 208 | int32_t aY, |
michael@0 | 209 | int32_t aWidth, |
michael@0 | 210 | int32_t aHeight, |
michael@0 | 211 | bool aRepaint); |
michael@0 | 212 | |
michael@0 | 213 | void NativeShow (bool aAction); |
michael@0 | 214 | void SetHasMappedToplevel(bool aState); |
michael@0 | 215 | nsIntSize GetSafeWindowSize(nsIntSize aSize); |
michael@0 | 216 | |
michael@0 | 217 | void EnsureGrabs (void); |
michael@0 | 218 | void GrabPointer (guint32 aTime); |
michael@0 | 219 | void ReleaseGrabs (void); |
michael@0 | 220 | |
michael@0 | 221 | public: |
michael@0 | 222 | enum PluginType { |
michael@0 | 223 | PluginType_NONE = 0, /* do not have any plugin */ |
michael@0 | 224 | PluginType_XEMBED, /* the plugin support xembed */ |
michael@0 | 225 | PluginType_NONXEMBED /* the plugin does not support xembed */ |
michael@0 | 226 | }; |
michael@0 | 227 | |
michael@0 | 228 | void SetPluginType(PluginType aPluginType); |
michael@0 | 229 | #ifdef MOZ_X11 |
michael@0 | 230 | void SetNonXEmbedPluginFocus(void); |
michael@0 | 231 | void LoseNonXEmbedPluginFocus(void); |
michael@0 | 232 | #endif /* MOZ_X11 */ |
michael@0 | 233 | |
michael@0 | 234 | void ThemeChanged(void); |
michael@0 | 235 | |
michael@0 | 236 | #ifdef MOZ_X11 |
michael@0 | 237 | Window mOldFocusWindow; |
michael@0 | 238 | #endif /* MOZ_X11 */ |
michael@0 | 239 | |
michael@0 | 240 | static guint32 sLastButtonPressTime; |
michael@0 | 241 | |
michael@0 | 242 | NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 243 | int32_t aHorizontal, |
michael@0 | 244 | int32_t aVertical); |
michael@0 | 245 | NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent); |
michael@0 | 246 | |
michael@0 | 247 | MozContainer* GetMozContainer() { return mContainer; } |
michael@0 | 248 | // GetMozContainerWidget returns the MozContainer even for undestroyed |
michael@0 | 249 | // descendant windows |
michael@0 | 250 | GtkWidget* GetMozContainerWidget(); |
michael@0 | 251 | GdkWindow* GetGdkWindow() { return mGdkWindow; } |
michael@0 | 252 | bool IsDestroyed() { return mIsDestroyed; } |
michael@0 | 253 | |
michael@0 | 254 | void DispatchDragEvent(uint32_t aMsg, |
michael@0 | 255 | const nsIntPoint& aRefPoint, |
michael@0 | 256 | guint aTime); |
michael@0 | 257 | static void UpdateDragStatus (GdkDragContext *aDragContext, |
michael@0 | 258 | nsIDragService *aDragService); |
michael@0 | 259 | // If this dispatched the keydown event actually, this returns TRUE, |
michael@0 | 260 | // otherwise, FALSE. |
michael@0 | 261 | bool DispatchKeyDownEvent(GdkEventKey *aEvent, |
michael@0 | 262 | bool *aIsCancelled); |
michael@0 | 263 | |
michael@0 | 264 | NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) MOZ_OVERRIDE; |
michael@0 | 265 | NS_IMETHOD_(void) SetInputContext(const InputContext& aContext, |
michael@0 | 266 | const InputContextAction& aAction); |
michael@0 | 267 | NS_IMETHOD_(InputContext) GetInputContext(); |
michael@0 | 268 | NS_IMETHOD_(bool) ExecuteNativeKeyBinding( |
michael@0 | 269 | NativeKeyBindingsType aType, |
michael@0 | 270 | const mozilla::WidgetKeyboardEvent& aEvent, |
michael@0 | 271 | DoCommandCallback aCallback, |
michael@0 | 272 | void* aCallbackData) MOZ_OVERRIDE; |
michael@0 | 273 | NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState); |
michael@0 | 274 | |
michael@0 | 275 | // These methods are for toplevel windows only. |
michael@0 | 276 | void ResizeTransparencyBitmap(); |
michael@0 | 277 | void ApplyTransparencyBitmap(); |
michael@0 | 278 | void ClearTransparencyBitmap(); |
michael@0 | 279 | |
michael@0 | 280 | virtual void SetTransparencyMode(nsTransparencyMode aMode); |
michael@0 | 281 | virtual nsTransparencyMode GetTransparencyMode(); |
michael@0 | 282 | virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations); |
michael@0 | 283 | nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect, |
michael@0 | 284 | uint8_t* aAlphas, int32_t aStride); |
michael@0 | 285 | |
michael@0 | 286 | #if (MOZ_WIDGET_GTK == 2) |
michael@0 | 287 | gfxASurface *GetThebesSurface(); |
michael@0 | 288 | |
michael@0 | 289 | static already_AddRefed<gfxASurface> GetSurfaceForGdkDrawable(GdkDrawable* aDrawable, |
michael@0 | 290 | const nsIntSize& aSize); |
michael@0 | 291 | #else |
michael@0 | 292 | gfxASurface *GetThebesSurface(cairo_t *cr); |
michael@0 | 293 | #endif |
michael@0 | 294 | NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); |
michael@0 | 295 | |
michael@0 | 296 | virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint, |
michael@0 | 297 | uint32_t aNativeMessage, |
michael@0 | 298 | uint32_t aModifierFlags); |
michael@0 | 299 | |
michael@0 | 300 | virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) |
michael@0 | 301 | { return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); } |
michael@0 | 302 | |
michael@0 | 303 | protected: |
michael@0 | 304 | // event handling code |
michael@0 | 305 | void DispatchActivateEvent(void); |
michael@0 | 306 | void DispatchDeactivateEvent(void); |
michael@0 | 307 | void DispatchResized(int32_t aWidth, int32_t aHeight); |
michael@0 | 308 | |
michael@0 | 309 | // Helper for SetParent and ReparentNativeWidget. |
michael@0 | 310 | void ReparentNativeWidgetInternal(nsIWidget* aNewParent, |
michael@0 | 311 | GtkWidget* aNewContainer, |
michael@0 | 312 | GdkWindow* aNewParentWindow, |
michael@0 | 313 | GtkWidget* aOldContainer); |
michael@0 | 314 | nsCOMPtr<nsIWidget> mParent; |
michael@0 | 315 | // Is this a toplevel window? |
michael@0 | 316 | bool mIsTopLevel; |
michael@0 | 317 | // Has this widget been destroyed yet? |
michael@0 | 318 | bool mIsDestroyed; |
michael@0 | 319 | |
michael@0 | 320 | // This is a flag that tracks if we need to resize a widget or |
michael@0 | 321 | // window when we show it. |
michael@0 | 322 | bool mNeedsResize; |
michael@0 | 323 | // This is a flag that tracks if we need to move a widget or |
michael@0 | 324 | // window when we show it. |
michael@0 | 325 | bool mNeedsMove; |
michael@0 | 326 | // Should we send resize events on all resizes? |
michael@0 | 327 | bool mListenForResizes; |
michael@0 | 328 | // This flag tracks if we're hidden or shown. |
michael@0 | 329 | bool mIsShown; |
michael@0 | 330 | bool mNeedsShow; |
michael@0 | 331 | // is this widget enabled? |
michael@0 | 332 | bool mEnabled; |
michael@0 | 333 | // has the native window for this been created yet? |
michael@0 | 334 | bool mCreated; |
michael@0 | 335 | |
michael@0 | 336 | private: |
michael@0 | 337 | void DestroyChildWindows(); |
michael@0 | 338 | GtkWidget *GetToplevelWidget(); |
michael@0 | 339 | nsWindow *GetContainerWindow(); |
michael@0 | 340 | void SetUrgencyHint(GtkWidget *top_window, bool state); |
michael@0 | 341 | void *SetupPluginPort(void); |
michael@0 | 342 | void SetDefaultIcon(void); |
michael@0 | 343 | void InitButtonEvent(mozilla::WidgetMouseEvent& aEvent, |
michael@0 | 344 | GdkEventButton* aGdkEvent); |
michael@0 | 345 | bool DispatchCommandEvent(nsIAtom* aCommand); |
michael@0 | 346 | bool DispatchContentCommandEvent(int32_t aMsg); |
michael@0 | 347 | void SetWindowClipRegion(const nsTArray<nsIntRect>& aRects, |
michael@0 | 348 | bool aIntersectWithExisting); |
michael@0 | 349 | bool CheckForRollup(gdouble aMouseX, gdouble aMouseY, |
michael@0 | 350 | bool aIsWheel, bool aAlwaysRollup); |
michael@0 | 351 | bool GetDragInfo(mozilla::WidgetMouseEvent* aMouseEvent, |
michael@0 | 352 | GdkWindow** aWindow, gint* aButton, |
michael@0 | 353 | gint* aRootX, gint* aRootY); |
michael@0 | 354 | void ClearCachedResources(); |
michael@0 | 355 | |
michael@0 | 356 | GtkWidget *mShell; |
michael@0 | 357 | MozContainer *mContainer; |
michael@0 | 358 | GdkWindow *mGdkWindow; |
michael@0 | 359 | |
michael@0 | 360 | uint32_t mHasMappedToplevel : 1, |
michael@0 | 361 | mIsFullyObscured : 1, |
michael@0 | 362 | mRetryPointerGrab : 1; |
michael@0 | 363 | nsSizeMode mSizeState; |
michael@0 | 364 | PluginType mPluginType; |
michael@0 | 365 | |
michael@0 | 366 | int32_t mTransparencyBitmapWidth; |
michael@0 | 367 | int32_t mTransparencyBitmapHeight; |
michael@0 | 368 | |
michael@0 | 369 | #ifdef MOZ_HAVE_SHMIMAGE |
michael@0 | 370 | // If we're using xshm rendering, mThebesSurface wraps mShmImage |
michael@0 | 371 | nsRefPtr<nsShmImage> mShmImage; |
michael@0 | 372 | #endif |
michael@0 | 373 | nsRefPtr<gfxASurface> mThebesSurface; |
michael@0 | 374 | |
michael@0 | 375 | #ifdef ACCESSIBILITY |
michael@0 | 376 | nsRefPtr<mozilla::a11y::Accessible> mRootAccessible; |
michael@0 | 377 | |
michael@0 | 378 | /** |
michael@0 | 379 | * Request to create the accessible for this window if it is top level. |
michael@0 | 380 | */ |
michael@0 | 381 | void CreateRootAccessible(); |
michael@0 | 382 | |
michael@0 | 383 | /** |
michael@0 | 384 | * Dispatch accessible event for the top level window accessible. |
michael@0 | 385 | * |
michael@0 | 386 | * @param aEventType [in] the accessible event type to dispatch |
michael@0 | 387 | */ |
michael@0 | 388 | void DispatchEventToRootAccessible(uint32_t aEventType); |
michael@0 | 389 | |
michael@0 | 390 | /** |
michael@0 | 391 | * Dispatch accessible window activate event for the top level window |
michael@0 | 392 | * accessible. |
michael@0 | 393 | */ |
michael@0 | 394 | void DispatchActivateEventAccessible(); |
michael@0 | 395 | |
michael@0 | 396 | /** |
michael@0 | 397 | * Dispatch accessible window deactivate event for the top level window |
michael@0 | 398 | * accessible. |
michael@0 | 399 | */ |
michael@0 | 400 | void DispatchDeactivateEventAccessible(); |
michael@0 | 401 | |
michael@0 | 402 | /** |
michael@0 | 403 | * Dispatch accessible window maximize event for the top level window |
michael@0 | 404 | * accessible. |
michael@0 | 405 | */ |
michael@0 | 406 | void DispatchMaximizeEventAccessible(); |
michael@0 | 407 | |
michael@0 | 408 | /** |
michael@0 | 409 | * Dispatch accessible window minize event for the top level window |
michael@0 | 410 | * accessible. |
michael@0 | 411 | */ |
michael@0 | 412 | void DispatchMinimizeEventAccessible(); |
michael@0 | 413 | |
michael@0 | 414 | /** |
michael@0 | 415 | * Dispatch accessible window restore event for the top level window |
michael@0 | 416 | * accessible. |
michael@0 | 417 | */ |
michael@0 | 418 | void DispatchRestoreEventAccessible(); |
michael@0 | 419 | #endif |
michael@0 | 420 | |
michael@0 | 421 | // The cursor cache |
michael@0 | 422 | static GdkCursor *gsGtkCursorCache[eCursorCount]; |
michael@0 | 423 | |
michael@0 | 424 | // Transparency |
michael@0 | 425 | bool mIsTransparent; |
michael@0 | 426 | // This bitmap tracks which pixels are transparent. We don't support |
michael@0 | 427 | // full translucency at this time; each pixel is either fully opaque |
michael@0 | 428 | // or fully transparent. |
michael@0 | 429 | gchar* mTransparencyBitmap; |
michael@0 | 430 | |
michael@0 | 431 | // all of our DND stuff |
michael@0 | 432 | void InitDragEvent(mozilla::WidgetDragEvent& aEvent); |
michael@0 | 433 | |
michael@0 | 434 | float mLastMotionPressure; |
michael@0 | 435 | |
michael@0 | 436 | // Remember the last sizemode so that we can restore it when |
michael@0 | 437 | // leaving fullscreen |
michael@0 | 438 | nsSizeMode mLastSizeMode; |
michael@0 | 439 | |
michael@0 | 440 | static bool DragInProgress(void); |
michael@0 | 441 | |
michael@0 | 442 | void DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent); |
michael@0 | 443 | |
michael@0 | 444 | // nsBaseWidget |
michael@0 | 445 | virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr, |
michael@0 | 446 | LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE, |
michael@0 | 447 | LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, |
michael@0 | 448 | bool* aAllowRetaining = nullptr) MOZ_OVERRIDE; |
michael@0 | 449 | |
michael@0 | 450 | void CleanLayerManagerRecursive(); |
michael@0 | 451 | |
michael@0 | 452 | /** |
michael@0 | 453 | * |mIMModule| takes all IME related stuff. |
michael@0 | 454 | * |
michael@0 | 455 | * This is owned by the top-level nsWindow or the topmost child |
michael@0 | 456 | * nsWindow embedded in a non-Gecko widget. |
michael@0 | 457 | * |
michael@0 | 458 | * The instance is created when the top level widget is created. And when |
michael@0 | 459 | * the widget is destroyed, it's released. All child windows refer its |
michael@0 | 460 | * ancestor widget's instance. So, one set of IM contexts is created for |
michael@0 | 461 | * all windows in a hierarchy. If the children are released after the top |
michael@0 | 462 | * level window is released, the children still have a valid pointer, |
michael@0 | 463 | * however, IME doesn't work at that time. |
michael@0 | 464 | */ |
michael@0 | 465 | nsRefPtr<nsGtkIMModule> mIMModule; |
michael@0 | 466 | }; |
michael@0 | 467 | |
michael@0 | 468 | class nsChildWindow : public nsWindow { |
michael@0 | 469 | public: |
michael@0 | 470 | nsChildWindow(); |
michael@0 | 471 | ~nsChildWindow(); |
michael@0 | 472 | }; |
michael@0 | 473 | |
michael@0 | 474 | #endif /* __nsWindow_h__ */ |