Don't highlight toplevel menus on hover for gtk. Bug 233242, r=pch, sr=roc.

This commit is contained in:
bryner%brianryner.com 2004-03-06 21:27:33 +00:00
parent 2081246472
commit 64209ceda0
2 changed files with 27 additions and 2 deletions

View File

@ -53,6 +53,8 @@
#include "nsILookAndFeel.h"
#include "nsIDeviceContext.h"
#include "nsTransform2D.h"
#include "nsIMenuFrame.h"
#include "nsIMenuParent.h"
#include "prlink.h"
#include <gdk/gdkprivate.h>
@ -274,9 +276,30 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
}
// menu item state is determined by the attribute "_moz-menuactive",
// and not by the mouse hovering (accessibility).
// and not by the mouse hovering (accessibility). as a special case,
// menus which are children of a menu bar are only marked as prelight
// if they are open, not on normal hover.
if (aWidgetType == NS_THEME_MENUITEM) {
aState->inHover = CheckBooleanAttr(aFrame, mMenuActiveAtom);
PRBool isTopLevel = PR_FALSE;
nsIMenuFrame *menuFrame;
CallQueryInterface(aFrame, &menuFrame);
if (menuFrame) {
nsIMenuParent *menuParent;
menuFrame->GetMenuParent(&menuParent);
if (menuParent)
menuParent->IsMenuBar(isTopLevel);
}
if (isTopLevel) {
PRBool isOpen;
menuFrame->MenuIsOpen(isOpen);
aState->inHover = isOpen;
} else {
aState->inHover = CheckBooleanAttr(aFrame, mMenuActiveAtom);
}
aState->active = FALSE;
}
}

View File

@ -51,6 +51,8 @@ ifdef MOZ_XUL
DIRS = tree grid
endif
EXPORTS = nsIMenuParent.h
CPPSRCS = \
nsScrollBoxFrame.cpp \
nsRootBoxFrame.cpp \