зеркало из 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_NSIROLLUPLISTENER
|
||||
NS_DECL_NSIMENUROLLUP
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
virtual void GetSubmenuWidgetChain(nsTArray<nsIWidget*> *_retval);
|
||||
virtual void AdjustPopupsOnWindowChange(void);
|
||||
|
||||
static nsXULPopupManager* sInstance;
|
||||
|
||||
// initialize and shutdown methods called by nsLayoutStatics
|
||||
|
|
|
@ -60,6 +60,7 @@ EXPORTS = \
|
|||
nsIPluginWidget.h \
|
||||
nsINativeKeyBindings.h \
|
||||
nsIDeviceContextSpec.h \
|
||||
nsIMenuRollup.h \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
|
@ -100,7 +101,6 @@ XPIDLSRCS = \
|
|||
nsIClipboardHelper.idl \
|
||||
nsIClipboardOwner.idl \
|
||||
nsIRollupListener.idl \
|
||||
nsIMenuRollup.idl \
|
||||
nsIBaseWindow.idl \
|
||||
nsIBidiKeyboard.idl \
|
||||
nsIFullScreen.idl \
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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
|
||||
|
@ -13,19 +12,18 @@
|
|||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton <pinkerton@netscape.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"),
|
||||
* either of 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
|
||||
|
@ -37,19 +35,31 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
#ifndef nsIMenuRollup_h___
|
||||
#define nsIMenuRollup_h___
|
||||
|
||||
[uuid(10C69225-2C5A-4948-8690-0BC589D145B4)]
|
||||
interface nsIMenuRollup : nsISupports
|
||||
{
|
||||
// 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
|
||||
// parent menu.
|
||||
nsISupportsArray GetSubmenuWidgetChain ( ) ;
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#define NS_IMENUROLLUP_IID \
|
||||
{0x2b65d177, 0xc3e4, 0x4564, \
|
||||
{ 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) );
|
||||
if ( menuRollup )
|
||||
{
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
||||
if ( widgetChain )
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||
|
||||
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i )
|
||||
{
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for ( PRUint32 i = 0; i < count; ++i )
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget, pos) )
|
||||
{
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
||||
if ( widget )
|
||||
{
|
||||
nsIWidget* temp = widget.get();
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp, pos) )
|
||||
{
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if widgetChain
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if rollup listener knows about menus
|
||||
} // if rollup
|
||||
|
||||
|
|
|
@ -2455,21 +2455,15 @@ NSEvent* gLastDragEvent = nil;
|
|||
nsCOMPtr<nsIMenuRollup> menuRollup;
|
||||
menuRollup = (do_QueryInterface(gRollupListener));
|
||||
if (menuRollup) {
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain(getter_AddRefs(widgetChain));
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||
if (widgetChain) {
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt(i, getter_AddRefs(genericWidget));
|
||||
nsCOMPtr<nsIWidget> widget(do_QueryInterface(genericWidget));
|
||||
if (widget) {
|
||||
NSWindow* currWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (nsCocoaUtils::IsEventOverWindow(theEvent, currWindow)) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
for (PRUint32 i = 0; i < widgetChain.Length(); i++) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
NSWindow* currWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
if (nsCocoaUtils::IsEventOverWindow(theEvent, currWindow)) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
}
|
||||
|
|
|
@ -4104,26 +4104,17 @@ check_for_rollup(GdkWindow *aWindow, gdouble aMouseX, gdouble aMouseY,
|
|||
nsCOMPtr<nsIMenuRollup> menuRollup;
|
||||
menuRollup = (do_QueryInterface(gRollupListener));
|
||||
if (menuRollup) {
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain(getter_AddRefs(widgetChain));
|
||||
if (widgetChain) {
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for (PRUint32 i=0; i<count; ++i) {
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt(i,
|
||||
getter_AddRefs(genericWidget));
|
||||
nsCOMPtr<nsIWidget> widget(do_QueryInterface(genericWidget));
|
||||
if (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
|
||||
}
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain(&widgetChain);
|
||||
for (PRUint32 i=0; i<widgetChain.Length(); ++i) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
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 we've determined that we should still rollup, do it.
|
||||
|
|
|
@ -640,24 +640,15 @@ nsWindow :: DealWithPopups ( ULONG inMsg, MRESULT* outResult )
|
|||
if (rollup) {
|
||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||
if ( menuRollup ) {
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
||||
if ( widgetChain ) {
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
||||
if ( widget ) {
|
||||
nsIWidget* temp = widget.get();
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
}
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if rollup listener knows about menus
|
||||
}
|
||||
|
||||
|
@ -744,24 +735,15 @@ MRESULT EXPENTRY fnwpNSWindow( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
|||
if (rollup) {
|
||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||
if ( menuRollup ) {
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
||||
if ( widgetChain ) {
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
||||
if ( widget ) {
|
||||
nsIWidget* temp = widget.get();
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)temp) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
}
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
if ( nsWindow::EventIsInsideWindow((nsWindow*)widget) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if rollup listener knows about menus
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7724,24 +7724,15 @@ nsWindow :: DealWithPopups ( HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inL
|
|||
if (rollup) {
|
||||
nsCOMPtr<nsIMenuRollup> menuRollup ( do_QueryInterface(gRollupListener) );
|
||||
if ( menuRollup ) {
|
||||
nsCOMPtr<nsISupportsArray> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( getter_AddRefs(widgetChain) );
|
||||
if ( widgetChain ) {
|
||||
PRUint32 count = 0;
|
||||
widgetChain->Count(&count);
|
||||
for ( PRUint32 i = 0; i < count; ++i ) {
|
||||
nsCOMPtr<nsISupports> genericWidget;
|
||||
widgetChain->GetElementAt ( i, getter_AddRefs(genericWidget) );
|
||||
nsCOMPtr<nsIWidget> widget ( do_QueryInterface(genericWidget) );
|
||||
if ( widget ) {
|
||||
nsIWidget* temp = widget.get();
|
||||
if ( nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)temp) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
}
|
||||
nsAutoTArray<nsIWidget*, 5> widgetChain;
|
||||
menuRollup->GetSubmenuWidgetChain ( &widgetChain );
|
||||
for ( PRUint32 i = 0; i < widgetChain.Length(); ++i ) {
|
||||
nsIWidget* widget = widgetChain[i];
|
||||
if ( nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)widget) ) {
|
||||
rollup = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
} // foreach parent menu widget
|
||||
} // if rollup listener knows about menus
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче