Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple displays in DeviceDisplay #22641

Open
mattleibow opened this issue May 24, 2024 · 0 comments
Open

Add support for multiple displays in DeviceDisplay #22641

mattleibow opened this issue May 24, 2024 · 0 comments
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 proposal/open t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Milestone

Comments

@mattleibow
Copy link
Member

mattleibow commented May 24, 2024

Description

For desktop applications, there might be a need to have more information on the current screen the window is on or know about all the screens in order to move the window to a different display.

I believe all the platforms support multiple screens:

  • Windows and macOS both support adding new physical monitors/projectors
  • iOS may allow extending to the mac or iPad or something?
  • Android devices can have monitors and/or multiple screens on some phones.

Currently, the DeviceDisplay API only has info on the "main" display and this usually is fine for mobile. But, for desktop apps the main display may not actually be the current display.

public interface IDeviceDisplay
{
	DisplayInfo MainDisplayInfo { get; }
	event EventHandler<DisplayInfoChangedEventArgs> MainDisplayInfoChanged;
}

Public API Changes

A new API would be to add a display id or instance to Window objects, or at the very least add new ways to get more information about what monitors are in use.

public interface IDeviceDisplay
{
	// Gets the display information for the specified index
	DisplayInfo GetDisplay(int index);

	// OR: Gets the display information for the specified index
	DisplayInfo GetDisplay(DisplayId id);

	// Gets the number of displays attached to the device
	int DisplayCount { get; }

	// OR Gets the number of displays attached to the device
	DisplayId[] Displays { get; }

	// And event that gets raised if any display changes or a new one is added (or removed)
	event EventHandler<DisplayInfoChangedEventArgs> DisplayInfoChanged;
}
public class DisplayInfoChangedEventArgs
{
	// The index of the display that is changing
	public int Index { get; }

	// OR: The ID of the display that is changing
	public DisplayId Id { get; }
}
public struct DisplayId
{
	// something that will help MAUI identify different displays
	internal <platform-type> PlatformId { get; }
}
public class Window
{
	// Get the index of the display in the DeviceDisplay.GetDisplay list
	public int DisplayIndex { get; }

	// OR: Get the display ID
	public DisplayId DisplayId { get; }
}

Intended Use-Case

When launching an app, there may be a desire to launch on a specific monitor. Being able to find out where the monitors are so windows can be moved programmatically.

Potentially Related Issues

@mattleibow mattleibow added proposal/open partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) labels May 24, 2024
@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label May 24, 2024
@mattleibow mattleibow added area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 platform/android 🤖 platform/iOS 🍎 and removed s/triaged Issue has been reviewed labels May 24, 2024
@rmarinho rmarinho added this to the Backlog milestone May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 proposal/open t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

No branches or pull requests

2 participants