cocoa: only report mouse movements when window is not being dragged

even though the mouse doesn’t move relative to the window itself, when
the window is being dragged, some outliers are still reported and
trigger the OSC.
This commit is contained in:
Akemi 2017-02-20 17:25:21 +01:00
parent bdd096db9a
commit fffab30a3e
3 changed files with 19 additions and 1 deletions

View File

@ -211,6 +211,7 @@
{
if ([self.adapter mouseEnabled]) {
[self mouseUpEvent:event];
[self.adapter mouseUp];
} else {
[super mouseUp:event];
}

View File

@ -204,6 +204,11 @@
[self.adapter windowDidDeminiaturize:notification];
}
- (void)windowWillMove:(NSNotification *)notification
{
[self.adapter windowWillMove:notification];
}
- (BOOL)canBecomeMainWindow { return YES; }
- (BOOL)canBecomeKeyWindow { return YES; }
- (BOOL)windowShouldClose:(id)sender

View File

@ -76,6 +76,7 @@ struct vo_cocoa_state {
bool cursor_visibility;
bool cursor_visibility_wanted;
bool window_is_dragged;
bool embedded; // wether we are embedding in another GUI
@ -946,8 +947,9 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
- (void)signalMouseMovement:(NSPoint)point
{
mp_input_set_mouse_pos(self.vout->input_ctx, point.x, point.y);
[self recalcMovableByWindowBackground:point];
if (!self.vout->cocoa->window_is_dragged)
mp_input_set_mouse_pos(self.vout->input_ctx, point.x, point.y);
}
- (void)putKeyEvent:(NSEvent*)event
@ -1052,4 +1054,14 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
flag_events(self.vout, VO_EVENT_WIN_STATE);
}
- (void)windowWillMove:(NSNotification *)notification
{
self.vout->cocoa->window_is_dragged = true;
}
- (void)mouseUp
{
self.vout->cocoa->window_is_dragged = false;
}
@end