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

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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 delegate_->OnHostMouseEvent(event); 1105 delegate_->OnHostMouseEvent(event);
1106 } else { 1106 } else {
1107 // Another DesktopRootWindowHostX11 has installed itself as 1107 // Another DesktopRootWindowHostX11 has installed itself as
1108 // capture. Translate the event's location and dispatch to the other. 1108 // capture. Translate the event's location and dispatch to the other.
1109 event->ConvertLocationToTarget(root_window_->window(), 1109 event->ConvertLocationToTarget(root_window_->window(),
1110 g_current_capture->root_window_->window()); 1110 g_current_capture->root_window_->window());
1111 g_current_capture->delegate_->OnHostMouseEvent(event); 1111 g_current_capture->delegate_->OnHostMouseEvent(event);
1112 } 1112 }
1113 } 1113 }
1114 1114
1115 void DesktopRootWindowHostX11::DispatchTouchEvent(ui::TouchEvent* event) {
1116 if (g_current_capture && g_current_capture != this &&
1117 event->type() == ui::ET_TOUCH_PRESSED) {
1118 event->ConvertLocationToTarget(root_window_->window(),
1119 g_current_capture->root_window_->window());
1120 g_current_capture->delegate_->OnHostTouchEvent(event);
1121 } else {
1122 delegate_->OnHostTouchEvent(event);
1123 }
1124 }
1125
1115 void DesktopRootWindowHostX11::ResetWindowRegion() { 1126 void DesktopRootWindowHostX11::ResetWindowRegion() {
1116 if (!IsMaximized()) { 1127 if (!IsMaximized()) {
1117 gfx::Path window_mask; 1128 gfx::Path window_mask;
1118 views::Widget* widget = native_widget_delegate_->AsWidget(); 1129 views::Widget* widget = native_widget_delegate_->AsWidget();
1119 if (widget->non_client_view()) { 1130 if (widget->non_client_view()) {
1120 // Some frame views define a custom (non-rectangular) window mask. If 1131 // Some frame views define a custom (non-rectangular) window mask. If
1121 // so, use it to define the window shape. If not, fall through. 1132 // so, use it to define the window shape. If not, fall through.
1122 widget->non_client_view()->GetWindowMask(bounds_.size(), &window_mask); 1133 widget->non_client_view()->GetWindowMask(bounds_.size(), &window_mask);
1123 if (window_mask.countPoints() > 0) { 1134 if (window_mask.countPoints() > 0) {
1124 Region region = gfx::CreateRegionFromSkPath(window_mask); 1135 Region region = gfx::CreateRegionFromSkPath(window_mask);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 case GenericEvent: { 1281 case GenericEvent: {
1271 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 1282 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
1272 if (!factory->ShouldProcessXI2Event(xev)) 1283 if (!factory->ShouldProcessXI2Event(xev))
1273 break; 1284 break;
1274 1285
1275 ui::EventType type = ui::EventTypeFromNative(xev); 1286 ui::EventType type = ui::EventTypeFromNative(xev);
1276 XEvent last_event; 1287 XEvent last_event;
1277 int num_coalesced = 0; 1288 int num_coalesced = 0;
1278 1289
1279 switch (type) { 1290 switch (type) {
1280 // case ui::ET_TOUCH_MOVED: 1291 case ui::ET_TOUCH_MOVED:
1281 // num_coalesced = CoalescePendingMotionEvents(xev, &last_event); 1292 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
1282 // if (num_coalesced > 0) 1293 if (num_coalesced > 0)
1283 // xev = &last_event; 1294 xev = &last_event;
1284 // // fallthrough 1295 // fallthrough
1285 // case ui::ET_TOUCH_PRESSED: 1296 case ui::ET_TOUCH_PRESSED:
1286 // case ui::ET_TOUCH_RELEASED: { 1297 case ui::ET_TOUCH_RELEASED: {
1287 // ui::TouchEvent touchev(xev); 1298 ui::TouchEvent touchev(xev);
1288 // delegate_->OnHostTouchEvent(&touchev); 1299 DispatchTouchEvent(&touchev);
1289 // break; 1300 break;
1290 // } 1301 }
1291 case ui::ET_MOUSE_MOVED: 1302 case ui::ET_MOUSE_MOVED:
1292 case ui::ET_MOUSE_DRAGGED: 1303 case ui::ET_MOUSE_DRAGGED:
1293 case ui::ET_MOUSE_PRESSED: 1304 case ui::ET_MOUSE_PRESSED:
1294 case ui::ET_MOUSE_RELEASED: 1305 case ui::ET_MOUSE_RELEASED:
1295 case ui::ET_MOUSE_ENTERED: 1306 case ui::ET_MOUSE_ENTERED:
1296 case ui::ET_MOUSE_EXITED: { 1307 case ui::ET_MOUSE_EXITED: {
1297 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) { 1308 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_DRAGGED) {
1298 // If this is a motion event, we want to coalesce all pending motion 1309 // If this is a motion event, we want to coalesce all pending motion
1299 // events that are at the top of the queue. 1310 // events that are at the top of the queue.
1300 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event); 1311 num_coalesced = ui::CoalescePendingMotionEvents(xev, &last_event);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 if (linux_ui) { 1521 if (linux_ui) {
1511 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); 1522 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme();
1512 if (native_theme) 1523 if (native_theme)
1513 return native_theme; 1524 return native_theme;
1514 } 1525 }
1515 1526
1516 return ui::NativeTheme::instance(); 1527 return ui::NativeTheme::instance();
1517 } 1528 }
1518 1529
1519 } // namespace views 1530 } // 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