[Offscreengecko-commits] SF.net SVN: offscreengecko:[104] trunk/src/libosgk
Status: Pre-Alpha
Brought to you by:
res2002
|
From: <re...@us...> - 2009-07-05 14:40:59
|
Revision: 104
http://offscreengecko.svn.sourceforge.net/offscreengecko/?rev=104&view=rev
Author: res2002
Date: 2009-07-05 14:40:58 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
Build with xulrunner 1.9.1
Modified Paths:
--------------
trunk/src/libosgk/CMakeLists.txt
trunk/src/libosgk/OffscreenDeviceContext.h
trunk/src/libosgk/OffscreenWidget.h
trunk/src/libosgk/nsBaseWidget.cpp
trunk/src/libosgk/nsBaseWidget.h
Modified: trunk/src/libosgk/CMakeLists.txt
===================================================================
--- trunk/src/libosgk/CMakeLists.txt 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/CMakeLists.txt 2009-07-05 14:40:58 UTC (rev 104)
@@ -23,7 +23,6 @@
# @@@ Gentoo: libdir points at sdk/lib/ subdirectory which only contains a subset of xulrunner libs
set(XULRUNNER_NEW_LIBRARY_DIRS ${XULRUNNER_NEW_LIBRARY_DIRS} ${XULRUNNER_LIB_DIR}/../..)
set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -L${XULRUNNER_LIB_DIR}/../..)
- set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -Wl,-rpath,${XULRUNNER_LIB_DIR}/../..)
endforeach(XULRUNNER_LIB_DIR)
set(XULRUNNER_LIBRARY_DIRS XULRUNNER_NEW_LIBRARY_DIRS)
ELSE(XULRUNNER_FOUND)
@@ -39,6 +38,10 @@
set(XULRUNNER_LDFLAGS -lxul -lnspr4)
ENDIF(XULRUNNER_SDK_DIR)
+IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -lmozjs)
+ENDIF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+
set(CMAKE_REQUIRED_INCLUDES "${XULRUNNER_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_DEFINITIONS "${XULRUNNER_CFLAGS}")
CHECK_CXX_SOURCE_COMPILES(
@@ -48,7 +51,6 @@
XULRUNNER_FLAT_INCDIR)
IF(XULRUNNER_FLAT_INCDIR)
- add_definitions(-DOSGK_GECKOINC_FLAT)
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DOSGK_GECKOINC_FLAT")
ENDIF(XULRUNNER_FLAT_INCDIR)
@@ -79,9 +81,6 @@
int main() { gfxASurface* surf = 0; surf->Release(); return 0; }"
XULRUNNER_LINKS_WITHOUT_THEBES)
-IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
- set(XULRUNNER_LDFLAGS ${XULRUNNER_LDFLAGS} -lthebes)
-ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
include_directories(${XULRUNNER_INCLUDE_DIRS})
IF(XULRUNNER_FLAT_INCDIR)
@@ -141,19 +140,19 @@
IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
message("Creating relaytool files...")
execute_process(
- COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay xul --relay nspr4 ${XULRUNNER_LDFLAGS}
+ COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay xul --relay nspr4 --relay mozjs ${XULRUNNER_LDFLAGS}
WORKING_DIRECTORY out/libosgk
OUTPUT_VARIABLE XULRUNNER_LFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# @@@ FIXME(?): Disabled b/c of duplicate symbols in thebes and xul
- #IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
- # execute_process(
- # COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay thebes ${XULRUNNER_LDFLAGS}
- # WORKING_DIRECTORY out/libosgk
- # OUTPUT_VARIABLE RELAYTOOL_THEBES
- # OUTPUT_STRIP_TRAILING_WHITESPACE)
- # set(XULRUNNER_LFLAGS ${XULRUNNER_LFLAGS} ${RELAYTOOL_THEBES})
- #ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
+ IF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
+ execute_process(
+ COMMAND ${OffscreenGecko_SOURCE_DIR}/bin/relaytool --relay thebes ${XULRUNNER_LDFLAGS} -lthebes
+ WORKING_DIRECTORY out/libosgk
+ OUTPUT_VARIABLE RELAYTOOL_THEBES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(XULRUNNER_LFLAGS ${XULRUNNER_LFLAGS} ${RELAYTOOL_THEBES})
+ ENDIF(NOT XULRUNNER_LINKS_WITHOUT_THEBES)
# -lxpcomglue added manually to work around xpcomglue_s appearing in LFLAGS on gentoo
string(STRIP "-lxpcomglue ${XULRUNNER_LFLAGS}" XULRUNNER_LFLAGS)
target_link_libraries(OffscreenGecko ${XULRUNNER_LFLAGS})
Modified: trunk/src/libosgk/OffscreenDeviceContext.h
===================================================================
--- trunk/src/libosgk/OffscreenDeviceContext.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/OffscreenDeviceContext.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -89,10 +89,10 @@
NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
{ return thebesDC->GetSystemFont (aID, aFont); }
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
- nsIFontMetrics*& aMetrics)
- { return thebesDC->GetMetricsFor (aFont, aLangGroup, aMetrics); }
- NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics)
- { return thebesDC->GetMetricsFor (aFont, aMetrics); }
+ gfxUserFontSet* fs, nsIFontMetrics*& aMetrics)
+ { return thebesDC->GetMetricsFor (aFont, aLangGroup, fs, aMetrics); }
+ NS_IMETHOD GetMetricsFor(const nsFont& aFont, gfxUserFontSet* fs, nsIFontMetrics*& aMetrics)
+ { return thebesDC->GetMetricsFor (aFont, fs, aMetrics); }
NS_IMETHOD CheckFontExistence(const nsString& aFaceName)
{ return thebesDC->CheckFontExistence (aFaceName); }
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName)
Modified: trunk/src/libosgk/OffscreenWidget.h
===================================================================
--- trunk/src/libosgk/OffscreenWidget.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/OffscreenWidget.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -236,7 +236,7 @@
NS_IMETHOD SetTitle(const nsAString& aTitle) { return NS_ERROR_NOT_IMPLEMENTED; }
- NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetMenuBar(void* aMenuBar) { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_NOT_IMPLEMENTED; }
Modified: trunk/src/libosgk/nsBaseWidget.cpp
===================================================================
--- trunk/src/libosgk/nsBaseWidget.cpp 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/nsBaseWidget.cpp 2009-07-05 14:40:58 UTC (rev 104)
@@ -36,8 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
-#include "mozilla-config.h"
-
#include "nsBaseWidget.h"
#include "nsIDeviceContext.h"
#include "nsCOMPtr.h"
@@ -48,6 +46,7 @@
#include "nsIScreenManager.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsISimpleEnumerator.h"
+#include "nsIContent.h"
// [res]: for CallCreateInstance
#include "nsComponentManagerUtils.h"
@@ -69,10 +68,27 @@
static PRInt32 gNumWidgets;
#endif
+nsIContent* nsBaseWidget::mLastRollup = nsnull;
+
// nsBaseWidget
-NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget)
+NS_IMPL_ISUPPORTS2(nsBaseWidget, nsIWidget, nsIWidget_1_9_1_BRANCH)
+nsAutoRollup::nsAutoRollup()
+{
+ // remember if mLastRollup was null, and only clear it upon destruction
+ // if so. This prevents recursive usage of nsAutoRollup from clearing
+ // mLastRollup when it shouldn't.
+ wasClear = !nsBaseWidget::mLastRollup;
+}
+
+nsAutoRollup::~nsAutoRollup()
+{
+ if (nsBaseWidget::mLastRollup && wasClear) {
+ NS_RELEASE(nsBaseWidget::mLastRollup);
+ }
+}
+
//-------------------------------------------------------------------------
//
// nsBaseWidget constructor
@@ -84,15 +100,10 @@
, mEventCallback(nsnull)
, mContext(nsnull)
, mToolkit(nsnull)
-, mMouseListener(nsnull)
, mEventListener(nsnull)
, mCursor(eCursor_standard)
, mWindowType(eWindowType_child)
, mBorderStyle(eBorderStyle_none)
-, mIsShiftDown(PR_FALSE)
-, mIsControlDown(PR_FALSE)
-, mIsAltDown(PR_FALSE)
-, mIsDestroying(PR_FALSE)
, mOnDestroyCalled(PR_FALSE)
, mBounds(0,0,0,0)
, mOriginalBounds(nsnull)
@@ -245,14 +256,12 @@
{
// Just in case our parent is the only ref to us
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
-
// disconnect from the parent
nsIWidget *parent = GetParent();
if (parent) {
parent->RemoveChild(this);
}
// disconnect listeners.
- NS_IF_RELEASE(mMouseListener);
NS_IF_RELEASE(mEventListener);
return NS_OK;
@@ -282,6 +291,35 @@
//-------------------------------------------------------------------------
//
+// Get this nsBaseWidget top level widget
+//
+//-------------------------------------------------------------------------
+nsIWidget* nsBaseWidget::GetTopLevelWidget(PRInt32* aLevelsUp)
+{
+ nsIWidget *topLevelWidget, *widget = this;
+ if (aLevelsUp)
+ *aLevelsUp = -1;
+ while (widget) {
+ topLevelWidget = widget;
+ widget = widget->GetParent();
+ if (aLevelsUp)
+ ++*aLevelsUp;
+ }
+ return topLevelWidget;
+}
+
+//-------------------------------------------------------------------------
+//
+// Get this nsBaseWidget's top (non-sheet) parent (if it's a sheet)
+//
+//-------------------------------------------------------------------------
+nsIWidget* nsBaseWidget::GetSheetWindowParent(void)
+{
+ return nsnull;
+}
+
+//-------------------------------------------------------------------------
+//
// Add a child to the list of children
//
//-------------------------------------------------------------------------
@@ -523,17 +561,21 @@
//
//-------------------------------------------------------------------------
-NS_IMETHODIMP nsBaseWidget::SetWindowTranslucency(PRBool aTranslucent) {
- return NS_ERROR_NOT_IMPLEMENTED;
+void nsBaseWidget::SetTransparencyMode(nsTransparencyMode aMode) {
}
-NS_IMETHODIMP nsBaseWidget::GetWindowTranslucency(PRBool& aTranslucent) {
- aTranslucent = PR_FALSE;
- return NS_OK;
+nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
+ return eTransparencyOpaque;
}
-NS_IMETHODIMP nsBaseWidget::UpdateTranslucentWindowAlpha(const nsRect& aRect, PRUint8* aAlphas) {
- NS_ASSERTION(PR_FALSE, "Window is not translucent");
+//-------------------------------------------------------------------------
+//
+// Set window shadow style
+//
+//-------------------------------------------------------------------------
+
+NS_IMETHODIMP nsBaseWidget::SetWindowShadowStyle(PRInt32 aMode)
+{
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -555,11 +597,7 @@
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
{
HideWindowChrome(aFullScreen);
- return MakeFullScreenInternal(aFullScreen);
-}
-nsresult nsBaseWidget::MakeFullScreenInternal(PRBool aFullScreen)
-{
nsCOMPtr<nsIFullScreen> fullScreen = do_GetService("@mozilla.org/browser/fullscreen;1");
if (aFullScreen) {
@@ -696,25 +734,12 @@
/**
-* Processes a mouse pressed event
+* Sets the event listener for a widget
*
**/
-NS_METHOD nsBaseWidget::AddMouseListener(nsIMouseListener * aListener)
-{
- NS_PRECONDITION(mMouseListener == nsnull, "Null mouse listener");
- NS_IF_RELEASE(mMouseListener);
- NS_ADDREF(aListener);
- mMouseListener = aListener;
- return NS_OK;
-}
-
-/**
-* Processes a mouse pressed event
-*
-**/
NS_METHOD nsBaseWidget::AddEventListener(nsIEventListener * aListener)
{
- NS_PRECONDITION(mEventListener == nsnull, "Null mouse listener");
+ NS_PRECONDITION(mEventListener == nsnull, "Null event listener");
NS_IF_RELEASE(mEventListener);
NS_ADDREF(aListener);
mEventListener = aListener;
@@ -818,6 +843,12 @@
return NS_ERROR_NOT_IMPLEMENTED;
}
+PRBool
+nsBaseWidget::HasPendingInputEvent()
+{
+ return PR_FALSE;
+}
+
NS_IMETHODIMP
nsBaseWidget::SetIcon(const nsAString&)
{
@@ -845,12 +876,18 @@
}
NS_IMETHODIMP
-nsBaseWidget::SetWindowTitlebarColor(nscolor aColor)
+nsBaseWidget::SetWindowTitlebarColor(nscolor aColor, PRBool aActive)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
+PRBool
+nsBaseWidget::ShowsResizeIndicator(nsIntRect* aResizerRect)
+{
+ return PR_FALSE;
+}
+
/**
* Modifies aFile to point at an icon file with the given name and suffix. The
* suffix may correspond to a file extension with leading '.' if appropriate.
@@ -866,7 +903,7 @@
// [res]: embed nsString doesn't have '+'
//aFile->Append(aIconName + aIconSuffix);
aFile->Append(aIconName);
- aFile->Append(aIconSuffix);
+ aFile->Append(aIconSuffix);
PRBool readable;
return NS_SUCCEEDED(aFile->IsReadable(&readable)) && readable;
@@ -921,6 +958,12 @@
NS_ADDREF(*aResult = file);
}
+NS_IMETHODIMP
+nsBaseWidget::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
#ifdef DEBUG
//////////////////////////////////////////////////////////////
//
@@ -939,9 +982,8 @@
nsAutoString eventName(NS_LITERAL_STRING("UNKNOWN"));
- // [res]: removed AssignWithConversion
#define _ASSIGN_eventName(_value,_name)\
-case _value: eventName.Assign(NS_L(_name)) ; break
+case _value: eventName.AssignWithConversion(_name) ; break
switch(aGuiEvent->message)
{
@@ -995,8 +1037,8 @@
char buf[32];
sprintf(buf,"UNKNOWN: %d",aGuiEvent->message);
- // [res]: removed AssignWithConversion
- eventName = NS_ConvertASCIItoUTF16 (buf);
+
+ eventName.AssignWithConversion(buf);
}
break;
}
@@ -1174,9 +1216,7 @@
if (!debug_GetCachedBoolPref("nglayout.debug.event_dumping"))
return;
- // [res]: removed AssignWithConversion
- nsCAutoString tempString;
- tempString = NS_ConvertUTF16toUTF8 (debug_GuiEventToString(aGuiEvent).get());
+ nsCAutoString tempString; tempString.AssignWithConversion(debug_GuiEventToString(aGuiEvent).get());
fprintf(aFileOut,
"%4d %-26s widget=%-8p name=%-12s id=%-8p refpt=%d,%d\n",
Modified: trunk/src/libosgk/nsBaseWidget.h
===================================================================
--- trunk/src/libosgk/nsBaseWidget.h 2008-11-10 23:48:25 UTC (rev 103)
+++ trunk/src/libosgk/nsBaseWidget.h 2009-07-05 14:40:58 UTC (rev 104)
@@ -43,7 +43,6 @@
#include "nsRect.h"
#include "nsIWidget.h"
-#include "nsIMouseListener.h"
#include "nsIEventListener.h"
#include "nsIToolkit.h"
#include "nsIAppShell.h"
@@ -54,6 +53,9 @@
#include "nsCOMPtr.h"
#include "nsGUIEvent.h"
+class nsIContent;
+class nsAutoRollup;
+
/**
* Common widget implementation used as base class for native
* or crossplatform implementations of Widgets.
@@ -63,8 +65,9 @@
* class, but it gives them a head start.)
*/
-class nsBaseWidget : public nsIWidget
+class nsBaseWidget : public nsIWidget_1_9_1_BRANCH
{
+ friend class nsAutoRollup;
public:
nsBaseWidget();
@@ -83,6 +86,8 @@
NS_IMETHOD Destroy();
NS_IMETHOD SetParent(nsIWidget* aNewParent);
virtual nsIWidget* GetParent(void);
+ virtual nsIWidget* GetTopLevelWidget(PRInt32* aLevelsUp = NULL);
+ virtual nsIWidget* GetSheetWindowParent(void);
virtual void AddChild(nsIWidget* aChild);
virtual void RemoveChild(nsIWidget* aChild);
@@ -104,24 +109,20 @@
PRUint32 aHotspotX, PRUint32 aHotspotY);
NS_IMETHOD GetWindowType(nsWindowType& aWindowType);
NS_IMETHOD SetWindowType(nsWindowType aWindowType);
- NS_IMETHOD SetWindowTranslucency(PRBool aTranslucent);
- NS_IMETHOD GetWindowTranslucency(PRBool& aTranslucent);
- NS_IMETHOD UpdateTranslucentWindowAlpha(const nsRect& aRect, PRUint8* aAlphas);
+ virtual void SetTransparencyMode(nsTransparencyMode aMode);
+ virtual nsTransparencyMode GetTransparencyMode();
+ NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
- nsresult MakeFullScreenInternal(PRBool aFullScreen);
virtual nsIRenderingContext* GetRenderingContext();
virtual nsIDeviceContext* GetDeviceContext();
virtual nsIToolkit* GetToolkit();
-#ifdef MOZ_CAIRO_GFX
virtual gfxASurface* GetThebesSurface();
-#endif
NS_IMETHOD SetModal(PRBool aModal);
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,
PRBool *aForWindow);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle);
- NS_IMETHOD AddMouseListener(nsIMouseListener * aListener);
NS_IMETHOD AddEventListener(nsIEventListener * aListener);
NS_IMETHOD SetBounds(const nsRect &aRect);
NS_IMETHOD GetBounds(nsRect &aRect);
@@ -133,12 +134,24 @@
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
+ virtual PRBool HasPendingInputEvent();
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
NS_IMETHOD BeginSecureKeyboardInput();
NS_IMETHOD EndSecureKeyboardInput();
- NS_IMETHOD SetWindowTitlebarColor(nscolor aColor);
+ NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
+ virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}
virtual void FreeNativeData(void * data, PRUint32 aDataType) {}
+ NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical);
+ virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
+ virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD ResetInputState() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEOpenState(PRBool aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEOpenState(PRBool* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD SetIMEEnabled(PRUint32 aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetIMEEnabled(PRUint32* aState) { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD CancelIMEComposition() { return NS_ERROR_NOT_IMPLEMENTED; }
+ NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState) { return NS_ERROR_NOT_IMPLEMENTED; }
protected:
@@ -154,27 +167,38 @@
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
+ virtual nsIContent* GetLastRollup()
+ {
+ return mLastRollup;
+ }
+
+ virtual nsresult SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
+ PRInt32 aNativeKeyCode,
+ PRUint32 aModifierFlags,
+ const nsAString& aCharacters,
+ const nsAString& aUnmodifiedCharacters)
+ { return NS_ERROR_UNEXPECTED; }
+
protected:
void* mClientData;
EVENT_CALLBACK mEventCallback;
nsIDeviceContext *mContext;
nsIToolkit *mToolkit;
- nsIMouseListener *mMouseListener;
nsIEventListener *mEventListener;
nscolor mBackground;
nscolor mForeground;
nsCursor mCursor;
nsWindowType mWindowType;
nsBorderStyle mBorderStyle;
- PRPackedBool mIsShiftDown;
- PRPackedBool mIsControlDown;
- PRPackedBool mIsAltDown;
- PRPackedBool mIsDestroying;
PRPackedBool mOnDestroyCalled;
nsRect mBounds;
nsRect* mOriginalBounds;
PRInt32 mZIndex;
nsSizeMode mSizeMode;
+
+ // the last rolled up popup. Only set this when an nsAutoRollup is in scope,
+ // so it can be cleared automatically.
+ static nsIContent* mLastRollup;
// Enumeration of the methods which are accessible on the "main GUI thread"
// via the CallMethod(...) mechanism...
@@ -216,4 +240,26 @@
#endif
};
+// A situation can occur when a mouse event occurs over a menu label while the
+// menu popup is already open. The expected behaviour is to close the popup.
+// This happens by calling nsIRollupListener::Rollup before the mouse event is
+// processed. However, in cases where the mouse event is not consumed, this
+// event will then get targeted at the menu label causing the menu to open
+// again. To prevent this, we store in mLastRollup a reference to the popup
+// that was closed during the Rollup call, and prevent this popup from
+// reopening while processing the mouse event.
+// mLastRollup should only be set while an nsAutoRollup is in scope;
+// when it goes out of scope mLastRollup is cleared automatically.
+// As mLastRollup is static, it can be retrieved by calling
+// nsIWidget::GetLastRollup on any widget.
+class nsAutoRollup
+{
+ PRBool wasClear;
+
+ public:
+
+ nsAutoRollup();
+ ~nsAutoRollup();
+};
+
#endif // nsBaseWidget_h__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|