Documentation ¶
Overview ¶
Package uwm implements a micro/pseudo X11 window-manager: not at all an actual window manager, but just one that can expose a window with sub-windows, and toggle between them.
Index ¶
- type Color
- type Color32
- type Geom
- type Option
- type Window
- func (w *Window) Close() error
- func (w *Window) Create(g Geom, opts ...Option) (*Window, error)
- func (w *Window) Geom() Geom
- func (w *Window) Hide() error
- func (w *Window) ID() WindowID
- func (w *Window) IsClosed() bool
- func (w *Window) IsTopLevel() bool
- func (w *Window) Show() error
- func (w *Window) SubShowOnly(sub *Window) error
- func (w *Window) SubSwapGeom(sub1, sub2 *Window) error
- func (w *Window) UpdateGeom(g Geom) error
- type WindowID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color interface{ RGBA() (r, g, b, a uint32) }
Color is identical to the color.Color interface
type Color32 ¶
type Color32 uint32
Color32 represents a 32-bit ARGB color, with bit-format 0xAARRGGBB. In typical X11 contexts, such as 24-bit depth windows, the alpha bits are ignored.
type Geom ¶
type Geom struct { W uint16 `json:"w,omitempty"` H uint16 `json:"h,omitempty"` X uint16 `json:"x,omitempty"` Y uint16 `json:"y,omitempty"` // contains filtered or unexported fields }
Geom represents a display region.
func (Geom) NoXY ¶
NoXY returns a copy of the receiver in which the X and Y offset are reset to zero.
func (Geom) Overlaps ¶ added in v1.2.0
Overlaps returns true if any part of g strictly covers, or is covered by, any part of h. Geometries that are merely adjacent are not considered overlapping.
func (Geom) Partition ¶
Partition returns a new Geom representing the subregion of the receiver corresponding to the given row and col (zero-indexed) when uniformly divided into a grid of rows and cols.
If used to position subwindows, call NoXY on the receiver first, since sub-window positions are relative to their parent.
Partition will panic if rows or cols is less than 1, or row or col is semantically out-of-bounds.
type Option ¶
Option represents a Window modifier. Nil Option values will be ignored.
func Display ¶
Display sets the X11 display name/socket; this will not succeed in Window.Create calls.
func Floating ¶
func Floating() Option
Floating marks the window as being floating rather than tiled, for typical tiling window managers.
func Undecorated ¶
func Undecorated() Option
Undecorated marks the window as being undecorated and uncontrolled by the window-manager. This may only be passed to the top-level window.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a displayed region that may have sub-windows. Sub-windows have positions relative to their parent, rather than the screen itself.
Concurrent accesses between a parent and children are generally not safe: this includes concurrent Close of parent and child (closing parent will close all children), as well as UpdateGeom on one of the children involved in a parent's SubSwapGeom. However, it is safe to concurrently Create children of the same parent, and to use Show/Hide on a child alongside SubShowOnly on a parent.
func Create ¶
Create returns a new window with the given geometry and options. Sub-windows should be created by calling the Window.Create method. A Close of any parent will implicitly close all children.
See Window for documentation on concurrent-safety.
func (*Window) Close ¶
Close destroys the window, as well as all sub-windows of this window. All subsequent calls to other methods will return an error or zero value.
func (*Window) Create ¶
Create initializes a sub-window of the receiver. The geometry is interpreted relative to the top-left corner of the receiver.
func (*Window) IsClosed ¶
IsClosed returns true if the window has been closed, and is therefore no longer renderable.
func (*Window) IsTopLevel ¶
IsTopLevel returns true if the given window was produced by the global Create function.
func (*Window) Show ¶
Show marks the receiver as visible, though the window will only be displayed if all ancestor windows are marked as visible.
func (*Window) SubShowOnly ¶
SubShowOnly hides all children but the given sub-window. If the given window is not one of the receiver's direct children, no action is taken.
func (*Window) SubSwapGeom ¶
SubSwapGeom exchanges the geometries of the two given sub-windows. If the given windows are not the receiver's direct children, no action is taken.
func (*Window) UpdateGeom ¶
UpdateGeom repositions and/or resizes the receiver.