OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 [window_ setOpaque:NO]; | 782 [window_ setOpaque:NO]; |
783 [window_ setBackgroundColor:[NSColor clearColor]]; | 783 [window_ setBackgroundColor:[NSColor clearColor]]; |
784 } | 784 } |
785 | 785 |
786 UpdateLayerProperties(); | 786 UpdateLayerProperties(); |
787 } | 787 } |
788 | 788 |
789 //////////////////////////////////////////////////////////////////////////////// | 789 //////////////////////////////////////////////////////////////////////////////// |
790 // BridgedNativeWidget, internal::InputMethodDelegate: | 790 // BridgedNativeWidget, internal::InputMethodDelegate: |
791 | 791 |
792 bool BridgedNativeWidget::DispatchKeyEventPostIME(const ui::KeyEvent& key) { | 792 ui::EventDispatchDetails BridgedNativeWidget::DispatchKeyEventPostIME( |
| 793 ui::KeyEvent* key) { |
793 DCHECK(focus_manager_); | 794 DCHECK(focus_manager_); |
794 native_widget_mac_->GetWidget()->OnKeyEvent(const_cast<ui::KeyEvent*>(&key)); | 795 native_widget_mac_->GetWidget()->OnKeyEvent(key); |
795 if (!key.handled()) | 796 if (!key->handled()) { |
796 return !focus_manager_->OnKeyEvent(key); | 797 if (!focus_manager_->OnKeyEvent(*key)) |
797 return key.handled(); | 798 key->StopPropagation(); |
| 799 } |
| 800 return ui::EventDispatchDetails(); |
798 } | 801 } |
799 | 802 |
800 //////////////////////////////////////////////////////////////////////////////// | 803 //////////////////////////////////////////////////////////////////////////////// |
801 // BridgedNativeWidget, CocoaMouseCaptureDelegate: | 804 // BridgedNativeWidget, CocoaMouseCaptureDelegate: |
802 | 805 |
803 void BridgedNativeWidget::PostCapturedEvent(NSEvent* event) { | 806 void BridgedNativeWidget::PostCapturedEvent(NSEvent* event) { |
804 [bridged_view_ processCapturedMouseEvent:event]; | 807 [bridged_view_ processCapturedMouseEvent:event]; |
805 } | 808 } |
806 | 809 |
807 void BridgedNativeWidget::OnMouseCaptureLost() { | 810 void BridgedNativeWidget::OnMouseCaptureLost() { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1085 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1083 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1086 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1084 // changes. Previously we tried adding an NSView and removing it, but for some | 1087 // changes. Previously we tried adding an NSView and removing it, but for some |
1085 // reason it required reposting the mouse-down event, and didn't always work. | 1088 // reason it required reposting the mouse-down event, and didn't always work. |
1086 // Calling the below seems to be an effective solution. | 1089 // Calling the below seems to be an effective solution. |
1087 [window_ setMovableByWindowBackground:NO]; | 1090 [window_ setMovableByWindowBackground:NO]; |
1088 [window_ setMovableByWindowBackground:YES]; | 1091 [window_ setMovableByWindowBackground:YES]; |
1089 } | 1092 } |
1090 | 1093 |
1091 } // namespace views | 1094 } // namespace views |
OLD | NEW |