Documentation
¶
Overview ¶
Package dialogsurface maps a portal dialog the way its request asks: transient for the app window that asked, when the request names it by an xdg-foreign handle the compositor can import, so the dialog is modal to that window only and the rest of the desktop stays usable; otherwise as an overlay over an output, which holds the keyboard while it is modal. The dialog builds its tree for the surface it is on: on the overlay it floats and frames itself, in a window the compositor frames and resizes it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CardRoot ¶
func CardRoot(s Surface, card *widget.Card, floatingClass string, sheet *widget.Stylesheet) (root *widget.Box, rev *widget.Revealer)
CardRoot is the root of a dialog that is one card, on s: window.<floatingClass> around rev, the revealer that plays the card's entry and exit, with sheet attached. On the overlay the window is transparent (the class's rule) and the card floats on it in its own frame; in a window the window's background fills it and the card draws no frame.
func ParentHandle ¶
ParentHandle is the xdg-foreign handle a request's parent_window names, false when it names none a Wayland dialog can be parented to.
Types ¶
type Spec ¶
type Spec struct {
// Caller is the request: its parent window and modality.
Caller portaldialogs.Caller
// Title names the dialog's window.
Title string
// Root builds the dialog's tree for the surface it shows on. It
// runs again, for the overlay, when a window dialog moves there.
Root func(Surface) widget.Widget
// Layer is the dialog as an overlay, its Root left nil: Root fills
// it. A window dialog takes its input hooks other than OnResize,
// and its Namespace as its app id.
Layer app.LayerConfig
// Window sizes the dialog as a window.
Window WindowSize
// Failed runs when the dialog lost its parent and could not map as
// an overlay instead: nothing shows it any more, and the host
// answers the request.
Failed func()
}
Spec is one dialog to map.
func (Spec) LayerConfig ¶
func (s Spec) LayerConfig() app.LayerConfig
LayerConfig is s as an overlay: its Layer, with the tree Root builds for the overlay.
type Surface ¶
type Surface int
Surface is what a dialog shows on, which decides what frames it.
const ( // OnOverlay is an overlay layer over an output: the dialog floats // on it as a card with its own border, rounding and shadow. OnOverlay Surface = iota // OnWindow is a toplevel transient for the caller's window: the // compositor's decoration frames it and the compositor resizes it, // so the dialog fills the window and draws no frame of its own. OnWindow )
type Window ¶
Window is a mapped dialog, either kind.
func Open ¶
func Open(a *app.Application, s Spec) (Window, error)
Open maps s on a: parented to the caller's window where it can be, else as the overlay. A parent the compositor cannot import (no xdg-foreign importer) falls back silently, any other failure to open with a warning. A spec without Root, with a Layer.Root, or with a window size out of range is an error.
type WindowSize ¶
WindowSize is a window dialog's size. Initial is the size it opens at, the tree's natural size on a zero axis; Min and Max bound how far the compositor resizes it, unbounded on a zero axis. Within Max, the window's minimum also follows the least size its tree lays out at, so content that grows grows the window and the user cannot shrink it below its content. OnResize, when set, hears every size the window takes, the first included.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package surfacetest runs a portal dialog host against a real lys-wm, with an app window it can be parented to, and reads back where lys-wm put the dialog.
|
Package surfacetest runs a portal dialog host against a real lys-wm, with an app window it can be parented to, and reads back where lys-wm put the dialog. |
|
probe
command
Command probe maps one app window for surfacetest, in a process of its own as a real app's is, and reports on stdout the handle it is exported as ("handle <h>") and whether it holds the keyboard focus ("keyboard true|false"), each when it changes, until it is killed.
|
Command probe maps one app window for surfacetest, in a process of its own as a real app's is, and reports on stdout the handle it is exported as ("handle <h>") and whether it holds the keyboard focus ("keyboard true|false"), each when it changes, until it is killed. |