Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc

Issue 89413002: linux aura: Support touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_x11.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_root_window_host_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 delegate_->OnHostMouseEvent(event); 1106 delegate_->OnHostMouseEvent(event);
1107 } else { 1107 } else {
1108 // Another DesktopRootWindowHostX11 has installed itself as 1108 // Another DesktopRootWindowHostX11 has installed itself as
1109 // capture. Translate the event's location and dispatch to the other. 1109 // capture. Translate the event's location and dispatch to the other.
1110 event->ConvertLocationToTarget(root_window_->window(), 1110 event->ConvertLocationToTarget(root_window_->window(),
1111 g_current_capture->root_window_->window()); 1111 g_current_capture->root_window_->window());
1112 g_current_capture->delegate_->OnHostMouseEvent(event); 1112 g_current_capture->delegate_->OnHostMouseEvent(event);
1113 } 1113 }
1114 } 1114 }
1115 1115
1116 void DesktopRootWindowHostX11::DispatchTouchEvent(ui::TouchEvent* event) {
1117 if (g_current_capture && g_current_capture != this &&
1118 event->type() == ui::ET_MOUSE_PRESSED) {
dshwang 2013/12/04 17:37:27 s/ET_MOUSE_PRESSED/ET_TOUCH_PRESSED/ ? why Dispat
sadrul 2013/12/04 17:57:29 Whoops. Fixed.
1119 event->ConvertLocationToTarget(root_window_->window(),
1120 g_current_capture->root_window_->window());
1121 g_current_capture->delegate_->OnHostTouchEvent(event);
1122 } else {
1123 delegate_->OnHostTouchEvent(event);
1124 }
1125 }
1126
1116 void DesktopRootWindowHostX11::ResetWindowRegion() { 1127 void DesktopRootWindowHostX11::ResetWindowRegion() {
1117 if (!IsMaximized()) { 1128 if (!IsMaximized()) {
1118 gfx::Path window_mask; 1129 gfx::Path window_mask;
1119 views::Widget* widget = native_widget_delegate_->AsWidget(); 1130 views::Widget* widget = native_widget_delegate_->AsWidget();
1120 if (widget->non_client_view()) { 1131 if (widget->non_client_view()) {
1121 // Some frame views define a custom (non-rectangular) window mask. If 1132 // Some frame views define a custom (non-rectangular) window mask. If
1122 // so, use it to define the window shape. If not, fall through. 1133 // so, use it to define the window shape. If not, fall through.
1123 widget->non_client_view()->GetWindowMask(bounds_.size(), &window_mask); 1134 widget->non_client_view()->GetWindowMask(bounds_.size(), &window_mask);
1124 if (window_mask.countPoints() > 0) { 1135 if (window_mask.countPoints() > 0) {
1125 Region region = gfx::CreateRegionFromSkPath(window_mask); 1136 Region region = gfx::CreateRegionFromSkPath(window_mask);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 case GenericEvent: { 1282 case GenericEvent: {
1272 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 1283 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
1273 if (!factory->ShouldProcessXI2Event(xev)) 1284 if (!factory->ShouldProcessXI2Event(xev))
1274 break; 1285 break;
1275 1286
1276 ui::EventType type = ui::EventTypeFromNative(xev); 1287 ui::EventType type = ui::EventTypeFromNative(xev);
1277 XEvent last_event; 1288 XEvent last_event;
1278 int num_coalesced = 0; 1289 int num_coalesced = 0;
1279 1290
1280 switch (type) { 1291 switch (type) {
1281 // case ui::ET_TOUCH_MOVED: 1292 case ui::ET_TOUCH_MOVED:
1282 // num_coalesced = CoalescePendingMotionEvents(xev, &last_event); 1293 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
1283 // if (num_coalesced > 0) 1294 if (num_coalesced > 0)
1284 // xev = &last_event; 1295 xev = &last_event;
1285 // // fallthrough 1296 // fallthrough
1286 // case ui::ET_TOUCH_PRESSED: 1297 case ui::ET_TOUCH_PRESSED:
1287 // case ui::ET_TOUCH_RELEASED: { 1298 case ui::ET_TOUCH_RELEASED: {
1288 // ui::TouchEvent touchev(xev); 1299 ui::TouchEvent touchev(xev);
1289 // delegate_->OnHostTouchEvent(&touchev); 1300 DispatchTouchEvent(&touchev);
1290 // break; 1301 break;
1291 // } 1302 }
1292 case ui::ET_MOUSE_MOVED: 1303 case ui::ET_MOUSE_MOVED:
1293 case ui::ET_MOUSE_DRAGGED: 1304 case ui::ET_MOUSE_DRAGGED:
1294 case ui::ET_MOUSE_PRESSED: 1305 case ui::ET_MOUSE_PRESSED:
1295 case ui::ET_MOUSE_RELEASED: 1306 case ui::ET_MOUSE_RELEASED:
1296 case ui::ET_MOUSE_ENTERED: 1307 case ui::ET_MOUSE_ENTERED:
1297 case ui::ET_MOUSE_EXITED: { 1308 case ui::ET_MOUSE_EXITED: {
1298 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) { 1309 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) {
1299 // If this is a motion event, we want to coalesce all pending motion 1310 // If this is a motion event, we want to coalesce all pending motion
1300 // events that are at the top of the queue. 1311 // events that are at the top of the queue.
1301 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event); 1312 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 if (linux_ui) { 1527 if (linux_ui) {
1517 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); 1528 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
1518 if (native_theme) 1529 if (native_theme)
1519 return native_theme; 1530 return native_theme;
1520 } 1531 }
1521 1532
1522 return ui::NativeTheme::instance(); 1533 return ui::NativeTheme::instance();
1523 } 1534 }
1524 1535
1525 } // namespace views 1536 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698