displaybackend

package
v0.0.0-...-143e6d5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend implements graphics.Backend and graphics.InputHandler using the custom display protocol client.

func New

func New() *Backend

New creates a display backend with default 800x600 size.

func (*Backend) Buffer

func (b *Backend) Buffer() *graphics.Buffer

Buffer returns the shared memory pixel buffer.

func (*Backend) Close

func (b *Backend) Close() error

Close stops the event loop and disconnects.

func (*Backend) ClosePopup

func (b *Backend) ClosePopup(p *Popup)

ClosePopup destroys a popup window. Safe to call multiple times.

func (*Backend) Flush

func (b *Backend) Flush() error

Flush marks the entire window as damaged.

func (*Backend) FlushRect

func (b *Backend) FlushRect(r graphics.Rect) error

FlushRect marks a region as damaged.

func (*Backend) HasSystemCursor

func (b *Backend) HasSystemCursor() bool

HasSystemCursor returns true since the server draws the cursor.

func (*Backend) Info

func (b *Backend) Info() string

Info returns backend information.

func (*Backend) ListWindows

func (b *Backend) ListWindows() ([]display.WindowInfo, error)

ListWindows returns current managed normal windows from the display server.

func (*Backend) MousePosition

func (b *Backend) MousePosition() (int, int)

MousePosition returns the last known pointer position.

func (*Backend) Open

func (b *Backend) Open() error

Open connects to the display server and creates a window or layer surface.

func (*Backend) OpenPopup

func (b *Backend) OpenPopup(x, y, w, h int, content graphics.Widget, onClose func()) *Popup

OpenPopup creates a popup window positioned relative to the main window. The content widget is rendered into the popup buffer and receives events. onClose is called when the popup is dismissed (e.g. click outside).

func (*Backend) Poll

func (b *Backend) Poll() *graphics.Event

Poll returns the next event or nil.

func (*Backend) ReconfigureLayer

func (b *Backend) ReconfigureLayer(anchor uint32, exclusive int) error

ReconfigureLayer updates anchor/exclusive for an already-open layer surface. The main layer surface is recreated in-place to apply new positioning.

func (*Backend) RegisterShortcut

func (b *Backend) RegisterShortcut(shortcutID, windowID, scope uint32, key graphics.Key, modifiers graphics.Modifiers) error

RegisterShortcut registers a compositor shortcut for this client. Use ShortcutScopeGlobal for compositor-wide shortcuts and ShortcutScopeClient for shortcuts scoped to this client (optionally a specific window ID).

func (*Backend) RegisterShortcutEx

func (b *Backend) RegisterShortcutEx(shortcutID, windowID, scope uint32, key graphics.Key, ch rune, modifiers graphics.Modifiers) error

RegisterShortcutEx registers a shortcut keyed either by graphics.Key, or by a printable rune when key is graphics.KeyNone.

func (*Backend) Resize

func (b *Backend) Resize(width, height int) error

Resize changes the main surface size at runtime. For layer surfaces this allows dynamic content-sized bars/docks.

func (*Backend) SetLayer

func (b *Backend) SetLayer(layer, anchor uint32, exclusive int)

SetLayer configures this backend as a layer surface. Call before Open(). Layer surfaces are anchored to screen edges and can reserve exclusive zones (e.g. 32px for a panel).

func (*Backend) SetLayerOpaqueHint

func (b *Backend) SetLayerOpaqueHint(opaque bool)

SetLayerOpaqueHint hints that the layer content is fully opaque.

func (*Backend) SetScreenSize

func (b *Backend) SetScreenSize(_, _ int)

SetScreenSize is a no-op for window-based backends.

func (*Backend) SetSize

func (b *Backend) SetSize(width, height int)

SetSize sets the window size (call before Open).

func (*Backend) SetTitle

func (b *Backend) SetTitle(title string)

SetTitle sets the window title (call before Open).

func (*Backend) SetWindowState

func (b *Backend) SetWindowState(windowID, action uint32) error

SetWindowState updates a managed window state (minimize/maximize/restore/focus).

func (*Backend) Size

func (b *Backend) Size() (int, int)

Size returns the window dimensions.

func (*Backend) Start

func (b *Backend) Start()

Start begins the event loop goroutine.

func (*Backend) UnregisterShortcut

func (b *Backend) UnregisterShortcut(shortcutID uint32) error

UnregisterShortcut removes a previously registered shortcut.

type Popup struct {
	// contains filtered or unexported fields
}

Popup represents a popup window managed by the display backend.

func (*Popup) Redraw

func (p *Popup) Redraw()

Redraw re-renders the popup widget into the popup buffer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL