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:
|
|
|
|
*/
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Christopher Blizzard
|
|
|
|
* <blizzard@mozilla.org>. Portions created by the Initial Developer
|
|
|
|
* are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Masayuki Nakano <masayuki@d-toybox.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef __nsWindow_h__
|
|
|
|
#define __nsWindow_h__
|
|
|
|
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
|
|
|
|
#include "mozcontainer.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsIDragService.h"
|
|
|
|
#include "nsITimer.h"
|
2008-02-06 13:56:02 -08:00
|
|
|
#include "nsWidgetAtoms.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_DFB
|
|
|
|
#include <gdk/gdkdirectfb.h>
|
|
|
|
#endif /* MOZ_DFB */
|
|
|
|
|
|
|
|
#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
|
2010-05-11 23:47:35 -07:00
|
|
|
#include "nsAccessible.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 */
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
void CommonCreate(nsIWidget *aParent, PRBool aListenForResizes);
|
|
|
|
|
|
|
|
// event handling code
|
|
|
|
void InitKeyEvent(nsKeyEvent &aEvent, GdkEventKey *aGdkEvent);
|
|
|
|
|
|
|
|
void DispatchActivateEvent(void);
|
|
|
|
void DispatchDeactivateEvent(void);
|
2009-01-14 19:27:09 -08:00
|
|
|
void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
|
2008-10-18 18:13:27 -07:00
|
|
|
|
|
|
|
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
|
|
|
|
PRBool 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,
|
2007-03-22 10:30:00 -07:00
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
|
|
|
nsIDeviceContext *aContext,
|
|
|
|
nsIAppShell *aAppShell,
|
|
|
|
nsIToolkit *aToolkit,
|
|
|
|
nsWidgetInitData *aInitData);
|
|
|
|
NS_IMETHOD Destroy(void);
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual nsIWidget *GetParent();
|
|
|
|
virtual nsresult SetParent(nsIWidget* aNewParent);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SetModal(PRBool aModal);
|
|
|
|
NS_IMETHOD IsVisible(PRBool & aState);
|
|
|
|
NS_IMETHOD ConstrainPosition(PRBool aAllowSlop,
|
|
|
|
PRInt32 *aX,
|
|
|
|
PRInt32 *aY);
|
|
|
|
NS_IMETHOD Move(PRInt32 aX,
|
|
|
|
PRInt32 aY);
|
2008-10-18 18:13:27 -07:00
|
|
|
NS_IMETHOD Show (PRBool aState);
|
|
|
|
NS_IMETHOD Resize (PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
|
|
|
PRBool aRepaint);
|
|
|
|
NS_IMETHOD Resize (PRInt32 aX,
|
|
|
|
PRInt32 aY,
|
|
|
|
PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
|
|
|
PRBool aRepaint);
|
|
|
|
NS_IMETHOD IsEnabled (PRBool *aState);
|
|
|
|
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
|
|
|
nsIWidget *aWidget,
|
|
|
|
PRBool aActivate);
|
|
|
|
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
|
|
|
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
|
|
|
NS_IMETHOD Enable(PRBool aState);
|
|
|
|
NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE);
|
2009-01-14 19:27:09 -08:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
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,
|
|
|
|
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
2009-01-14 19:27:09 -08:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect,
|
|
|
|
PRBool aIsSynchronous);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD Update();
|
2009-08-13 19:09:51 -07:00
|
|
|
virtual void Scroll(const nsIntPoint& aDelta,
|
|
|
|
const nsTArray<nsIntRect>& aDestRects,
|
2009-07-21 17:45:13 -07:00
|
|
|
const nsTArray<Configuration>& aReconfigureChildren);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void* GetNativeData(PRUint32 aDataType);
|
|
|
|
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();
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD EnableDragDrop(PRBool aEnable);
|
|
|
|
NS_IMETHOD CaptureMouse(PRBool aCapture);
|
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2009-12-22 15:49:33 -08:00
|
|
|
nsIMenuRollup *aMenuRollup,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool aDoCapture,
|
|
|
|
PRBool aConsumeRollupEvent);
|
|
|
|
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
2009-04-21 16:53:52 -07:00
|
|
|
|
|
|
|
virtual PRBool HasPendingInputEvent();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
|
|
|
|
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 11:00:39 -07:00
|
|
|
// utility method
|
2007-03-22 10:30:00 -07:00
|
|
|
gint ConvertBorderStyles(nsBorderStyle aStyle);
|
|
|
|
|
|
|
|
// event callbacks
|
|
|
|
gboolean OnExposeEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventExpose *aEvent);
|
|
|
|
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);
|
|
|
|
gboolean OnDragMotionEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
guint aTime,
|
|
|
|
void *aData);
|
|
|
|
void OnDragLeaveEvent(GtkWidget * aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
guint aTime,
|
|
|
|
gpointer aData);
|
|
|
|
gboolean OnDragDropEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
guint aTime,
|
|
|
|
gpointer *aData);
|
|
|
|
void OnDragDataReceivedEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
GtkSelectionData*aSelectionData,
|
|
|
|
guint aInfo,
|
|
|
|
guint aTime,
|
|
|
|
gpointer aData);
|
|
|
|
void OnDragLeave(void);
|
|
|
|
void OnDragEnter(nscoord aX, nscoord aY);
|
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual void NativeResize(PRInt32 aWidth,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 aHeight,
|
|
|
|
PRBool aRepaint);
|
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual void NativeResize(PRInt32 aX,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 aY,
|
|
|
|
PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
|
|
|
PRBool aRepaint);
|
|
|
|
|
2008-10-18 18:13:27 -07:00
|
|
|
virtual void NativeShow (PRBool aAction);
|
2009-11-01 18:03:12 -08:00
|
|
|
void SetHasMappedToplevel(PRBool aState);
|
|
|
|
nsIntSize GetSafeWindowSize(nsIntSize aSize);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void EnsureGrabs (void);
|
|
|
|
void GrabPointer (void);
|
|
|
|
void GrabKeyboard (void);
|
|
|
|
void ReleaseGrabs (void);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2010-02-01 07:11:09 -08:00
|
|
|
void CheckNeedDragLeaveEnter(nsWindow* aInnerMostWidget,
|
|
|
|
nsIDragService* aDragService,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
nscoord aX, nscoord aY);
|
|
|
|
|
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;
|
|
|
|
static guint32 sLastButtonReleaseTime;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-12-11 02:08:35 -08:00
|
|
|
NS_IMETHOD BeginResizeDrag (nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
|
|
|
|
2010-03-18 21:21:16 -07:00
|
|
|
MozContainer* GetMozContainer() { return mContainer; }
|
|
|
|
GdkWindow* GetGdkWindow() { return mGdkWindow; }
|
|
|
|
PRBool IsDestroyed() { return mIsDestroyed; }
|
|
|
|
|
|
|
|
// If this dispatched the keydown event actually, this returns TRUE,
|
|
|
|
// otherwise, FALSE.
|
|
|
|
PRBool DispatchKeyDownEvent(GdkEventKey *aEvent,
|
|
|
|
PRBool *aIsCancelled);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD ResetInputState();
|
2007-04-15 06:43:55 -07:00
|
|
|
NS_IMETHOD SetIMEEnabled(PRUint32 aState);
|
|
|
|
NS_IMETHOD GetIMEEnabled(PRUint32* aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD CancelIMEComposition();
|
2010-03-18 21:21:16 -07:00
|
|
|
NS_IMETHOD OnIMEFocusChange(PRBool aFocus);
|
2007-06-16 12:19:46 -07:00
|
|
|
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void ResizeTransparencyBitmap(PRInt32 aNewWidth, PRInt32 aNewHeight);
|
|
|
|
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,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRUint8* aAlphas, PRInt32 aStride);
|
|
|
|
|
|
|
|
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);
|
2008-06-18 02:20:29 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
static PRBool sAccessibilityEnabled;
|
|
|
|
#endif
|
2008-10-18 18:13:27 -07:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIWidget> mParent;
|
|
|
|
// Is this a toplevel window?
|
|
|
|
PRPackedBool mIsTopLevel;
|
|
|
|
// Has this widget been destroyed yet?
|
|
|
|
PRPackedBool mIsDestroyed;
|
|
|
|
|
|
|
|
// This is a flag that tracks if we need to resize a widget or
|
|
|
|
// window when we show it.
|
|
|
|
PRPackedBool mNeedsResize;
|
|
|
|
// This is a flag that tracks if we need to move a widget or
|
|
|
|
// window when we show it.
|
|
|
|
PRPackedBool mNeedsMove;
|
|
|
|
// Should we send resize events on all resizes?
|
|
|
|
PRPackedBool mListenForResizes;
|
|
|
|
// This flag tracks if we're hidden or shown.
|
|
|
|
PRPackedBool mIsShown;
|
|
|
|
PRPackedBool mNeedsShow;
|
|
|
|
// is this widget enabled?
|
|
|
|
PRPackedBool mEnabled;
|
|
|
|
// has the native window for this been created yet?
|
|
|
|
PRPackedBool mCreated;
|
|
|
|
// Has anyone set an x/y location for this widget yet? Toplevels
|
|
|
|
// shouldn't be automatically set to 0,0 for first show.
|
|
|
|
PRPackedBool mPlaced;
|
|
|
|
|
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);
|
2008-08-27 19:04:06 -07:00
|
|
|
GtkWidget *GetMozContainerWidget();
|
2009-02-19 18:07:08 -08:00
|
|
|
nsWindow *GetContainerWindow();
|
2007-03-22 10:30:00 -07:00
|
|
|
void SetUrgencyHint(GtkWidget *top_window, PRBool state);
|
|
|
|
void *SetupPluginPort(void);
|
2009-01-21 20:15:34 -08:00
|
|
|
nsresult SetWindowIconList(const nsTArray<nsCString> &aIconList);
|
2007-03-22 10:30:00 -07:00
|
|
|
void SetDefaultIcon(void);
|
2007-12-13 23:00:44 -08:00
|
|
|
void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
|
2008-02-20 02:10:08 -08:00
|
|
|
PRBool DispatchCommandEvent(nsIAtom* aCommand);
|
2009-12-13 13:01:33 -08:00
|
|
|
void SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
|
|
|
PRBool aIntersectWithExisting);
|
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;
|
|
|
|
|
|
|
|
PRUint32 mContainerGotFocus : 1,
|
|
|
|
mContainerLostFocus : 1,
|
|
|
|
mContainerBlockFocus : 1,
|
2009-11-01 18:03:12 -08:00
|
|
|
mHasMappedToplevel : 1,
|
|
|
|
mIsFullyObscured : 1,
|
2007-03-22 10:30:00 -07:00
|
|
|
mRetryPointerGrab : 1,
|
|
|
|
mRetryKeyboardGrab : 1;
|
|
|
|
GtkWindow *mTransientParent;
|
|
|
|
PRInt32 mSizeState;
|
|
|
|
PluginType mPluginType;
|
|
|
|
|
2008-01-01 02:21:28 -08:00
|
|
|
PRInt32 mTransparencyBitmapWidth;
|
|
|
|
PRInt32 mTransparencyBitmapHeight;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> mThebesSurface;
|
|
|
|
|
2008-08-06 13:48:55 -07:00
|
|
|
#ifdef MOZ_DFB
|
|
|
|
int mDFBCursorX;
|
|
|
|
int mDFBCursorY;
|
|
|
|
PRUint32 mDFBCursorCount;
|
|
|
|
IDirectFB *mDFB;
|
|
|
|
IDirectFBDisplayLayer *mDFBLayer;
|
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-05-11 23:47:35 -07:00
|
|
|
nsRefPtr<nsAccessible> mRootAccessible;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate the NS_GETACCESSIBLE event to get accessible for this window
|
|
|
|
* and return it.
|
|
|
|
*/
|
|
|
|
nsAccessible *DispatchAccessibleEvent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible event for the top level window accessible.
|
|
|
|
*
|
|
|
|
* @param aEventType [in] the accessible event type to dispatch
|
|
|
|
*/
|
|
|
|
void DispatchEventToRootAccessible(PRUint32 aEventType);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// The cursor cache
|
|
|
|
static GdkCursor *gsGtkCursorCache[eCursorCount];
|
|
|
|
|
|
|
|
// Transparency
|
2007-12-19 11:40:18 -08:00
|
|
|
PRBool 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
|
|
|
|
// this is the last window that had a drag event happen on it.
|
|
|
|
static nsWindow *mLastDragMotionWindow;
|
2008-08-27 05:07:27 -07:00
|
|
|
void InitDragEvent (nsDragEvent &aEvent);
|
2010-02-01 07:11:09 -08:00
|
|
|
void UpdateDragStatus (GdkDragContext *aDragContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDragService *aDragService);
|
|
|
|
|
|
|
|
// this is everything we need to be able to fire motion events
|
|
|
|
// repeatedly
|
|
|
|
GtkWidget *mDragMotionWidget;
|
|
|
|
GdkDragContext *mDragMotionContext;
|
|
|
|
gint mDragMotionX;
|
|
|
|
gint mDragMotionY;
|
|
|
|
guint mDragMotionTime;
|
|
|
|
guint mDragMotionTimerID;
|
|
|
|
nsCOMPtr<nsITimer> mDragLeaveTimer;
|
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;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static PRBool sIsDraggingOutOf;
|
|
|
|
// drag in progress
|
|
|
|
static PRBool DragInProgress(void);
|
|
|
|
|
|
|
|
void ResetDragMotionTimer (GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
guint aTime);
|
|
|
|
void FireDragMotionTimer (void);
|
|
|
|
void FireDragLeaveTimer (void);
|
|
|
|
static guint DragMotionTimerCallback (gpointer aClosure);
|
|
|
|
static void DragLeaveTimerCallback (nsITimer *aTimer, void *aClosure);
|
|
|
|
|
2007-04-27 09:34:44 -07:00
|
|
|
/* Key Down event is DOM Virtual Key driven, needs 256 bits. */
|
|
|
|
PRUint32 mKeyDownFlags[8];
|
|
|
|
|
|
|
|
/* Helper methods for DOM Key Down event suppression. */
|
|
|
|
PRUint32* GetFlagWord32(PRUint32 aKeyCode, PRUint32* aMask) {
|
|
|
|
/* Mozilla DOM Virtual Key Code is from 0 to 224. */
|
|
|
|
NS_ASSERTION((aKeyCode <= 0xFF), "Invalid DOM Key Code");
|
|
|
|
aKeyCode &= 0xFF;
|
|
|
|
|
|
|
|
/* 32 = 2^5 = 0x20 */
|
|
|
|
*aMask = PRUint32(1) << (aKeyCode & 0x1F);
|
|
|
|
return &mKeyDownFlags[(aKeyCode >> 5)];
|
2007-05-02 01:03:46 -07:00
|
|
|
}
|
2007-04-27 09:34:44 -07:00
|
|
|
|
|
|
|
PRBool IsKeyDown(PRUint32 aKeyCode) {
|
|
|
|
PRUint32 mask;
|
|
|
|
PRUint32* flag = GetFlagWord32(aKeyCode, &mask);
|
|
|
|
return ((*flag) & mask) != 0;
|
2007-05-02 01:03:46 -07:00
|
|
|
}
|
2007-04-27 09:34:44 -07:00
|
|
|
|
|
|
|
void SetKeyDownFlag(PRUint32 aKeyCode) {
|
|
|
|
PRUint32 mask;
|
|
|
|
PRUint32* flag = GetFlagWord32(aKeyCode, &mask);
|
|
|
|
*flag |= mask;
|
2007-05-02 01:03:46 -07:00
|
|
|
}
|
2007-04-27 09:34:44 -07:00
|
|
|
|
|
|
|
void ClearKeyDownFlag(PRUint32 aKeyCode) {
|
|
|
|
PRUint32 mask;
|
|
|
|
PRUint32* flag = GetFlagWord32(aKeyCode, &mask);
|
|
|
|
*flag &= ~mask;
|
2007-05-02 01:03:46 -07:00
|
|
|
}
|
2007-04-27 09:34:44 -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__ */
|
|
|
|
|