Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_screen_x11.h |
| diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.h b/ui/views/widget/desktop_aura/desktop_screen_x11.h |
| index fc71915321abb156526479b7c7ed48ce6341d7eb..c6a03340f16df9ddb682f26d7c9cff5b07cc874f 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_screen_x11.h |
| +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.h |
| @@ -9,11 +9,12 @@ |
| #include <memory> |
| +#include "base/cancelable_callback.h" |
| #include "base/macros.h" |
| -#include "base/timer/timer.h" |
| #include "ui/display/display_change_notifier.h" |
| #include "ui/display/screen.h" |
| #include "ui/events/platform/platform_event_dispatcher.h" |
| +#include "ui/views/linux_ui/device_scale_factor_observer.h" |
| #include "ui/views/views_export.h" |
| typedef unsigned long XID; |
| @@ -29,7 +30,8 @@ class DesktopScreenX11TestApi; |
| // Our singleton screen implementation that talks to xrandr. |
| class VIEWS_EXPORT DesktopScreenX11 : public display::Screen, |
| - public ui::PlatformEventDispatcher { |
| + public ui::PlatformEventDispatcher, |
| + public views::DeviceScaleFactorObserver { |
| public: |
| DesktopScreenX11(); |
| @@ -55,6 +57,9 @@ class VIEWS_EXPORT DesktopScreenX11 : public display::Screen, |
| bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
| uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
| + // views::DeviceScaleFactorObserver: |
| + void OnDeviceScaleFactorChanged() override; |
| + |
| static void UpdateDeviceScaleFactorForTest(); |
| private: |
| @@ -68,8 +73,9 @@ class VIEWS_EXPORT DesktopScreenX11 : public display::Screen, |
| // the X server. |
| std::vector<display::Display> BuildDisplaysFromXRandRInfo(); |
| - // We delay updating the display so we can coalesce events. |
| - void ConfigureTimerFired(); |
| + void RestartDelayedConfigureTask(); |
| + |
| + void UpdateDisplayConfiguration(); |
|
Elliot Glaysher
2017/06/29 17:22:36
docs please.
Tom Anderson
2017/06/29 18:38:59
Done.
|
| // Updates |displays_| and sets FontRenderParams's scale factor. |
| void SetDisplaysInternal(const std::vector<display::Display>& displays); |
| @@ -90,12 +96,14 @@ class VIEWS_EXPORT DesktopScreenX11 : public display::Screen, |
| // The index into displays_ that represents the primary display. |
| size_t primary_display_index_; |
| - // The timer to delay configuring outputs. See also the comments in |
| - // Dispatch(). |
| - std::unique_ptr<base::OneShotTimer> configure_timer_; |
| + // The task to delay configuring outputs. We delay updating the |
| + // display so we can coalesce events. |
| + base::CancelableCallback<void()> delayed_configuration_task_; |
| display::DisplayChangeNotifier change_notifier_; |
| + base::WeakPtrFactory<DesktopScreenX11> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); |
| }; |