зеркало из https://github.com/mozilla/pjs.git
#56589 - Add shared menus support (requires version 1.2 of SharedMenus.component) for CFM version of Mozilla for Mac OS X. r=bnesse,sr=sfraser
This commit is contained in:
Родитель
0ef08d01b8
Коммит
297f4b55c1
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -86,6 +86,9 @@
|
|||
#include "nsISocketTransportService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
|
||||
#if TARGET_CARBON && !XP_MACOSX
|
||||
#include "MenuSharing.h"
|
||||
#endif
|
||||
|
||||
#ifndef topLeft
|
||||
#define topLeft(r) (((Point *) &(r))[0])
|
||||
|
@ -189,6 +192,22 @@ static long ConvertOSMenuResultToPPMenuResult(long menuResult)
|
|||
}
|
||||
|
||||
#pragma mark -
|
||||
#if TARGET_CARBON && !XP_MACOSX
|
||||
#pragma mark MenuSharingToolkitSupport
|
||||
//=================================================================
|
||||
static pascal void ErrorDialog (Str255 s)
|
||||
{
|
||||
//ParamText (s, "\p", "\p", "\p");
|
||||
//Alert (kMenuSharingAlertID, nil);
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
static pascal void EventFilter (EventRecord *ev)
|
||||
{
|
||||
// Hrm, prolly should do _something_ here
|
||||
}
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
|
@ -214,6 +233,11 @@ nsMacMessagePump::nsMacMessagePump(nsToolkit *aToolkit)
|
|||
|
||||
// startup the watch cursor idle time vbl task
|
||||
nsWatchTask::GetTask().Start();
|
||||
|
||||
#if TARGET_CARBON && !XP_MACOSX
|
||||
// added to support Menu Sharing API. Initializes the Menu Sharing API.
|
||||
InitSharedMenus (ErrorDialog, EventFilter);
|
||||
#endif
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
|
@ -983,6 +1007,14 @@ void nsMacMessagePump::DoIdle(EventRecord &anEvent)
|
|||
// send mouseMove event
|
||||
static Point lastWhere = {0, 0};
|
||||
|
||||
#if TARGET_CARBON && !XP_MACOSX
|
||||
if ( nsToolkit::IsAppInForeground() )
|
||||
{
|
||||
// Shared Menu support - note we hardcode first menu ID available as 31000
|
||||
CheckSharedMenus(31000);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*(long*)&lastWhere == *(long*)&anEvent.where)
|
||||
return;
|
||||
|
||||
|
|
|
@ -70,6 +70,10 @@
|
|||
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
#if !XP_MACOSX
|
||||
#include "MenuSharing.h"
|
||||
#endif
|
||||
|
||||
// CIDs
|
||||
#include "nsWidgetsCID.h"
|
||||
static NS_DEFINE_CID(kMenuBarCID, NS_MENUBAR_CID);
|
||||
|
@ -351,6 +355,20 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
|||
break;
|
||||
}
|
||||
|
||||
#if !XP_MACOSX
|
||||
case 'SHMN':
|
||||
{ // Shared menu support
|
||||
MenuItemIndex index = command.menu.menuItemIndex;
|
||||
if (index)
|
||||
{
|
||||
(void)SharedMenuHit(GetMenuID(command.menu.menuRef), command.menu.menuItemIndex);
|
||||
::HiliteMenu(0);
|
||||
handled = noErr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
// given the commandID, look it up in our hashtable and dispatch to
|
||||
|
|
Загрузка…
Ссылка в новой задаче