Index: wm/host/root_window_host_linux.h |
diff --git a/ui/aura/root_window_host_linux.h b/wm/host/root_window_host_linux.h |
similarity index 63% |
copy from ui/aura/root_window_host_linux.h |
copy to wm/host/root_window_host_linux.h |
index 85fcd3b30d7392158b214e04df5a35b048e7b2fb..72880852752951f0d9c64f866fb25586f18d4a32 100644 |
--- a/ui/aura/root_window_host_linux.h |
+++ b/wm/host/root_window_host_linux.h |
@@ -1,9 +1,9 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
-#define UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
+#ifndef WM_HOST_ROOT_WINDOW_HOST_LINUX_H_ |
+#define WM_HOST_ROOT_WINDOW_HOST_LINUX_H_ |
#include <X11/Xlib.h> |
@@ -12,9 +12,11 @@ |
// Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
#undef RootWindow |
+#include "base/hash_tables.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop.h" |
#include "ui/aura/root_window_host.h" |
+#include "ui/aura/window_observer.h" |
#include "ui/base/x/x11_atom_cache.h" |
#include "ui/base/x/x11_util.h" |
#include "ui/gfx/rect.h" |
@@ -23,14 +25,18 @@ namespace ui { |
class MouseEvent; |
} |
-namespace aura { |
+namespace wm { |
+class ForeignWindow; |
namespace internal { |
class TouchEventCalibrate; |
} |
-class RootWindowHostLinux : public RootWindowHost, |
- public MessageLoop::Dispatcher { |
+// TODO(reveman): Reuse aura::RootWindowHostLinux code. |
+class RootWindowHostLinux : public aura::RootWindowHost, |
+ public MessageLoop::Dispatcher, |
+ public aura::WindowObserver, |
+ public base::SupportsWeakPtr<RootWindowHostLinux> { |
public: |
explicit RootWindowHostLinux(const gfx::Rect& bounds); |
virtual ~RootWindowHostLinux(); |
@@ -38,9 +44,22 @@ class RootWindowHostLinux : public RootWindowHost, |
// Overridden from Dispatcher overrides: |
virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
- // RootWindowHost Overrides. |
- virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; |
- virtual RootWindow* GetRootWindow() OVERRIDE; |
+ private: |
+ class MouseMoveFilter; |
+ |
+ typedef base::hash_map< ::Window, scoped_refptr<ForeignWindow> > |
+ ForeignWindowMap; |
+ |
+ bool DispatchEventForRootWindow(const base::NativeEvent& event); |
+ |
+ // Dispatches XI2 events. Note that some events targetted for the X root |
+ // window are dispatched to the aura root window (e.g. touch events after |
+ // calibration). |
+ void DispatchXI2Event(const base::NativeEvent& event); |
+ |
+ // Overridden from aura::RootWindowHost: |
+ virtual void SetDelegate(aura::RootWindowHostDelegate* delegate) OVERRIDE; |
+ virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
virtual void Show() OVERRIDE; |
virtual void Hide() OVERRIDE; |
@@ -67,16 +86,6 @@ class RootWindowHostLinux : public RootWindowHost, |
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
virtual void PrepareForShutdown() OVERRIDE; |
- private: |
- class MouseMoveFilter; |
- |
- bool DispatchEventForRootWindow(const base::NativeEvent& event); |
- |
- // Dispatches XI2 events. Note that some events targetted for the X root |
- // window are dispatched to the aura root window (e.g. touch events after |
- // calibration). |
- void DispatchXI2Event(const base::NativeEvent& event); |
- |
// Returns true if there's an X window manager present... in most cases. Some |
// window managers (notably, ion3) don't implement enough of ICCCM for us to |
// detect that they're there. |
@@ -94,7 +103,35 @@ class RootWindowHostLinux : public RootWindowHost, |
// CopyAreaToSkCanvas() and GrabSnapshot(). |
scoped_ptr<ui::XScopedImage> GetXImage(const gfx::Rect& snapshot_bounds); |
- RootWindowHostDelegate* delegate_; |
+ // Overridden from aura::WindowObserver: |
+ virtual void OnWindowAdded(aura::Window* window) OVERRIDE; |
+ virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; |
+ virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; |
+ virtual void OnWindowVisibilityChanged( |
+ aura::Window* window, bool visible) OVERRIDE; |
+ virtual void OnWindowBoundsChanged(aura::Window* window, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds) OVERRIDE; |
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
+ |
+ ::Window GetTopForeignWindow(const aura::Window* window); |
+ ::Window FindForeignWindowToStackAbove(const aura::Window* window); |
+ void MapWindowIfNeeded(ForeignWindow* window); |
+ void UnmapWindowIfNeeded(ForeignWindow* window); |
+ |
+ void RecursiveConfigure( |
+ aura::Window* window, |
+ gfx::Vector2d offset, |
+ ::Window* sibling_to_stack_above, |
+ SkRegion* input_region); |
+ |
+ // Configure of native windows. |
+ void Configure(); |
+ |
+ // Schedule deferred configure of native windows. |
+ void ScheduleConfigure(aura::Window* window); |
+ |
+ aura::RootWindowHostDelegate* delegate_; |
// The display and the native X window hosting the root window. |
Display* xdisplay_; |
@@ -126,9 +163,18 @@ class RootWindowHostLinux : public RootWindowHost, |
ui::X11AtomCache atom_cache_; |
+ ForeignWindowMap foreign_windows_; |
+ aura::Window* configure_window_; |
+ |
+ // The native input window. |
+ ::Window x_input_window_; |
+ |
+ // To ensure we set the default cursor for native windows. |
+ bool need_to_set_default_cursor_; |
+ |
DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); |
}; |
-} // namespace aura |
+} // namespace wm |
-#endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
+#endif // WM_HOST_ROOT_WINDOW_HOST_LINUX_H_ |