uwm

package module
Version: v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

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

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.

func (Color32) RGBA

func (c Color32) RGBA() (r, g, b, a uint32)

RGBA allows Color32 to implement the image.Color interface.

func (Color32) String

func (c Color32) String() string

String returns a hexadecimal representation of the receiver.

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) IsValid

func (g Geom) IsValid() bool

IsValid returns true if the receiver represents a non-empty region.

func (Geom) IsZero

func (g Geom) IsZero() bool

IsZero returns true if all fields are zero.

func (Geom) NoXY

func (g Geom) NoXY() Geom

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

func (g Geom) Overlaps(h Geom) bool

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

func (g Geom) Partition(rows, cols, row, col int) Geom

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.

func (Geom) String

func (g Geom) String() string

String returns a conventional X11 geometry string representation.

func (Geom) Union added in v1.1.0

func (g Geom) Union(h Geom) Geom

Union produces a new Geom that fully contains g and h.

type Option

type Option func(*Window) error

Option represents a Window modifier. Nil Option values will be ignored.

func BGColor

func BGColor(color Color) Option

BGColor sets the background color for the window.

func BGColor32

func BGColor32(color Color32) Option

BGColor32 sets the background color for the window.

func Display

func Display(display string) Option

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 Name

func Name(s string) Option

Name sets the title of the top-level window.

func Parent

func Parent(id WindowID) Option

Parent sets the parent window ID; this will not succeed in Window.Create calls.

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.

func Create

func Create(g Geom, opts ...Option) (*Window, error)

Create returns a new window with the given geometry and options. Sub-windows should be created by calling the Window.Create method.

func (*Window) Close

func (w *Window) Close() error

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

func (w *Window) Create(g Geom, opts ...Option) (*Window, error)

Create initializes a sub-window of the receiver. The geometry is interpreted relative to the top-left corner of the receiver.

func (*Window) Geom

func (w *Window) Geom() Geom

Geom returns the geometry associated with the window.

func (*Window) Hide

func (w *Window) Hide() error

Hide marks the receiver as invisible.

func (*Window) ID

func (w *Window) ID() WindowID

ID returns the X11 window ID associated with the window.

func (*Window) IsClosed

func (w *Window) IsClosed() bool

IsClosed returns true if the window has been closed, and is therefore no longer renderable.

func (*Window) IsTopLevel

func (w *Window) IsTopLevel() bool

IsTopLevel returns true if the given window was produced by the global Create function.

func (*Window) Show

func (w *Window) Show() error

Show marks the receiver as visible, though the window will only be displayed if all ancestor windows are marked as visible.

func (*Window) SubShowOnly

func (w *Window) SubShowOnly(sub *Window) error

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

func (w *Window) SubSwapGeom(sub1, sub2 *Window) error

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

func (w *Window) UpdateGeom(g Geom) error

UpdateGeom repositions and/or resizes the receiver.

type WindowID

type WindowID uint32

WindowID represents an X11 window identifier

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL