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
3// found in the LICENSE file.
4
5#ifndef ASH_HOST_ASH_WINDOW_TREE_HOST_X11_H_
6#define ASH_HOST_ASH_WINDOW_TREE_HOST_X11_H_
7
8#include "ash/ash_export.h"
9#include "ash/host/ash_window_tree_host.h"
10#include "ash/host/transformer_helper.h"
11#include "base/memory/scoped_ptr.h"
12#include "ui/aura/env_observer.h"
13#include "ui/aura/window_tree_host_x11.h"
14
15namespace ash {
16class RootWindowTransformer;
17class MouseCursorEventFilter;
18
19class ASH_EXPORT AshWindowTreeHostX11 : public AshWindowTreeHost,
20                                        public aura::WindowTreeHostX11,
21                                        public aura::EnvObserver {
22 public:
23  explicit AshWindowTreeHostX11(const gfx::Rect& initial_bounds);
24  virtual ~AshWindowTreeHostX11();
25
26 private:
27  // AshWindowTreeHost:
28  virtual void ToggleFullScreen() OVERRIDE;
29  virtual bool ConfineCursorToRootWindow() OVERRIDE;
30  virtual void UnConfineCursor() OVERRIDE;
31  virtual void SetRootWindowTransformer(
32      scoped_ptr<RootWindowTransformer> transformer) OVERRIDE;
33  virtual gfx::Insets GetHostInsets() const OVERRIDE;
34  virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE;
35  virtual void UpdateDisplayID(int64 id1, int64 id2) OVERRIDE;
36  virtual void PrepareForShutdown() OVERRIDE;
37
38  // aura::WindowTreehost:
39  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
40  virtual gfx::Transform GetRootTransform() const OVERRIDE;
41  virtual void SetRootTransform(const gfx::Transform& transform) OVERRIDE;
42  virtual gfx::Transform GetInverseRootTransform() const OVERRIDE;
43  virtual void UpdateRootWindowSize(const gfx::Size& host_size) OVERRIDE;
44  virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
45
46  // aura::WindowTreeHostX11:
47  virtual void OnConfigureNotify() OVERRIDE;
48  virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
49  virtual void TranslateAndDispatchLocatedEvent(ui::LocatedEvent* event)
50      OVERRIDE;
51
52  // EnvObserver overrides.
53  virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
54  virtual void OnHostInitialized(aura::WindowTreeHost* host) OVERRIDE;
55
56#if defined(OS_CHROMEOS)
57  // Set the CrOS touchpad "tap paused" property. It is used to temporarily
58  // turn off the Tap-to-click feature when the mouse pointer is invisible.
59  void SetCrOSTapPaused(bool state);
60#endif
61
62  scoped_ptr<XID[]> pointer_barriers_;
63
64  TransformerHelper transformer_helper_;
65
66  // The display IDs associated with this root window.
67  // In single monitor or extended mode dual monitor case, the root window
68  // is associated with one display.
69  // In mirror mode dual monitors case, the root window is associated with
70  // both displays.
71  std::pair<int64, int64> display_ids_;
72
73  DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostX11);
74};
75
76}  // namespace ash
77
78#endif  // ASH_HOST_ASH_WINDOW_TREE_HOST_X11_H_
79