Bug 1013852 - Clicking doesn't focus the window sometimes. r=mstange

This commit is contained in:
Steven Michaud 2014-06-02 16:43:31 -05:00
parent c28a196416
commit 6b447e78bc

View File

@ -484,10 +484,17 @@ nsAppShell::ProcessNextNativeEvent(bool aMayWait)
continue; continue;
} }
EventAttributes attrs = GetEventAttributes(currentEvent); EventAttributes attrs = GetEventAttributes(currentEvent);
UInt32 eventKind = GetEventKind(currentEvent);
bool osCocoaEvent =
((GetEventClass(currentEvent) == 'cgs ') &&
((eventKind == NSAppKitDefined) || (eventKind == NSSystemDefined)));
// If attrs is kEventAttributeUserEvent or kEventAttributeMonitored // If attrs is kEventAttributeUserEvent or kEventAttributeMonitored
// (i.e. a user input event), we shouldn't process it here while // (i.e. a user input event), we shouldn't process it here while
// aMayWait is false. // aMayWait is false. Likewise if currentEvent will eventually be
if (attrs != kEventAttributeNone) { // turned into an OS-defined Cocoa event. Doing otherwise risks
// doing too much work here, and preventing the event from being
// properly processed as a Cocoa event.
if ((attrs != kEventAttributeNone) || osCocoaEvent) {
// Since we can't process the next event here (while aMayWait is false), // Since we can't process the next event here (while aMayWait is false),
// we want moreEvents to be false on return. // we want moreEvents to be false on return.
eventProcessed = false; eventProcessed = false;