Index: ui/views/widget/desktop_root_window_host_linux.h |
diff --git a/ui/views/widget/desktop_root_window_host_linux.h b/ui/views/widget/desktop_root_window_host_linux.h |
index 8a5de347032156e5e0936e6f439ef8ebd12d6758..32acfd1f14b34695e86954f2196ccfe8fdc3523a 100644 |
--- a/ui/views/widget/desktop_root_window_host_linux.h |
+++ b/ui/views/widget/desktop_root_window_host_linux.h |
@@ -5,17 +5,52 @@ |
#ifndef UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_ |
#define UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_ |
+#include <X11/Xlib.h> |
+ |
+// Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
+#undef RootWindow |
+ |
#include "base/basictypes.h" |
+#include "ui/aura/root_window_host.h" |
+#include "ui/gfx/rect.h" |
+#include "ui/base/x/x11_atom_cache.h" |
#include "ui/views/widget/desktop_root_window_host.h" |
+namespace aura { |
+class DesktopActivationClient; |
+class DesktopDispatcherClient; |
+class FocusManager; |
+namespace shared { |
+class CompoundEventFilter; |
+class InputMethodEventFilter; |
+} |
+} |
+ |
namespace views { |
+class DesktopCaptureClient; |
+class X11WindowEventFilter; |
-class DesktopRootWindowHostLinux : public DesktopRootWindowHost { |
+class DesktopRootWindowHostLinux : public DesktopRootWindowHost, |
+ public aura::RootWindowHost, |
+ public MessageLoop::Dispatcher { |
public: |
DesktopRootWindowHostLinux(); |
virtual ~DesktopRootWindowHostLinux(); |
private: |
+ // Initializes our X11 surface to draw on. This method performs all |
+ // initialization related to talking to the X11 server. |
+ void InitX11Window(const gfx::Rect& bounds); |
+ |
+ // Creates an aura::RootWindow to contain the |content_window|, along with |
+ // all aura client objects that direct behavior. |
+ void InitRootWindow(const Widget::InitParams& params); |
+ |
+ // 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. |
+ bool IsWindowManagerPresent(); |
+ |
// Overridden from DesktopRootWindowHost: |
virtual void Init(aura::Window* content_window, |
const Widget::InitParams& params) OVERRIDE; |
@@ -50,6 +85,69 @@ class DesktopRootWindowHostLinux : public DesktopRootWindowHost { |
virtual internal::InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; |
virtual void SetWindowTitle(const string16& title) OVERRIDE; |
+ // Overridden from aura::RootWindowHost: |
+ virtual aura::RootWindow* GetRootWindow() OVERRIDE; |
+ virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
+ virtual void Show() OVERRIDE; |
+ virtual void Hide() OVERRIDE; |
+ virtual void ToggleFullScreen() OVERRIDE; |
+ virtual gfx::Rect GetBounds() const OVERRIDE; |
+ virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
+ virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
+ virtual void SetCapture() OVERRIDE; |
+ virtual void ReleaseCapture() OVERRIDE; |
+ virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
+ virtual void ShowCursor(bool show) OVERRIDE; |
+ virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
+ virtual bool ConfineCursorToRootWindow() OVERRIDE; |
+ virtual void UnConfineCursor() OVERRIDE; |
+ virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
+ virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; |
+ virtual bool GrabSnapshot( |
+ const gfx::Rect& snapshot_bounds, |
+ std::vector<unsigned char>* png_representation) OVERRIDE; |
+ virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
+ virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
+ virtual void PrepareForShutdown() OVERRIDE; |
+ |
+ // Overridden from Dispatcher overrides: |
+ virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
+ |
+ // X11 things |
+ // The display and the native X window hosting the root window. |
+ Display* xdisplay_; |
+ ::Window xwindow_; |
+ |
+ // The native root window. |
+ ::Window x_root_window_; |
+ |
+ ui::X11AtomCache atom_cache_; |
+ |
+ // Is the window mapped to the screen? |
+ bool window_mapped_; |
+ |
+ // The bounds of |xwindow_|. |
+ gfx::Rect bounds_; |
+ |
+ // True if the window should be focused when the window is shown. |
+ bool focus_when_shown_; |
+ |
+ // aura:: objects that we own. |
+ scoped_ptr<aura::RootWindow> root_window_; |
+ scoped_ptr<DesktopCaptureClient> capture_client_; |
+ scoped_ptr<aura::DesktopActivationClient> activation_client_; |
+ scoped_ptr<aura::DesktopDispatcherClient> dispatcher_client_; |
+ |
+ // Toplevel event filter which dispatches to other event filters. |
+ aura::shared::CompoundEventFilter* root_window_event_filter_; |
+ |
+ // An event filter that pre-handles all key events to send them to an IME. |
+ scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; |
+ scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; |
+ |
+ aura::RootWindowHostDelegate* root_window_host_delegate_; |
+ aura::Window* content_window_; |
+ |
DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostLinux); |
}; |