зеркало из https://github.com/mozilla/gecko-dev.git
revert some changes that broke menu clicking in apprunner
This commit is contained in:
Родитель
c6d2b1732d
Коммит
809a5eac4d
|
@ -19,6 +19,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include "nsMenu.h"
|
||||
#include "nsMenuItem.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIMenuBar.h"
|
||||
#include "nsIMenuItem.h"
|
||||
|
@ -327,7 +328,7 @@ NS_METHOD nsMenu::RemoveItem(const PRUint32 aPos)
|
|||
{
|
||||
#if 0
|
||||
// this may work here better than Removeall(), but i'm not sure how to test this one
|
||||
void *item = mMenuItemVoidArray[aPos];
|
||||
nsISupports *item = mMenuItemVoidArray[aPos];
|
||||
delete item;
|
||||
mMenuItemVoidArray.RemoveElementAt(aPos);
|
||||
#endif
|
||||
|
@ -352,14 +353,39 @@ NS_METHOD nsMenu::RemoveAll()
|
|||
#if 0
|
||||
// this doesn't work quite right, but this is about all that should really be needed
|
||||
int i=0;
|
||||
for (i = mMenuItemVoidArray.Count(); i > 0; i--) {
|
||||
if(nsnull != mMenuItemVoidArray[i-1]) {
|
||||
void *item = mMenuItemVoidArray[i-1];
|
||||
delete item;
|
||||
mMenuItemVoidArray.RemoveElementAt(i-1);
|
||||
nsresult rv = -1;
|
||||
nsIMenu *menu = nsnull;
|
||||
nsIMenuItem *menuitem = nsnull;
|
||||
nsISupports *item = nsnull;
|
||||
|
||||
for (i=mMenuItemVoidArray.Count(); i>0; i--)
|
||||
{
|
||||
item = (nsISupports*)mMenuItemVoidArray[i-1];
|
||||
|
||||
if(nsnull != item)
|
||||
{
|
||||
rv = item->QueryInterface(kIMenuItemIID, (void**)&menuitem);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// we do this twice because we have to do it once for QueryInterface,
|
||||
// then we want to get rid of it.
|
||||
NS_RELEASE(menuitem);
|
||||
NS_RELEASE(menuitem);
|
||||
menuitem = nsnull;
|
||||
} else {
|
||||
rv = item->QueryInterface(kIMenuIID, (void**)&menu);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_RELEASE(menu);
|
||||
NS_RELEASE(menu);
|
||||
menu = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
// mMenuItemVoidArray.RemoveElementAt(i-1);
|
||||
}
|
||||
}
|
||||
mMenuItemVoidArray.Clear();
|
||||
#endif
|
||||
|
||||
for (int i = mMenuItemVoidArray.Count(); i > 0; i--) {
|
||||
if(nsnull != mMenuItemVoidArray[i-1]) {
|
||||
nsIMenuItem * menuitem = nsnull;
|
||||
|
@ -369,9 +395,9 @@ NS_METHOD nsMenu::RemoveAll()
|
|||
void *gtkmenuitem = nsnull;
|
||||
menuitem->GetNativeData(gtkmenuitem);
|
||||
if (gtkmenuitem) {
|
||||
gtk_widget_ref(GTK_WIDGET(gtkmenuitem));
|
||||
gtk_widget_destroy(GTK_WIDGET(gtkmenuitem));
|
||||
// gtk_container_remove (GTK_CONTAINER (mMenu), GTK_WIDGET(gtkmenuitem));
|
||||
// gtk_widget_ref(GTK_WIDGET(gtkmenuitem));
|
||||
//gtk_widget_destroy(GTK_WIDGET(gtkmenuitem));
|
||||
gtk_container_remove (GTK_CONTAINER (mMenu), GTK_WIDGET(gtkmenuitem));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -394,6 +420,7 @@ NS_METHOD nsMenu::RemoveAll()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,6 @@ NS_METHOD nsMenuItem::Create(nsISupports *aParent,
|
|||
|
||||
// create the native menu item
|
||||
|
||||
|
||||
if(mIsSeparator) {
|
||||
mMenuItem = gtk_menu_item_new();
|
||||
} else {
|
||||
|
@ -202,9 +201,9 @@ NS_METHOD nsMenuItem::Create(nsISupports *aParent,
|
|||
|
||||
gtk_widget_show(mMenuItem);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (mMenuItem), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_item_activate_handler),
|
||||
this);
|
||||
gtk_signal_connect(GTK_OBJECT(mMenuItem), "activate",
|
||||
GTK_SIGNAL_FUNC(menu_item_activate_handler),
|
||||
this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче