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

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: Remove CocoaNonClientDragMaskView, change BridgedContentView instead. Remove CGEventTap implementat… 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 NativeWidgetMacNSWindow (CocoaNonClientDrag)
tapted 2015/05/20 07:18:17 I don't think this is needed (see later comments)
13 // Called when the application receives a mouse-down, but before the event
14 // is processed by NSWindows. Returns NO if the event should be processed as-is,
15 // or YES if the event should be reposted to handle window dragging. Events are
16 // reposted at the CGSessionEventTap level because window dragging happens there
17 // before the application receives the event.
18 - (BOOL)willReceiveLeftMouseDown:(NSPoint)locationInWindow;
19 @end
20
21 namespace views {
22
23 // Support window caption/draggable regions.
24 // In AppKit, non-client regions are set by overriding
25 // -[NSView mouseDownCanMoveWindow]. NSApplication caches this area as views are
26 // installed and performs window moving when mouse-downs land in the area.
27 // In Views, non-client regions are determined via hit-tests when the event
28 // occurs.
29 // To bridge the two models, we monitor mouse-downs with
30 // +[NSEvent addLocalMonitorForEventsMatchingMask:handler:]. This receives
31 // events after window dragging is handled, so for mouse-downs that land on a
32 // draggable point, we cancel the event and repost it at the CGSessionEventTap
33 // level so that window dragging will be handled again.
34 class VIEWS_EXPORT CocoaNonClientDrag {
jackhou1 2015/05/20 05:50:37 It feels kind of roundabout that a class instantia
35 public:
36 CocoaNonClientDrag();
37 ~CocoaNonClientDrag();
38
39 private:
40 DISALLOW_COPY_AND_ASSIGN(CocoaNonClientDrag);
41 };
42
43 } // namespace views
44
45 #endif // UI_VIEWS_COCOA_COCOA_NON_CLIENT_DRAG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698