r=mkaply, a=brendan
Code from jkobal to fix menus rolling up prematurely - straight from Windows
This commit is contained in:
mkaply%us.ibm.com 2000-08-30 22:13:20 +00:00
Родитель 6615b47a81
Коммит 11f82c7a51
1 изменённых файлов: 29 добавлений и 10 удалений

Просмотреть файл

@ -59,6 +59,7 @@
#include "nsDragService.h"
//#include "nsContextMenu.h"
#include "nsIRollupListener.h"
#include "nsIMenuRollup.h"
#include "nsIRegion.h"
//~~~ windowless plugin support
@ -525,15 +526,33 @@ MRESULT EXPENTRY fnwpNSWindow( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
if( nsnull != gRollupListener && nsnull != gRollupWidget) {
if( msg == WM_ACTIVATE || msg == WM_BUTTON1DOWN ||
msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) {
// Rollup if the event is outside the popup
if( PR_FALSE == nsWindow::EventIsInsideWindow( (nsWindow*)gRollupWidget)) {
gRollupListener->Rollup();
// Rollup if the event is outside the popup.
PRBool rollup = !nsWindow::EventIsInsideWindow((nsWindow*)gRollupWidget);
// if we are supposed to be consuming events and it is
// a Mouse Button down, let it go through
// if( gRollupConsumeRollupEvent && msg != WM_BUTTON1DOWN) {
// return FALSE;
// }
// If we're dealing with menus, we probably have submenus and we don't
// want to rollup if the click is in a parent menu of the current submenu.
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
}
} // if rollup listener knows about menus
}
}
else if( msg == WM_SETFOCUS) {