Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: ui/views/cocoa/cocoa_non_client_drag.h

Issue 1146873002: [MacViews] Enable dragging a window by its caption/draggable areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
6 #define UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
7
8 #include "base/macros.h"
9 #import "ui/views/cocoa/native_widget_mac_nswindow.h"
10 #include "ui/views/views_export.h"
11
12 @interface CocoaNonClientDragMaskView : NSView
13 @end
14
15 @interface NativeWidgetMacNSWindow (CocoaNonClientDrag)
16 // Called when the application receives a mouse-down, but before the event
17 // is processed by NSWindows. Returns NO if the event should be processed as-is,
18 // or YES if the event should be reposted to handle window dragging. Events are
19 // reposted at the CGSessionEventTap level because window dragging happens there
20 // before the application receives the event.
21 - (BOOL)willReceiveLeftMouseDown:(NSPoint)locationInWindow;
22 @end
23
24 namespace views {
25
26 // Support window caption/draggable regions.
27 // In AppKit, non-client regions are set by overriding
28 // -[NSView mouseDownCanMoveWindow]. NSApplication caches this area as views are
29 // installed and performs window moving when mouse-downs land in the area.
30 // In Views, non-client regions are determined via hit-tests when the event
31 // occurs.
32 // To bridge the two models, we monitor mouse-downs with
33 // +[NSEvent addLocalMonitorForEventsMatchingMask:handler:]. This receives
34 // events after window dragging is handled, so for mouse-downs that land on a
35 // draggable point, we cancel the event and repost it at the CGSessionEventTap
36 // level so that window dragging will be handled again.
37 class VIEWS_EXPORT CocoaNonClientDrag {
38 public:
39 CocoaNonClientDrag();
40 ~CocoaNonClientDrag();
41
42 private:
43 DISALLOW_COPY_AND_ASSIGN(CocoaNonClientDrag);
44 };
45
46 } // namespace views
47
48 #endif // UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698