take key modifiers from the current event not the current hardware state. b=320746 r=smichaud sr=roc

This commit is contained in:
joshmoz@gmail.com 2008-03-04 09:58:52 -08:00
parent 41721e9840
commit df3cd329a5
5 changed files with 13 additions and 18 deletions

View File

@ -2885,7 +2885,7 @@ static void InitializeEventRecord(EventRecord* event)
memset(event, 0, sizeof(EventRecord));
::GetGlobalMouse(&event->where);
event->when = ::TickCount();
event->modifiers = ::GetCurrentKeyModifiers();
event->modifiers = ::GetCurrentEventKeyModifiers();
}
NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()

View File

@ -2687,7 +2687,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
}
#ifdef XP_MACOSX
if (GetCurrentKeyModifiers() & optionKey)
if (GetCurrentEventKeyModifiers() & optionKey)
gSafeMode = PR_TRUE;
#endif

View File

@ -1886,7 +1886,7 @@ NS_IMETHODIMP nsChildView::GetToggledKeyState(PRUint32 aKeyCode,
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
PRUint32 modifierFlags = ::GetCurrentKeyModifiers();
PRUint32 modifierFlags = ::GetCurrentEventKeyModifiers();
*aLEDState = (modifierFlags & key) != 0;
return NS_OK;
@ -2834,7 +2834,7 @@ NSEvent* gLastDragEvent = nil;
macEvent.message = 0;
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = GetCurrentKeyModifiers();
macEvent.modifiers = ::GetCurrentEventKeyModifiers();
geckoEvent.nativeMsg = &macEvent;
mGeckoChild->DispatchMouseEvent(geckoEvent);
@ -2870,7 +2870,7 @@ NSEvent* gLastDragEvent = nil;
macEvent.message = 0;
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = GetCurrentKeyModifiers();
macEvent.modifiers = ::GetCurrentEventKeyModifiers();
geckoEvent.nativeMsg = &macEvent;
mGeckoChild->DispatchMouseEvent(geckoEvent);
@ -2900,7 +2900,7 @@ static nsEventStatus SendGeckoMouseEnterOrExitEvent(PRBool isTrusted,
macEvent.message = 0;
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = ::GetCurrentKeyModifiers();
macEvent.modifiers = ::GetCurrentEventKeyModifiers();
event.nativeMsg = &macEvent;
nsEventStatus status;
@ -3021,7 +3021,7 @@ static nsEventStatus SendGeckoMouseEnterOrExitEvent(PRBool isTrusted,
macEvent.message = 0;
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = GetCurrentKeyModifiers();
macEvent.modifiers = ::GetCurrentEventKeyModifiers();
geckoEvent.nativeMsg = &macEvent;
mGeckoChild->DispatchMouseEvent(geckoEvent);
@ -3058,7 +3058,7 @@ static nsEventStatus SendGeckoMouseEnterOrExitEvent(PRBool isTrusted,
macEvent.message = 0;
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = btnState | ::GetCurrentKeyModifiers();
macEvent.modifiers = btnState | ::GetCurrentEventKeyModifiers();
geckoEvent.nativeMsg = &macEvent;
mGeckoChild->DispatchMouseEvent(geckoEvent);
@ -3467,7 +3467,7 @@ static void ConvertCocoaKeyEventToMacEvent(NSEvent* cocoaEvent, EventRecord& mac
macEvent.message = (charCode & 0x00FF) | ([cocoaEvent keyCode] << 8);
macEvent.when = ::TickCount();
::GetGlobalMouse(&macEvent.where);
macEvent.modifiers = ::GetCurrentKeyModifiers();
macEvent.modifiers = ::GetCurrentEventKeyModifiers();
NS_OBJC_END_TRY_ABORT_BLOCK;
}

View File

@ -74,7 +74,7 @@ else
ifeq (WINNT,$(OS_ARCH))
CPPSRCS += nsUserInfoWin.cpp
else
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
nsUserInfoMac.cpp \
nsCommandLineServiceMac.cpp \

View File

@ -138,16 +138,11 @@ nsresult nsMacCommandLine::Initialize(int& argc, char**& argv)
mArgs[0] = nsnull;
mArgsAllocated = kArgsGrowSize;
mArgsUsed = 0;
#if defined(XP_MACOSX)
// Here, we may actually get useful args.
// Copy them first to mArgv.
for (int arg = 0; arg < argc; arg++)
AddToCommandLine(argv[arg]);
#else
// init the args buffer with the program name
AddToCommandLine("mozilla");
#endif
// Set up AppleEvent handling.
OSErr err = CreateAEHandlerClasses(false);
@ -175,8 +170,8 @@ nsresult nsMacCommandLine::Initialize(int& argc, char**& argv)
err = ::AEProcessAppleEvent(&anEvent);
}
}
if (GetCurrentKeyModifiers() & optionKey)
if (::GetCurrentEventKeyModifiers() & optionKey)
AddToCommandLine("-p");
// we've started up now