| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/canvas.h" | 10 #include "app/gfx/canvas.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return true; | 353 return true; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 // Reset mouse_pressed_handler_ to indicate that no processing is occurring. | 357 // Reset mouse_pressed_handler_ to indicate that no processing is occurring. |
| 358 mouse_pressed_handler_ = NULL; | 358 mouse_pressed_handler_ = NULL; |
| 359 | 359 |
| 360 if (focus_on_mouse_pressed_) { | 360 if (focus_on_mouse_pressed_) { |
| 361 #if defined(OS_WIN) | 361 #if defined(OS_WIN) |
| 362 HWND hwnd = GetWidget()->GetNativeView(); | 362 HWND hwnd = GetWidget()->GetNativeView(); |
| 363 if (::GetFocus() != hwnd) { | 363 if (::GetFocus() != hwnd) |
| 364 ::SetFocus(hwnd); | 364 ::SetFocus(hwnd); |
| 365 } | |
| 366 #else | 365 #else |
| 367 NOTIMPLEMENTED(); | 366 GtkWidget* widget = GetWidget()->GetNativeView(); |
| 367 if (!gtk_widget_is_focus(widget)) |
| 368 gtk_widget_grab_focus(widget); |
| 368 #endif | 369 #endif |
| 369 } | 370 } |
| 370 | 371 |
| 371 // In the event that a double-click is not handled after traversing the | 372 // In the event that a double-click is not handled after traversing the |
| 372 // entire hierarchy (even as a single-click when sent to a different view), | 373 // entire hierarchy (even as a single-click when sent to a different view), |
| 373 // it must be marked as handled to avoid anything happening from default | 374 // it must be marked as handled to avoid anything happening from default |
| 374 // processing if it the first click-part was handled by us. | 375 // processing if it the first click-part was handled by us. |
| 375 if (last_click_handler_ && e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK) | 376 if (last_click_handler_ && e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK) |
| 376 hit_disabled_view = true; | 377 hit_disabled_view = true; |
| 377 | 378 |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 776 |
| 776 View* v = GetFocusedView(); | 777 View* v = GetFocusedView(); |
| 777 // Special case to handle right-click context menus triggered by the | 778 // Special case to handle right-click context menus triggered by the |
| 778 // keyboard. | 779 // keyboard. |
| 779 if (v && v->IsEnabled() && ((event.GetCharacter() == base::VKEY_APPS) || | 780 if (v && v->IsEnabled() && ((event.GetCharacter() == base::VKEY_APPS) || |
| 780 (event.GetCharacter() == base::VKEY_F10 && event.IsShiftDown()))) { | 781 (event.GetCharacter() == base::VKEY_F10 && event.IsShiftDown()))) { |
| 781 gfx::Point screen_loc = v->GetKeyboardContextMenuLocation(); | 782 gfx::Point screen_loc = v->GetKeyboardContextMenuLocation(); |
| 782 v->ShowContextMenu(screen_loc.x(), screen_loc.y(), false); | 783 v->ShowContextMenu(screen_loc.x(), screen_loc.y(), false); |
| 783 return true; | 784 return true; |
| 784 } | 785 } |
| 785 | |
| 786 for (; v && v != this && !consumed; v = v->GetParent()) { | 786 for (; v && v != this && !consumed; v = v->GetParent()) { |
| 787 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? | 787 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? |
| 788 v->OnKeyPressed(event) : v->OnKeyReleased(event); | 788 v->OnKeyPressed(event) : v->OnKeyReleased(event); |
| 789 } | 789 } |
| 790 | 790 |
| 791 if (!consumed && default_keyboard_handler_) { | 791 if (!consumed && default_keyboard_handler_) { |
| 792 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? | 792 consumed = (event.GetType() == Event::ET_KEY_PRESSED) ? |
| 793 default_keyboard_handler_->OnKeyPressed(event) : | 793 default_keyboard_handler_->OnKeyPressed(event) : |
| 794 default_keyboard_handler_->OnKeyReleased(event); | 794 default_keyboard_handler_->OnKeyReleased(event); |
| 795 } | 795 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 gfx::NativeView native_view = GetWidget()->GetNativeView(); | 918 gfx::NativeView native_view = GetWidget()->GetNativeView(); |
| 919 if (!native_view) | 919 if (!native_view) |
| 920 return; | 920 return; |
| 921 gdk_window_set_cursor(native_view->window, cursor); | 921 gdk_window_set_cursor(native_view->window, cursor); |
| 922 if (cursor) | 922 if (cursor) |
| 923 gdk_cursor_destroy(cursor); | 923 gdk_cursor_destroy(cursor); |
| 924 #endif | 924 #endif |
| 925 } | 925 } |
| 926 | 926 |
| 927 } // namespace views | 927 } // namespace views |
| OLD | NEW |