"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "shell/browser/native_browser_view_mac.mm" between
electron-11.0.1.tar.gz and electron-11.0.2.tar.gz

About: Electron is a framework for creating native cross platform applications with web technologies like JavaScript, HTML, and CSS.

native_browser_view_mac.mm  (electron-11.0.1):native_browser_view_mac.mm  (electron-11.0.2)
skipping to change at line 37 skipping to change at line 37
@end @end
@implementation DragRegionView @implementation DragRegionView
@synthesize initialLocation; @synthesize initialLocation;
- (BOOL)mouseDownCanMoveWindow { - (BOOL)mouseDownCanMoveWindow {
return NO; return NO;
} }
- (NSView*)hitTest:(NSPoint)aPoint { - (BOOL)shouldIgnoreMouseEvent {
// Pass-through events that don't hit one of the exclusion zones NSEventType type = [[NSApp currentEvent] type];
return type != NSEventTypeLeftMouseDragged &&
type != NSEventTypeLeftMouseDown;
}
- (NSView*)hitTest:(NSPoint)point {
// Pass-through events that hit one of the exclusion zones
for (NSView* exclusion_zones in [self subviews]) { for (NSView* exclusion_zones in [self subviews]) {
if ([exclusion_zones hitTest:aPoint]) if ([exclusion_zones hitTest:point])
return nil; return nil;
} }
return self; return self;
} }
- (void)mouseDown:(NSEvent*)event { - (void)mouseDown:(NSEvent*)event {
[super mouseDown:event];
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) { if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) {
// According to Google, using performWindowDragWithEvent: // According to Google, using performWindowDragWithEvent:
// does not generate a NSWindowWillMoveNotification. Hence post one. // does not generate a NSWindowWillMoveNotification. Hence post one.
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
postNotificationName:NSWindowWillMoveNotification postNotificationName:NSWindowWillMoveNotification
object:self]; object:self];
if (@available(macOS 10.11, *)) { if (@available(macOS 10.11, *)) {
[self.window performWindowDragWithEvent:event]; [self.window performWindowDragWithEvent:event];
} }
return; return;
} }
if (self.window.styleMask & NSWindowStyleMaskFullScreen) { if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
return; return;
} }
self.initialLocation = [event locationInWindow]; self.initialLocation = [event locationInWindow];
} }
- (void)mouseDragged:(NSEvent*)theEvent { - (void)mouseDragged:(NSEvent*)event {
if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) { if ([self.window respondsToSelector:@selector(performWindowDragWithEvent)]) {
return; return;
} }
if (self.window.styleMask & NSWindowStyleMaskFullScreen) { if (self.window.styleMask & NSWindowStyleMaskFullScreen) {
return; return;
} }
NSPoint currentLocation = [NSEvent mouseLocation]; NSPoint currentLocation = [NSEvent mouseLocation];
NSPoint newOrigin; NSPoint newOrigin;
skipping to change at line 128 skipping to change at line 136
// Don't let window get dragged up under the menu bar // Don't let window get dragged up under the menu bar
if (inMenuBar && !screenAboveMainScreen) { if (inMenuBar && !screenAboveMainScreen) {
newOrigin.y = screenFrame.origin.y + newOrigin.y = screenFrame.origin.y +
(screenFrame.size.height - windowFrame.size.height); (screenFrame.size.height - windowFrame.size.height);
} }
// Move the window to the new location // Move the window to the new location
[self.window setFrameOrigin:newOrigin]; [self.window setFrameOrigin:newOrigin];
} }
// Debugging tips: // For debugging purposes only.
// Uncomment the following four lines to color DragRegionView bright red - (void)drawRect:(NSRect)aRect {
// #ifdef DEBUG_DRAG_REGIONS if (getenv("ELECTRON_DEBUG_DRAG_REGIONS")) {
// - (void)drawRect:(NSRect)aRect [[[NSColor greenColor] colorWithAlphaComponent:0.5] set];
// { NSRectFill([self bounds]);
// [[NSColor redColor] set]; }
// NSRectFill([self bounds]); }
// }
// #endif
@end @end
@interface ExcludeDragRegionView : NSView @interface ExcludeDragRegionView : NSView
@end @end
@implementation ExcludeDragRegionView @implementation ExcludeDragRegionView
- (BOOL)mouseDownCanMoveWindow { - (BOOL)mouseDownCanMoveWindow {
return NO; return NO;
} }
// Debugging tips: // For debugging purposes only.
// Uncomment the following four lines to color ExcludeDragRegionView bright red - (void)drawRect:(NSRect)aRect {
// #ifdef DEBUG_DRAG_REGIONS if (getenv("ELECTRON_DEBUG_DRAG_REGIONS")) {
// - (void)drawRect:(NSRect)aRect [[[NSColor redColor] colorWithAlphaComponent:0.5] set];
// { NSRectFill([self bounds]);
// [[NSColor greenColor] set]; }
// NSRectFill([self bounds]); }
// }
// #endif
@end @end
namespace electron { namespace electron {
NativeBrowserViewMac::NativeBrowserViewMac( NativeBrowserViewMac::NativeBrowserViewMac(
InspectableWebContents* inspectable_web_contents) InspectableWebContents* inspectable_web_contents)
: NativeBrowserView(inspectable_web_contents) { : NativeBrowserView(inspectable_web_contents) {
auto* iwc_view = GetInspectableWebContentsView(); auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view) if (!iwc_view)
 End of changes. 6 change blocks. 
22 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)