Documentation
¶
Index ¶
- Constants
- Variables
- func TextExtents(text string, f Fontable) (*xproto.QueryTextExtentsReply, error)
- type Display
- func (d *Display) ActiveWindow() *Window
- func (d *Display) Atom(aid xproto.Atom) string
- func (d *Display) DefaultScreen() *Screen
- func (d *Display) FindWindow(wid uint32) (*Window, error)
- func (d *Display) FontOpen(pattern string) (*Font, error)
- func (d *Display) Name() string
- func (d *Display) NewGraphicsContext(components ...GraphicsContextComponent) (*GraphicsContext, error)
- func (d *Display) NewWindow(operations ...WindowOperation) (*Window, error)
- func (d *Display) NumberOfDesktops() uint32
- func (d *Display) NumberOfScreens() int
- func (d *Display) Pointer() *DisplayPointer
- func (d *Display) Screens() []*Screen
- func (d *Display) Setup() *Setup
- type DisplayPointer
- type Drawable
- type Font
- type FontInfo
- type Fontable
- type GraphicsContext
- type GraphicsContextComponent
- type GraphicsContextComponents
- func (_ GraphicsContextComponents) BackgroundPixel(val uint32) GraphicsContextComponent
- func (_ GraphicsContextComponents) Font(font *Font) GraphicsContextComponent
- func (_ GraphicsContextComponents) ForegroundPixel(val uint32) GraphicsContextComponent
- func (_ GraphicsContextComponents) NewFont(pattern string) GraphicsContextComponent
- func (_ GraphicsContextComponents) NewFontIfMatch(pattern string) GraphicsContextComponent
- type Keyboard
- type KeyboardControll
- type Pixmap
- type PixmapDrawer
- type PixmapDrawers
- type PixmapOperation
- type PixmapOperations
- type Pointer
- func (p *Pointer) Control() *PointerControll
- func (p *Pointer) Display() *Display
- func (p *Pointer) MotionNotify(stop <-chan struct{}) <-chan xproto.MotionNotifyEvent
- func (p *Pointer) Screen() *Screen
- func (p *Pointer) Status() (PointerStatus, error)
- func (p *Pointer) String() string
- func (p *Pointer) Window() *Window
- type PointerControll
- func (c *PointerControll) ClickLeft() error
- func (c *PointerControll) ClickRight() error
- func (c *PointerControll) Display() *Display
- func (c *PointerControll) DownLeft() error
- func (c *PointerControll) DownRight() error
- func (c *PointerControll) Move(x, y int) error
- func (c *PointerControll) MoveRelative(x, y int) error
- func (c *PointerControll) Screen() *Screen
- func (c *PointerControll) ScrollDown() error
- func (c *PointerControll) ScrollUp() error
- func (c *PointerControll) UpLeft() error
- func (c *PointerControll) UpRight() error
- type PointerStatus
- type Screen
- func (s *Screen) Default() bool
- func (s *Screen) Display() *Display
- func (s *Screen) Id() int
- func (s *Screen) NewGraphicsContext(components ...GraphicsContextComponent) (*GraphicsContext, error)
- func (s *Screen) NewPixmap(size image.Point, operations ...PixmapOperation) (*Pixmap, error)
- func (s *Screen) NewPixmapFromImage(image image.Image, operations ...PixmapOperation) (*Pixmap, error)
- func (s *Screen) NewWindow(operations ...WindowOperation) (*Window, error)
- func (s *Screen) Window() *Window
- type Setup
- type Window
- func (w *Window) AttributesChange(attributes ...WindowAttribute) error
- func (w *Window) AttributesInfo() (*WindowAttributesInfo, error)
- func (w *Window) Children() ([]*Window, error)
- func (w *Window) Clear() error
- func (w *Window) CloseNotify(stop <-chan struct{}) (<-chan struct{}, error)
- func (w *Window) Destroy() error
- func (w *Window) Display() *Display
- func (w *Window) Drawable() xproto.Drawable
- func (w *Window) IsRoot() bool
- func (w *Window) IsVisible() bool
- func (w *Window) Keyboard() *Keyboard
- func (w *Window) Map() error
- func (w *Window) MoveResize(bounds image.Rectangle) error
- func (w *Window) Name() string
- func (w *Window) Operations(operations ...WindowOperation) error
- func (w *Window) Parent() (*Window, error)
- func (w *Window) Parents() ([]*Window, error)
- func (w *Window) Pointer() *Pointer
- func (w *Window) Protocols() ([]string, error)
- func (w *Window) ProtocolsSet(protocols []string) error
- func (w *Window) Resize(size image.Point) error
- func (w *Window) Screen() *Screen
- func (w *Window) String() string
- type WindowAttribute
- type WindowAttributes
- type WindowAttributesInfo
- type WindowOperation
- type WindowOperations
Constants ¶
const ( IsUnmapped = xproto.MapStateUnmapped IsUnviewable = xproto.MapStateUnviewable IsViewable = xproto.MapStateViewable )
const ( SizeReqestMax = (1 << 16) * 4 SizeRequestPutImageFixedPart = 24 )
Variables ¶
var (
DEBUG bool = os.Getenv("XGO_DEBUG") != ""
)
Functions ¶
func TextExtents ¶
func TextExtents(text string, f Fontable) (*xproto.QueryTextExtentsReply, error)
TODO? return non xproto result?
Types ¶
type Display ¶
Display instance.
func OpenDisplay ¶
Creates a new Display instance.
Parameter d contains display name, such as ":0". If empty, it uses the environment variable DISPLAY.
returns nil on failure
func (*Display) ActiveWindow ¶
func (*Display) DefaultScreen ¶
func (*Display) NewGraphicsContext ¶
func (d *Display) NewGraphicsContext(components ...GraphicsContextComponent) (*GraphicsContext, error)
Creates GraphicsContext on default screen. Calls Display.Screen().NewGraphicsContext.
func (*Display) NewWindow ¶
func (d *Display) NewWindow(operations ...WindowOperation) (*Window, error)
Calls NewWindow on default screen
func (*Display) NumberOfDesktops ¶
func (*Display) NumberOfScreens ¶
func (*Display) Pointer ¶
func (d *Display) Pointer() *DisplayPointer
type DisplayPointer ¶
type DisplayPointer struct {
// contains filtered or unexported fields
}
func (*DisplayPointer) Status ¶
func (p *DisplayPointer) Status() (PointerStatus, error)
type Font ¶
Font allocated on display
func OpenFontOnDisplay ¶
Opens font with pattern on provided display. If you don't want to use the font anymore, use Close method on it. On any error, the error is returned
func (*Font) TextExtents ¶
func (f *Font) TextExtents(text string) (*xproto.QueryTextExtentsReply, error)
type FontInfo ¶
type FontInfo struct { *xproto.QueryFontReply // contains filtered or unexported fields }
TODO timestamps for all X replies
func FontQuery ¶
Returns font information for Fontable structures, or error if some troubles. Current Fontables are: *Font, *GraphicsContext
func (*FontInfo) Properties ¶
type GraphicsContext ¶
func NewGraphicsContextOnDisplay ¶
func NewGraphicsContextOnDisplay(d *Display, drawable Drawable, components ...GraphicsContextComponent) (resultGc *GraphicsContext, resultErr error)
Create and allocate graphics context on display with drawable root and depth using provided components Returned graphical context can be used with any destination drawable having the same root and depthe. Use with other drawables results in a BadMatch error.
func (*GraphicsContext) Display ¶
func (gc *GraphicsContext) Display() *Display
func (*GraphicsContext) FontInfo ¶
func (gc *GraphicsContext) FontInfo() (*FontInfo, error)
func (*GraphicsContext) Fontable ¶
func (gc *GraphicsContext) Fontable() xproto.Fontable
func (*GraphicsContext) Free ¶
func (gc *GraphicsContext) Free() error
func (*GraphicsContext) TextExtents ¶
func (gc *GraphicsContext) TextExtents(text string) (*xproto.QueryTextExtentsReply, error)
type GraphicsContextComponent ¶
type GraphicsContextComponent func(gc *GraphicsContext) (map[uint32]uint32, error)
type GraphicsContextComponents ¶
type GraphicsContextComponents struct{}
func (GraphicsContextComponents) BackgroundPixel ¶
func (_ GraphicsContextComponents) BackgroundPixel(val uint32) GraphicsContextComponent
func (GraphicsContextComponents) Font ¶
func (_ GraphicsContextComponents) Font(font *Font) GraphicsContextComponent
func (GraphicsContextComponents) ForegroundPixel ¶
func (_ GraphicsContextComponents) ForegroundPixel(val uint32) GraphicsContextComponent
func (GraphicsContextComponents) NewFont ¶
func (_ GraphicsContextComponents) NewFont(pattern string) GraphicsContextComponent
Opens first font matching pattern an assigns to graphics context, if used in graphics context creation or editing. Font is closed upon graphics context freeing, or graphics contexts font beeing updated (eg. with this component again).
func (GraphicsContextComponents) NewFontIfMatch ¶
func (_ GraphicsContextComponents) NewFontIfMatch(pattern string) GraphicsContextComponent
Opens first font matching pattern, if there is any and assigns it to graphics context, If font does not exist, previous is kept, or if there is no previous, default is used. if used in graphics context creation or editing. Font is closed upon graphics context freeing, or graphics contexts font beeing updated (eg. with this component again).
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
func (*Keyboard) Control ¶
func (k *Keyboard) Control() *KeyboardControll
func (*Keyboard) MappingAll ¶
func (k *Keyboard) MappingAll() *xproto.GetKeyboardMappingReply
type KeyboardControll ¶
type KeyboardControll struct {
// contains filtered or unexported fields
}
func (*KeyboardControll) Display ¶
func (c *KeyboardControll) Display() *Display
func (*KeyboardControll) Screen ¶
func (c *KeyboardControll) Screen() *Screen
func (*KeyboardControll) String ¶
func (c *KeyboardControll) String() string
func (*KeyboardControll) Write ¶
func (c *KeyboardControll) Write(s string) error
type Pixmap ¶
type Pixmap struct { xproto.Pixmap Size image.Point Depth byte // contains filtered or unexported fields }
func NewPixmapFromImageOnScreen ¶
func NewPixmapFromImageOnScreen(scr *Screen, img image.Image, operations ...PixmapOperation) (*Pixmap, error)
Allocate new pixmap in X on screen, with screen default depth and size of the image Then draws the image to pixmap and applies all pixmap operations. If there is an error along somewhere, pixmap is destroyed and the first occuring error is returned This is an shortcut for: NewPixmapOnScreen(
scr, image.Pt(img.Bounds().Dx(),img.Bounds().Dy()), PixmapOperations{}.DrawImage(img), options..., )
func NewPixmapOnScreen ¶
Allocate new pixmap in X on screen, with screen default depth and provided size Then applies all pixmap operations. If there is an error along somewhere, pixmap is destroyed and the first occuring error is returned
func (*Pixmap) Draw ¶
func (p *Pixmap) Draw(drawers ...PixmapDrawer) error
TODO implement all xproto draw functions TODO theese draw operations shoul be not only for pixmap, but all drawable objects (which are they???)
if err := xproto.PolyLineChecked( d.Conn, xproto.CoordModeOrigin, xproto.Drawable(pixmapId), gc, []xproto.Point{xproto.Point{0, 0}, xproto.Point{100, 100}, xproto.Point{0, 100}}, ).Check(); err != nil { fmt.Printf("Unable draw line: %v\n", err) return } fmt.Println("line draw") }
Uses all draw functions in order. Stops on first encountered error and returns it.
type PixmapDrawers ¶
type PixmapDrawers struct{}
func (PixmapDrawers) Image ¶
func (pd PixmapDrawers) Image(img image.Image) PixmapDrawer
Draws image "img" to pixmap, so top-left corner of image "img.Bounds().Min" is at point [0,0].
func (PixmapDrawers) ImageAt ¶
func (_ PixmapDrawers) ImageAt(img image.Image, pt image.Point) PixmapDrawer
Draws image "img" to pixmap, so top-left corner of image "img.Bounds().Min" is at point "pt".
func (PixmapDrawers) Text ¶
func (_ PixmapDrawers) Text(text string, position image.Point, gc *GraphicsContext) PixmapDrawer
type PixmapOperation ¶
type PixmapOperations ¶
type PixmapOperations struct{}
func (PixmapOperations) Draw ¶
func (_ PixmapOperations) Draw(drawers ...PixmapDrawer) PixmapOperation
type Pointer ¶
type Pointer struct {
// contains filtered or unexported fields
}
func (*Pointer) Control ¶
func (p *Pointer) Control() *PointerControll
func (*Pointer) MotionNotify ¶
func (p *Pointer) MotionNotify(stop <-chan struct{}) <-chan xproto.MotionNotifyEvent
func (*Pointer) Status ¶
func (p *Pointer) Status() (PointerStatus, error)
type PointerControll ¶
type PointerControll struct {
// contains filtered or unexported fields
}
func (*PointerControll) ClickLeft ¶
func (c *PointerControll) ClickLeft() error
func (*PointerControll) ClickRight ¶
func (c *PointerControll) ClickRight() error
func (*PointerControll) Display ¶
func (c *PointerControll) Display() *Display
func (*PointerControll) DownLeft ¶
func (c *PointerControll) DownLeft() error
func (*PointerControll) DownRight ¶
func (c *PointerControll) DownRight() error
func (*PointerControll) Move ¶
func (c *PointerControll) Move(x, y int) error
func (*PointerControll) MoveRelative ¶
func (c *PointerControll) MoveRelative(x, y int) error
func (*PointerControll) Screen ¶
func (c *PointerControll) Screen() *Screen
func (*PointerControll) ScrollDown ¶
func (c *PointerControll) ScrollDown() error
func (*PointerControll) ScrollUp ¶
func (c *PointerControll) ScrollUp() error
func (*PointerControll) UpLeft ¶
func (c *PointerControll) UpLeft() error
func (*PointerControll) UpRight ¶
func (c *PointerControll) UpRight() error
type PointerStatus ¶
type Screen ¶
type Screen struct { *xproto.ScreenInfo // contains filtered or unexported fields }
Screen instance
func (*Screen) NewGraphicsContext ¶
func (s *Screen) NewGraphicsContext(components ...GraphicsContextComponent) (*GraphicsContext, error)
Creates GraphicsContext with this creens root window depth.
func (*Screen) NewPixmapFromImage ¶
func (s *Screen) NewPixmapFromImage(image image.Image, operations ...PixmapOperation) (*Pixmap, error)
Calls NewPixmapFromImageOnScreen on current screen
type Window ¶
func NewWindowOnScreen ¶
func NewWindowOnScreen(s *Screen, operations ...WindowOperation) (*Window, error)
Creates an unmapped input/output window on default screen with no initialization. Window size is [1,1], position is [0,0], border 0, with screen root depth and none (default?) attributes. Then applies all window operations. If there is an error along somewhere, window is destroyed and the first occuring error is returned
func (*Window) AttributesChange ¶
func (w *Window) AttributesChange(attributes ...WindowAttribute) error
Applies attributes to window. If duplicate attributes provided, error is produced. The attributes are not applied in provided order and are allways sorted by mask of the attribute. eg. if you use BackgroundPixelColor and BackgroundPixmap, it will not show the pixmap on background, because mask for BackgroundPixelColor has greater value than BackgroundPixmap and will com after. So every time the last background operation is BackgroundPixelColor. See WindowAttributes struct and underlying xproto.Cw... costants for mask value info TODO? or should I return error if background is set twice, or any other alike situations?
func (*Window) AttributesInfo ¶
func (w *Window) AttributesInfo() (*WindowAttributesInfo, error)
func (*Window) Clear ¶
Paints a rectangular area in the window with the window's background pixel or pixmap. If the window has a defined background tile, the rectangle clipped by any children is filled with this tile. If the window has background None, the contents of the window are not changed.
func (*Window) CloseNotify ¶
func (*Window) MoveResize ¶
Makes a ConfigRequest, to alter position and size. Returns error if something is wrong
func (*Window) Operations ¶
func (w *Window) Operations(operations ...WindowOperation) error
func (*Window) ProtocolsSet ¶
type WindowAttribute ¶
type WindowAttributes ¶
type WindowAttributes struct{}
func (WindowAttributes) BackgroundPixelColor ¶
func (_ WindowAttributes) BackgroundPixelColor(col color.Color) WindowAttribute
TODO CwBorderPixmap, CwBorderPixel, CwBitGravity, CwWinGravity, CwBackingStore, CwBackingPlanes, CwBackingPixel, CwOverrideRedirect , CwSaveUnder, CwEventMask, CwDontPropagate, CwColormap, CwCursor
func (WindowAttributes) BackgroundPixmap ¶
func (_ WindowAttributes) BackgroundPixmap(pixmap *Pixmap) WindowAttribute
type WindowAttributesInfo ¶
type WindowAttributesInfo struct { *xproto.GetWindowAttributesReply // contains filtered or unexported fields }
type WindowOperation ¶
type WindowOperations ¶
type WindowOperations struct{}
func (WindowOperations) Attributes ¶
func (_ WindowOperations) Attributes(attributes ...WindowAttribute) WindowOperation
func (WindowOperations) Clear ¶
func (_ WindowOperations) Clear() WindowOperation
func (WindowOperations) Map ¶
func (_ WindowOperations) Map() WindowOperation
func (WindowOperations) Size ¶
func (_ WindowOperations) Size(size image.Point) WindowOperation
TODO ConfigWindowX, ConfigWindowY, ConfigWindowBorderWidth, ConfigWindowSibling, ConfigWindowStackMode,
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
activeWindow
Prints active window's parents and children for default screeen.
|
Prints active window's parents and children for default screeen. |
windowTree
Prints visible named window tree for all screens.
|
Prints visible named window tree for all screens. |