2002-04-27 20:26:10 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
|
|
|
*/
|
2001-12-10 20:37:36 +03:00
|
|
|
/* ***** 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.
|
|
|
|
*
|
2004-12-02 01:27:03 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
2001-12-10 20:37:36 +03:00
|
|
|
*
|
2004-12-02 01:27:03 +03:00
|
|
|
* The Initial Developer of the Original Code is Christopher Blizzard
|
2001-12-10 20:37:36 +03:00
|
|
|
* <blizzard@mozilla.org>. Portions created by the Initial Developer
|
|
|
|
* are Copyright (C) 2001 the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
2001-07-26 02:05:10 +04:00
|
|
|
* Contributor(s):
|
2006-03-14 09:07:54 +03:00
|
|
|
* Masayuki Nakano <masayuki@d-toybox.com>
|
2001-12-10 20:37:36 +03:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
2001-07-26 02:05:10 +04:00
|
|
|
|
2001-12-07 08:23:56 +03:00
|
|
|
#ifndef __nsWindow_h__
|
2007-01-23 02:51:15 +03:00
|
|
|
#define __nsWindow_h__
|
2001-12-07 08:23:56 +03:00
|
|
|
|
2011-04-03 06:14:00 +04:00
|
|
|
#include "mozilla/ipc/SharedMemorySysV.h"
|
2010-09-24 06:54:52 +04:00
|
|
|
|
2005-11-29 23:12:29 +03:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
|
2001-12-04 19:58:04 +03:00
|
|
|
#include "mozcontainer.h"
|
2002-01-23 09:39:48 +03:00
|
|
|
#include "nsWeakReference.h"
|
2001-12-04 19:58:04 +03:00
|
|
|
|
2002-08-10 20:18:44 +04:00
|
|
|
#include "nsIDragService.h"
|
|
|
|
#include "nsITimer.h"
|
2011-10-14 22:11:22 +04:00
|
|
|
#include "nsGkAtoms.h"
|
2002-08-10 20:18:44 +04:00
|
|
|
|
2008-06-18 13:20:29 +04:00
|
|
|
#include "gfxASurface.h"
|
|
|
|
|
2008-10-19 05:13:27 +04:00
|
|
|
#include "nsBaseWidget.h"
|
|
|
|
#include "nsGUIEvent.h"
|
2009-01-03 10:37:52 +03:00
|
|
|
#include <gdk/gdk.h>
|
2002-08-10 20:18:44 +04:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2008-08-07 00:48:55 +04:00
|
|
|
#ifdef MOZ_X11
|
2002-09-02 09:11:10 +04:00
|
|
|
#include <gdk/gdkx.h>
|
2008-08-07 00:48:55 +04:00
|
|
|
#endif /* MOZ_X11 */
|
2002-01-12 10:14:54 +03:00
|
|
|
|
2002-10-14 12:43:35 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-05-12 10:47:35 +04:00
|
|
|
#include "nsAccessible.h"
|
2002-10-14 12:43:35 +04:00
|
|
|
#endif
|
|
|
|
|
2010-03-20 15:00:55 +03:00
|
|
|
#include "nsGtkIMModule.h"
|
2002-09-26 10:20:01 +04:00
|
|
|
|
2008-10-19 05:13:27 +04:00
|
|
|
#ifdef MOZ_LOGGING
|
|
|
|
|
|
|
|
// make sure that logging is enabled before including prlog.h
|
|
|
|
#define FORCE_PR_LOG
|
|
|
|
|
|
|
|
#include "prlog.h"
|
2009-01-22 07:15:34 +03:00
|
|
|
#include "nsTArray.h"
|
2008-10-19 05:13:27 +04:00
|
|
|
|
|
|
|
extern PRLogModuleInfo *gWidgetLog;
|
|
|
|
extern PRLogModuleInfo *gWidgetFocusLog;
|
2009-06-15 04:48:52 +04:00
|
|
|
extern PRLogModuleInfo *gWidgetDragLog;
|
2008-10-19 05:13:27 +04:00
|
|
|
extern PRLogModuleInfo *gWidgetDrawLog;
|
|
|
|
|
|
|
|
#define LOG(args) PR_LOG(gWidgetLog, 4, args)
|
|
|
|
#define LOGFOCUS(args) PR_LOG(gWidgetFocusLog, 4, args)
|
2009-06-15 04:48:52 +04:00
|
|
|
#define LOGDRAG(args) PR_LOG(gWidgetDragLog, 4, args)
|
2008-10-19 05:13:27 +04:00
|
|
|
#define LOGDRAW(args) PR_LOG(gWidgetDrawLog, 4, args)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define LOG(args)
|
|
|
|
#define LOGFOCUS(args)
|
2009-06-20 05:35:08 +04:00
|
|
|
#define LOGDRAG(args)
|
2008-10-19 05:13:27 +04:00
|
|
|
#define LOGDRAW(args)
|
|
|
|
|
|
|
|
#endif /* MOZ_LOGGING */
|
|
|
|
|
2010-09-24 06:54:52 +04:00
|
|
|
#if defined(MOZ_X11) && defined(MOZ_HAVE_SHAREDMEMORYSYSV)
|
|
|
|
# define MOZ_HAVE_SHMIMAGE
|
|
|
|
|
2010-09-24 05:00:06 +04:00
|
|
|
class nsShmImage;
|
2010-09-24 06:54:52 +04:00
|
|
|
#endif
|
2008-10-19 05:13:27 +04:00
|
|
|
|
|
|
|
class nsWindow : public nsBaseWidget, public nsSupportsWeakReference
|
2006-03-14 09:07:54 +03:00
|
|
|
{
|
2002-04-27 20:26:10 +04:00
|
|
|
public:
|
|
|
|
nsWindow();
|
|
|
|
virtual ~nsWindow();
|
|
|
|
|
2003-07-02 23:27:38 +04:00
|
|
|
static void ReleaseGlobals();
|
|
|
|
|
2002-04-27 20:26:10 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2008-10-19 05:13:27 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void CommonCreate(nsIWidget *aParent, bool aListenForResizes);
|
2008-10-19 05:13:27 +04:00
|
|
|
|
|
|
|
// event handling code
|
|
|
|
void DispatchActivateEvent(void);
|
|
|
|
void DispatchDeactivateEvent(void);
|
2009-01-15 06:27:09 +03:00
|
|
|
void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
|
2008-10-19 05:13:27 +04: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
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AreBoundsSane(void);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
|
|
|
// nsIWidget
|
|
|
|
NS_IMETHOD Create(nsIWidget *aParent,
|
2009-09-24 10:18:10 +04:00
|
|
|
nsNativeWidget aNativeParent,
|
2009-01-15 06:27:09 +03:00
|
|
|
const nsIntRect &aRect,
|
2002-04-27 20:26:10 +04:00
|
|
|
EVENT_CALLBACK aHandleEventFunction,
|
2011-04-17 05:22:44 +04:00
|
|
|
nsDeviceContext *aContext,
|
2002-04-27 20:26:10 +04:00
|
|
|
nsWidgetInitData *aInitData);
|
|
|
|
NS_IMETHOD Destroy(void);
|
2008-10-19 05:13:27 +04:00
|
|
|
virtual nsIWidget *GetParent();
|
2010-08-13 13:57:55 +04:00
|
|
|
virtual float GetDPI();
|
2008-10-19 05:13:27 +04:00
|
|
|
virtual nsresult SetParent(nsIWidget* aNewParent);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD SetModal(bool aModal);
|
|
|
|
NS_IMETHOD IsVisible(bool & aState);
|
|
|
|
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
2002-04-27 20:26:10 +04:00
|
|
|
PRInt32 *aX,
|
|
|
|
PRInt32 *aY);
|
|
|
|
NS_IMETHOD Move(PRInt32 aX,
|
|
|
|
PRInt32 aY);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Show (bool aState);
|
2008-10-19 05:13:27 +04:00
|
|
|
NS_IMETHOD Resize (PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRepaint);
|
2008-10-19 05:13:27 +04:00
|
|
|
NS_IMETHOD Resize (PRInt32 aX,
|
|
|
|
PRInt32 aY,
|
|
|
|
PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRepaint);
|
|
|
|
NS_IMETHOD IsEnabled (bool *aState);
|
2008-10-19 05:13:27 +04:00
|
|
|
|
|
|
|
|
2003-10-07 05:19:51 +04:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
|
|
|
nsIWidget *aWidget,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aActivate);
|
2005-01-27 23:49:47 +03:00
|
|
|
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
|
2002-04-30 23:03:12 +04:00
|
|
|
NS_IMETHOD SetSizeMode(PRInt32 aMode);
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD Enable(bool aState);
|
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false);
|
2009-01-15 06:27:09 +03:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
2011-12-02 01:35:42 +04:00
|
|
|
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
|
|
|
virtual nsIntPoint GetClientOffset();
|
2002-04-27 20:26:10 +04:00
|
|
|
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
|
|
|
|
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
2005-07-01 08:29:42 +04:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
|
|
|
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
2011-12-24 07:52:21 +04:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect &aRect);
|
2002-04-27 20:26:10 +04:00
|
|
|
virtual void* GetNativeData(PRUint32 aDataType);
|
2004-04-19 03:18:23 +04:00
|
|
|
NS_IMETHOD SetTitle(const nsAString& aTitle);
|
2002-11-16 04:22:10 +03:00
|
|
|
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
|
2006-07-19 16:56:40 +04:00
|
|
|
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
2009-02-19 03:11:49 +03:00
|
|
|
virtual nsIntPoint WidgetToScreenOffset();
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable);
|
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture);
|
2002-04-27 20:26:10 +04:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDoCapture,
|
|
|
|
bool aConsumeRollupEvent);
|
2004-02-11 06:46:30 +03:00
|
|
|
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool HasPendingInputEvent();
|
2009-04-22 03:53:52 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
2012-02-02 06:12:26 +04:00
|
|
|
/**
|
2012-02-14 00:19:59 +04:00
|
|
|
* GetLastUserInputTime returns a timestamp for the most recent user input
|
|
|
|
* event. This is intended for pointer grab requests (including drags).
|
2012-02-02 06:12:26 +04:00
|
|
|
*/
|
2012-02-14 00:19:59 +04:00
|
|
|
static guint32 GetLastUserInputTime();
|
2012-02-02 06:12:26 +04:00
|
|
|
|
2010-07-27 17:38:04 +04:00
|
|
|
// utility method, -1 if no change should be made, otherwise returns a
|
|
|
|
// value that can be passed to gdk_window_set_decorations
|
2003-05-01 06:32:24 +04:00
|
|
|
gint ConvertBorderStyles(nsBorderStyle aStyle);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
|
|
|
// event callbacks
|
2011-09-23 00:58:07 +04:00
|
|
|
#if defined(MOZ_WIDGET_GTK2)
|
|
|
|
gboolean OnExposeEvent(GdkEventExpose *aEvent);
|
|
|
|
#else
|
|
|
|
gboolean OnExposeEvent(cairo_t *cr);
|
|
|
|
#endif
|
2002-04-27 20:26:10 +04:00
|
|
|
gboolean OnConfigureEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventConfigure *aEvent);
|
2009-05-15 06:14:45 +04:00
|
|
|
void OnContainerUnrealize(GtkWidget *aWidget);
|
2002-04-27 20:26:10 +04: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);
|
2002-04-30 23:03:12 +04:00
|
|
|
void OnWindowStateEvent(GtkWidget *aWidget,
|
|
|
|
GdkEventWindowState *aEvent);
|
2002-08-10 21:07:40 +04:00
|
|
|
gboolean OnDragMotionEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
guint aTime,
|
2011-05-19 14:51:11 +04:00
|
|
|
gpointer aData);
|
2002-08-10 21:07:40 +04:00
|
|
|
void OnDragLeaveEvent(GtkWidget * aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
guint aTime,
|
|
|
|
gpointer aData);
|
|
|
|
gboolean OnDragDropEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
guint aTime,
|
2011-05-19 14:51:11 +04:00
|
|
|
gpointer aData);
|
2002-08-10 21:07:40 +04:00
|
|
|
void OnDragDataReceivedEvent(GtkWidget *aWidget,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
gint aX,
|
|
|
|
gint aY,
|
|
|
|
GtkSelectionData*aSelectionData,
|
|
|
|
guint aInfo,
|
|
|
|
guint aTime,
|
|
|
|
gpointer aData);
|
|
|
|
void OnDragLeave(void);
|
|
|
|
|
2012-02-02 06:12:02 +04:00
|
|
|
private:
|
|
|
|
void NativeResize(PRInt32 aWidth,
|
2002-04-27 20:26:10 +04:00
|
|
|
PRInt32 aHeight,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRepaint);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
2012-02-02 06:12:02 +04:00
|
|
|
void NativeResize(PRInt32 aX,
|
2002-04-27 20:26:10 +04:00
|
|
|
PRInt32 aY,
|
|
|
|
PRInt32 aWidth,
|
|
|
|
PRInt32 aHeight,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aRepaint);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
2012-02-02 06:12:02 +04:00
|
|
|
void NativeShow (bool aAction);
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetHasMappedToplevel(bool aState);
|
2009-11-02 05:03:12 +03:00
|
|
|
nsIntSize GetSafeWindowSize(nsIntSize aSize);
|
2002-04-27 20:26:10 +04:00
|
|
|
|
|
|
|
void EnsureGrabs (void);
|
2012-02-02 06:12:26 +04:00
|
|
|
void GrabPointer (guint32 aTime);
|
2002-04-27 20:26:10 +04:00
|
|
|
void ReleaseGrabs (void);
|
2003-02-17 18:36:37 +03:00
|
|
|
|
2012-02-02 06:12:02 +04:00
|
|
|
public:
|
2003-09-16 05:44:41 +04: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-07 00:48:55 +04:00
|
|
|
#ifdef MOZ_X11
|
2003-02-17 18:36:37 +03:00
|
|
|
void SetNonXEmbedPluginFocus(void);
|
|
|
|
void LoseNonXEmbedPluginFocus(void);
|
2008-08-07 00:48:55 +04:00
|
|
|
#endif /* MOZ_X11 */
|
2002-04-27 20:26:10 +04:00
|
|
|
|
2004-09-17 10:27:01 +04:00
|
|
|
void ThemeChanged(void);
|
|
|
|
|
2012-04-17 04:59:56 +04:00
|
|
|
void CheckNeedDragLeave(nsWindow* aInnerMostWidget,
|
|
|
|
nsIDragService* aDragService,
|
|
|
|
GdkDragContext *aDragContext,
|
|
|
|
nscoord aX, nscoord aY);
|
2010-02-01 18:11:09 +03:00
|
|
|
|
2008-08-07 00:48:55 +04:00
|
|
|
#ifdef MOZ_X11
|
2003-02-17 21:50:01 +03:00
|
|
|
Window mOldFocusWindow;
|
2008-08-07 00:48:55 +04:00
|
|
|
#endif /* MOZ_X11 */
|
2003-02-17 21:50:01 +03:00
|
|
|
|
2010-03-24 06:37:06 +03:00
|
|
|
static guint32 sLastButtonPressTime;
|
|
|
|
static guint32 sLastButtonReleaseTime;
|
2002-09-26 10:20:01 +04:00
|
|
|
|
2010-07-17 12:11:54 +04:00
|
|
|
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
|
|
|
|
NS_IMETHOD BeginMoveDrag(nsMouseEvent* aEvent);
|
2007-12-11 13:08:35 +03:00
|
|
|
|
2010-03-19 07:21:16 +03:00
|
|
|
MozContainer* GetMozContainer() { return mContainer; }
|
|
|
|
GdkWindow* GetGdkWindow() { return mGdkWindow; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsDestroyed() { return mIsDestroyed; }
|
2010-03-19 07:21:16 +03:00
|
|
|
|
2012-04-17 05:00:25 +04:00
|
|
|
void DispatchDragEvent(PRUint32 aMsg,
|
|
|
|
const nsIntPoint& aRefPoint,
|
|
|
|
guint aTime);
|
2010-03-19 07:21:16 +03:00
|
|
|
// If this dispatched the keydown event actually, this returns TRUE,
|
|
|
|
// otherwise, FALSE.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DispatchKeyDownEvent(GdkEventKey *aEvent,
|
|
|
|
bool *aIsCancelled);
|
2006-03-14 09:07:54 +03:00
|
|
|
|
|
|
|
NS_IMETHOD ResetInputState();
|
2011-11-27 15:51:52 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction);
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext();
|
2006-03-14 09:07:54 +03:00
|
|
|
NS_IMETHOD CancelIMEComposition();
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD OnIMEFocusChange(bool aFocus);
|
|
|
|
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, bool* aLEDState);
|
2006-03-14 09:07:54 +03:00
|
|
|
|
2004-07-24 16:42:32 +04:00
|
|
|
void ResizeTransparencyBitmap(PRInt32 aNewWidth, PRInt32 aNewHeight);
|
|
|
|
void ApplyTransparencyBitmap();
|
2008-08-13 04:44:14 +04:00
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode();
|
2009-07-22 04:44:55 +04:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
|
2009-01-15 06:27:09 +03:00
|
|
|
nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
2006-02-21 01:43:44 +03:00
|
|
|
PRUint8* aAlphas, PRInt32 aStride);
|
2004-07-24 16:42:32 +04:00
|
|
|
|
2011-09-23 00:58:07 +04:00
|
|
|
#if defined(MOZ_WIDGET_GTK2)
|
2005-11-29 23:12:29 +03:00
|
|
|
gfxASurface *GetThebesSurface();
|
|
|
|
|
2008-06-18 13:20:29 +04:00
|
|
|
static already_AddRefed<gfxASurface> GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
|
2009-01-15 06:27:09 +03:00
|
|
|
const nsIntSize& aSize);
|
2011-09-23 00:58:07 +04:00
|
|
|
#else
|
|
|
|
gfxASurface *GetThebesSurface(cairo_t *cr);
|
|
|
|
#endif
|
2010-09-18 15:28:50 +04:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
2008-06-18 13:20:29 +04:00
|
|
|
|
2012-04-12 01:55:21 +04:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
|
|
|
PRUint32 aNativeMessage,
|
|
|
|
PRUint32 aModifierFlags);
|
|
|
|
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
|
|
|
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); }
|
|
|
|
|
2008-10-19 05:13:27 +04:00
|
|
|
protected:
|
2010-09-18 15:28:50 +04:00
|
|
|
// Helper for SetParent and ReparentNativeWidget.
|
|
|
|
void ReparentNativeWidgetInternal(nsIWidget* aNewParent,
|
|
|
|
GtkWidget* aNewContainer,
|
|
|
|
GdkWindow* aNewParentWindow,
|
|
|
|
GtkWidget* aOldContainer);
|
2008-10-19 05:13:27 +04:00
|
|
|
nsCOMPtr<nsIWidget> mParent;
|
|
|
|
// Is this a toplevel window?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsTopLevel;
|
2008-10-19 05:13:27 +04:00
|
|
|
// Has this widget been destroyed yet?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsDestroyed;
|
2008-10-19 05:13:27 +04:00
|
|
|
|
|
|
|
// This is a flag that tracks if we need to resize a widget or
|
|
|
|
// window when we show it.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNeedsResize;
|
2008-10-19 05:13:27 +04:00
|
|
|
// This is a flag that tracks if we need to move a widget or
|
|
|
|
// window when we show it.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mNeedsMove;
|
2008-10-19 05:13:27 +04:00
|
|
|
// Should we send resize events on all resizes?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mListenForResizes;
|
2008-10-19 05:13:27 +04:00
|
|
|
// This flag tracks if we're hidden or shown.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsShown;
|
|
|
|
bool mNeedsShow;
|
2008-10-19 05:13:27 +04:00
|
|
|
// is this widget enabled?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mEnabled;
|
2008-10-19 05:13:27 +04:00
|
|
|
// has the native window for this been created yet?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCreated;
|
2008-10-19 05:13:27 +04:00
|
|
|
|
2002-04-27 20:26:10 +04:00
|
|
|
private:
|
2009-11-11 00:57:25 +03:00
|
|
|
void DestroyChildWindows();
|
2002-04-27 20:26:10 +04:00
|
|
|
void GetToplevelWidget(GtkWidget **aWidget);
|
2008-08-28 06:04:06 +04:00
|
|
|
GtkWidget *GetMozContainerWidget();
|
2009-02-20 05:07:08 +03:00
|
|
|
nsWindow *GetContainerWindow();
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetUrgencyHint(GtkWidget *top_window, bool state);
|
2002-09-02 09:11:10 +04:00
|
|
|
void *SetupPluginPort(void);
|
2002-11-16 04:22:10 +03:00
|
|
|
void SetDefaultIcon(void);
|
2007-12-14 10:00:44 +03:00
|
|
|
void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DispatchCommandEvent(nsIAtom* aCommand);
|
|
|
|
bool DispatchContentCommandEvent(PRInt32 aMsg);
|
2009-12-14 00:01:33 +03:00
|
|
|
void SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIntersectWithExisting);
|
|
|
|
bool GetDragInfo(nsMouseEvent* aMouseEvent,
|
2010-07-17 12:11:54 +04:00
|
|
|
GdkWindow** aWindow, gint* aButton,
|
|
|
|
gint* aRootX, gint* aRootY);
|
2011-01-22 00:45:23 +03:00
|
|
|
void ClearCachedResources();
|
2002-04-27 20:26:10 +04:00
|
|
|
|
|
|
|
GtkWidget *mShell;
|
|
|
|
MozContainer *mContainer;
|
2009-07-27 05:39:36 +04:00
|
|
|
GdkWindow *mGdkWindow;
|
2002-04-27 20:26:10 +04:00
|
|
|
|
|
|
|
GtkWindowGroup *mWindowGroup;
|
|
|
|
|
2010-06-02 03:33:28 +04:00
|
|
|
PRUint32 mHasMappedToplevel : 1,
|
2009-11-02 05:03:12 +03:00
|
|
|
mIsFullyObscured : 1,
|
2011-02-16 23:10:16 +03:00
|
|
|
mRetryPointerGrab : 1;
|
2002-04-27 20:26:10 +04:00
|
|
|
GtkWindow *mTransientParent;
|
2002-04-30 23:03:12 +04:00
|
|
|
PRInt32 mSizeState;
|
2003-09-16 05:44:41 +04:00
|
|
|
PluginType mPluginType;
|
2002-05-08 11:42:34 +04:00
|
|
|
|
2008-01-01 13:21:28 +03:00
|
|
|
PRInt32 mTransparencyBitmapWidth;
|
|
|
|
PRInt32 mTransparencyBitmapHeight;
|
2006-10-16 16:13:54 +04:00
|
|
|
|
2010-09-24 06:54:52 +04:00
|
|
|
#ifdef MOZ_HAVE_SHMIMAGE
|
2010-09-24 05:00:06 +04:00
|
|
|
// If we're using xshm rendering, mThebesSurface wraps mShmImage
|
|
|
|
nsRefPtr<nsShmImage> mShmImage;
|
|
|
|
#endif
|
2005-11-29 23:12:29 +03:00
|
|
|
nsRefPtr<gfxASurface> mThebesSurface;
|
|
|
|
|
2002-05-08 11:42:34 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-05-12 10:47:35 +04:00
|
|
|
nsRefPtr<nsAccessible> mRootAccessible;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request to create the accessible for this window if it is top level.
|
|
|
|
*/
|
2003-04-23 09:28:41 +04:00
|
|
|
void CreateRootAccessible();
|
2010-05-12 10:47:35 +04: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-19 05:13:27 +04:00
|
|
|
void DispatchActivateEventAccessible();
|
2010-05-12 10:47:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch accessible window deactivate event for the top level window
|
|
|
|
* accessible.
|
|
|
|
*/
|
2008-10-19 05:13:27 +04:00
|
|
|
void DispatchDeactivateEventAccessible();
|
2011-03-26 19:06:00 +03: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();
|
2002-05-08 11:42:34 +04:00
|
|
|
#endif
|
2002-08-10 20:18:44 +04:00
|
|
|
|
2002-08-10 22:07:20 +04:00
|
|
|
// The cursor cache
|
2003-05-03 02:23:55 +04:00
|
|
|
static GdkCursor *gsGtkCursorCache[eCursorCount];
|
2002-08-10 22:07:20 +04:00
|
|
|
|
2004-07-24 16:42:32 +04:00
|
|
|
// Transparency
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsTransparent;
|
2004-07-24 16:42:32 +04: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;
|
|
|
|
|
2002-08-10 21:07:40 +04:00
|
|
|
// all of our DND stuff
|
2002-08-10 20:18:44 +04:00
|
|
|
// this is the last window that had a drag event happen on it.
|
2011-01-27 04:58:49 +03:00
|
|
|
static nsWindow *sLastDragMotionWindow;
|
2008-08-27 16:07:27 +04:00
|
|
|
void InitDragEvent (nsDragEvent &aEvent);
|
2010-02-01 18:11:09 +03:00
|
|
|
void UpdateDragStatus (GdkDragContext *aDragContext,
|
2002-08-10 20:18:44 +04:00
|
|
|
nsIDragService *aDragService);
|
|
|
|
|
|
|
|
nsCOMPtr<nsITimer> mDragLeaveTimer;
|
2008-12-12 02:55:15 +03:00
|
|
|
float mLastMotionPressure;
|
2002-08-10 20:18:44 +04:00
|
|
|
|
2009-08-27 04:09:47 +04:00
|
|
|
// Remember the last sizemode so that we can restore it when
|
|
|
|
// leaving fullscreen
|
|
|
|
nsSizeMode mLastSizeMode;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool sIsDraggingOutOf;
|
2003-12-03 04:50:50 +03:00
|
|
|
// drag in progress
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool DragInProgress(void);
|
2003-12-03 04:50:50 +03:00
|
|
|
|
2002-08-10 21:07:40 +04:00
|
|
|
void FireDragLeaveTimer (void);
|
2002-08-10 20:18:44 +04:00
|
|
|
static void DragLeaveTimerCallback (nsITimer *aTimer, void *aClosure);
|
|
|
|
|
2010-03-24 06:37:06 +03:00
|
|
|
void DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent);
|
|
|
|
|
2010-03-19 07:21:16 +03: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;
|
2001-07-26 02:05:10 +04:00
|
|
|
};
|
2001-12-07 08:23:56 +03:00
|
|
|
|
|
|
|
class nsChildWindow : public nsWindow {
|
2002-04-27 20:26:10 +04:00
|
|
|
public:
|
|
|
|
nsChildWindow();
|
|
|
|
~nsChildWindow();
|
2001-12-07 08:23:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __nsWindow_h__ */
|