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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <X11/extensions/shape.h> | 10 #include <X11/extensions/shape.h> |
11 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
12 #include <X11/Xutil.h> | 12 #include <X11/Xutil.h> |
13 | 13 |
14 #include "base/cancelable_callback.h" | 14 #include "base/cancelable_callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "ui/aura/scoped_window_targeter.h" |
18 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
19 #include "ui/base/cursor/cursor_loader_x11.h" | 20 #include "ui/base/cursor/cursor_loader_x11.h" |
20 #include "ui/events/platform/platform_event_dispatcher.h" | 21 #include "ui/events/platform/platform_event_dispatcher.h" |
21 #include "ui/gfx/geometry/insets.h" | 22 #include "ui/gfx/geometry/insets.h" |
22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
24 #include "ui/gfx/x/x11_atom_cache.h" | 25 #include "ui/gfx/x/x11_atom_cache.h" |
25 #include "ui/views/views_export.h" | 26 #include "ui/views/views_export.h" |
26 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" | 27 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 class ImageSkia; | 30 class ImageSkia; |
30 class ImageSkiaRep; | 31 class ImageSkiaRep; |
31 } | 32 } |
32 | 33 |
33 namespace ui { | 34 namespace ui { |
34 class EventHandler; | 35 class EventHandler; |
35 } | 36 } |
36 | 37 |
37 namespace views { | 38 namespace views { |
38 class DesktopDragDropClientAuraX11; | 39 class DesktopDragDropClientAuraX11; |
39 class DesktopWindowTreeHostObserverX11; | 40 class DesktopWindowTreeHostObserverX11; |
40 class X11DesktopWindowMoveClient; | 41 class X11DesktopWindowMoveClient; |
41 class X11WindowEventFilter; | 42 class X11WindowEventFilter; |
42 | 43 |
| 44 class ScopedHandle { |
| 45 public: |
| 46 explicit ScopedHandle(const base::Closure& destroy_callback); |
| 47 ~ScopedHandle(); |
| 48 |
| 49 private: |
| 50 base::Closure destroy_callback_; |
| 51 DISALLOW_COPY_AND_ASSIGN(ScopedHandle); |
| 52 }; |
| 53 |
43 class VIEWS_EXPORT DesktopWindowTreeHostX11 | 54 class VIEWS_EXPORT DesktopWindowTreeHostX11 |
44 : public DesktopWindowTreeHost, | 55 : public DesktopWindowTreeHost, |
45 public aura::WindowTreeHost, | 56 public aura::WindowTreeHost, |
46 public ui::PlatformEventDispatcher { | 57 public ui::PlatformEventDispatcher { |
47 public: | 58 public: |
48 DesktopWindowTreeHostX11( | 59 DesktopWindowTreeHostX11( |
49 internal::NativeWidgetDelegate* native_widget_delegate, | 60 internal::NativeWidgetDelegate* native_widget_delegate, |
50 DesktopNativeWidgetAura* desktop_native_widget_aura); | 61 DesktopNativeWidgetAura* desktop_native_widget_aura); |
51 ~DesktopWindowTreeHostX11() override; | 62 ~DesktopWindowTreeHostX11() override; |
52 | 63 |
(...skipping 26 matching lines...) Expand all Loading... |
79 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); | 90 void AddObserver(views::DesktopWindowTreeHostObserverX11* observer); |
80 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); | 91 void RemoveObserver(views::DesktopWindowTreeHostObserverX11* observer); |
81 | 92 |
82 // Swaps the current handler for events in the non client view with |handler|. | 93 // Swaps the current handler for events in the non client view with |handler|. |
83 void SwapNonClientEventHandler(scoped_ptr<ui::EventHandler> handler); | 94 void SwapNonClientEventHandler(scoped_ptr<ui::EventHandler> handler); |
84 | 95 |
85 // Runs the |func| callback for each content-window, and deallocates the | 96 // Runs the |func| callback for each content-window, and deallocates the |
86 // internal list of open windows. | 97 // internal list of open windows. |
87 static void CleanUpWindowList(void (*func)(aura::Window* window)); | 98 static void CleanUpWindowList(void (*func)(aura::Window* window)); |
88 | 99 |
| 100 // Disables event listening to make |dialog| modal. |
| 101 scoped_ptr<ScopedHandle> DisableEventListening(XID dialog); |
| 102 |
| 103 // Enables event listening after closing |dialog|. |
| 104 void EnableEventListening(); |
| 105 |
| 106 // Returns XID of dialog currently displayed. When it returns 0, |
| 107 // there is no dialog on the host window. |
| 108 XID GetModalDialog(); |
| 109 |
89 protected: | 110 protected: |
90 // Overridden from DesktopWindowTreeHost: | 111 // Overridden from DesktopWindowTreeHost: |
91 void Init(aura::Window* content_window, | 112 void Init(aura::Window* content_window, |
92 const Widget::InitParams& params) override; | 113 const Widget::InitParams& params) override; |
93 void OnNativeWidgetCreated(const Widget::InitParams& params) override; | 114 void OnNativeWidgetCreated(const Widget::InitParams& params) override; |
94 scoped_ptr<corewm::Tooltip> CreateTooltip() override; | 115 scoped_ptr<corewm::Tooltip> CreateTooltip() override; |
95 scoped_ptr<aura::client::DragDropClient> CreateDragDropClient( | 116 scoped_ptr<aura::client::DragDropClient> CreateDragDropClient( |
96 DesktopNativeCursorManager* cursor_manager) override; | 117 DesktopNativeCursorManager* cursor_manager) override; |
97 void Close() override; | 118 void Close() override; |
98 void CloseNow() override; | 119 void CloseNow() override; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // Whether we currently are flashing our frame. This feature is implemented | 362 // Whether we currently are flashing our frame. This feature is implemented |
342 // by setting the urgency hint with the window manager, which can draw | 363 // by setting the urgency hint with the window manager, which can draw |
343 // attention to the window or completely ignore the hint. We stop flashing | 364 // attention to the window or completely ignore the hint. We stop flashing |
344 // the frame when |xwindow_| gains focus or handles a mouse button event. | 365 // the frame when |xwindow_| gains focus or handles a mouse button event. |
345 bool urgency_hint_set_; | 366 bool urgency_hint_set_; |
346 | 367 |
347 bool activatable_; | 368 bool activatable_; |
348 | 369 |
349 base::CancelableCallback<void()> delayed_resize_task_; | 370 base::CancelableCallback<void()> delayed_resize_task_; |
350 | 371 |
| 372 scoped_ptr<aura::ScopedWindowTargeter> targeter_for_modal_; |
| 373 |
| 374 XID modal_dialog_xid_; |
| 375 |
351 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 376 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
352 | 377 |
353 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 378 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
354 }; | 379 }; |
355 | 380 |
356 } // namespace views | 381 } // namespace views |
357 | 382 |
358 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 383 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
OLD | NEW |