| OLD | NEW |
| 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 #ifndef UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ | 5 #ifndef UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
| 6 #define UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ | 6 #define UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| 11 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 11 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
| 12 #undef RootWindow | 12 #undef RootWindow |
| 13 | 13 |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "ui/aura/root_window_host.h" | 15 #include "ui/aura/root_window_host.h" |
| 16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 | 19 |
| 20 class RootWindowHostLinux : public RootWindowHost, | 20 class RootWindowHostLinux : public RootWindowHost { |
| 21 public MessageLoop::DestructionObserver { | |
| 22 public: | 21 public: |
| 23 explicit RootWindowHostLinux(const gfx::Rect& bounds); | 22 explicit RootWindowHostLinux(const gfx::Rect& bounds); |
| 24 virtual ~RootWindowHostLinux(); | 23 virtual ~RootWindowHostLinux(); |
| 25 | 24 |
| 26 // Handles an event targeted at this host's window. | 25 // Handles an event targeted at this host's window. |
| 27 base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); | 26 base::MessagePumpDispatcher::DispatchStatus Dispatch(XEvent* xev); |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 // RootWindowHost Overrides. | 29 // RootWindowHost Overrides. |
| 31 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; | 30 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; |
| 32 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 31 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 33 virtual void Show() OVERRIDE; | 32 virtual void Show() OVERRIDE; |
| 34 virtual void ToggleFullScreen() OVERRIDE; | 33 virtual void ToggleFullScreen() OVERRIDE; |
| 35 virtual gfx::Size GetSize() const OVERRIDE; | 34 virtual gfx::Size GetSize() const OVERRIDE; |
| 36 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 35 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 37 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 36 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
| 38 virtual void SetCapture() OVERRIDE; | 37 virtual void SetCapture() OVERRIDE; |
| 39 virtual void ReleaseCapture() OVERRIDE; | 38 virtual void ReleaseCapture() OVERRIDE; |
| 40 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; | 39 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; |
| 41 virtual void ShowCursor(bool show) OVERRIDE; | 40 virtual void ShowCursor(bool show) OVERRIDE; |
| 42 virtual gfx::Point QueryMouseLocation() OVERRIDE; | 41 virtual gfx::Point QueryMouseLocation() OVERRIDE; |
| 43 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 42 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
| 44 virtual void UnConfineCursor() OVERRIDE; | 43 virtual void UnConfineCursor() OVERRIDE; |
| 45 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 44 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
| 46 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; | 45 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; |
| 47 | 46 |
| 48 // MessageLoop::DestructionObserver Overrides. | |
| 49 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | |
| 50 | |
| 51 // Returns true if there's an X window manager present... in most cases. Some | 47 // Returns true if there's an X window manager present... in most cases. Some |
| 52 // window managers (notably, ion3) don't implement enough of ICCCM for us to | 48 // window managers (notably, ion3) don't implement enough of ICCCM for us to |
| 53 // detect that they're there. | 49 // detect that they're there. |
| 54 bool IsWindowManagerPresent(); | 50 bool IsWindowManagerPresent(); |
| 55 | 51 |
| 56 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update | 52 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update |
| 57 // |current_cursor_|. | 53 // |current_cursor_|. |
| 58 void SetCursorInternal(gfx::NativeCursor cursor); | 54 void SetCursorInternal(gfx::NativeCursor cursor); |
| 59 | 55 |
| 60 RootWindow* root_window_; | 56 RootWindow* root_window_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 | 73 |
| 78 // The bounds of |xwindow_|. | 74 // The bounds of |xwindow_|. |
| 79 gfx::Rect bounds_; | 75 gfx::Rect bounds_; |
| 80 | 76 |
| 81 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); | 77 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); |
| 82 }; | 78 }; |
| 83 | 79 |
| 84 } // namespace aura | 80 } // namespace aura |
| 85 | 81 |
| 86 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ | 82 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
| OLD | NEW |