| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void AddObserver(DesktopWindowTreeHostObserverX11* observer); | 77 void AddObserver(DesktopWindowTreeHostObserverX11* observer); |
| 77 void RemoveObserver(DesktopWindowTreeHostObserverX11* observer); | 78 void RemoveObserver(DesktopWindowTreeHostObserverX11* observer); |
| 78 | 79 |
| 79 // Swaps the current handler for events in the non client view with |handler|. | 80 // Swaps the current handler for events in the non client view with |handler|. |
| 80 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler); | 81 void SwapNonClientEventHandler(std::unique_ptr<ui::EventHandler> handler); |
| 81 | 82 |
| 82 // Runs the |func| callback for each content-window, and deallocates the | 83 // Runs the |func| callback for each content-window, and deallocates the |
| 83 // internal list of open windows. | 84 // internal list of open windows. |
| 84 static void CleanUpWindowList(void (*func)(aura::Window* window)); | 85 static void CleanUpWindowList(void (*func)(aura::Window* window)); |
| 85 | 86 |
| 87 // Disables event listening to make |dialog| modal. |
| 88 std::unique_ptr<base::Closure> DisableEventListening(XID dialog); |
| 89 |
| 90 // Returns XID of dialog currently displayed. When it returns 0, |
| 91 // there is no dialog on the host window. |
| 92 XID GetModalDialog(); |
| 93 |
| 86 protected: | 94 protected: |
| 87 // Overridden from DesktopWindowTreeHost: | 95 // Overridden from DesktopWindowTreeHost: |
| 88 void Init(aura::Window* content_window, | 96 void Init(aura::Window* content_window, |
| 89 const Widget::InitParams& params) override; | 97 const Widget::InitParams& params) override; |
| 90 void OnNativeWidgetCreated(const Widget::InitParams& params) override; | 98 void OnNativeWidgetCreated(const Widget::InitParams& params) override; |
| 91 std::unique_ptr<corewm::Tooltip> CreateTooltip() override; | 99 std::unique_ptr<corewm::Tooltip> CreateTooltip() override; |
| 92 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient( | 100 std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient( |
| 93 DesktopNativeCursorManager* cursor_manager) override; | 101 DesktopNativeCursorManager* cursor_manager) override; |
| 94 void Close() override; | 102 void Close() override; |
| 95 void CloseNow() override; | 103 void CloseNow() override; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // ui::PlatformEventDispatcher: | 267 // ui::PlatformEventDispatcher: |
| 260 bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 268 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
| 261 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 269 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
| 262 | 270 |
| 263 void DelayedResize(const gfx::Size& size_in_pixels); | 271 void DelayedResize(const gfx::Size& size_in_pixels); |
| 264 | 272 |
| 265 gfx::Rect GetWorkAreaBoundsInPixels() const; | 273 gfx::Rect GetWorkAreaBoundsInPixels() const; |
| 266 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const; | 274 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const; |
| 267 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const; | 275 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const; |
| 268 | 276 |
| 277 // Enables event listening after closing |dialog|. |
| 278 void EnableEventListening(); |
| 279 |
| 269 // X11 things | 280 // X11 things |
| 270 // The display and the native X window hosting the root window. | 281 // The display and the native X window hosting the root window. |
| 271 XDisplay* xdisplay_; | 282 XDisplay* xdisplay_; |
| 272 ::Window xwindow_; | 283 ::Window xwindow_; |
| 273 | 284 |
| 274 // Events selected on |xwindow_|. | 285 // Events selected on |xwindow_|. |
| 275 std::unique_ptr<ui::XScopedEventSelector> xwindow_events_; | 286 std::unique_ptr<ui::XScopedEventSelector> xwindow_events_; |
| 276 | 287 |
| 277 // The native root window. | 288 // The native root window. |
| 278 ::Window x_root_window_; | 289 ::Window x_root_window_; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 bool ignore_keyboard_input_; | 416 bool ignore_keyboard_input_; |
| 406 | 417 |
| 407 // Used for tracking activation state in {Before|After}ActivationStateChanged. | 418 // Used for tracking activation state in {Before|After}ActivationStateChanged. |
| 408 bool was_active_; | 419 bool was_active_; |
| 409 bool had_pointer_; | 420 bool had_pointer_; |
| 410 bool had_pointer_grab_; | 421 bool had_pointer_grab_; |
| 411 bool had_window_focus_; | 422 bool had_window_focus_; |
| 412 | 423 |
| 413 base::CancelableCallback<void()> delayed_resize_task_; | 424 base::CancelableCallback<void()> delayed_resize_task_; |
| 414 | 425 |
| 426 std::unique_ptr<aura::ScopedWindowTargeter> targeter_for_modal_; |
| 427 |
| 428 XID modal_dialog_xid_; |
| 429 |
| 415 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 430 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
| 431 base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_; |
| 416 | 432 |
| 417 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 433 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
| 418 }; | 434 }; |
| 419 | 435 |
| 420 } // namespace views | 436 } // namespace views |
| 421 | 437 |
| 422 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 438 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
| OLD | NEW |