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

Side by Side Diff: ash/host/ash_window_tree_host_x11.cc

Issue 25108005: linux_aura: Compile ash into chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win64 compile. Created 6 years, 8 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/host/ash_window_tree_host_x11.h" 5 #include "ash/host/ash_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/Xfixes.h> 7 #include <X11/extensions/Xfixes.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/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 gfx::Transform AshWindowTreeHostX11::GetInverseRootTransform() const { 276 gfx::Transform AshWindowTreeHostX11::GetInverseRootTransform() const {
277 return transformer_helper_.GetInverseTransform(); 277 return transformer_helper_.GetInverseTransform();
278 } 278 }
279 279
280 void AshWindowTreeHostX11::UpdateRootWindowSize(const gfx::Size& host_size) { 280 void AshWindowTreeHostX11::UpdateRootWindowSize(const gfx::Size& host_size) {
281 transformer_helper_.UpdateWindowSize(host_size); 281 transformer_helper_.UpdateWindowSize(host_size);
282 } 282 }
283 283
284 void AshWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { 284 void AshWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) {
285 #if defined(OS_CHROMEOS)
285 SetCrOSTapPaused(!show); 286 SetCrOSTapPaused(!show);
287 #endif
286 } 288 }
287 289
288 void AshWindowTreeHostX11::OnWindowInitialized(aura::Window* window) {} 290 void AshWindowTreeHostX11::OnWindowInitialized(aura::Window* window) {}
289 291
290 void AshWindowTreeHostX11::OnHostInitialized(aura::WindowTreeHost* host) { 292 void AshWindowTreeHostX11::OnHostInitialized(aura::WindowTreeHost* host) {
291 // UpdateIsInternalDisplay relies on RootWindowSettings' display_id being set 293 // UpdateIsInternalDisplay relies on RootWindowSettings' display_id being set
292 // available by the time WED::Init is called. (set in 294 // available by the time WED::Init is called. (set in
293 // DisplayManager::CreateRootWindowForDisplay) 295 // DisplayManager::CreateRootWindowForDisplay)
294 // Ready when NotifyHostInitialized is called from WED::Init. 296 // Ready when NotifyHostInitialized is called from WED::Init.
295 if (host != AsWindowTreeHost()) 297 if (host != AsWindowTreeHost())
296 return; 298 return;
297 UpdateIsInternalDisplay(); 299 UpdateIsInternalDisplay();
298 300
301 #if defined(OS_CHROMEOS)
299 // We have to enable Tap-to-click by default because the cursor is set to 302 // We have to enable Tap-to-click by default because the cursor is set to
300 // visible in Shell::InitRootWindowController. 303 // visible in Shell::InitRootWindowController.
301 SetCrOSTapPaused(false); 304 SetCrOSTapPaused(false);
305 #endif
302 } 306 }
303 307
304 void AshWindowTreeHostX11::OnConfigureNotify() { 308 void AshWindowTreeHostX11::OnConfigureNotify() {
305 UpdateIsInternalDisplay(); 309 UpdateIsInternalDisplay();
306 310
307 // Always update barrier and mouse location because |bounds_| might 311 // Always update barrier and mouse location because |bounds_| might
308 // have already been updated in |SetBounds|. 312 // have already been updated in |SetBounds|.
309 if (pointer_barriers_) { 313 if (pointer_barriers_) {
310 UnConfineCursor(); 314 UnConfineCursor();
311 ConfineCursorToRootWindow(); 315 ConfineCursorToRootWindow();
312 } 316 }
313 } 317 }
314 318
315 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( 319 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent(
316 ui::LocatedEvent* event) { 320 ui::LocatedEvent* event) {
317 switch (event->type()) { 321 switch (event->type()) {
318 case ui::ET_TOUCH_MOVED: 322 case ui::ET_TOUCH_MOVED:
319 case ui::ET_TOUCH_PRESSED: 323 case ui::ET_TOUCH_PRESSED:
320 case ui::ET_TOUCH_CANCELLED: 324 case ui::ET_TOUCH_CANCELLED:
321 case ui::ET_TOUCH_RELEASED: { 325 case ui::ET_TOUCH_RELEASED: {
326 #if defined(OS_CHROMEOS)
322 ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(event); 327 ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(event);
323 if (base::SysInfo::IsRunningOnChromeOS()) { 328 if (base::SysInfo::IsRunningOnChromeOS()) {
324 // X maps the touch-surface to the size of the X root-window. 329 // X maps the touch-surface to the size of the X root-window.
325 // In multi-monitor setup, Coordinate Transformation Matrix 330 // In multi-monitor setup, Coordinate Transformation Matrix
326 // repositions the touch-surface onto part of X root-window 331 // repositions the touch-surface onto part of X root-window
327 // containing aura root-window corresponding to the touchscreen. 332 // containing aura root-window corresponding to the touchscreen.
328 // However, if aura root-window has non-zero origin, 333 // However, if aura root-window has non-zero origin,
329 // we need to relocate the event into aura root-window coordinates. 334 // we need to relocate the event into aura root-window coordinates.
330 touchev->Relocate(bounds().origin()); 335 touchev->Relocate(bounds().origin());
331 #if defined(USE_XI2_MT) 336 #if defined(USE_XI2_MT)
332 if (is_internal_display_) 337 if (is_internal_display_)
333 touch_calibrate_->Calibrate(touchev, bounds()); 338 touch_calibrate_->Calibrate(touchev, bounds());
334 #endif // defined(USE_XI2_MT) 339 #endif // defined(USE_XI2_MT)
335 } 340 }
341 #endif // defined(OS_CHROMEOS)
336 break; 342 break;
337 } 343 }
338 default: { 344 default: {
339 aura::Window* root_window = window(); 345 aura::Window* root_window = window();
340 aura::client::ScreenPositionClient* screen_position_client = 346 aura::client::ScreenPositionClient* screen_position_client =
341 aura::client::GetScreenPositionClient(root_window); 347 aura::client::GetScreenPositionClient(root_window);
342 gfx::Rect local(bounds().size()); 348 gfx::Rect local(bounds().size());
343 349
344 if (screen_position_client && !local.Contains(event->location())) { 350 if (screen_position_client && !local.Contains(event->location())) {
345 gfx::Point location(event->location()); 351 gfx::Point location(event->location());
(...skipping 15 matching lines...) Expand all
361 } 367 }
362 368
363 void AshWindowTreeHostX11::UpdateIsInternalDisplay() { 369 void AshWindowTreeHostX11::UpdateIsInternalDisplay() {
364 aura::Window* root_window = window(); 370 aura::Window* root_window = window();
365 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); 371 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window);
366 gfx::Display display = screen->GetDisplayNearestWindow(root_window); 372 gfx::Display display = screen->GetDisplayNearestWindow(root_window);
367 DCHECK(display.is_valid()); 373 DCHECK(display.is_valid());
368 is_internal_display_ = display.IsInternal(); 374 is_internal_display_ = display.IsInternal();
369 } 375 }
370 376
377 #if defined(OS_CHROMEOS)
371 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) { 378 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) {
372 if (!ui::IsXInput2Available()) 379 if (!ui::IsXInput2Available())
373 return; 380 return;
374 // Temporarily pause tap-to-click when the cursor is hidden. 381 // Temporarily pause tap-to-click when the cursor is hidden.
375 Atom prop = atom_cache()->GetAtom("Tap Paused"); 382 Atom prop = atom_cache()->GetAtom("Tap Paused");
376 unsigned char value = state; 383 unsigned char value = state;
377 XIDeviceList dev_list = 384 XIDeviceList dev_list =
378 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay()); 385 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay());
379 386
380 // Only slave pointer devices could possibly have tap-paused property. 387 // Only slave pointer devices could possibly have tap-paused property.
(...skipping 22 matching lines...) Expand all
403 dev_list[i].deviceid, 410 dev_list[i].deviceid,
404 prop, 411 prop,
405 XA_INTEGER, 412 XA_INTEGER,
406 8, 413 8,
407 PropModeReplace, 414 PropModeReplace,
408 &value, 415 &value,
409 1); 416 1);
410 } 417 }
411 } 418 }
412 } 419 }
420 #endif
413 421
414 AshWindowTreeHost* AshWindowTreeHost::Create(const gfx::Rect& initial_bounds) { 422 AshWindowTreeHost* AshWindowTreeHost::Create(const gfx::Rect& initial_bounds) {
415 return new AshWindowTreeHostX11(initial_bounds); 423 return new AshWindowTreeHostX11(initial_bounds);
416 } 424 }
417 425
418 } // namespace ash 426 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698