| 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..91a85ce6fda6ab8c28293d886c2a314b63a5dd28 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,10 +73,15 @@ 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();
|
| + // Removes |delayed_configuration_task_| from the task queue (if
|
| + // it's in the queue) and adds it back at the end of the queue.
|
| + void RestartDelayedConfigurationTask();
|
|
|
| - // Updates |displays_| and sets FontRenderParams's scale factor.
|
| + // Updates |displays_| with the latest XRandR info.
|
| + void UpdateDisplays();
|
| +
|
| + // Updates |displays_| from |displays| and sets FontRenderParams's scale
|
| + // factor.
|
| void SetDisplaysInternal(const std::vector<display::Display>& displays);
|
|
|
| Display* xdisplay_;
|
| @@ -90,12 +100,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);
|
| };
|
|
|
|
|