| Index: ui/views/cocoa/cocoa_non_client_drag.h
|
| diff --git a/ui/views/cocoa/cocoa_non_client_drag.h b/ui/views/cocoa/cocoa_non_client_drag.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2ae2dafa5d450cba011167ce5128e780547250e0
|
| --- /dev/null
|
| +++ b/ui/views/cocoa/cocoa_non_client_drag.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
|
| +#define UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
|
| +
|
| +#include "base/macros.h"
|
| +#import "ui/views/cocoa/native_widget_mac_nswindow.h"
|
| +#include "ui/views/views_export.h"
|
| +
|
| +@interface CocoaNonClientDragMaskView : NSView
|
| +@end
|
| +
|
| +@interface NativeWidgetMacNSWindow (CocoaNonClientDrag)
|
| +// Called when the application receives a mouse-down, but before the event
|
| +// is processed by NSWindows. Returns NO if the event should be processed as-is,
|
| +// or YES if the event should be reposted to handle window dragging. Events are
|
| +// reposted at the CGSessionEventTap level because window dragging happens there
|
| +// before the application receives the event.
|
| +- (BOOL)willReceiveLeftMouseDown:(NSPoint)locationInWindow;
|
| +@end
|
| +
|
| +namespace views {
|
| +
|
| +// Support window caption/draggable regions.
|
| +// In AppKit, non-client regions are set by overriding
|
| +// -[NSView mouseDownCanMoveWindow]. NSApplication caches this area as views are
|
| +// installed and performs window moving when mouse-downs land in the area.
|
| +// In Views, non-client regions are determined via hit-tests when the event
|
| +// occurs.
|
| +// To bridge the two models, we monitor mouse-downs with
|
| +// +[NSEvent addLocalMonitorForEventsMatchingMask:handler:]. This receives
|
| +// events after window dragging is handled, so for mouse-downs that land on a
|
| +// draggable point, we cancel the event and repost it at the CGSessionEventTap
|
| +// level so that window dragging will be handled again.
|
| +class VIEWS_EXPORT CocoaNonClientDrag {
|
| + public:
|
| + CocoaNonClientDrag();
|
| + ~CocoaNonClientDrag();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(CocoaNonClientDrag);
|
| +};
|
| +
|
| +} // namespace views
|
| +
|
| +#endif // UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
|
|
|