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_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
7 | 7 |
8 #include <X11/extensions/shape.h> | 8 #include <X11/extensions/shape.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
30 class EventHandler; | 30 class EventHandler; |
31 } | 31 } |
32 | 32 |
33 namespace views { | 33 namespace views { |
34 class DesktopDragDropClientAuraX11; | 34 class DesktopDragDropClientAuraX11; |
35 class DesktopDispatcherClient; | 35 class DesktopDispatcherClient; |
36 class DesktopWindowTreeHostObserverX11; | 36 class DesktopWindowTreeHostObserverX11; |
37 class X11DesktopWindowMoveClient; | 37 class X11DesktopWindowMoveClient; |
38 class X11ScopedCapture; | 38 class X11CaptureWindow; |
39 class X11WindowEventFilter; | 39 class X11WindowEventFilter; |
40 | 40 |
41 class VIEWS_EXPORT DesktopWindowTreeHostX11 | 41 class VIEWS_EXPORT DesktopWindowTreeHostX11 |
42 : public DesktopWindowTreeHost, | 42 : public DesktopWindowTreeHost, |
43 public aura::WindowTreeHost, | 43 public aura::WindowTreeHost, |
44 public ui::EventSource, | 44 public ui::EventSource, |
45 public ui::PlatformEventDispatcher { | 45 public ui::PlatformEventDispatcher { |
46 public: | 46 public: |
47 DesktopWindowTreeHostX11( | 47 DesktopWindowTreeHostX11( |
48 internal::NativeWidgetDelegate* native_widget_delegate, | 48 internal::NativeWidgetDelegate* native_widget_delegate, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Sends a message to the x11 window manager, enabling or disabling the | 185 // Sends a message to the x11 window manager, enabling or disabling the |
186 // states |state1| and |state2|. | 186 // states |state1| and |state2|. |
187 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); | 187 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); |
188 | 188 |
189 // Checks if the window manager has set a specific state. | 189 // Checks if the window manager has set a specific state. |
190 bool HasWMSpecProperty(const char* property) const; | 190 bool HasWMSpecProperty(const char* property) const; |
191 | 191 |
192 // Sets whether the window's borders are provided by the window manager. | 192 // Sets whether the window's borders are provided by the window manager. |
193 void SetUseNativeFrame(bool use_native_frame); | 193 void SetUseNativeFrame(bool use_native_frame); |
194 | 194 |
195 // Called when another DRWHL takes capture, or when capture is released | 195 // Releases |x11_capture_window_| so that it can be used by another |
196 // entirely. | 196 // DesktopWindowTreeHostX11. |
197 void OnCaptureReleased(); | 197 scoped_ptr<X11CaptureWindow> ReleaseCaptureWindow(); |
198 | 198 |
199 // Dispatches a mouse event, taking mouse capture into account. If a | 199 // Dispatches a mouse event, taking mouse capture into account. If a |
200 // different host has capture, we translate the event to its coordinate space | 200 // different host has capture, we translate the event to its coordinate space |
201 // and dispatch it to that host instead. | 201 // and dispatch it to that host instead. |
202 void DispatchMouseEvent(ui::MouseEvent* event); | 202 void DispatchMouseEvent(ui::MouseEvent* event); |
203 | 203 |
204 // Dispatches a touch event, taking capture into account. If a different host | 204 // Dispatches a touch event, taking capture into account. If a different host |
205 // has capture, then touch-press events are translated to its coordinate space | 205 // has capture, then touch-press events are translated to its coordinate space |
206 // and dispatched to that host instead. | 206 // and dispatched to that host instead. |
207 void DispatchTouchEvent(ui::TouchEvent* event); | 207 void DispatchTouchEvent(ui::TouchEvent* event); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 // The window shape if the window is non-rectangular. | 299 // The window shape if the window is non-rectangular. |
300 ::Region window_shape_; | 300 ::Region window_shape_; |
301 | 301 |
302 // Whether |window_shape_| was set via SetShape(). | 302 // Whether |window_shape_| was set via SetShape(). |
303 bool custom_window_shape_; | 303 bool custom_window_shape_; |
304 | 304 |
305 // The size of the window manager provided borders (if any). | 305 // The size of the window manager provided borders (if any). |
306 gfx::Insets native_window_frame_borders_; | 306 gfx::Insets native_window_frame_borders_; |
307 | 307 |
308 // The current root window host that has capture. While X11 has something | 308 // The current DesktopWindowTreeHostX11 which has capture. Set synchronously |
309 // like Windows SetCapture()/ReleaseCapture(), it is entirely implicit and | 309 // when capture is requested via SetCapture(). |
310 // there are no notifications when this changes. We need to track this so we | |
311 // can notify widgets when they have lost capture, which controls a bunch of | |
312 // things in views like hiding menus. | |
313 static DesktopWindowTreeHostX11* g_current_capture; | 310 static DesktopWindowTreeHostX11* g_current_capture; |
314 | 311 |
315 // A list of all (top-level) windows that have been created but not yet | 312 // A list of all (top-level) windows that have been created but not yet |
316 // destroyed. | 313 // destroyed. |
317 static std::list<XID>* open_windows_; | 314 static std::list<XID>* open_windows_; |
318 | 315 |
319 scoped_ptr<X11ScopedCapture> x11_capture_; | 316 scoped_ptr<X11CaptureWindow> capture_window_; |
320 | 317 |
321 base::string16 window_title_; | 318 base::string16 window_title_; |
322 | 319 |
323 // Whether we currently are flashing our frame. This feature is implemented | 320 // Whether we currently are flashing our frame. This feature is implemented |
324 // by setting the urgency hint with the window manager, which can draw | 321 // by setting the urgency hint with the window manager, which can draw |
325 // attention to the window or completely ignore the hint. We stop flashing | 322 // attention to the window or completely ignore the hint. We stop flashing |
326 // the frame when |xwindow_| gains focus or handles a mouse button event. | 323 // the frame when |xwindow_| gains focus or handles a mouse button event. |
327 bool urgency_hint_set_; | 324 bool urgency_hint_set_; |
328 | 325 |
329 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 326 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
330 }; | 327 }; |
331 | 328 |
332 } // namespace views | 329 } // namespace views |
333 | 330 |
334 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 331 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |