fix: ensure detached devtools are not always draggable (#29717)

This commit is contained in:
Samuel Attard 2021-06-16 10:18:02 -07:00 committed by GitHub
parent 330c3bc136
commit f71c6c04fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,13 +169,12 @@
// Switch to new state. // Switch to new state.
devtools_docked_ = docked; devtools_docked_ = docked;
auto* inspectable_web_contents =
inspectableWebContentsView_->inspectable_web_contents();
auto* devToolsWebContents =
inspectable_web_contents->GetDevToolsWebContents();
auto devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView();
if (!docked) { if (!docked) {
auto* inspectable_web_contents =
inspectableWebContentsView_->inspectable_web_contents();
auto* devToolsWebContents =
inspectable_web_contents->GetDevToolsWebContents();
auto devToolsView = devToolsWebContents->GetNativeView().GetNativeNSView();
auto styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | auto styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
NSMiniaturizableWindowMask | NSWindowStyleMaskResizable | NSMiniaturizableWindowMask | NSWindowStyleMaskResizable |
NSTexturedBackgroundWindowMask | NSTexturedBackgroundWindowMask |
@ -198,6 +197,9 @@
devToolsView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; devToolsView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
[contentView addSubview:devToolsView]; [contentView addSubview:devToolsView];
[devToolsView setMouseDownCanMoveWindow:NO];
} else {
[devToolsView setMouseDownCanMoveWindow:YES];
} }
[self setDevToolsVisible:YES activate:activate]; [self setDevToolsVisible:YES activate:activate];
} }