| 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 | 7 |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. | 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class RootWindowHostLinux : public RootWindowHost, | 30 class RootWindowHostLinux : public RootWindowHost, |
| 31 public MessageLoop::Dispatcher { | 31 public MessageLoop::Dispatcher { |
| 32 public: | 32 public: |
| 33 RootWindowHostLinux(const gfx::Rect& bounds); | 33 RootWindowHostLinux(const gfx::Rect& bounds); |
| 34 virtual ~RootWindowHostLinux(); | 34 virtual ~RootWindowHostLinux(); |
| 35 | 35 |
| 36 // Overridden from Dispatcher overrides: | 36 // Overridden from Dispatcher overrides: |
| 37 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 37 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
| 38 | 38 |
| 39 private: | |
| 40 bool DispatchEventForRootWindow(const base::NativeEvent& event); | |
| 41 | |
| 42 // Dispatches XI2 events. Note that some events targetted for the X root | |
| 43 // window are dispatched to the aura root window (e.g. touch events after | |
| 44 // calibration). | |
| 45 void DispatchXI2Event(const base::NativeEvent& event); | |
| 46 | |
| 47 // RootWindowHost Overrides. | 39 // RootWindowHost Overrides. |
| 48 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; | 40 virtual void SetDelegate(RootWindowHostDelegate* delegate) OVERRIDE; |
| 49 virtual RootWindow* GetRootWindow() OVERRIDE; | 41 virtual RootWindow* GetRootWindow() OVERRIDE; |
| 50 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 42 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 51 virtual void Show() OVERRIDE; | 43 virtual void Show() OVERRIDE; |
| 52 virtual void Hide() OVERRIDE; | 44 virtual void Hide() OVERRIDE; |
| 53 virtual void ToggleFullScreen() OVERRIDE; | 45 virtual void ToggleFullScreen() OVERRIDE; |
| 54 virtual gfx::Rect GetBounds() const OVERRIDE; | 46 virtual gfx::Rect GetBounds() const OVERRIDE; |
| 55 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 47 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 56 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 48 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
| 57 virtual void SetCapture() OVERRIDE; | 49 virtual void SetCapture() OVERRIDE; |
| 58 virtual void ReleaseCapture() OVERRIDE; | 50 virtual void ReleaseCapture() OVERRIDE; |
| 59 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; | 51 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; |
| 60 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; | 52 virtual bool QueryMouseLocation(gfx::Point* location_return) OVERRIDE; |
| 61 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 53 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
| 62 virtual void UnConfineCursor() OVERRIDE; | 54 virtual void UnConfineCursor() OVERRIDE; |
| 63 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 55 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
| 64 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; | 56 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; |
| 57 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, |
| 58 const gfx::Point& dest_offset, |
| 59 SkCanvas* canvas); |
| 65 virtual bool GrabSnapshot( | 60 virtual bool GrabSnapshot( |
| 66 const gfx::Rect& snapshot_bounds, | 61 const gfx::Rect& snapshot_bounds, |
| 67 std::vector<unsigned char>* png_representation) OVERRIDE; | 62 std::vector<unsigned char>* png_representation) OVERRIDE; |
| 68 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; | 63 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; |
| 69 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 64 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
| 70 virtual void PrepareForShutdown() OVERRIDE; | 65 virtual void PrepareForShutdown() OVERRIDE; |
| 71 | 66 |
| 67 private: |
| 68 bool DispatchEventForRootWindow(const base::NativeEvent& event); |
| 69 |
| 70 // Dispatches XI2 events. Note that some events targetted for the X root |
| 71 // window are dispatched to the aura root window (e.g. touch events after |
| 72 // calibration). |
| 73 void DispatchXI2Event(const base::NativeEvent& event); |
| 74 |
| 72 // Returns true if there's an X window manager present... in most cases. Some | 75 // Returns true if there's an X window manager present... in most cases. Some |
| 73 // window managers (notably, ion3) don't implement enough of ICCCM for us to | 76 // window managers (notably, ion3) don't implement enough of ICCCM for us to |
| 74 // detect that they're there. | 77 // detect that they're there. |
| 75 bool IsWindowManagerPresent(); | 78 bool IsWindowManagerPresent(); |
| 76 | 79 |
| 77 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update | 80 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update |
| 78 // |current_cursor_|. | 81 // |current_cursor_|. |
| 79 void SetCursorInternal(gfx::NativeCursor cursor); | 82 void SetCursorInternal(gfx::NativeCursor cursor); |
| 80 | 83 |
| 81 // Translates the native mouse location into screen coordinates and and | 84 // Translates the native mouse location into screen coordinates and and |
| 82 // dispatches the event to RootWindowHostDelegate. | 85 // dispatches the event to RootWindowHostDelegate. |
| 83 void TranslateAndDispatchMouseEvent(ui::MouseEvent* event); | 86 void TranslateAndDispatchMouseEvent(ui::MouseEvent* event); |
| 84 | 87 |
| 88 // Copies and returns |snapshot_bounds| from |xwindow_|. Helper method for |
| 89 // CopyAreaToSkCanvas() and GrabSnapshot(). |
| 90 scoped_ptr<ui::XScopedImage> GetXImage(const gfx::Rect& snapshot_bounds); |
| 91 |
| 85 RootWindowHostDelegate* delegate_; | 92 RootWindowHostDelegate* delegate_; |
| 86 | 93 |
| 87 // The display and the native X window hosting the root window. | 94 // The display and the native X window hosting the root window. |
| 88 Display* xdisplay_; | 95 Display* xdisplay_; |
| 89 ::Window xwindow_; | 96 ::Window xwindow_; |
| 90 | 97 |
| 91 // The native root window. | 98 // The native root window. |
| 92 ::Window x_root_window_; | 99 ::Window x_root_window_; |
| 93 | 100 |
| 94 // Current Aura cursor. | 101 // Current Aura cursor. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 111 scoped_ptr<internal::TouchEventCalibrate> touch_calibrate_; | 118 scoped_ptr<internal::TouchEventCalibrate> touch_calibrate_; |
| 112 | 119 |
| 113 ui::X11AtomCache atom_cache_; | 120 ui::X11AtomCache atom_cache_; |
| 114 | 121 |
| 115 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); | 122 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); |
| 116 }; | 123 }; |
| 117 | 124 |
| 118 } // namespace aura | 125 } // namespace aura |
| 119 | 126 |
| 120 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ | 127 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
| OLD | NEW |