refactor: move devtools from brightray to atom (#15234)
This commit is contained in:
parent
122017e6fa
commit
6f3c46cc7e
58 changed files with 315 additions and 400 deletions
34
atom/browser/ui/cocoa/event_dispatching_window.mm
Normal file
34
atom/browser/ui/cocoa/event_dispatching_window.mm
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2016 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/cocoa/event_dispatching_window.h"
|
||||
|
||||
@implementation EventDispatchingWindow
|
||||
|
||||
- (void)sendEvent:(NSEvent*)event {
|
||||
if (!redispatchingEvent_)
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
- (BOOL)performKeyEquivalent:(NSEvent*)event {
|
||||
if (redispatchingEvent_)
|
||||
return NO;
|
||||
else
|
||||
return [super performKeyEquivalent:event];
|
||||
}
|
||||
|
||||
- (void)redispatchKeyEvent:(NSEvent*)event {
|
||||
NSEventType eventType = [event type];
|
||||
if (eventType != NSKeyDown && eventType != NSKeyUp &&
|
||||
eventType != NSFlagsChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Redispatch the event.
|
||||
redispatchingEvent_ = YES;
|
||||
[NSApp sendEvent:event];
|
||||
redispatchingEvent_ = NO;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue