blob: f302b27ff83386789b70e2550719d534fa0f704c [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.display;
using fuchsia.hardware.display;
using zx;
/// Unique identifier for a display.
/// Also serves as a capability, enabling the owner to perform certain
/// operations on displays in the DisplayManager protocol and other protocols
/// (like Scenic).
type DisplayRef = resource struct {
reference zx.handle:EVENT;
};
// === Mode flags ===
const MODES_MAX_LEN int32 = 256;
// Flag for interlaced display modes.
const MODE_INTERLACED int32 = 0x1;
const IDENTIFIER_MAX_LEN uint32 = 128;
alias DisplayIdentifier = string:IDENTIFIER_MAX_LEN;
type Info = resource table {
// Unique identifier for the display.
1: display_ref DisplayRef;
// Modes supported by the attached display. The first entry is the
// preferred mode.
2: modes vector<fuchsia.hardware.display.Mode>:MODES_MAX_LEN;
3: manufacturer_name DisplayIdentifier;
4: monitor_name DisplayIdentifier;
};
const DISPLAYS_MAX_LEN int32 = 1024;
/// Display Listener protocol implemented by clients.
protocol DisplayListener {
/// Called when displays are added. This method will also be called when
/// the listener is registered for any connected displays.
OnDisplayAdded(resource struct {
display Info;
});
/// Called when displays are removed.
OnDisplayRemoved(resource struct {
display DisplayRef;
});
/// Called when the client gains or loses ownership of the displays.
///
/// New clients should assume they do not have ownership of the display
/// until informed otherwise by this method. Ownership can be lost and
/// gained more than once.
OnDisplayOwnershipChanged(resource struct {
displays vector<DisplayRef>:DISPLAYS_MAX_LEN;
owned_by_display_controller bool;
});
};
/// `DisplayManager` is a service that informs the client of new or removed
/// displays and allows changing of display configuration. Every display is
/// associated with a DisplayRef which can also be used as a parameter to other
/// apis (e.g. Scenic).
protocol DisplayManager {
AddDisplayListener(resource struct {
listener client_end:DisplayListener;
});
};