Wayland implementation in Go

Related tags

Editor go-wayland
Overview

Wayland implementation in Go

Go Reference

This module contains pure Go implementation of the Wayland protocol. Currently only wayland-client functionality is supported.

Go code is generated from protocol XML files using go-wayland-scanner.

To load cursor, minimal port of wayland-cursor & xcursor in pure Go is located at cursor & cursor/xcursor respectively.

To demonstrate the functionality of this module examples/imageviewer contains a simple image viewer. It demos displaying a top-level window, resizing of window, cursor themes, pointer & keyboard. Because it's in pure Go, it can be compiled without CGO. You can try it using following commands:

CGO_ENABLED=0 go install github.com/rajveermalviya/go-wayland/examples/[email protected]

imageviewer file.jpg
You might also like...
OAuth 1.0a implementation in Go

Package oauth1a Summary An implementation of OAuth 1.0a in Go1. API reference Installing Run: go get github.com/kurrik/oauth1a Include in your source

OAuth 1.0 implementation in go (golang).

OAuth 1.0 Library for Go (If you need an OAuth 2.0 library, check out: https://godoc.org/golang.org/x/oauth2) Developing your own apps, with this libr

A golang implementation of a console-based trading bot for cryptocurrency exchanges
A golang implementation of a console-based trading bot for cryptocurrency exchanges

Golang Crypto Trading Bot A golang implementation of a console-based trading bot for cryptocurrency exchanges. Usage Download a release or directly bu

Pure Go termbox implementation

IMPORTANT This library is somewhat not maintained anymore. But I'm glad that it did what I wanted the most. It moved people away from "ncurses" mindse

go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config

HOCON (Human-Optimized Config Object Notation) Configuration library for working with the Lightbend's HOCON format. HOCON is a human-friendly JSON sup

Go implementation of the XDG Base Directory Specification and XDG user directories

xdg Provides an implementation of the XDG Base Directory Specification. The specification defines a set of standard paths for storing application file

Native LZO implementation in Go

go-lzo Native LZO1X implementation in Golang This code has been written using the original LZO1X source code as a reference, to study and understand t

Go implementation of BLAKE2 (b) cryptographic hash function (optimized for 64-bit platforms).

Go implementation of BLAKE2b collision-resistant cryptographic hash function created by Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, an

An implementation of JOSE standards (JWE, JWS, JWT) in Go

Go JOSE Package jose aims to provide an implementation of the Javascript Object Signing and Encryption set of standards. This includes support for JSO

Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein.

SipHash (Go) Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein (http://131002.net/sip

Go implementation of Count-Min-Log

Count-Min-Log Count-Min-Log sketch: Approximately counting with approximate counters - Guillaume Pitel & Geoffroy Fouquier TL;DR: Count-Min-Log Sketch

A Go implementation of the Elias-Fano encoding

go-ef A Go implementation of the Elias-Fano encoding Example package main import ( "fmt" "github.com/amallia/go-ef" "os" ) func main() {

Set is a useful collection but there is no built-in implementation in Go lang.

goset Set is a useful collection but there is no built-in implementation in Go lang. Why? The only one pkg which provides set operations now is golang

A skip list implementation in Go

About This is a library implementing skip lists for the Go programming language (http://golang.org/). Skip lists are a data structure that can be used

Go implementation of C++ STL iterators and algorithms.

iter Go implementation of C++ STL iterators and algorithms. Less hand-written loops, more expressive code. README translations: 简体中文 Motivation Althou

Go implementation to calculate Levenshtein Distance.

levenshtein Go package to calculate the Levenshtein Distance The library is fully capable of working with non-ascii strings. But the strings are not n

A Merkle Tree implementation written in Go.
A Merkle Tree implementation written in Go.

Merkle Tree in Golang An implementation of a Merkle Tree written in Go. A Merkle Tree is a hash tree that provides an efficient way to verify the cont

A prefix tree implementation in go

Trie (Prefix tree) This library is compatible with Go 1.11+ Please refer to CHANGELOG.md if you encounter breaking changes. Motivation Introduction Us

Package ring provides a high performance and thread safe Go implementation of a bloom filter.

ring - high performance bloom filter Package ring provides a high performance and thread safe Go implementation of a bloom filter. Usage Please see th

Comments
  • go-wayland-scanner generates invalid closure pointer comparison code

    go-wayland-scanner generates invalid closure pointer comparison code

    Currently, go-wayland-scanner generates a piece of code that uses reflect to get the pointer of a Go closure to compare its value with existing closures added inside a registry, like so:

    https://github.com/rajveermalviya/go-wayland/blob/5ab8266fceaf345964f7f5aafb37da467149d867/cmd/go-wayland-scanner/scanner.go#L624

    This piece of code depends on an implementation detail that may not necessarily be correct in all cases, which is why Go doesn't allow comparing closures in the first place.

    To fix this, I propose adding a new github.com/rajveermalviya/go-wayland/wayland/utils/handler package that contains specific structures to hold closures and allow removing them using a callback.

    Package handler should expose a public API that looks roughly like this pseudocode:

    package handler
    
    // Registry implements a registry of function handlers. All its methods are
    // concurrently safe.
    type Registry struct {
    	mu sync.Mutex
    	// any implementation
    }
    
    // Add adds the given function value into the registry and returns a function
    // that removes the given function from the registry.
    func (r *Registry) Add(fn interface{}) (remove func())
    

    The generated code could then look like this:

    // AddConfigureHandler : adds handler for SurfaceConfigureEvent
    func (i *Surface) AddConfigureHandler(f SurfaceConfigureHandlerFunc) (remove func()) {
    	if f == nil {
    		return
    	}
    
    	return i.configureHandlers.Add(f)
    }
    

    Package handler can be implemented in multiple ways. One way would be to wrap the closure inside a boxed struct and use its pointer as the key to a map:

    type Registry struct {
    	mu sync.Mutex
    	h  map[*box]struct{}
    }
    
    type box struct {
    	v interface{}
    }
    
    func (r *Registry) Add(fn interface{}) func() {
    	v := &box{fn}
    
    	r.mu.Lock()
    	r.h[v] = struct{}{}
    	r.mu.Unlock()
    
    	return func() {
    		r.mu.Lock()
    		delete(r.h, v)
    		r.mu.Unlock()
    	}
    }
    

    While this is the simplest way to implement handler, it might be fairly costly on the garbage collector, since an extra heap pointer will be made for each closure added, and if the user removes closures a lot, the garbage collector will likely spend a lot of time catching up to free the boxes.

    Another way that is slightly more complicated would be to use a free list, like what I have in diamondburned/arikawa/v3/utils/handler.

    opened by diamondburned 1
Owner
Rajveer Malviya
Rajveer Malviya
Wl-gammarelay - Wayland utility for changing color temperature using hotkeys

wl-gammarelay This utility was developed from gammastep, a fork of redshift as w

Jerko Steiner 21 Nov 20, 2022
Go language implementation of a blockchain based on the BDLS BFT protocol. The implementation was adapted from Ethereum and Sperax implementation

BDLS protocol based PoS Blockchain Most functionalities of this client is similar to the Ethereum golang implementation. If you do not find your quest

Yongge Wang 1 Oct 14, 2022
CVE-2021-4034 - A Golang implementation of clubby789's implementation of CVE-2021-4034

CVE-2021-4034 January 25, 2022 | An00bRektn This is a golang implementation of C

Ryan S. 10 Feb 3, 2022
An implementation of JOSE standards (JWE, JWS, JWT) in Go

Go JOSE Package jose aims to provide an implementation of the Javascript Object Signing and Encryption set of standards. This includes support for JSO

Square 2k Nov 22, 2022
goRBAC provides a lightweight role-based access control (RBAC) implementation in Golang.

goRBAC goRBAC provides a lightweight role-based access control implementation in Golang. For the purposes of this package: * an identity has one or mo

Xing 1.4k Nov 23, 2022
This is an implementation of JWT in golang!

jwt This is a minimal implementation of JWT designed with simplicity in mind. What is JWT? Jwt is a signed JSON object used for claims based authentic

John Rowley 99 Oct 25, 2022
Golang implementation of JSON Web Tokens (JWT)

jwt-go A go (or 'golang' for search engine friendliness) implementation of JSON Web Tokens NEW VERSION COMING: There have been a lot of improvements s

Dave Grijalva 10.5k Nov 22, 2022
Platform-Agnostic Security Tokens implementation in GO (Golang)

Golang implementation of PASETO: Platform-Agnostic Security Tokens This is a 100% compatible pure Go (Golang) implementation of PASETO tokens. PASETO

Oleg Lobanov 645 Nov 13, 2022
s3fs provides a S3 implementation for Go1.16 filesystem interface.

S3 FileSystem (fs.FS) implementation.Since S3 is a flat structure, s3fs simulates directories by using prefixes and "/" delim. ModTime on directories is always zero value.

Jacek Szwec 147 Nov 9, 2022
[NO LONGER MAINTAINED} oauth 2 server implementation in Go

hero hero is a feature rich oauth 2 server implementation in Go. Features User account management Client management oauth 2 rfc 6749 compliant Configu

Geofrey Ernest 213 Nov 18, 2022