зеркало из https://github.com/mozilla/gecko-dev.git
Bug 405512 - "deCOMtaminate nsIMenuRollup" [p=karunasagark@gmail.com (karuna [kay]) r+sr=roc a1.9=schrep]
This commit is contained in:
Родитель
aecd9a4302
Коммит
10aa82e60c
|
@ -323,9 +323,11 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIROLLUPLISTENER
|
NS_DECL_NSIROLLUPLISTENER
|
||||||
NS_DECL_NSIMENUROLLUP
|
|
||||||
NS_DECL_NSITIMERCALLBACK
|
NS_DECL_NSITIMERCALLBACK
|
||||||
|
|
||||||
|
virtual void GetSubmenuWidgetChain(nsTArray<nsIWidget*> *_retval);
|
||||||
|
virtual void AdjustPopupsOnWindowChange(void);
|
||||||
|
|
||||||
static nsXULPopupManager* sInstance;
|
static nsXULPopupManager* sInstance;
|
||||||
|
|
||||||
// initialize and shutdown methods called by nsLayoutStatics
|
// initialize and shutdown methods called by nsLayoutStatics
|
||||||
|
|
|
@ -60,6 +60,7 @@ EXPORTS = \
|
||||||
nsIPluginWidget.h \
|
nsIPluginWidget.h \
|
||||||
nsINativeKeyBindings.h \
|
nsINativeKeyBindings.h \
|
||||||
nsIDeviceContextSpec.h \
|
nsIDeviceContextSpec.h \
|
||||||
|
nsIMenuRollup.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||||
|
@ -100,7 +101,6 @@ XPIDLSRCS = \
|
||||||
nsIClipboardHelper.idl \
|
nsIClipboardHelper.idl \
|
||||||
nsIClipboardOwner.idl \
|
nsIClipboardOwner.idl \
|
||||||
nsIRollupListener.idl \
|
nsIRollupListener.idl \
|
||||||
nsIMenuRollup.idl \
|
|
||||||
nsIBaseWindow.idl \
|
nsIBaseWindow.idl \
|
||||||
nsIBidiKeyboard.idl \
|
nsIBidiKeyboard.idl \
|
||||||
nsIFullScreen.idl \
|
nsIFullScreen.idl \
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
*
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
@ -13,19 +12,18 @@
|
||||||
* for the specific language governing rights and limitations under the
|
* for the specific language governing rights and limitations under the
|
||||||
* License.
|
* License.
|
||||||
*
|
*
|
||||||
* The Original Code is the Mozilla browser.
|
* The Original Code is mozilla.org code.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is
|
* The Initial Developer of the Original Code is
|
||||||
* Netscape Communications Corporation.
|
* Netscape Communications Corporation.
|
||||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Mike Pinkerton <pinkerton@netscape.com>
|
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* 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
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
* 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
|
* 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
|
* 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
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
@ -37,19 +35,31 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
#include "nsISupportsArray.idl"
|
|
||||||
|
|
||||||
|
#ifndef nsIMenuRollup_h___
|
||||||
|
#define nsIMenuRollup_h___
|
||||||
|
|
||||||
[uuid(10C69225-2C5A-4948-8690-0BC589D145B4)]
|
#include "nsISupports.h"
|
||||||
interface nsIMenuRollup : nsISupports
|
#include "nsIWidget.h"
|
||||||
{
|
#include "nsTArray.h"
|
||||||
// Walks up the menu parent chain of a submenu pulling out the widgets and
|
|
||||||
// places them into a list. Useful for determining if a click is in a
|
#define NS_IMENUROLLUP_IID \
|
||||||
// parent menu.
|
{0x2b65d177, 0xc3e4, 0x4564, \
|
||||||
nsISupportsArray GetSubmenuWidgetChain ( ) ;
|
{ 0x8d, 0xed, 0x86, 0xd2, 0xfa, 0x2f, 0x65, 0x9a }}
|
||||||
|
|
||||||
|
class nsIMenuRollup : public nsISupports {
|
||||||
|
public:
|
||||||
|
|
||||||
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMENUROLLUP_IID)
|
||||||
|
|
||||||
|
/* void GetSubmenuWidgetChain (nsTArray<nsIWidget*>*); */
|
||||||
|
virtual void GetSubmenuWidgetChain(nsTArray<nsIWidget*> *_retval) = 0;
|
||||||
|
|
||||||
|
/* void AdjustPopupsOnWindowChange (); */
|
||||||
|
virtual void AdjustPopupsOnWindowChange(void) = 0;
|
||||||
|
|
||||||
// adjust the position of any open popups when the position or size of a
|
|
||||||
// window has been changed.
|
|
||||||
void AdjustPopupsOnWindowChange ( );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMenuRollup, NS_IMENUROLLUP_IID)
|
||||||
|
|
||||||
|
#endif
|
|
@ -885,28 +885,18 @@ nsWindow::DealWithPopups(uint32 methodID, nsPoint pos)
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||||
if ( menuRollup )
|
if ( menuRollup )
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||||
if ( widgetChain )
|
|
||||||
|
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i )
|
||||||
{
|
{
|
||||||
PRUint32 count = 0;
|
nsIWidget* widget = widgetChain[i];
|
||||||
widgetChain->Count(&count);
|
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget, pos) )
|
||||||
for ( PRUint32 i = 0; i < count; ++i )
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
rollup = PR_FALSE;
|
||||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
break;
|
||||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
}
|
||||||
if ( widget )
|
} // foreach parent menu widget
|
||||||
{
|
|
||||||
nsIWidget* temp = widget.get();
|
|
||||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp, pos) )
|
|
||||||
{
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // foreach parent menu widget
|
|
||||||
} // if widgetChain
|
|
||||||
} // if rollup listener knows about menus
|
} // if rollup listener knows about menus
|
||||||
} // if rollup
|
} // if rollup
|
||||||
|
|
||||||
|
|
|
@ -2455,21 +2455,15 @@ NSEvent* gLastDragEvent = nil;
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup;
|
nsCOMPtr<nsIMenuRollup> menuRollup;
|
||||||
menuRollup = (do_QueryInterface(gRollupListener));
|
menuRollup = (do_QueryInterface(gRollupListener));
|
||||||
if (menuRollup) {
|
if (menuRollup) {
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain(getter_AddRefs(widgetChain));
|
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||||
if (widgetChain) {
|
if (widgetChain) {
|
||||||
PRUint32 count = 0;
|
for (PRUint32 i = 0; i < widgetChain.Length(); i++) {
|
||||||
widgetChain->Count(&count);
|
nsIWidget* widget = widgetChain[i];
|
||||||
for (PRUint32 i = 0; i < count; i++) {
|
NSWindow* currWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
if (nsCocoaUtils::IsEventOverWindow(theEvent, currWindow)) {
|
||||||
widgetChain->GetElementAt(i, getter_AddRefs(genericWidget));
|
rollup = PR_FALSE;
|
||||||
nsCOMPtr<nsIWidget> widget(do_QueryInterface(genericWidget));
|
break;
|
||||||
if (widget) {
|
|
||||||
NSWindow* currWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
|
||||||
if (nsCocoaUtils::IsEventOverWindow(theEvent, currWindow)) {
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // foreach parent menu widget
|
} // foreach parent menu widget
|
||||||
}
|
}
|
||||||
|
|
|
@ -4104,26 +4104,17 @@ check_for_rollup(GdkWindow *aWindow, gdouble aMouseX, gdouble aMouseY,
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup;
|
nsCOMPtr<nsIMenuRollup> menuRollup;
|
||||||
menuRollup = (do_QueryInterface(gRollupListener));
|
menuRollup = (do_QueryInterface(gRollupListener));
|
||||||
if (menuRollup) {
|
if (menuRollup) {
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain(getter_AddRefs(widgetChain));
|
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||||
if (widgetChain) {
|
for (PRUint32 i=0; i<widgetChain.Length(); ++i) {
|
||||||
PRUint32 count = 0;
|
nsIWidget* widget = widgetChain[i];
|
||||||
widgetChain->Count(&count);
|
GdkWindow* currWindow =
|
||||||
for (PRUint32 i=0; i<count; ++i) {
|
(GdkWindow*) widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
|
||||||
widgetChain->GetElementAt(i,
|
rollup = PR_FALSE;
|
||||||
getter_AddRefs(genericWidget));
|
break;
|
||||||
nsCOMPtr<nsIWidget> widget(do_QueryInterface(genericWidget));
|
}
|
||||||
if (widget) {
|
} // foreach parent menu widget
|
||||||
GdkWindow* currWindow =
|
|
||||||
(GdkWindow*) widget->GetNativeData(NS_NATIVE_WINDOW);
|
|
||||||
if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // foreach parent menu widget
|
|
||||||
}
|
|
||||||
} // if rollup listener knows about menus
|
} // if rollup listener knows about menus
|
||||||
|
|
||||||
// if we've determined that we should still rollup, do it.
|
// if we've determined that we should still rollup, do it.
|
||||||
|
|
|
@ -640,24 +640,15 @@ nsWindow :: DealWithPopups ( ULONG inMsg, MRESULT* outResult )
|
||||||
if (rollup) {
|
if (rollup) {
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||||
if ( menuRollup ) {
|
if ( menuRollup ) {
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||||
if ( widgetChain ) {
|
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||||
PRUint32 count = 0;
|
nsIWidget* widget = widgetChain[i];
|
||||||
widgetChain->Count(&count);
|
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget) ) {
|
||||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
rollup = PR_FALSE;
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
break;
|
||||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
}
|
||||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
} // foreach parent menu widget
|
||||||
if ( widget ) {
|
|
||||||
nsIWidget* temp = widget.get();
|
|
||||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp) ) {
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // foreach parent menu widget
|
|
||||||
}
|
|
||||||
} // if rollup listener knows about menus
|
} // if rollup listener knows about menus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,24 +735,15 @@ MRESULT EXPENTRY fnwpNSWindow( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||||
if (rollup) {
|
if (rollup) {
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||||
if ( menuRollup ) {
|
if ( menuRollup ) {
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||||
if ( widgetChain ) {
|
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||||
PRUint32 count = 0;
|
nsIWidget* widget = widgetChain[i];
|
||||||
widgetChain->Count(&count);
|
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget) ) {
|
||||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
rollup = PR_FALSE;
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
break;
|
||||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
}
|
||||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
} // foreach parent menu widget
|
||||||
if ( widget ) {
|
|
||||||
nsIWidget* temp = widget.get();
|
|
||||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp) ) {
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // foreach parent menu widget
|
|
||||||
}
|
|
||||||
} // if rollup listener knows about menus
|
} // if rollup listener knows about menus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7724,24 +7724,15 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL
|
||||||
if (rollup) {
|
if (rollup) {
|
||||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||||
if ( menuRollup ) {
|
if ( menuRollup ) {
|
||||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||||
if ( widgetChain ) {
|
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||||
PRUint32 count = 0;
|
nsIWidget* widget = widgetChain[i];
|
||||||
widgetChain->Count(&count);
|
if ( nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)widget) ) {
|
||||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
rollup = PR_FALSE;
|
||||||
nsCOMPtr<nsISupports> genericWidget;
|
break;
|
||||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
}
|
||||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
} // foreach parent menu widget
|
||||||
if ( widget ) {
|
|
||||||
nsIWidget* temp = widget.get();
|
|
||||||
if ( nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)temp) ) {
|
|
||||||
rollup = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // foreach parent menu widget
|
|
||||||
}
|
|
||||||
} // if rollup listener knows about menus
|
} // if rollup listener knows about menus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче