Improve window snapping/dragging
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
platform :osx, '10.15'
|
||||
platform :osx, '12.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
desktop_multi_window: 566489c048b501134f9d7fb6a2354c60a9126486
|
||||
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
|
||||
FlutterMacOS: c232990155153907050900a2e175c7773903ba4e
|
||||
|
||||
PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009
|
||||
PODFILE CHECKSUM: 1e95c36afbfd1cb6423ceca4de7a8e1b256fb6ac
|
||||
|
||||
COCOAPODS: 1.16.2
|
||||
|
||||
@@ -567,7 +567,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
@@ -649,7 +649,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
@@ -699,7 +699,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
|
||||
@@ -22,45 +22,6 @@ class AppDelegate: FlutterAppDelegate {
|
||||
// FlutterViewController is already attached here, but poll briefly as a
|
||||
// fallback for other Flutter versions where it may not be yet.
|
||||
registerWinampChannelWhenReady()
|
||||
installMouseDiagnostics()
|
||||
}
|
||||
|
||||
/// Temporary diagnostics: logs every mouse event macOS delivers to one of
|
||||
/// our Flutter windows (frame, location, and whether the window moved the
|
||||
/// mouse over its content). Used to trace why the drag loop gets no events
|
||||
/// at launch while it works after the first resize.
|
||||
private var mouseDiag: Any?
|
||||
private func installMouseDiagnostics() {
|
||||
guard mouseDiag == nil else { return }
|
||||
mouseDiag = NSEvent.addLocalMonitorForEvents(
|
||||
matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp, .mouseMoved]
|
||||
) { event in
|
||||
guard let window = event.window,
|
||||
let vc = window.contentViewController as? FlutterViewController
|
||||
else { return event }
|
||||
let view = vc.view
|
||||
let local = view.convert(event.locationInWindow, from: nil)
|
||||
let inView = view.bounds.contains(local)
|
||||
NSLog(
|
||||
"mdiag %@ local=(%.1f,%.1f) inView=%@ frame=%@ wf=%@",
|
||||
Self.name(for: event.type),
|
||||
local.x, local.y,
|
||||
inView ? "y" : "n",
|
||||
NSStringFromRect(view.bounds),
|
||||
NSStringFromRect(window.frame)
|
||||
)
|
||||
return event
|
||||
}
|
||||
}
|
||||
|
||||
private static func name(for type: NSEvent.EventType) -> String {
|
||||
switch type {
|
||||
case .leftMouseDown: return "down"
|
||||
case .leftMouseDragged: return "drag"
|
||||
case .leftMouseUp: return "up"
|
||||
case .mouseMoved: return "move"
|
||||
default: return "other"
|
||||
}
|
||||
}
|
||||
|
||||
/// Quits this instance if another copy of the app is already running, and
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"fill" : "automatic",
|
||||
"groups" : [
|
||||
{
|
||||
"layers" : [
|
||||
{
|
||||
"glass" : false,
|
||||
"image-name" : "WinampIcon.png",
|
||||
"name" : "WinampIcon",
|
||||
"position" : {
|
||||
"scale" : 3.5,
|
||||
"translation-in-points" : [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"shadow" : {
|
||||
"kind" : "neutral",
|
||||
"opacity" : 0.5
|
||||
},
|
||||
"translucency" : {
|
||||
"enabled" : true,
|
||||
"value" : 0.5
|
||||
}
|
||||
}
|
||||
],
|
||||
"supported-platforms" : {
|
||||
"circles" : [
|
||||
"watchOS"
|
||||
],
|
||||
"squares" : "shared"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user