Commit bafe7888 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

multi-display-mirroring: Prerequisite clean up

This CL is a prerequisite CL for supporting mirroring across 3+
displays.
Changes:
1. Clean up old code of mirror mode in display manager and make software
and hardware mirroring more intuitive.
2. Fix a bug that misuses mirroring destination display as source in
display_info_provider_chromeos.cc

Design doc:
go/multi-display-mirroring

BUG=607844

Change-Id: I38a065e2693c1094d9b460dd99ad0b2daabd0215
Reviewed-on: https://chromium-review.googlesource.com/734799Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512867}
parent 0dd70bf6
...@@ -150,13 +150,16 @@ void CursorWindowController::UpdateContainer() { ...@@ -150,13 +150,16 @@ void CursorWindowController::UpdateContainer() {
if (display.is_valid()) if (display.is_valid())
SetDisplay(display); SetDisplay(display);
} else { } else {
aura::Window* mirror_window = Shell::Get() aura::Window::Windows mirror_windows = Shell::Get()
->window_tree_host_manager() ->window_tree_host_manager()
->mirror_window_controller() ->mirror_window_controller()
->GetWindow(); ->GetAllRootWindows();
if (mirror_window) if (mirror_windows.empty()) {
display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); SetContainer(nullptr);
SetContainer(mirror_window); return;
}
display_ = display::Screen::GetScreen()->GetPrimaryDisplay();
SetContainer(mirror_windows[0]);
} }
// Updates the hot point based on the current display. // Updates the hot point based on the current display.
UpdateCursorImage(); UpdateCursorImage();
......
...@@ -1350,7 +1350,7 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { ...@@ -1350,7 +1350,7 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
EXPECT_EQ("0,0 500x500", EXPECT_EQ("0,0 500x500",
GetDisplayForId(internal_display_id).bounds().ToString()); GetDisplayForId(internal_display_id).bounds().ToString());
EXPECT_EQ(2U, display_manager()->num_connected_displays()); EXPECT_EQ(2U, display_manager()->num_connected_displays());
EXPECT_EQ(11U, display_manager()->mirroring_display_id()); EXPECT_EQ(11U, display_manager()->GetMirroringDstDisplayIdList()[0]);
EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_TRUE(display_manager()->IsInMirrorMode());
// Test display name. // Test display name.
...@@ -2147,13 +2147,13 @@ class TestDisplayObserver : public display::DisplayObserver { ...@@ -2147,13 +2147,13 @@ class TestDisplayObserver : public display::DisplayObserver {
void OnDisplayAdded(const display::Display& new_display) override { void OnDisplayAdded(const display::Display& new_display) override {
// Mirror window should already be delete before restoring // Mirror window should already be delete before restoring
// the external display. // the external display.
EXPECT_FALSE(test_api.GetHost()); EXPECT_TRUE(test_api.GetHosts().empty());
changed_ = true; changed_ = true;
} }
void OnDisplayRemoved(const display::Display& old_display) override { void OnDisplayRemoved(const display::Display& old_display) override {
// Mirror window should not be created until the external display // Mirror window should not be created until the external display
// is removed. // is removed.
EXPECT_FALSE(test_api.GetHost()); EXPECT_TRUE(test_api.GetHosts().empty());
changed_ = true; changed_ = true;
} }
...@@ -2174,7 +2174,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { ...@@ -2174,7 +2174,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
UpdateDisplay("300x400,400x500"); UpdateDisplay("300x400,400x500");
MirrorWindowTestApi test_api; MirrorWindowTestApi test_api;
EXPECT_EQ(nullptr, test_api.GetHost()); EXPECT_TRUE(test_api.GetHosts().empty());
TestDisplayObserver display_observer; TestDisplayObserver display_observer;
display::Screen::GetScreen()->AddObserver(&display_observer); display::Screen::GetScreen()->AddObserver(&display_observer);
...@@ -2187,15 +2187,15 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { ...@@ -2187,15 +2187,15 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
EXPECT_EQ( EXPECT_EQ(
"0,0 300x400", "0,0 300x400",
display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); display::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString());
EXPECT_EQ("400x500", std::vector<aura::WindowTreeHost*> hosts = test_api.GetHosts();
test_api.GetHost()->GetBoundsInPixels().size().ToString()); EXPECT_EQ(1U, hosts.size());
EXPECT_EQ("300x400", EXPECT_EQ("400x500", hosts[0]->GetBoundsInPixels().size().ToString());
test_api.GetHost()->window()->bounds().size().ToString()); EXPECT_EQ("300x400", hosts[0]->window()->bounds().size().ToString());
EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_TRUE(display_manager()->IsInMirrorMode());
display_manager()->SetMirrorMode(false); display_manager()->SetMirrorMode(false);
EXPECT_TRUE(display_observer.changed_and_reset()); EXPECT_TRUE(display_observer.changed_and_reset());
EXPECT_EQ(nullptr, test_api.GetHost()); EXPECT_TRUE(test_api.GetHosts().empty());
EXPECT_EQ(2U, display_manager()->GetNumDisplays()); EXPECT_EQ(2U, display_manager()->GetNumDisplays());
EXPECT_FALSE(display_manager()->IsInMirrorMode()); EXPECT_FALSE(display_manager()->IsInMirrorMode());
...@@ -2207,28 +2207,28 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { ...@@ -2207,28 +2207,28 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) {
UpdateDisplay("300x400@0.5,400x500"); UpdateDisplay("300x400@0.5,400x500");
EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_FALSE(display_observer.changed_and_reset());
EXPECT_EQ("300x400", EXPECT_EQ("300x400",
test_api.GetHost()->window()->bounds().size().ToString()); test_api.GetHosts()[0]->window()->bounds().size().ToString());
UpdateDisplay("310x410*2,400x500"); UpdateDisplay("310x410*2,400x500");
EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_FALSE(display_observer.changed_and_reset());
EXPECT_EQ("310x410", EXPECT_EQ("310x410",
test_api.GetHost()->window()->bounds().size().ToString()); test_api.GetHosts()[0]->window()->bounds().size().ToString());
UpdateDisplay("320x420/r,400x500"); UpdateDisplay("320x420/r,400x500");
EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_FALSE(display_observer.changed_and_reset());
EXPECT_EQ("320x420", EXPECT_EQ("320x420",
test_api.GetHost()->window()->bounds().size().ToString()); test_api.GetHosts()[0]->window()->bounds().size().ToString());
UpdateDisplay("330x440/r,400x500"); UpdateDisplay("330x440/r,400x500");
EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_FALSE(display_observer.changed_and_reset());
EXPECT_EQ("330x440", EXPECT_EQ("330x440",
test_api.GetHost()->window()->bounds().size().ToString()); test_api.GetHosts()[0]->window()->bounds().size().ToString());
// Overscan insets are ignored. // Overscan insets are ignored.
UpdateDisplay("400x600/o,600x800/o"); UpdateDisplay("400x600/o,600x800/o");
EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_FALSE(display_observer.changed_and_reset());
EXPECT_EQ("400x600", EXPECT_EQ("400x600",
test_api.GetHost()->window()->bounds().size().ToString()); test_api.GetHosts()[0]->window()->bounds().size().ToString());
display::Screen::GetScreen()->RemoveObserver(&display_observer); display::Screen::GetScreen()->RemoveObserver(&display_observer);
} }
...@@ -2255,14 +2255,16 @@ TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) { ...@@ -2255,14 +2255,16 @@ TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) {
EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ(1U, display_manager()->GetNumDisplays());
WindowTreeHostManager* window_tree_host_manager = WindowTreeHostManager* window_tree_host_manager =
ash::Shell::Get()->window_tree_host_manager(); ash::Shell::Get()->window_tree_host_manager();
EXPECT_TRUE( EXPECT_EQ(1U, window_tree_host_manager->mirror_window_controller()
window_tree_host_manager->mirror_window_controller()->GetWindow()); ->GetAllRootWindows()
.size());
UpdateDisplay("600x400"); UpdateDisplay("600x400");
EXPECT_FALSE(display_manager()->IsInMirrorMode()); EXPECT_FALSE(display_manager()->IsInMirrorMode());
EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ(1U, display_manager()->GetNumDisplays());
EXPECT_FALSE( EXPECT_TRUE(window_tree_host_manager->mirror_window_controller()
window_tree_host_manager->mirror_window_controller()->GetWindow()); ->GetAllRootWindows()
.empty());
} }
// Make sure this does not cause any crashes. See http://crbug.com/412910 // Make sure this does not cause any crashes. See http://crbug.com/412910
...@@ -2270,7 +2272,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) { ...@@ -2270,7 +2272,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroringWithCompositingCursor) {
UpdateDisplay("300x400,400x500"); UpdateDisplay("300x400,400x500");
MirrorWindowTestApi test_api; MirrorWindowTestApi test_api;
EXPECT_EQ(nullptr, test_api.GetHost()); EXPECT_TRUE(test_api.GetHosts().empty());
display::ManagedDisplayInfo secondary_info = display::ManagedDisplayInfo secondary_info =
display_manager()->GetDisplayInfo( display_manager()->GetDisplayInfo(
......
...@@ -315,16 +315,6 @@ void MirrorWindowController::OnHostResized(aura::WindowTreeHost* host) { ...@@ -315,16 +315,6 @@ void MirrorWindowController::OnHostResized(aura::WindowTreeHost* host) {
} }
} }
aura::Window* MirrorWindowController::GetWindow() {
display::DisplayManager* display_manager = Shell::Get()->display_manager();
if (!display_manager->IsInMirrorMode() || mirroring_host_info_map_.empty())
return nullptr;
DCHECK_EQ(1U, mirroring_host_info_map_.size());
return mirroring_host_info_map_.begin()
->second->ash_host->AsWindowTreeHost()
->window();
}
display::Display MirrorWindowController::GetDisplayForRootWindow( display::Display MirrorWindowController::GetDisplayForRootWindow(
const aura::Window* root) const { const aura::Window* root) const {
for (const auto& pair : mirroring_host_info_map_) { for (const auto& pair : mirroring_host_info_map_) {
......
...@@ -64,10 +64,6 @@ class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver { ...@@ -64,10 +64,6 @@ class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver {
// aura::WindowTreeHostObserver overrides: // aura::WindowTreeHostObserver overrides:
void OnHostResized(aura::WindowTreeHost* host) override; void OnHostResized(aura::WindowTreeHost* host) override;
// Return the root window used to mirror the content. NULL if the
// display is not mirrored by the compositor path.
aura::Window* GetWindow();
// Returns the display::Display for the mirroring root window. // Returns the display::Display for the mirroring root window.
display::Display GetDisplayForRootWindow(const aura::Window* root) const; display::Display GetDisplayForRootWindow(const aura::Window* root) const;
......
...@@ -259,7 +259,7 @@ TEST_F(MirrorWindowControllerTest, DockMode) { ...@@ -259,7 +259,7 @@ TEST_F(MirrorWindowControllerTest, DockMode) {
EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ(1U, display_manager()->GetNumDisplays());
EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_TRUE(display_manager()->IsInMirrorMode());
EXPECT_EQ(external_id, display_manager()->mirroring_display_id()); EXPECT_EQ(external_id, display_manager()->GetMirroringDstDisplayIdList()[0]);
// dock mode. // dock mode.
display_info_list.clear(); display_info_list.clear();
...@@ -277,14 +277,14 @@ TEST_F(MirrorWindowControllerTest, DockMode) { ...@@ -277,14 +277,14 @@ TEST_F(MirrorWindowControllerTest, DockMode) {
display_manager()->OnNativeDisplaysChanged(display_info_list); display_manager()->OnNativeDisplaysChanged(display_info_list);
EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ(1U, display_manager()->GetNumDisplays());
EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_TRUE(display_manager()->IsInMirrorMode());
EXPECT_EQ(external_id, display_manager()->mirroring_display_id()); EXPECT_EQ(external_id, display_manager()->GetMirroringDstDisplayIdList()[0]);
} }
TEST_F(MirrorOnBootTest, MirrorOnBoot) { TEST_F(MirrorOnBootTest, MirrorOnBoot) {
EXPECT_TRUE(display_manager()->IsInMirrorMode()); EXPECT_TRUE(display_manager()->IsInMirrorMode());
RunAllPendingInMessageLoop(); RunAllPendingInMessageLoop();
MirrorWindowTestApi test_api; MirrorWindowTestApi test_api;
EXPECT_TRUE(test_api.GetHost()); EXPECT_EQ(1U, test_api.GetHosts().size());
} }
} // namespace ash } // namespace ash
...@@ -14,12 +14,15 @@ ...@@ -14,12 +14,15 @@
namespace ash { namespace ash {
const aura::WindowTreeHost* MirrorWindowTestApi::GetHost() const { std::vector<aura::WindowTreeHost*> MirrorWindowTestApi::GetHosts() const {
aura::Window* window = Shell::Get() std::vector<aura::WindowTreeHost*> hosts;
->window_tree_host_manager() for (auto* window : Shell::Get()
->mirror_window_controller() ->window_tree_host_manager()
->GetWindow(); ->mirror_window_controller()
return window ? window->GetHost() : NULL; ->GetAllRootWindows()) {
hosts.emplace_back(window->GetHost());
}
return hosts;
} }
ui::CursorType MirrorWindowTestApi::GetCurrentCursorType() const { ui::CursorType MirrorWindowTestApi::GetCurrentCursorType() const {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef ASH_DISPLAY_MIRROR_WINDOW_TEST_API_H_ #ifndef ASH_DISPLAY_MIRROR_WINDOW_TEST_API_H_
#define ASH_DISPLAY_MIRROR_WINDOW_TEST_API_H_ #define ASH_DISPLAY_MIRROR_WINDOW_TEST_API_H_
#include <vector>
#include "base/macros.h" #include "base/macros.h"
namespace aura { namespace aura {
...@@ -27,7 +29,7 @@ class MirrorWindowTestApi { ...@@ -27,7 +29,7 @@ class MirrorWindowTestApi {
MirrorWindowTestApi() {} MirrorWindowTestApi() {}
~MirrorWindowTestApi() {} ~MirrorWindowTestApi() {}
const aura::WindowTreeHost* GetHost() const; std::vector<aura::WindowTreeHost*> GetHosts() const;
ui::CursorType GetCurrentCursorType() const; ui::CursorType GetCurrentCursorType() const;
......
...@@ -127,7 +127,7 @@ class RootWindowTransformersTest : public AshTestBase { ...@@ -127,7 +127,7 @@ class RootWindowTransformersTest : public AshTestBase {
DCHECK(display_manager()->IsInMirrorMode()); DCHECK(display_manager()->IsInMirrorMode());
const display::ManagedDisplayInfo& mirror_display_info = const display::ManagedDisplayInfo& mirror_display_info =
display_manager()->GetDisplayInfo( display_manager()->GetDisplayInfo(
display_manager()->mirroring_display_id()); display_manager()->GetMirroringDstDisplayIdList()[0]);
const display::ManagedDisplayInfo& source_display_info = const display::ManagedDisplayInfo& source_display_info =
display_manager()->GetDisplayInfo( display_manager()->GetDisplayInfo(
display::Screen::GetScreen()->GetPrimaryDisplay().id()); display::Screen::GetScreen()->GetPrimaryDisplay().id());
......
...@@ -51,18 +51,21 @@ base::string16 GetDisplayName(int64_t display_id) { ...@@ -51,18 +51,21 @@ base::string16 GetDisplayName(int64_t display_id) {
base::string16 GetDisplaySize(int64_t display_id) { base::string16 GetDisplaySize(int64_t display_id) {
display::DisplayManager* display_manager = GetDisplayManager(); display::DisplayManager* display_manager = GetDisplayManager();
const display::Display* display =
&display_manager->GetDisplayForId(display_id);
// We don't show display size for mirrored display. Fallback // We don't show display size for mirrored display. Fallback
// to empty string if this happens on release build. // to empty string if this happens on release build.
bool mirroring = display_manager->mirroring_display_id() == display_id; const display::DisplayIdList id_list =
display_manager->GetMirroringDstDisplayIdList();
const bool mirroring =
display_manager->IsInMirrorMode() &&
std::find(id_list.begin(), id_list.end(), display_id) != id_list.end();
DCHECK(!mirroring); DCHECK(!mirroring);
if (mirroring) if (mirroring)
return base::string16(); return base::string16();
DCHECK(display->is_valid()); const display::Display& display =
return base::UTF8ToUTF16(display->size().ToString()); display_manager->GetDisplayForId(display_id);
DCHECK(display.is_valid());
return base::UTF8ToUTF16(display.size().ToString());
} }
// Callback to handle a user selecting the notification view. // Callback to handle a user selecting the notification view.
...@@ -131,10 +134,11 @@ bool IsDockedModeEnabled() { ...@@ -131,10 +134,11 @@ bool IsDockedModeEnabled() {
// Returns the notification message that should be shown when mirror display // Returns the notification message that should be shown when mirror display
// mode is entered. // mode is entered.
base::string16 GetEnterMirrorModeMessage() { base::string16 GetEnterMirrorModeMessage() {
DCHECK(GetDisplayManager()->IsInMirrorMode());
if (display::Display::HasInternalDisplay()) { if (display::Display::HasInternalDisplay()) {
return l10n_util::GetStringFUTF16( return l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING,
GetDisplayName(GetDisplayManager()->mirroring_display_id())); GetDisplayName(GetDisplayManager()->GetMirroringDstDisplayIdList()[0]));
} }
return l10n_util::GetStringUTF16( return l10n_util::GetStringUTF16(
......
...@@ -97,8 +97,9 @@ base::string16 ScreenLayoutObserverTest::GetSecondDisplayName() { ...@@ -97,8 +97,9 @@ base::string16 ScreenLayoutObserverTest::GetSecondDisplayName() {
} }
base::string16 ScreenLayoutObserverTest::GetMirroringDisplayName() { base::string16 ScreenLayoutObserverTest::GetMirroringDisplayName() {
DCHECK(display_manager()->IsInMirrorMode());
return base::UTF8ToUTF16(display_manager()->GetDisplayNameForId( return base::UTF8ToUTF16(display_manager()->GetDisplayNameForId(
display_manager()->mirroring_display_id())); display_manager()->GetMirroringDstDisplayIdList()[0]));
} }
const message_center::Notification* const message_center::Notification*
......
...@@ -610,7 +610,7 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform( ...@@ -610,7 +610,7 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform(
unit->name = display_manager->GetDisplayNameForId(display.id()); unit->name = display_manager->GetDisplayNameForId(display.id());
if (display_manager->IsInMirrorMode()) { if (display_manager->IsInMirrorMode()) {
unit->mirroring_source_id = unit->mirroring_source_id =
base::Int64ToString(display_manager->mirroring_display_id()); base::Int64ToString(display_manager->mirroring_source_id());
} }
const display::ManagedDisplayInfo& display_info = const display::ManagedDisplayInfo& display_info =
......
...@@ -531,7 +531,7 @@ TEST_F(DisplayInfoProviderChromeosTest, GetMirroring) { ...@@ -531,7 +531,7 @@ TEST_F(DisplayInfoProviderChromeosTest, GetMirroring) {
ASSERT_EQ(1u, result.size()); ASSERT_EQ(1u, result.size());
EXPECT_EQ(base::Int64ToString(display_id_primary), result[0].id); EXPECT_EQ(base::Int64ToString(display_id_primary), result[0].id);
EXPECT_EQ(base::Int64ToString(display_id_secondary), EXPECT_EQ(base::Int64ToString(display_id_primary),
result[0].mirroring_source_id); result[0].mirroring_source_id);
GetDisplayManager()->SetMirrorMode(false); GetDisplayManager()->SetMirrorMode(false);
......
...@@ -110,6 +110,9 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator ...@@ -110,6 +110,9 @@ class DISPLAY_MANAGER_EXPORT DisplayConfigurator
// Called when the hardware mirroring failed. // Called when the hardware mirroring failed.
virtual void SetSoftwareMirroring(bool enabled) = 0; virtual void SetSoftwareMirroring(bool enabled) = 0;
// Returns true when software mirroring mode is requested, but it does
// not guarantee that the mode is active.
virtual bool SoftwareMirroringEnabled() const = 0; virtual bool SoftwareMirroringEnabled() const = 0;
}; };
......
This diff is collapsed.
...@@ -289,13 +289,31 @@ class DISPLAY_MANAGER_EXPORT DisplayManager ...@@ -289,13 +289,31 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
// mirrored. // mirrored.
size_t num_connected_displays() const { return num_connected_displays_; } size_t num_connected_displays() const { return num_connected_displays_; }
// Returns the mirroring status. // Returns true if either software or hardware mirror mode is active.
bool IsInMirrorMode() const; bool IsInMirrorMode() const;
int64_t mirroring_display_id() const { return mirroring_display_id_; }
// Returns true if software mirror mode is active. Note that when
// SoftwareMirroringEnabled() returns true, it only means software mirroring
// mode is requested, but it does not guarantee that the mode is active. The
// mode will be active after UpdateDisplaysWith() is called.
bool IsInSoftwareMirrorMode() const;
// Returns true if hardware mirror mode is active.
bool IsInHardwareMirrorMode() const;
int64_t mirroring_source_id() const { return mirroring_source_id_; }
// Returns a list of mirroring destination display ids.
DisplayIdList GetMirroringDstDisplayIdList() const;
const Displays& software_mirroring_display_list() const { const Displays& software_mirroring_display_list() const {
return software_mirroring_display_list_; return software_mirroring_display_list_;
} }
// Remove mirroring source and destination displays, so that they will be
// updated when UpdateDisplaysWith() is called.
void ClearMirroringSourceAndDestination();
// Sets/gets if the unified desktop feature is enabled. // Sets/gets if the unified desktop feature is enabled.
void SetUnifiedDesktopEnabled(bool enabled); void SetUnifiedDesktopEnabled(bool enabled);
bool unified_desktop_enabled() const { return unified_desktop_enabled_; } bool unified_desktop_enabled() const { return unified_desktop_enabled_; }
...@@ -408,10 +426,6 @@ class DISPLAY_MANAGER_EXPORT DisplayManager ...@@ -408,10 +426,6 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
DISALLOW_COPY_AND_ASSIGN(BeginEndNotifier); DISALLOW_COPY_AND_ASSIGN(BeginEndNotifier);
}; };
bool software_mirroring_enabled() const {
return multi_display_mode_ == MIRRORING;
}
void set_change_display_upon_host_resize(bool value) { void set_change_display_upon_host_resize(bool value) {
change_display_upon_host_resize_ = value; change_display_upon_host_resize_ = value;
} }
...@@ -423,7 +437,7 @@ class DISPLAY_MANAGER_EXPORT DisplayManager ...@@ -423,7 +437,7 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
Display* FindDisplayForId(int64_t id); Display* FindDisplayForId(int64_t id);
// Add the mirror display's display info if the software based mirroring is in // Add the mirror display's display info if the software based mirroring is in
// use. // use. This should only be called before UpdateDisplaysWith().
void AddMirrorDisplayInfoIfAny(DisplayInfoList* display_info_list); void AddMirrorDisplayInfoIfAny(DisplayInfoList* display_info_list);
// Inserts and update the ManagedDisplayInfo according to the overscan state. // Inserts and update the ManagedDisplayInfo according to the overscan state.
...@@ -508,14 +522,25 @@ class DISPLAY_MANAGER_EXPORT DisplayManager ...@@ -508,14 +522,25 @@ class DISPLAY_MANAGER_EXPORT DisplayManager
MultiDisplayMode multi_display_mode_ = EXTENDED; MultiDisplayMode multi_display_mode_ = EXTENDED;
MultiDisplayMode current_default_multi_display_mode_ = EXTENDED; MultiDisplayMode current_default_multi_display_mode_ = EXTENDED;
// When mirroring is enabled this is the id of the destination display. // This is used in two distinct ways:
int64_t mirroring_display_id_ = kInvalidDisplayId; // 1. The source display id when software mirroring is active.
// 2. There's no source and destination display in hardware mirroring, so we
// treat the first mirroring display id as source id when hardware mirroring
// is active.
int64_t mirroring_source_id_ = kInvalidDisplayId;
// This is used in two distinct ways: // This is used in two distinct ways:
// 1. when mirroring is enabled this contains the destination display. // 1. when software mirroring is active this contains the destination
// displays.
// 2. when unified mode is enabled this is the set of physical displays. // 2. when unified mode is enabled this is the set of physical displays.
Displays software_mirroring_display_list_; Displays software_mirroring_display_list_;
// There's no source and destination display in hardware mirroring, so we
// treat the first mirroring display as source and store its id in
// |mirroring_source_id_| and treat the rest of mirroring displays as
// destination and store their ids in this list.
DisplayIdList hardware_mirroring_display_id_list_;
// Cached mirror mode for metrics changed notification. // Cached mirror mode for metrics changed notification.
bool mirror_mode_for_metrics_ = false; bool mirror_mode_for_metrics_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment