| 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/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
| (...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 flags |= ui::EF_IS_NON_CLIENT; | 1782 flags |= ui::EF_IS_NON_CLIENT; |
| 1783 event->set_flags(flags); | 1783 event->set_flags(flags); |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 // While we unset the urgency hint when we gain focus, we also must remove it | 1786 // While we unset the urgency hint when we gain focus, we also must remove it |
| 1787 // on mouse clicks because we can call FlashFrame() on an active window. | 1787 // on mouse clicks because we can call FlashFrame() on an active window. |
| 1788 if (event->IsAnyButton() || event->IsMouseWheelEvent()) | 1788 if (event->IsAnyButton() || event->IsMouseWheelEvent()) |
| 1789 FlashFrame(false); | 1789 FlashFrame(false); |
| 1790 | 1790 |
| 1791 if (!g_current_capture || g_current_capture == this) { | 1791 if (!g_current_capture || g_current_capture == this) { |
| 1792 SendEventToProcessor(event); | 1792 SendEventToSink(event); |
| 1793 } else { | 1793 } else { |
| 1794 // Another DesktopWindowTreeHostX11 has installed itself as | 1794 // Another DesktopWindowTreeHostX11 has installed itself as |
| 1795 // capture. Translate the event's location and dispatch to the other. | 1795 // capture. Translate the event's location and dispatch to the other. |
| 1796 ConvertEventToDifferentHost(event, g_current_capture); | 1796 ConvertEventToDifferentHost(event, g_current_capture); |
| 1797 g_current_capture->SendEventToProcessor(event); | 1797 g_current_capture->SendEventToSink(event); |
| 1798 } | 1798 } |
| 1799 } | 1799 } |
| 1800 | 1800 |
| 1801 void DesktopWindowTreeHostX11::DispatchTouchEvent(ui::TouchEvent* event) { | 1801 void DesktopWindowTreeHostX11::DispatchTouchEvent(ui::TouchEvent* event) { |
| 1802 if (g_current_capture && g_current_capture != this && | 1802 if (g_current_capture && g_current_capture != this && |
| 1803 event->type() == ui::ET_TOUCH_PRESSED) { | 1803 event->type() == ui::ET_TOUCH_PRESSED) { |
| 1804 ConvertEventToDifferentHost(event, g_current_capture); | 1804 ConvertEventToDifferentHost(event, g_current_capture); |
| 1805 g_current_capture->SendEventToProcessor(event); | 1805 g_current_capture->SendEventToSink(event); |
| 1806 } else { | 1806 } else { |
| 1807 SendEventToProcessor(event); | 1807 SendEventToSink(event); |
| 1808 } | 1808 } |
| 1809 } | 1809 } |
| 1810 | 1810 |
| 1811 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { | 1811 void DesktopWindowTreeHostX11::DispatchKeyEvent(ui::KeyEvent* event) { |
| 1812 if (native_widget_delegate_->AsWidget()->IsActive()) | 1812 if (native_widget_delegate_->AsWidget()->IsActive()) |
| 1813 GetInputMethod()->DispatchKeyEvent(event); | 1813 GetInputMethod()->DispatchKeyEvent(event); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( | 1816 void DesktopWindowTreeHostX11::ConvertEventToDifferentHost( |
| 1817 ui::LocatedEvent* located_event, | 1817 ui::LocatedEvent* located_event, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 } | 2133 } |
| 2134 case ui::ET_MOUSEWHEEL: { | 2134 case ui::ET_MOUSEWHEEL: { |
| 2135 ui::MouseWheelEvent mouseev(xev); | 2135 ui::MouseWheelEvent mouseev(xev); |
| 2136 DispatchMouseEvent(&mouseev); | 2136 DispatchMouseEvent(&mouseev); |
| 2137 break; | 2137 break; |
| 2138 } | 2138 } |
| 2139 case ui::ET_SCROLL_FLING_START: | 2139 case ui::ET_SCROLL_FLING_START: |
| 2140 case ui::ET_SCROLL_FLING_CANCEL: | 2140 case ui::ET_SCROLL_FLING_CANCEL: |
| 2141 case ui::ET_SCROLL: { | 2141 case ui::ET_SCROLL: { |
| 2142 ui::ScrollEvent scrollev(xev); | 2142 ui::ScrollEvent scrollev(xev); |
| 2143 SendEventToProcessor(&scrollev); | 2143 SendEventToSink(&scrollev); |
| 2144 break; | 2144 break; |
| 2145 } | 2145 } |
| 2146 case ui::ET_KEY_PRESSED: | 2146 case ui::ET_KEY_PRESSED: |
| 2147 case ui::ET_KEY_RELEASED: { | 2147 case ui::ET_KEY_RELEASED: { |
| 2148 ui::KeyEvent key_event(xev); | 2148 ui::KeyEvent key_event(xev); |
| 2149 DispatchKeyEvent(&key_event); | 2149 DispatchKeyEvent(&key_event); |
| 2150 break; | 2150 break; |
| 2151 } | 2151 } |
| 2152 case ui::ET_UNKNOWN: | 2152 case ui::ET_UNKNOWN: |
| 2153 break; | 2153 break; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 | 2351 |
| 2352 // static | 2352 // static |
| 2353 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2353 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 2354 internal::NativeWidgetDelegate* native_widget_delegate, | 2354 internal::NativeWidgetDelegate* native_widget_delegate, |
| 2355 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2355 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 2356 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2356 return new DesktopWindowTreeHostX11(native_widget_delegate, |
| 2357 desktop_native_widget_aura); | 2357 desktop_native_widget_aura); |
| 2358 } | 2358 } |
| 2359 | 2359 |
| 2360 } // namespace views | 2360 } // namespace views |
| OLD | NEW |