diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 03:47:37 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 03:47:37 +0000 |
commit | 9d56dd31573039d45135ec516260bcc070cc284f (patch) | |
tree | f1df57876f1d1fc9998dda7d35adc98764a34b94 /views/widget/native_widget_views.cc | |
parent | e49002ab6fab8693dda975ee8bd0ffaae8bbc5cb (diff) | |
download | chromium_src-9d56dd31573039d45135ec516260bcc070cc284f.zip chromium_src-9d56dd31573039d45135ec516260bcc070cc284f.tar.gz chromium_src-9d56dd31573039d45135ec516260bcc070cc284f.tar.bz2 |
Attempt 2 at:
Gets mouse capture to work for menus with pure views. As part of this
I moved what was in menu_host_gtk into native_widget_gtk. Gtk supports
two grab types, both mouse and key. We only want key grab when showing
menus.
BUG=none
TEST=none
TBR=ben@chromium.org
Review URL: http://codereview.chromium.org/7354006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/native_widget_views.cc')
-rw-r--r-- | views/widget/native_widget_views.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc index c073b9d..2f1476d 100644 --- a/views/widget/native_widget_views.cc +++ b/views/widget/native_widget_views.cc @@ -160,17 +160,36 @@ void NativeWidgetViews::SendNativeAccessibilityEvent( } void NativeWidgetViews::SetMouseCapture() { + View* parent_root_view = GetParentNativeWidget()->GetWidget()->GetRootView(); + static_cast<internal::RootView*>(parent_root_view)->set_capture_view( + view_.get()); GetParentNativeWidget()->SetMouseCapture(); } void NativeWidgetViews::ReleaseMouseCapture() { + View* parent_root_view = GetParentNativeWidget()->GetWidget()->GetRootView(); + static_cast<internal::RootView*>(parent_root_view)->set_capture_view(NULL); GetParentNativeWidget()->ReleaseMouseCapture(); } bool NativeWidgetViews::HasMouseCapture() const { + // NOTE: we may need to tweak this to only return true if the parent native + // widget's RootView has us as the capture view. return GetParentNativeWidget()->HasMouseCapture(); } +void NativeWidgetViews::SetKeyboardCapture() { + GetParentNativeWidget()->SetKeyboardCapture(); +} + +void NativeWidgetViews::ReleaseKeyboardCapture() { + GetParentNativeWidget()->ReleaseKeyboardCapture(); +} + +bool NativeWidgetViews::HasKeyboardCapture() { + return GetParentNativeWidget()->HasKeyboardCapture(); +} + InputMethod* NativeWidgetViews::GetInputMethodNative() { return GetParentNativeWidget()->GetInputMethodNative(); } |