Only define enable/disable API for views

This commit is contained in:
Cheng Zhao 2016-06-20 15:44:50 +09:00
parent e33e4be257
commit 5674e8d114
8 changed files with 64 additions and 98 deletions

View file

@ -279,7 +279,6 @@ bool ScopedDisableResize::disable_resize_ = false;
@property BOOL acceptsFirstMouse;
@property BOOL disableAutoHideCursor;
@property BOOL disableKeyOrMainWindow;
@property BOOL disableMouseEvents;
- (void)setShell:(atom::NativeWindowMac*)shell;
- (void)setEnableLargerThanScreen:(bool)enable;
@ -349,29 +348,6 @@ bool ScopedDisableResize::disable_resize_ = false;
return !self.disableKeyOrMainWindow;
}
- (void)sendEvent:(NSEvent*)event {
// Drop all mouse events.
if (self.disableMouseEvents) {
switch([event type]) {
case NSLeftMouseUp:
case NSLeftMouseDown:
case NSRightMouseDown:
case NSRightMouseUp:
case NSOtherMouseUp:
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
case NSMouseMoved:
case NSScrollWheel:
return;
default:
break;
}
}
[super sendEvent:event];
}
@end
@interface ControlRegionView : NSView
@ -521,7 +497,6 @@ NativeWindowMac::NativeWindowMac(
backing:NSBackingStoreBuffered
defer:YES]);
[window_ setShell:this];
[window_ setDisableMouseEvents:NO];
[window_ setEnableLargerThanScreen:enable_larger_than_screen()];
window_delegate_.reset([[AtomNSWindowDelegate alloc] initWithShell:this]);
@ -692,11 +667,6 @@ bool NativeWindowMac::IsVisible() {
return [window_ isVisible];
}
void NativeWindowMac::SetEnabled(bool enable) {
[window_ setDisableKeyOrMainWindow:!enable];
[window_ setDisableMouseEvents:!enable];
}
bool NativeWindowMac::IsEnabled() {
return [window_ attachedSheet] == nil;
}