File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
WobblyWindows.xcodeproj/project.xcworkspace/xcuserdata/Professional.xcuserdatad Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ extension NSScreen {
148
148
}
149
149
150
150
@objc public func startDrag( at point: CGPoint ) {
151
+ self . alreadySetFrame = false
151
152
let distances = particles
152
153
. map { $0. position. distanceTo ( point: point) }
153
154
@@ -183,7 +184,9 @@ extension NSScreen {
183
184
}
184
185
}
185
186
187
+ var alreadySetFrame = false
186
188
@objc public func endDrag( ) {
189
+ if alreadySetFrame { return }
187
190
let idx = GRID_WIDTH * ( GRID_HEIGHT - 1 ) + GRID_HEIGHT * ( GRID_WIDTH - 1 )
188
191
springs. removeLast ( springs. count - idx)
189
192
if particles. indices. contains ( GRID_WIDTH * GRID_HEIGHT) { particles. remove ( at: GRID_WIDTH * GRID_HEIGHT) }
@@ -208,6 +211,7 @@ extension NSScreen {
208
211
)
209
212
210
213
self . window. setFrameDirty ( frame)
214
+ self . alreadySetFrame = true
211
215
212
216
self . window. styleMask. insert ( NSWindow . StyleMask. resizable)
213
217
} else {
Original file line number Diff line number Diff line change @@ -62,10 +62,8 @@ + (void) willMove:(id) notification {
62
62
// NSLog(@"willMove");
63
63
NSWindow * window = (NSWindow *)[(NSNotification *)notification object ];
64
64
65
- // Fallback for whatsapp and IDEA
66
- if (window.warp == NULL ) {
67
- window.warp = [[Warp alloc ] initWithWindow: window];
68
- }
65
+ // Reinit window since it may have moved in different method
66
+ window.warp = [[Warp alloc ] initWithWindow: window];
69
67
70
68
[window.warp startDragAt: NSEvent .mouseLocation];
71
69
[window windowMoves: notification];
@@ -78,9 +76,9 @@ - (void) windowMoves:(id) notification {
78
76
NSWindow * window = (NSWindow *)[(NSNotification *)notification object ];
79
77
timer = [NSTimer scheduledTimerWithTimeInterval: (1 .0f / 60 .0f ) target: self selector: @selector (windowMoved: ) userInfo: window repeats: YES ];
80
78
81
- // if (monitor != NULL) { // only disable mouseup monitor when we move a window again, because sometimes the first event does not fully trigger.
82
- // [NSEvent removeMonitor:monitor];
83
- // }
79
+ if (monitor != NULL ) { // only disable mouseup monitor when we move a window again, because sometimes the first event does not fully trigger.
80
+ [NSEvent removeMonitor: monitor];
81
+ }
84
82
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask: NSEventMaskLeftMouseUp | NSEventMaskRightMouseUp handler: ^(NSEvent *event) {
85
83
[window moveStopped ];
86
84
}];
You can’t perform that action at this time.
0 commit comments