2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef __nsWindow_h__
|
|
|
|
#define __nsWindow_h__
|
|
|
|
|
2011-04-02 19:14:00 -07:00
|
|
|
#include "mozilla/ipc/SharedMemorySysV.h"
|
2010-09-23 19:54:52 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
|
|
|
|
#include "mozcontainer.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsIDragService.h"
|
|
|
|
#include "nsITimer.h"
|
2011-10-14 11:11:22 -07:00
|
|
|
#include "nsGkAtoms.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-06-18 02:20:29 -07:00
|
|
|
#include "gfxASurface.h"
|
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
#include "nsGUIEvent.h"
|
2009-01-02 23:37:52 -08:00
|
|
|
#include <gdk/gdk.h>
|
2007-03-22 10:30:00 -07:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2008-08-06 13:48:55 -07:00
|
|
|
#ifdef MOZ_X11
|
2007-03-22 10:30:00 -07:00
|
|
|
#include <gdk/gdkx.h>
|
2008-08-06 13:48:55 -07:00
|
|
|
#endif /* MOZ_X11 */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-05-28 18:18:45 -07:00
|
|
|
#include "mozilla/a11y/Accessible.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2010-03-20 05:00:55 -07:00
|
|
|
#include "nsGtkIMModule.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
#ifdef MOZ_LOGGING
|
|
|
|
|
|
|
|
// make sure that logging is enabled before including prlog.h
|
|
|
|
#define FORCE_PR_LOG
|
|
|
|
|
|
|
|
#include "prlog.h"
|
2009-01-21 20:15:34 -08:00
|
|
|
#include "nsTArray.h"
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
extern PRLogModuleInfo *gWidgetLog;
|
|
|
|
extern PRLogModuleInfo *gWidgetFocusLog;
|
2009-06-14 17:48:52 -07:00
|
|
|
extern PRLogModuleInfo *gWidgetDragLog;
|
2008-10-18 18:13:27 -07:00
|
|
|
extern PRLogModuleInfo *gWidgetDrawLog;
|
|
|
|
|
|
|
|
#define LOG(args) PR_LOG(gWidgetLog, 4, args)
|
|
|
|
#define LOGFOCUS(args) PR_LOG(gWidgetFocusLog, 4, args)
|
2009-06-14 17:48:52 -07:00
|
|
|
#define LOGDRAG(args) PR_LOG(gWidgetDragLog, 4, args)
|
2008-10-18 18:13:27 -07:00
|
|
|
#define LOGDRAW(args) PR_LOG(gWidgetDrawLog, 4, args)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define LOG(args)
|
|
|
|
#define LOGFOCUS(args)
|
2009-06-19 18:35:08 -07:00
|
|
|
#define LOGDRAG(args)
|
2008-10-18 18:13:27 -07:00
|
|
|
#define LOGDRAW(args)
|
|
|
|
|
|
|
|
#endif /* MOZ_LOGGING */
|
|
|
|
|
2012-04-16 18:00:26 -07:00
|
|
|
class nsDragService;
|
2010-09-23 19:54:52 -07:00
|
|
|
#if defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
|
|
|
|
# define MOZ_HAVE_SHMIMAGE
|
|
|
|
|
2010-09-23 18:00:06 -07:00
|
|
|
class nsShmImage;
|
2010-09-23 19:54:52 -07:00
|
|
|
#endif
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
class nsWindow : public nsBaseWidget, public nsSupportsWeakReference
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
|
|
|
static void ReleaseGlobals();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-10-18 18:13:27 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void CommonCreate(nsIWidget *aParent, bool aListenForResizes);
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
// event handling code
|
|
|
|
void DispatchActivateEvent(void);
|
|
|
|
void DispatchDeactivateEvent(void);
|
|
|
|
|
|
|
|
virtual nsresult DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus);
|
|
|
|
|
|
|
|
// called when we are destroyed
|
|
|
|
void OnDestroy(void);
|
|
|
|
|
|
|
|
// called to check and see if a widget's dimensions are sane
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AreBoundsSane(void);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIWidget
|
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
2009-09-23 23:18:10 -07:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-14 19:27:09 -08:00
|
|
|
const nsIntRect &aRect,
|
2011-04-16 18:22:44 -07:00
|
|
|
nsDeviceContext *aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsWidgetInitData *aInitData);
|
|
|
|
NS_IMETHOD Destroy(void);
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual nsIWidget *GetParent();
|
2010-08-13 02:57:55 -07:00
|
|
|
virtual float GetDPI();
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual nsresult SetParent(nsIWidget* aNewParent);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetModal(bool aModal);
|
2012-07-19 01:57:50 -07:00
|
|
|
virtual bool IsVisible() const;
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aX,
|
|
|
|
int32_t *aY);
|
2012-07-30 17:43:29 -07:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Move(int32_t aX,
|
|
|
|
int32_t aY);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD Show (bool aState);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Resize (int32_t aWidth,
|
|
|
|
int32_t aHeight,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRepaint);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Resize (int32_t aX,
|
|
|
|
int32_t aY,
|
|
|
|
int32_t aWidth,
|
|
|
|
int32_t aHeight,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRepaint);
|
2012-07-22 22:19:08 -07:00
|
|
|
virtual bool IsEnabled() const;
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
|
|
|
nsIWidget *aWidget,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aActivate);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SetZIndex(int32_t aZIndex);
|
|
|
|
NS_IMETHOD SetSizeMode(int32_t aMode);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
2009-01-14 19:27:09 -08:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2011-12-01 13:35:42 -08:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
|
|
|
virtual nsIntPoint GetClientOffset();
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY);
|
2011-12-23 19:52:21 -08:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
|
|
|
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
|
|
|
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
2009-02-18 16:11:49 -08:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDoCapture,
|
|
|
|
bool aConsumeRollupEvent);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount);
|
2009-04-21 16:53:52 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool HasPendingInputEvent();
|
2009-04-21 16:53:52 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-02-01 18:12:26 -08:00
|
|
|
/**
|
2012-02-13 12:19:59 -08:00
|
|
|
* GetLastUserInputTime returns a timestamp for the most recent user input
|
|
|
|
* event. This is intended for pointer grab requests (including drags).
|
2012-02-01 18:12:26 -08:00
|
|
|
*/
|
2012-02-13 12:19:59 -08:00
|
|
|
static guint32 GetLastUserInputTime();
|
2012-02-01 18:12:26 -08:00
|
|
|
|
2010-07-27 06:38:04 -07:00
|
|
|
// utility method, -1 if no change should be made, otherwise returns a
|
|
|
|
// value that can be passed to gdk_window_set_decorations
|
2007-03-22 10:30:00 -07:00
|
|
|
gint ConvertBorderStyles(nsBorderStyle aStyle);
|
|
|
|
|
|
|
|
// event callbacks
|
2011-09-22 13:58:07 -07:00
|
|
|
#if defined(MOZ_WIDGET_GTK2)
|
|
|
|
gboolean OnExposeEvent(GdkEventExpose *aEvent);
|
|
|
|
#else
|
|
|
|
gboolean OnExposeEvent(cairo_t *cr);
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
gboolean OnConfigureEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventConfigure *aEvent);
|
2009-05-14 19:14:45 -07:00
|
|
|
void OnContainerUnrealize(GtkWidget *aWidget);
|
2007-03-22 10:30:00 -07:00
|
|
|
void OnSizeAllocate(GtkWidget *aWidget,
|
|
|
|
GtkAllocation *aAllocation);
|
|
|
|
void OnDeleteEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventAny *aEvent);
|
|
|
|
void OnEnterNotifyEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventCrossing *aEvent);
|
|
|
|
void OnLeaveNotifyEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventCrossing *aEvent);
|
|
|
|
void OnMotionNotifyEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventMotion *aEvent);
|
|
|
|
void OnButtonPressEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventButton *aEvent);
|
|
|
|
void OnButtonReleaseEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventButton *aEvent);
|
|
|
|
void OnContainerFocusInEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventFocus *aEvent);
|
|
|
|
void OnContainerFocusOutEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventFocus *aEvent);
|
|
|
|
gboolean OnKeyPressEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventKey *aEvent);
|
|
|
|
gboolean OnKeyReleaseEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventKey *aEvent);
|
|
|
|
void OnScrollEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventScroll *aEvent);
|
|
|
|
void OnVisibilityNotifyEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventVisibility *aEvent);
|
|
|
|
void OnWindowStateEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventWindowState *aEvent);
|
|
|
|
void OnDragDataReceivedEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
GtkSelectionData*aSelectionData,
|
|
|
|
guint aInfo,
|
|
|
|
guint aTime,
|
|
|
|
gpointer aData);
|
|
|
|
|
2012-02-01 18:12:02 -08:00
|
|
|
private:
|
2012-08-22 08:56:38 -07:00
|
|
|
void NativeResize(int32_t aWidth,
|
|
|
|
int32_t aHeight,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRepaint);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void NativeResize(int32_t aX,
|
|
|
|
int32_t aY,
|
|
|
|
int32_t aWidth,
|
|
|
|
int32_t aHeight,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRepaint);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-02-01 18:12:02 -08:00
|
|
|
void NativeShow (bool aAction);
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetHasMappedToplevel(bool aState);
|
2009-11-01 18:03:12 -08:00
|
|
|
nsIntSize GetSafeWindowSize(nsIntSize aSize);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void EnsureGrabs (void);
|
2012-02-01 18:12:26 -08:00
|
|
|
void GrabPointer (guint32 aTime);
|
2007-03-22 10:30:00 -07:00
|
|
|
void ReleaseGrabs (void);
|
|
|
|
|
2012-02-01 18:12:02 -08:00
|
|
|
public:
|
2007-03-22 10:30:00 -07:00
|
|
|
enum PluginType {
|
|
|
|
PluginType_NONE = 0, /* do not have any plugin */
|
|
|
|
PluginType_XEMBED, /* the plugin support xembed */
|
|
|
|
PluginType_NONXEMBED /* the plugin does not support xembed */
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetPluginType(PluginType aPluginType);
|
2008-08-06 13:48:55 -07:00
|
|
|
#ifdef MOZ_X11
|
2007-03-22 10:30:00 -07:00
|
|
|
void SetNonXEmbedPluginFocus(void);
|
|
|
|
void LoseNonXEmbedPluginFocus(void);
|
2008-08-06 13:48:55 -07:00
|
|
|
#endif /* MOZ_X11 */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void ThemeChanged(void);
|
|
|
|
|
2008-08-06 13:48:55 -07:00
|
|
|
#ifdef MOZ_X11
|
2007-03-22 10:30:00 -07:00
|
|
|
Window mOldFocusWindow;
|
2008-08-06 13:48:55 -07:00
|
|
|
#endif /* MOZ_X11 */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-03-23 20:37:06 -07:00
|
|
|
static guint32 sLastButtonPressTime;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, int32_t aHorizontal, int32_t aVertical);
|
2010-07-17 01:11:54 -07:00
|
|
|
NS_IMETHOD BeginMoveDrag(nsMouseEvent* aEvent);
|
2007-12-11 02:08:35 -08:00
|
|
|
|
2010-03-18 21:21:16 -07:00
|
|
|
MozContainer* GetMozContainer() { return mContainer; }
|
2012-04-18 23:18:31 -07:00
|
|
|
// GetMozContainerWidget returns the MozContainer even for undestroyed
|
|
|
|
// descendant windows
|
|
|
|
GtkWidget* GetMozContainerWidget();
|
2010-03-18 21:21:16 -07:00
|
|
|
GdkWindow* GetGdkWindow() { return mGdkWindow; }
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsDestroyed() { return mIsDestroyed; }
|
2010-03-18 21:21:16 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void DispatchDragEvent(uint32_t aMsg,
|
2012-04-16 18:00:25 -07:00
|
|
|
const nsIntPoint& aRefPoint,
|
|
|
|
guint aTime);
|
2012-04-18 23:18:31 -07:00
|
|
|
static void UpdateDragStatus (GdkDragContext *aDragContext,
|
|
|
|
nsIDragService *aDragService);
|
2010-03-18 21:21:16 -07:00
|
|
|
// If this dispatched the keydown event actually, this returns TRUE,
|
|
|
|
// otherwise, FALSE.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool DispatchKeyDownEvent(GdkEventKey *aEvent,
|
|
|
|
bool *aIsCancelled);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD ResetInputState();
|
2011-11-27 03:51:52 -08:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD CancelIMEComposition();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD OnIMEFocusChange(bool aFocus);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void ResizeTransparencyBitmap(int32_t aNewWidth, int32_t aNewHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
void ApplyTransparencyBitmap();
|
2008-08-12 17:44:14 -07:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2009-07-21 17:44:55 -07:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2009-01-14 19:27:09 -08:00
|
|
|
nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint8_t* aAlphas, int32_t aStride);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-22 13:58:07 -07:00
|
|
|
#if defined(MOZ_WIDGET_GTK2)
|
2007-03-22 10:30:00 -07:00
|
|
|
gfxASurface *GetThebesSurface();
|
|
|
|
|
2008-06-18 02:20:29 -07:00
|
|
|
static already_AddRefed<gfxASurface> GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
|
2009-01-14 19:27:09 -08:00
|
|
|
const nsIntSize& aSize);
|
2011-09-22 13:58:07 -07:00
|
|
|
#else
|
|
|
|
gfxASurface *GetThebesSurface(cairo_t *cr);
|
|
|
|
#endif
|
2010-09-18 04:28:50 -07:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
2008-06-18 02:20:29 -07:00
|
|
|
|
2012-04-11 14:55:21 -07:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags);
|
2012-04-11 14:55:21 -07:00
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); }
|
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
protected:
|
2010-09-18 04:28:50 -07:00
|
|
|
// Helper for SetParent and ReparentNativeWidget.
|
|
|
|
void ReparentNativeWidgetInternal(nsIWidget* aNewParent,
|
|
|
|
GtkWidget* aNewContainer,
|
|
|
|
GdkWindow* aNewParentWindow,
|
|
|
|
GtkWidget* aOldContainer);
|
2008-10-18 18:13:27 -07:00
|
|
|
nsCOMPtr<nsIWidget> mParent;
|
|
|
|
// Is this a toplevel window?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsTopLevel;
|
2008-10-18 18:13:27 -07:00
|
|
|
// Has this widget been destroyed yet?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsDestroyed;
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
// This is a flag that tracks if we need to resize a widget or
|
|
|
|
// window when we show it.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNeedsResize;
|
2008-10-18 18:13:27 -07:00
|
|
|
// This is a flag that tracks if we need to move a widget or
|
|
|
|
// window when we show it.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mNeedsMove;
|
2008-10-18 18:13:27 -07:00
|
|
|
// Should we send resize events on all resizes?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mListenForResizes;
|
2008-10-18 18:13:27 -07:00
|
|
|
// This flag tracks if we're hidden or shown.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsShown;
|
|
|
|
bool mNeedsShow;
|
2008-10-18 18:13:27 -07:00
|
|
|
// is this widget enabled?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mEnabled;
|
2008-10-18 18:13:27 -07:00
|
|
|
// has the native window for this been created yet?
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCreated;
|
2008-10-18 18:13:27 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2009-11-10 13:57:25 -08:00
|
|
|
void DestroyChildWindows();
|
2007-03-22 10:30:00 -07:00
|
|
|
void GetToplevelWidget(GtkWidget **aWidget);
|
2009-02-19 18:07:08 -08:00
|
|
|
nsWindow *GetContainerWindow();
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetUrgencyHint(GtkWidget *top_window, bool state);
|
2007-03-22 10:30:00 -07:00
|
|
|
void *SetupPluginPort(void);
|
|
|
|
void SetDefaultIcon(void);
|
2007-12-13 23:00:44 -08:00
|
|
|
void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool DispatchCommandEvent(nsIAtom* aCommand);
|
2012-08-22 08:56:38 -07:00
|
|
|
bool DispatchContentCommandEvent(int32_t aMsg);
|
2009-12-13 13:01:33 -08:00
|
|
|
void SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIntersectWithExisting);
|
|
|
|
bool GetDragInfo(nsMouseEvent* aMouseEvent,
|
2010-07-17 01:11:54 -07:00
|
|
|
GdkWindow** aWindow, gint* aButton,
|
|
|
|
gint* aRootX, gint* aRootY);
|
2011-01-21 13:45:23 -08:00
|
|
|
void ClearCachedResources();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
GtkWidget *mShell;
|
|
|
|
MozContainer *mContainer;
|
2009-07-26 18:39:36 -07:00
|
|
|
GdkWindow *mGdkWindow;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
GtkWindowGroup *mWindowGroup;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mHasMappedToplevel : 1,
|
2009-11-01 18:03:12 -08:00
|
|
|
mIsFullyObscured : 1,
|
2011-02-16 12:10:16 -08:00
|
|
|
mRetryPointerGrab : 1;
|
2007-03-22 10:30:00 -07:00
|
|
|
GtkWindow *mTransientParent;
|
2012-08-15 11:52:42 -07:00
|
|
|
nsSizeMode mSizeState;
|
2007-03-22 10:30:00 -07:00
|
|
|
PluginType mPluginType;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mTransparencyBitmapWidth;
|
|
|
|
int32_t mTransparencyBitmapHeight;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-09-23 19:54:52 -07:00
|
|
|
#ifdef MOZ_HAVE_SHMIMAGE
|
2010-09-23 18:00:06 -07:00
|
|
|
// If we're using xshm rendering, mThebesSurface wraps mShmImage
|
|
|
|
nsRefPtr<nsShmImage> mShmImage;
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRefPtr<gfxASurface> mThebesSurface;
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-05-28 18:18:45 -07:00
|
|
|
nsRefPtr<Accessible> mRootAccessible;
|
2010-05-11 23:47:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request to create the accessible for this window if it is top level.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void CreateRootAccessible();
|
2010-05-11 23:47:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible event for the top level window accessible.
|
|
|
|
*
|
|
|
|
* @param aEventType [in] the accessible event type to dispatch
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void DispatchEventToRootAccessible(uint32_t aEventType);
|
2010-05-11 23:47:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window activate event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
2008-10-18 18:13:27 -07:00
|
|
|
void DispatchActivateEventAccessible();
|
2010-05-11 23:47:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window deactivate event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
2008-10-18 18:13:27 -07:00
|
|
|
void DispatchDeactivateEventAccessible();
|
2011-03-26 09:06:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window maximize event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
|
|
|
void DispatchMaximizeEventAccessible();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window minize event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
|
|
|
void DispatchMinimizeEventAccessible();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window restore event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
|
|
|
void DispatchRestoreEventAccessible();
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// The cursor cache
|
|
|
|
static GdkCursor *gsGtkCursorCache[eCursorCount];
|
|
|
|
|
|
|
|
// Transparency
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsTransparent;
|
2007-03-22 10:30:00 -07:00
|
|
|
// This bitmap tracks which pixels are transparent. We don't support
|
|
|
|
// full translucency at this time; each pixel is either fully opaque
|
|
|
|
// or fully transparent.
|
|
|
|
gchar* mTransparencyBitmap;
|
|
|
|
|
|
|
|
// all of our DND stuff
|
2008-08-27 05:07:27 -07:00
|
|
|
void InitDragEvent (nsDragEvent &aEvent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-12-11 15:55:15 -08:00
|
|
|
float mLastMotionPressure;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-08-26 17:09:47 -07:00
|
|
|
// Remember the last sizemode so that we can restore it when
|
|
|
|
// leaving fullscreen
|
|
|
|
nsSizeMode mLastSizeMode;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool DragInProgress(void);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-03-23 20:37:06 -07:00
|
|
|
void DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent);
|
|
|
|
|
2010-03-18 21:21:16 -07:00
|
|
|
/**
|
|
|
|
* |mIMModule| takes all IME related stuff.
|
|
|
|
*
|
|
|
|
* This is owned by the top-level nsWindow or the topmost child
|
|
|
|
* nsWindow embedded in a non-Gecko widget.
|
|
|
|
*
|
|
|
|
* The instance is created when the top level widget is created. And when
|
|
|
|
* the widget is destroyed, it's released. All child windows refer its
|
|
|
|
* ancestor widget's instance. So, one set of IM contexts is created for
|
|
|
|
* all windows in a hierarchy. If the children are released after the top
|
|
|
|
* level window is released, the children still have a valid pointer,
|
|
|
|
* however, IME doesn't work at that time.
|
|
|
|
*/
|
|
|
|
nsRefPtr<nsGtkIMModule> mIMModule;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsChildWindow : public nsWindow {
|
|
|
|
public:
|
|
|
|
nsChildWindow();
|
|
|
|
~nsChildWindow();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __nsWindow_h__ */
|