зеркало из https://github.com/mozilla/pjs.git
Fix for bug 82474; ignore the console window on Mac when sending off events. r=conrad, sr=scc, a=blizzard
This commit is contained in:
Родитель
a0d0dc4a9c
Коммит
f448d4413c
|
@ -1,3 +0,0 @@
|
|||
InitializeSIOUX
|
||||
SIOUXHandleOneEvent
|
||||
SIOUXSettings
|
|
@ -25,6 +25,14 @@
|
|||
ANSII headers.
|
||||
*/
|
||||
|
||||
#ifndef __MACTYPES__
|
||||
#include <MacTypes.h>
|
||||
#endif
|
||||
|
||||
#ifndef __QUICKDRAW__
|
||||
#include <Quickdraw.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -39,6 +47,7 @@ extern void InitializeMacToolbox(void); // also calls InitializeSIOUX(false) if
|
|||
|
||||
#if DEBUG
|
||||
extern void InitializeSIOUX(unsigned char isStandAlone);
|
||||
extern Boolean IsSIOUXWindow(WindowPtr inWindow);
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "macstdlibextras.h"
|
||||
|
||||
|
||||
#include <Types.h>
|
||||
#include <MacTypes.h>
|
||||
#include <Memory.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -210,4 +210,9 @@ void InitializeSIOUX(unsigned char isStandAlone)
|
|||
}
|
||||
|
||||
|
||||
Boolean IsSIOUXWindow(WindowPtr inWindow)
|
||||
{
|
||||
return SIOUXIsAppWindow(inWindow);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -85,9 +85,6 @@
|
|||
const short kMinWindowWidth = 125;
|
||||
const short kMinWindowHeight = 150;
|
||||
|
||||
NS_WIDGET nsMacMessagePump::nsWindowlessMenuEventHandler nsMacMessagePump::gWindowlessMenuEventHandler = nsnull;
|
||||
|
||||
|
||||
extern nsIRollupListener * gRollupListener;
|
||||
extern nsIWidget * gRollupWidget;
|
||||
|
||||
|
@ -217,6 +214,23 @@ nsMacMessagePump::~nsMacMessagePump()
|
|||
//
|
||||
}
|
||||
|
||||
|
||||
//=================================================================
|
||||
/* Return the frontmost window that is not the SIOUX console
|
||||
*/
|
||||
WindowPtr nsMacMessagePump::GetFrontApplicationWindow()
|
||||
{
|
||||
WindowPtr firstAppWindow = ::FrontWindow();
|
||||
|
||||
#if DEBUG
|
||||
if (IsSIOUXWindow(firstAppWindow))
|
||||
firstAppWindow = ::GetNextWindow(firstAppWindow);
|
||||
#endif
|
||||
|
||||
return firstAppWindow;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================
|
||||
/* Runs the message pump for the macintosh
|
||||
* @update dc 08/31/98
|
||||
|
@ -747,7 +761,7 @@ void nsMacMessagePump::DoMouseUp(EventRecord &anEvent)
|
|||
// when the user clicks a widget, keeps the mouse button pressed and
|
||||
// releases it outside the window, the event needs to be reported to
|
||||
// the widget so that it can deactivate itself.
|
||||
whichWindow = ::FrontWindow();
|
||||
whichWindow = GetFrontApplicationWindow();
|
||||
}
|
||||
DispatchOSEventToRaptor(anEvent, whichWindow);
|
||||
}
|
||||
|
@ -771,7 +785,7 @@ void nsMacMessagePump::DoMouseMove(EventRecord &anEvent)
|
|||
|
||||
partCode = ::FindWindow(anEvent.where, &whichWindow);
|
||||
if (whichWindow == nil)
|
||||
whichWindow = ::FrontWindow();
|
||||
whichWindow = GetFrontApplicationWindow();
|
||||
|
||||
/* Disable mouse moved events for windowshaded windows -- this prevents tooltips
|
||||
from popping up in empty space.
|
||||
|
@ -808,7 +822,7 @@ void nsMacMessagePump::DoKey(EventRecord &anEvent)
|
|||
//}
|
||||
//else
|
||||
{
|
||||
PRBool handled = DispatchOSEventToRaptor(anEvent, ::FrontWindow());
|
||||
PRBool handled = DispatchOSEventToRaptor(anEvent, GetFrontApplicationWindow());
|
||||
/* we want to call this if cmdKey is pressed and no other modifier keys are pressed */
|
||||
if((!handled) && (anEvent.what == keyDown) && (anEvent.modifiers == cmdKey) )
|
||||
{
|
||||
|
@ -849,6 +863,8 @@ void nsMacMessagePump::DoDisk(const EventRecord& anEvent)
|
|||
// DoMenu
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
extern Boolean SIOUXIsAppWindow(WindowPtr window);
|
||||
|
||||
void nsMacMessagePump::DoMenu(EventRecord &anEvent, long menuResult)
|
||||
{
|
||||
// The app can handle its menu commands here or
|
||||
|
@ -881,16 +897,8 @@ extern const PRInt16 kAppleMenuID; // Danger Will Robinson!!! - this currently r
|
|||
|
||||
// Note that we still give Raptor a shot at the event as it will eventually
|
||||
// handle the About... selection
|
||||
DispatchMenuCommandToRaptor(anEvent, menuResult);
|
||||
|
||||
if (mMessageSink->IsRaptorWindow(::FrontWindow()))
|
||||
{
|
||||
DispatchMenuCommandToRaptor(anEvent, menuResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gWindowlessMenuEventHandler != nsnull)
|
||||
gWindowlessMenuEventHandler(menuResult);
|
||||
}
|
||||
HiliteMenu(0);
|
||||
}
|
||||
|
||||
|
@ -960,9 +968,10 @@ PRBool nsMacMessagePump::DispatchMenuCommandToRaptor(
|
|||
long menuResult)
|
||||
{
|
||||
PRBool handled = PR_FALSE;
|
||||
WindowPtr theFrontWindow = GetFrontApplicationWindow();
|
||||
|
||||
if (mMessageSink->IsRaptorWindow(::FrontWindow()))
|
||||
handled = mMessageSink->DispatchMenuCommand(anEvent, menuResult);
|
||||
if (mMessageSink->IsRaptorWindow(theFrontWindow))
|
||||
handled = mMessageSink->DispatchMenuCommand(anEvent, menuResult, theFrontWindow);
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
|
|
@ -92,14 +92,7 @@ private:
|
|||
|
||||
PRBool BrowserIsBusy();
|
||||
|
||||
private:
|
||||
|
||||
typedef void (*nsWindowlessMenuEventHandler) (PRInt32 menuResult);
|
||||
static nsWindowlessMenuEventHandler gWindowlessMenuEventHandler;
|
||||
|
||||
public:
|
||||
static void SetWindowlessMenuEventHandler(nsWindowlessMenuEventHandler func)
|
||||
{gWindowlessMenuEventHandler = func;}
|
||||
WindowPtr GetFrontApplicationWindow();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -55,12 +55,12 @@ NS_EXPORT PRBool nsMacMessageSink::DispatchOSEvent(
|
|||
//-------------------------------------------------------------------------
|
||||
NS_EXPORT PRBool nsMacMessageSink::DispatchMenuCommand(
|
||||
EventRecord &anEvent,
|
||||
long menuResult)
|
||||
long menuResult,
|
||||
WindowPtr aWindow)
|
||||
{
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
|
||||
nsMacWindow* raptorWindow = GetNSWindowFromMacWindow(::FrontWindow());
|
||||
|
||||
nsMacWindow* raptorWindow = GetNSWindowFromMacWindow(aWindow);
|
||||
if (raptorWindow)
|
||||
{
|
||||
eventHandled = raptorWindow->HandleMenuCommand(anEvent, menuResult);
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
public:
|
||||
|
||||
PRBool DispatchOSEvent(EventRecord &anEvent, WindowPtr aWindow);
|
||||
PRBool DispatchMenuCommand(EventRecord &anEvent, long menuResult);
|
||||
PRBool DispatchMenuCommand(EventRecord &anEvent, long menuResult, WindowPtr aWindow);
|
||||
|
||||
static void AddRaptorWindowToList(WindowPtr wind, nsMacWindow* theRaptorWindow);
|
||||
static void RemoveRaptorWindowFromList(WindowPtr wind);
|
||||
|
|
Загрузка…
Ссылка в новой задаче