| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/root_window_host_x11.h" | 5 #include "ui/aura/root_window_host_x11.h" |
| 6 | 6 |
| 7 #include <strings.h> | 7 #include <strings.h> |
| 8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
| 9 #include <X11/extensions/Xfixes.h> | 9 #include <X11/extensions/Xfixes.h> |
| 10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 break; | 422 break; |
| 423 } | 423 } |
| 424 case Expose: { | 424 case Expose: { |
| 425 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, | 425 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, |
| 426 xev->xexpose.width, xev->xexpose.height); | 426 xev->xexpose.width, xev->xexpose.height); |
| 427 compositor()->ScheduleRedrawRect(damage_rect); | 427 compositor()->ScheduleRedrawRect(damage_rect); |
| 428 break; | 428 break; |
| 429 } | 429 } |
| 430 case KeyPress: { | 430 case KeyPress: { |
| 431 ui::KeyEvent keydown_event(xev, false); | 431 ui::KeyEvent keydown_event(xev, false); |
| 432 delegate_->OnHostKeyEvent(&keydown_event); | 432 SendEventToProcessor(&keydown_event); |
| 433 break; | 433 break; |
| 434 } | 434 } |
| 435 case KeyRelease: { | 435 case KeyRelease: { |
| 436 ui::KeyEvent keyup_event(xev, false); | 436 ui::KeyEvent keyup_event(xev, false); |
| 437 delegate_->OnHostKeyEvent(&keyup_event); | 437 SendEventToProcessor(&keyup_event); |
| 438 break; | 438 break; |
| 439 } | 439 } |
| 440 case ButtonPress: { | 440 case ButtonPress: { |
| 441 if (static_cast<int>(xev->xbutton.button) == kBackMouseButton || | 441 if (static_cast<int>(xev->xbutton.button) == kBackMouseButton || |
| 442 static_cast<int>(xev->xbutton.button) == kForwardMouseButton) { | 442 static_cast<int>(xev->xbutton.button) == kForwardMouseButton) { |
| 443 client::UserActionClient* gesture_client = | 443 client::UserActionClient* gesture_client = |
| 444 client::GetUserActionClient(delegate_->AsRootWindow()->window()); | 444 client::GetUserActionClient(delegate_->AsRootWindow()->window()); |
| 445 if (gesture_client) { | 445 if (gesture_client) { |
| 446 gesture_client->OnUserAction( | 446 gesture_client->OnUserAction( |
| 447 static_cast<int>(xev->xbutton.button) == kBackMouseButton ? | 447 static_cast<int>(xev->xbutton.button) == kBackMouseButton ? |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 // containing aura root-window corresponding to the touchscreen. | 895 // containing aura root-window corresponding to the touchscreen. |
| 896 // However, if aura root-window has non-zero origin, | 896 // However, if aura root-window has non-zero origin, |
| 897 // we need to relocate the event into aura root-window coordinates. | 897 // we need to relocate the event into aura root-window coordinates. |
| 898 touchev.Relocate(bounds_.origin()); | 898 touchev.Relocate(bounds_.origin()); |
| 899 #if defined(USE_XI2_MT) | 899 #if defined(USE_XI2_MT) |
| 900 if (is_internal_display_) | 900 if (is_internal_display_) |
| 901 touch_calibrate_->Calibrate(&touchev, bounds_); | 901 touch_calibrate_->Calibrate(&touchev, bounds_); |
| 902 #endif // defined(USE_XI2_MT) | 902 #endif // defined(USE_XI2_MT) |
| 903 } | 903 } |
| 904 #endif // defined(OS_CHROMEOS) | 904 #endif // defined(OS_CHROMEOS) |
| 905 delegate_->OnHostTouchEvent(&touchev); | 905 SendEventToProcessor(&touchev); |
| 906 break; | 906 break; |
| 907 } | 907 } |
| 908 case ui::ET_MOUSE_MOVED: | 908 case ui::ET_MOUSE_MOVED: |
| 909 case ui::ET_MOUSE_DRAGGED: | 909 case ui::ET_MOUSE_DRAGGED: |
| 910 case ui::ET_MOUSE_PRESSED: | 910 case ui::ET_MOUSE_PRESSED: |
| 911 case ui::ET_MOUSE_RELEASED: | 911 case ui::ET_MOUSE_RELEASED: |
| 912 case ui::ET_MOUSE_ENTERED: | 912 case ui::ET_MOUSE_ENTERED: |
| 913 case ui::ET_MOUSE_EXITED: { | 913 case ui::ET_MOUSE_EXITED: { |
| 914 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) { | 914 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) { |
| 915 // If this is a motion event, we want to coalesce all pending motion | 915 // If this is a motion event, we want to coalesce all pending motion |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 } | 948 } |
| 949 case ui::ET_MOUSEWHEEL: { | 949 case ui::ET_MOUSEWHEEL: { |
| 950 ui::MouseWheelEvent mouseev(xev); | 950 ui::MouseWheelEvent mouseev(xev); |
| 951 TranslateAndDispatchMouseEvent(&mouseev); | 951 TranslateAndDispatchMouseEvent(&mouseev); |
| 952 break; | 952 break; |
| 953 } | 953 } |
| 954 case ui::ET_SCROLL_FLING_START: | 954 case ui::ET_SCROLL_FLING_START: |
| 955 case ui::ET_SCROLL_FLING_CANCEL: | 955 case ui::ET_SCROLL_FLING_CANCEL: |
| 956 case ui::ET_SCROLL: { | 956 case ui::ET_SCROLL: { |
| 957 ui::ScrollEvent scrollev(xev); | 957 ui::ScrollEvent scrollev(xev); |
| 958 delegate_->OnHostScrollEvent(&scrollev); | 958 SendEventToProcessor(&scrollev); |
| 959 break; | 959 break; |
| 960 } | 960 } |
| 961 case ui::ET_UMA_DATA: | 961 case ui::ET_UMA_DATA: |
| 962 break; | 962 break; |
| 963 case ui::ET_UNKNOWN: | 963 case ui::ET_UNKNOWN: |
| 964 break; | 964 break; |
| 965 default: | 965 default: |
| 966 NOTREACHED(); | 966 NOTREACHED(); |
| 967 } | 967 } |
| 968 | 968 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 994 // In order to get the correct point in screen coordinates | 994 // In order to get the correct point in screen coordinates |
| 995 // during passive grab, we first need to find on which host window | 995 // during passive grab, we first need to find on which host window |
| 996 // the mouse is on, and find out the screen coordinates on that | 996 // the mouse is on, and find out the screen coordinates on that |
| 997 // host window, then convert it back to this host window's coordinate. | 997 // host window, then convert it back to this host window's coordinate. |
| 998 screen_position_client->ConvertHostPointToScreen(root_window, &location); | 998 screen_position_client->ConvertHostPointToScreen(root_window, &location); |
| 999 screen_position_client->ConvertPointFromScreen(root_window, &location); | 999 screen_position_client->ConvertPointFromScreen(root_window, &location); |
| 1000 ConvertPointToHost(&location); | 1000 ConvertPointToHost(&location); |
| 1001 event->set_location(location); | 1001 event->set_location(location); |
| 1002 event->set_root_location(location); | 1002 event->set_root_location(location); |
| 1003 } | 1003 } |
| 1004 delegate_->OnHostMouseEvent(event); | 1004 SendEventToProcessor(event); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 void WindowTreeHostX11::UpdateIsInternalDisplay() { | 1007 void WindowTreeHostX11::UpdateIsInternalDisplay() { |
| 1008 Window* root_window = GetRootWindow()->window(); | 1008 Window* root_window = GetRootWindow()->window(); |
| 1009 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); | 1009 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); |
| 1010 gfx::Display display = screen->GetDisplayNearestWindow(root_window); | 1010 gfx::Display display = screen->GetDisplayNearestWindow(root_window); |
| 1011 is_internal_display_ = display.IsInternal(); | 1011 is_internal_display_ = display.IsInternal(); |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 void WindowTreeHostX11::SetCrOSTapPaused(bool state) { | 1014 void WindowTreeHostX11::SetCrOSTapPaused(bool state) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 namespace test { | 1055 namespace test { |
| 1056 | 1056 |
| 1057 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 1057 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
| 1058 default_override_redirect = override_redirect; | 1058 default_override_redirect = override_redirect; |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 } // namespace test | 1061 } // namespace test |
| 1062 } // namespace aura | 1062 } // namespace aura |
| OLD | NEW |