| 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/scoped_window_targeter.h" |
| 19 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
| 20 #include "ui/base/cursor/cursor_loader_x11.h" | 20 #include "ui/base/cursor/cursor_loader_x11.h" |
| 21 #include "ui/display/display_observer.h" |
| 21 #include "ui/events/platform/platform_event_dispatcher.h" | 22 #include "ui/events/platform/platform_event_dispatcher.h" |
| 22 #include "ui/gfx/geometry/insets.h" | 23 #include "ui/gfx/geometry/insets.h" |
| 23 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
| 24 #include "ui/gfx/geometry/size.h" | 25 #include "ui/gfx/geometry/size.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 class XScopedEventSelector; | 36 class XScopedEventSelector; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace views { | 39 namespace views { |
| 39 class DesktopDragDropClientAuraX11; | 40 class DesktopDragDropClientAuraX11; |
| 40 class DesktopWindowTreeHostObserverX11; | 41 class DesktopWindowTreeHostObserverX11; |
| 41 class NonClientFrameView; | 42 class NonClientFrameView; |
| 42 class X11DesktopWindowMoveClient; | 43 class X11DesktopWindowMoveClient; |
| 43 | 44 |
| 44 class VIEWS_EXPORT DesktopWindowTreeHostX11 | 45 class VIEWS_EXPORT DesktopWindowTreeHostX11 |
| 45 : public DesktopWindowTreeHost, | 46 : public DesktopWindowTreeHost, |
| 46 public aura::WindowTreeHost, | 47 public aura::WindowTreeHost, |
| 47 public ui::PlatformEventDispatcher { | 48 public ui::PlatformEventDispatcher, |
| 49 public display::DisplayObserver { |
| 48 public: | 50 public: |
| 49 DesktopWindowTreeHostX11( | 51 DesktopWindowTreeHostX11( |
| 50 internal::NativeWidgetDelegate* native_widget_delegate, | 52 internal::NativeWidgetDelegate* native_widget_delegate, |
| 51 DesktopNativeWidgetAura* desktop_native_widget_aura); | 53 DesktopNativeWidgetAura* desktop_native_widget_aura); |
| 52 ~DesktopWindowTreeHostX11() override; | 54 ~DesktopWindowTreeHostX11() override; |
| 53 | 55 |
| 54 // A way of converting an X11 |xid| host window into a |content_window_|. | 56 // A way of converting an X11 |xid| host window into a |content_window_|. |
| 55 static aura::Window* GetContentWindowForXID(XID xid); | 57 static aura::Window* GetContentWindowForXID(XID xid); |
| 56 | 58 |
| 57 // A way of converting an X11 |xid| host window into this object. | 59 // A way of converting an X11 |xid| host window into this object. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 gfx::Rect GetBoundsInPixels() const override; | 164 gfx::Rect GetBoundsInPixels() const override; |
| 163 void SetBoundsInPixels(const gfx::Rect& requested_bounds_in_pixels) override; | 165 void SetBoundsInPixels(const gfx::Rect& requested_bounds_in_pixels) override; |
| 164 gfx::Point GetLocationOnScreenInPixels() const override; | 166 gfx::Point GetLocationOnScreenInPixels() const override; |
| 165 void SetCapture() override; | 167 void SetCapture() override; |
| 166 void ReleaseCapture() override; | 168 void ReleaseCapture() override; |
| 167 void SetCursorNative(gfx::NativeCursor cursor) override; | 169 void SetCursorNative(gfx::NativeCursor cursor) override; |
| 168 void MoveCursorToScreenLocationInPixels( | 170 void MoveCursorToScreenLocationInPixels( |
| 169 const gfx::Point& location_in_pixels) override; | 171 const gfx::Point& location_in_pixels) override; |
| 170 void OnCursorVisibilityChangedNative(bool show) override; | 172 void OnCursorVisibilityChangedNative(bool show) override; |
| 171 | 173 |
| 174 // Overridden from display::DisplayObserver: |
| 175 void OnDisplayAdded(const display::Display& new_display) override; |
| 176 void OnDisplayRemoved(const display::Display& old_display) override; |
| 177 void OnDisplayMetricsChanged(const display::Display& display, |
| 178 uint32_t changed_metrics) override; |
| 179 |
| 172 private: | 180 private: |
| 173 friend class DesktopWindowTreeHostX11HighDPITest; | 181 friend class DesktopWindowTreeHostX11HighDPITest; |
| 174 // Initializes our X11 surface to draw on. This method performs all | 182 // Initializes our X11 surface to draw on. This method performs all |
| 175 // initialization related to talking to the X11 server. | 183 // initialization related to talking to the X11 server. |
| 176 void InitX11Window(const Widget::InitParams& params); | 184 void InitX11Window(const Widget::InitParams& params); |
| 177 | 185 |
| 178 // Creates an aura::WindowEventDispatcher to contain the |content_window|, | 186 // Creates an aura::WindowEventDispatcher to contain the |content_window|, |
| 179 // along with all aura client objects that direct behavior. | 187 // along with all aura client objects that direct behavior. |
| 180 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); | 188 aura::WindowEventDispatcher* InitDispatcher(const Widget::InitParams& params); |
| 181 | 189 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 void DelayedResize(const gfx::Size& size_in_pixels); | 278 void DelayedResize(const gfx::Size& size_in_pixels); |
| 271 void DelayedChangeFrameType(Widget::FrameType new_type); | 279 void DelayedChangeFrameType(Widget::FrameType new_type); |
| 272 | 280 |
| 273 gfx::Rect GetWorkAreaBoundsInPixels() const; | 281 gfx::Rect GetWorkAreaBoundsInPixels() const; |
| 274 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const; | 282 gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const; |
| 275 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const; | 283 gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const; |
| 276 | 284 |
| 277 // Enables event listening after closing |dialog|. | 285 // Enables event listening after closing |dialog|. |
| 278 void EnableEventListening(); | 286 void EnableEventListening(); |
| 279 | 287 |
| 288 // Removes |delayed_resize_task_| from the task queue (if it's in |
| 289 // the queue) and adds it back at the end of the queue. |
| 290 void RestartDelayedResizeTask(); |
| 291 |
| 280 // X11 things | 292 // X11 things |
| 281 // The display and the native X window hosting the root window. | 293 // The display and the native X window hosting the root window. |
| 282 XDisplay* xdisplay_; | 294 XDisplay* xdisplay_; |
| 283 ::Window xwindow_; | 295 ::Window xwindow_; |
| 284 | 296 |
| 285 // Events selected on |xwindow_|. | 297 // Events selected on |xwindow_|. |
| 286 std::unique_ptr<ui::XScopedEventSelector> xwindow_events_; | 298 std::unique_ptr<ui::XScopedEventSelector> xwindow_events_; |
| 287 | 299 |
| 288 // The native root window. | 300 // The native root window. |
| 289 ::Window x_root_window_; | 301 ::Window x_root_window_; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 437 |
| 426 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; | 438 base::WeakPtrFactory<DesktopWindowTreeHostX11> close_widget_factory_; |
| 427 base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_; | 439 base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_; |
| 428 | 440 |
| 429 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); | 441 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); |
| 430 }; | 442 }; |
| 431 | 443 |
| 432 } // namespace views | 444 } // namespace views |
| 433 | 445 |
| 434 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ | 446 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_X11_H_ |
| OLD | NEW |