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 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 } | 21 } |
22 | 22 |
23 namespace aura { | 23 namespace aura { |
24 | 24 |
25 class RootWindowHostLinux : public RootWindowHost, | 25 class RootWindowHostLinux : public RootWindowHost, |
26 public MessageLoop::Dispatcher { | 26 public MessageLoop::Dispatcher { |
27 public: | 27 public: |
28 explicit RootWindowHostLinux(const gfx::Rect& bounds); | 28 explicit RootWindowHostLinux(const gfx::Rect& bounds); |
29 virtual ~RootWindowHostLinux(); | 29 virtual ~RootWindowHostLinux(); |
30 | 30 |
31 // Whether we should show the window manager border or not. | |
32 void SetShouldUseWindowManagerBorder(bool use_wm_border); | |
Daniel Erat
2012/05/09 20:58:27
delete this
| |
33 | |
31 // Overridden from Dispatcher overrides: | 34 // Overridden from Dispatcher overrides: |
32 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 35 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
33 | 36 |
34 private: | 37 private: |
35 // RootWindowHost Overrides. | 38 // RootWindowHost Overrides. |
36 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; | 39 virtual void SetRootWindow(RootWindow* root_window) OVERRIDE; |
37 virtual RootWindow* GetRootWindow() OVERRIDE; | 40 virtual RootWindow* GetRootWindow() OVERRIDE; |
38 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 41 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
39 virtual void Show() OVERRIDE; | 42 virtual void Show() OVERRIDE; |
40 virtual void ToggleFullScreen() OVERRIDE; | 43 virtual void ToggleFullScreen() OVERRIDE; |
41 virtual gfx::Rect GetBounds() const OVERRIDE; | 44 virtual gfx::Rect GetBounds() const OVERRIDE; |
42 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 45 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
43 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; | 46 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; |
44 virtual void SetCapture() OVERRIDE; | 47 virtual void SetCapture() OVERRIDE; |
45 virtual void ReleaseCapture() OVERRIDE; | 48 virtual void ReleaseCapture() OVERRIDE; |
46 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; | 49 virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; |
47 virtual void ShowCursor(bool show) OVERRIDE; | 50 virtual void ShowCursor(bool show) OVERRIDE; |
48 virtual gfx::Point QueryMouseLocation() OVERRIDE; | 51 virtual gfx::Point QueryMouseLocation() OVERRIDE; |
49 virtual bool ConfineCursorToRootWindow() OVERRIDE; | 52 virtual bool ConfineCursorToRootWindow() OVERRIDE; |
50 virtual void UnConfineCursor() OVERRIDE; | 53 virtual void UnConfineCursor() OVERRIDE; |
51 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; | 54 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; |
52 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; | 55 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; |
53 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; | 56 virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; |
57 virtual void SetUseOSWindowBorders(bool use_os_borders) OVERRIDE; | |
58 virtual bool DispatchWindowDragMovement(int hittest, | |
59 MouseEvent* event) OVERRIDE; | |
54 | 60 |
55 // Returns true if there's an X window manager present... in most cases. Some | 61 // Returns true if there's an X window manager present... in most cases. Some |
56 // window managers (notably, ion3) don't implement enough of ICCCM for us to | 62 // window managers (notably, ion3) don't implement enough of ICCCM for us to |
57 // detect that they're there. | 63 // detect that they're there. |
58 bool IsWindowManagerPresent(); | 64 bool IsWindowManagerPresent(); |
59 | 65 |
60 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update | 66 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update |
61 // |current_cursor_|. | 67 // |current_cursor_|. |
62 void SetCursorInternal(gfx::NativeCursor cursor); | 68 void SetCursorInternal(gfx::NativeCursor cursor); |
63 | 69 |
70 // Signal to the window manager that it is to move the window as we've had a | |
71 // hit in our non-client area. | |
72 void SendWMMoveResize(int direction, int x_root, int y_root); | |
73 | |
64 RootWindow* root_window_; | 74 RootWindow* root_window_; |
65 | 75 |
66 // The display and the native X window hosting the root window. | 76 // The display and the native X window hosting the root window. |
67 Display* xdisplay_; | 77 Display* xdisplay_; |
68 ::Window xwindow_; | 78 ::Window xwindow_; |
69 | 79 |
70 // The native root window. | 80 // The native root window. |
71 ::Window x_root_window_; | 81 ::Window x_root_window_; |
72 | 82 |
73 // Current Aura cursor. | 83 // Current Aura cursor. |
74 gfx::NativeCursor current_cursor_; | 84 gfx::NativeCursor current_cursor_; |
75 | 85 |
76 // Is the cursor currently shown? | 86 // Is the cursor currently shown? |
77 bool cursor_shown_; | 87 bool cursor_shown_; |
78 | 88 |
79 // The invisible cursor. | 89 // The invisible cursor. |
80 ::Cursor invisible_cursor_; | 90 ::Cursor invisible_cursor_; |
81 | 91 |
82 // The bounds of |xwindow_|. | 92 // The bounds of |xwindow_|. |
83 gfx::Rect bounds_; | 93 gfx::Rect bounds_; |
84 | 94 |
85 // Names of cached atoms that we fetch during the constructor to minimize | 95 // Names of cached atoms that we fetch during the constructor to minimize |
86 // round trips to the X11 server. | 96 // round trips to the X11 server. |
87 enum AtomList { | 97 enum AtomList { |
88 ATOM_WM_DELETE_WINDOW = 0, | 98 ATOM_WM_DELETE_WINDOW = 0, |
99 ATOM__NET_WM_MOVERESIZE, | |
89 ATOM__NET_WM_PING, | 100 ATOM__NET_WM_PING, |
90 ATOM__NET_WM_PID, | 101 ATOM__NET_WM_PID, |
91 ATOM_WM_S0, | 102 ATOM_WM_S0, |
92 | 103 |
104 ATOM__MOTIF_WM_HINTS, | |
105 | |
93 ATOM_COUNT | 106 ATOM_COUNT |
94 }; | 107 }; |
95 ::Atom cached_atoms_[ATOM_COUNT]; | 108 ::Atom cached_atoms_[ATOM_COUNT]; |
96 | 109 |
97 // True if the window should be focused when the window is shown. | 110 // True if the window should be focused when the window is shown. |
98 bool focus_when_shown_; | 111 bool focus_when_shown_; |
99 | 112 |
100 scoped_array<XID> pointer_barriers_; | 113 scoped_array<XID> pointer_barriers_; |
101 | 114 |
102 scoped_ptr<ui::ViewProp> prop_; | 115 scoped_ptr<ui::ViewProp> prop_; |
103 | 116 |
104 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); | 117 DISALLOW_COPY_AND_ASSIGN(RootWindowHostLinux); |
105 }; | 118 }; |
106 | 119 |
107 } // namespace aura | 120 } // namespace aura |
108 | 121 |
109 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ | 122 #endif // UI_AURA_ROOT_WINDOW_HOST_LINUX_H_ |
OLD | NEW |