Chromium Code Reviews| 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 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 43 class VIEWS_EXPORT DesktopWindowTreeHostX11 | 44 class VIEWS_EXPORT DesktopWindowTreeHostX11 |
| 44 : public DesktopWindowTreeHost, | 45 : public DesktopWindowTreeHost, |
| 45 public aura::WindowTreeHost, | 46 public aura::WindowTreeHost, |
| 46 public ui::PlatformEventDispatcher { | 47 public ui::PlatformEventDispatcher { |
| 47 public: | 48 public: |
| 48 DesktopWindowTreeHostX11( | 49 DesktopWindowTreeHostX11( |
| 49 internal::NativeWidgetDelegate* native_widget_delegate, | 50 internal::NativeWidgetDelegate* native_widget_delegate, |
| 50 DesktopNativeWidgetAura* desktop_native_widget_aura); | 51 DesktopNativeWidgetAura* desktop_native_widget_aura); |
| 51 ~DesktopWindowTreeHostX11() override; | 52 ~DesktopWindowTreeHostX11() override; |
| 52 | 53 |
| 54 class ScopedHandle { | |
| 55 public: | |
| 56 explicit ScopedHandle(const base::Closure& destroy_callback); | |
| 57 ~ScopedHandle(); | |
| 58 | |
| 59 private: | |
| 60 base::Closure destroy_callback_; | |
| 61 DISALLOW_COPY_AND_ASSIGN(ScopedHandle); | |
| 62 }; | |
| 63 | |
| 53 // A way of converting an X11 |xid| host window into a |content_window_|. | 64 // A way of converting an X11 |xid| host window into a |content_window_|. |
| 54 static aura::Window* GetContentWindowForXID(XID xid); | 65 static aura::Window* GetContentWindowForXID(XID xid); |
| 55 | 66 |
| 56 // A way of converting an X11 |xid| host window into this object. | 67 // A way of converting an X11 |xid| host window into this object. |
| 57 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); | 68 static DesktopWindowTreeHostX11* GetHostForXID(XID xid); |
| 58 | 69 |
| 59 // Get all open top-level windows. This includes windows that may not be | 70 // Get all open top-level windows. This includes windows that may not be |
| 60 // visible. This list is sorted in their stacking order, i.e. the first window | 71 // visible. This list is sorted in their stacking order, i.e. the first window |
| 61 // is the topmost window. | 72 // is the topmost window. |
| 62 static std::vector<aura::Window*> GetAllOpenWindows(); | 73 static std::vector<aura::Window*> GetAllOpenWindows(); |
| (...skipping 16 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(std::unique_ptr<ui::EventHandler> handler); | 94 void SwapNonClientEventHandler(std::unique_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 std::unique_ptr<ScopedHandle> DisableEventListening(XID dialog); | |
| 102 | |
| 103 // Enables event listening after closing |dialog|. | |
| 104 void EnableEventListening(); | |
|
sadrul
2016/04/19 14:56:11
Make this a private method.
| |
| 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 std::unique_ptr<corewm::Tooltip> CreateTooltip() override; | 115 std::unique_ptr<corewm::Tooltip> CreateTooltip() override; |
| 95 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient( | 116 std::unique_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 std::unique_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 |