OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "views/widget/root_view.h" | 5 #include "views/widget/root_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/drag_drop_types.h" | 9 #include "app/drag_drop_types.h" |
10 #include "app/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "gfx/canvas_skia.h" | 13 #include "gfx/canvas_skia.h" |
14 #include "views/fill_layout.h" | 14 #include "views/fill_layout.h" |
15 #include "views/focus/view_storage.h" | 15 #include "views/focus/view_storage.h" |
16 #include "views/widget/widget.h" | 16 #include "views/widget/widget.h" |
17 #include "views/window/window.h" | 17 #include "views/window/window.h" |
18 | 18 |
19 #if defined(OS_LINUX) | 19 #if defined(OS_LINUX) |
20 #include "views/widget/widget_gtk.h" | 20 #include "views/widget/widget_gtk.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 gfx::NativeView native_view) { | 574 gfx::NativeView native_view) { |
575 PropagateNativeViewHierarchyChanged(attached, native_view, this); | 575 PropagateNativeViewHierarchyChanged(attached, native_view, this); |
576 } | 576 } |
577 | 577 |
578 bool RootView::ProcessKeyEvent(const KeyEvent& event) { | 578 bool RootView::ProcessKeyEvent(const KeyEvent& event) { |
579 bool consumed = false; | 579 bool consumed = false; |
580 | 580 |
581 View* v = GetFocusedView(); | 581 View* v = GetFocusedView(); |
582 // Special case to handle right-click context menus triggered by the | 582 // Special case to handle right-click context menus triggered by the |
583 // keyboard. | 583 // keyboard. |
584 if (v && v->IsEnabled() && ((event.GetKeyCode() == app::VKEY_APPS) || | 584 if (v && v->IsEnabled() && ((event.GetKeyCode() == base::VKEY_APPS) || |
585 (event.GetKeyCode() == app::VKEY_F10 && event.IsShiftDown()))) { | 585 (event.GetKeyCode() == base::VKEY_F10 && event.IsShiftDown()))) { |
586 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); | 586 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); |
587 return true; | 587 return true; |
588 } | 588 } |
589 for (; v && v != this && !consumed; v = v->GetParent()) { | 589 for (; v && v != this && !consumed; v = v->GetParent()) { |
590 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? | 590 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? |
591 v->OnKeyPressed(event) : v->OnKeyReleased(event); | 591 v->OnKeyPressed(event) : v->OnKeyReleased(event); |
592 } | 592 } |
593 | 593 |
594 if (!consumed && default_keyboard_handler_) { | 594 if (!consumed && default_keyboard_handler_) { |
595 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? | 595 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 static_cast<WidgetGtk*>(GetWidget())->window_contents(); | 710 static_cast<WidgetGtk*>(GetWidget())->window_contents(); |
711 if (!native_view) | 711 if (!native_view) |
712 return; | 712 return; |
713 gdk_window_set_cursor(native_view->window, cursor); | 713 gdk_window_set_cursor(native_view->window, cursor); |
714 if (cursor) | 714 if (cursor) |
715 gdk_cursor_destroy(cursor); | 715 gdk_cursor_destroy(cursor); |
716 #endif | 716 #endif |
717 } | 717 } |
718 | 718 |
719 } // namespace views | 719 } // namespace views |
OLD | NEW |