From 48fb710f357a363cce043a9f546e8a4aff196786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 8 Sep 2018 19:39:28 +0200 Subject: [PATCH] nexgb: post-merge fixups and cleanups AUTHORS, CONTRIBUTORS: still useful, add people from git log, clean up. LICENSE: Google doesn't really grant you shit anymore. The EU doesn't have software patents either, so it doesn't affect me directly. README, doc.go: erase mentions of unmaintained xgbutil. --- nexgb/AUTHORS | 22 ++++++++---- nexgb/CONTRIBUTORS | 38 +++++++++----------- nexgb/LICENSE | 69 +++++++++++++++---------------------- nexgb/Makefile | 8 ++--- nexgb/README | 46 ++++++++++--------------- nexgb/STYLE | 8 ++--- nexgb/auth.go | 2 +- nexgb/conn.go | 4 +-- nexgb/cookie.go | 2 +- nexgb/doc.go | 28 +++++++-------- nexgb/help.go | 2 +- nexgb/sync.go | 2 +- nexgb/xgb.go | 2 +- nexgb/xgbgen/translation.go | 14 ++++---- 14 files changed, 111 insertions(+), 136 deletions(-) diff --git a/nexgb/AUTHORS b/nexgb/AUTHORS index 08fc0cd..49c10da 100644 --- a/nexgb/AUTHORS +++ b/nexgb/AUTHORS @@ -1,18 +1,26 @@ -Andrew Gallant is the maintainer of this fork. What follows is the original -list of authors for the x-go-binding. - -# This is the official list of XGB authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS files. +# This is the official list of neXGB authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS file. # See the latter for an explanation. # Names should be added to this file as # Name or Organization # The email address is not required for organizations. -# Please keep the list sorted. - Anthony Martin Firmansyah Adiputra Google Inc. Scott Lawrence Tor Andersson + +# The names above come from the original x-go-binding by Google. +# The following list pertains to BurntSushi/xgb and janouch.name/haven/nexgb: + +Andrew Gallant +Paul Sbarra +Axel Wagner +snyh +Alessandro Arzilli +fangyuanziti +Bryan Matsuo +Rabin Vincent +Přemysl Janouch diff --git a/nexgb/CONTRIBUTORS b/nexgb/CONTRIBUTORS index 46dc4b0..353c609 100644 --- a/nexgb/CONTRIBUTORS +++ b/nexgb/CONTRIBUTORS @@ -1,34 +1,17 @@ -Andrew Gallant is the maintainer of this fork. What follows is the original -list of contributors for the x-go-binding. - -# This is the official list of people who can contribute -# (and typically have contributed) code to the XGB repository. +# This is the official list of people who may have contributed +# code to the neXGB repository. +# # The AUTHORS file lists the copyright holders; this file # lists people. For example, Google employees are listed here # but not in AUTHORS, because Google holds the copyright. # -# The submission process automatically checks to make sure -# that people submitting code are listed in this file (by email address). -# -# Names should be added to this file only after verifying that -# the individual or the individual's organization has agreed to -# the appropriate Contributor License Agreement, found here: -# -# http://code.google.com/legal/individual-cla-v1.0.html -# http://code.google.com/legal/corporate-cla-v1.0.html -# -# The agreement for individuals can be filled out on the web. -# # When adding J Random Contributor's name to this file, # either J's name or J's organization's name should be -# added to the AUTHORS file, depending on whether the -# individual or corporate CLA was used. +# added to the AUTHORS file. # Names should be added to this file like so: # Name -# Please keep the list sorted. - Anthony Martin Firmansyah Adiputra Ian Lance Taylor @@ -37,3 +20,16 @@ Robert Griesemer Russ Cox Scott Lawrence Tor Andersson + +# The names above come from the original x-go-binding by Google. +# The following list pertains to BurntSushi/xgb and janouch.name/haven/nexgb: + +Andrew Gallant +Paul Sbarra +Axel Wagner +snyh +Alessandro Arzilli +fangyuanziti +Bryan Matsuo +Rabin Vincent +Přemysl Janouch diff --git a/nexgb/LICENSE b/nexgb/LICENSE index d99cd90..263d39d 100644 --- a/nexgb/LICENSE +++ b/nexgb/LICENSE @@ -1,42 +1,27 @@ -// Copyright (c) 2009 The XGB Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Subject to the terms and conditions of this License, Google hereby -// grants to You a perpetual, worldwide, non-exclusive, no-charge, -// royalty-free, irrevocable (except as stated in this section) patent -// license to make, have made, use, offer to sell, sell, import, and -// otherwise transfer this implementation of XGB, where such license -// applies only to those patent claims licensable by Google that are -// necessarily infringed by use of this implementation of XGB. If You -// institute patent litigation against any entity (including a -// cross-claim or counterclaim in a lawsuit) alleging that this -// implementation of XGB or a Contribution incorporated within this -// implementation of XGB constitutes direct or contributory patent -// infringement, then any patent licenses granted to You under this -// License for this implementation of XGB shall terminate as of the date -// such litigation is filed. +Copyright (c) 2009 The XGB Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nexgb/Makefile b/nexgb/Makefile index c0ee531..dda2f05 100644 --- a/nexgb/Makefile +++ b/nexgb/Makefile @@ -1,5 +1,5 @@ # This Makefile is used by the developer. It is not needed in any way to build -# a checkout of the XGB repository. +# a checkout of the neXGB repository. # It will be useful, however, if you are hacking at the code generator. # i.e., after making a change to the code generator, run 'make' in the # xgb directory. This will build xgbgen and regenerate each sub-package. @@ -14,7 +14,7 @@ ifndef XPROTO XPROTO=/usr/share/xcb endif -# All of the XML files in my /usr/share/xcb directory EXCEPT XKB. -_- +# All of the XML files in my /usr/share/xcb directory except XKB, Xinput, SYNC. # This is intended to build xgbgen and generate Go code for each supported # extension. all: build-xgbgen \ @@ -74,7 +74,3 @@ gofmt: gofmt -w *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go colcheck *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go -push: - git push origin master - git push github master - diff --git a/nexgb/README b/nexgb/README index c96a5fb..090f178 100644 --- a/nexgb/README +++ b/nexgb/README @@ -1,26 +1,28 @@ -XGB is the X Go Binding, which is a low-level API to communicate with the -core X protocol and many of the X extensions. It is closely modeled after -XCB and xpyb. +neXGB is a fork of a fork of the X Go Binding, which is a low-level API to +communicate with the core X protocol and many of the X extensions. +It is closely modelled after XCB and xpyb. It is thread safe and gets immediate improvement from parallelism when GOMAXPROCS > 1. (See the benchmarks in xproto/xproto_test.go for evidence.) Please see doc.go for more info. -Note that unless you know you need XGB, you can probably make your life -easier by using a slightly higher level library: xgbutil. +Quick usage +----------- + go get janouch.name/haven/nexgb + go run $GOPATH/src/janouch.name/haven/nexgb/examples/create-window/main.go -Quick Usage -=========== -go get github.com/BurntSushi/xgb -go run go/path/src/github.com/BurntSushi/xgb/examples/create-window/main.go +Přemysl Janouch's fork +---------------------- +I've merged BurntSushi/xgb into haven as a subdirectory due to a/ inactivity +upstream, and b/ intentions to make incompatible changes meant to be in sync +with the rest of the project. -BurntSushi's Fork -================= -I've forked the XGB repository from Google Code due to inactivty upstream. +It's Not Exactly XGB anymore. -Godoc documentation can be found here: -http://godoc.burntsushi.net/pkg/github.com/BurntSushi/xgb/ +BurntSushi's fork +----------------- +I've forked the XGB repository from Google Code due to inactivity upstream. Much of the code has been rewritten in an effort to support thread safety and multiple extensions. Namely, go_client.py has been thrown away in favor @@ -37,18 +39,8 @@ in tact. I suppose I can legitimately release xgbgen under the WTFPL. To be fair, it is at least as complex as XGB itself. *sigh* -What follows is the original README: - -XGB README -========== -XGB is the X protocol Go language Binding. - -It is the Go equivalent of XCB, the X protocol C-language Binding -(http://xcb.freedesktop.org/). - -Unless otherwise noted, the XGB source files are distributed +License +------- +Unless otherwise noted, the neXGB source files are distributed under the BSD-style license found in the LICENSE file. -Contributions should follow the same procedure as for the Go project: -http://golang.org/doc/contribute.html - diff --git a/nexgb/STYLE b/nexgb/STYLE index b827c3c..a7e933a 100644 --- a/nexgb/STYLE +++ b/nexgb/STYLE @@ -1,8 +1,8 @@ -I like to keep all my code to 80 columns or less. I have plenty of screen real -estate, but enjoy 80 columns so that I can have multiple code windows open side -to side and not be plagued by the ugly auto-wrapping of a text editor. +Keep all code to 80 columns or less. We, the maintainers, have plenty of screen +real estate, but enjoy 80 columns so that we can have multiple code windows +open side to side and not be plagued by the ugly auto-wrapping of a text editor. -If you don't oblige me, I will fix any patch you submit to abide 80 columns. +If you don't oblige us, we will fix any patch you submit to abide 80 columns. Note that this style restriction does not preclude gofmt, but introduces a few peculiarities. The first is that gofmt will occasionally add spacing (typically diff --git a/nexgb/auth.go b/nexgb/auth.go index ec51d10..d7272ff 100644 --- a/nexgb/auth.go +++ b/nexgb/auth.go @@ -1,4 +1,4 @@ -package xgb +package nexgb /* auth.go contains functions to facilitate the parsing of .Xauthority files. diff --git a/nexgb/conn.go b/nexgb/conn.go index 1b7d838..f9dfeec 100644 --- a/nexgb/conn.go +++ b/nexgb/conn.go @@ -1,4 +1,4 @@ -package xgb +package nexgb /* conn.go contains a couple of functions that do some real dirty work related @@ -138,7 +138,7 @@ func (c *Conn) dial(display string) error { } } - display = display[colonIdx+1 : len(display)] + display = display[colonIdx+1:] if len(display) == 0 { return errors.New("bad display string: " + display0) } diff --git a/nexgb/cookie.go b/nexgb/cookie.go index d5cdb29..2f0d2f2 100644 --- a/nexgb/cookie.go +++ b/nexgb/cookie.go @@ -1,4 +1,4 @@ -package xgb +package nexgb import ( "errors" diff --git a/nexgb/doc.go b/nexgb/doc.go index 64540e9..a587d4c 100644 --- a/nexgb/doc.go +++ b/nexgb/doc.go @@ -1,16 +1,14 @@ /* -Package XGB provides the X Go Binding, which is a low-level API to communicate +Package nexgb provides the X Go Binding, which is a low-level API to communicate with the core X protocol and many of the X extensions. It is *very* closely modeled on XCB, so that experience with XCB (or xpyb) is -easily translatable to XGB. That is, it uses the same cookie/reply model +easily translatable to neXGB. That is, it uses the same cookie/reply model and is thread safe. There are otherwise no major differences (in the API). -Most uses of XGB typically fall under the realm of window manager and GUI kit +Most uses of neXGB typically fall under the realm of window manager and GUI kit development, but other applications (like pagers, panels, tilers, etc.) may -also require XGB. Moreover, it is a near certainty that if you need to work -with X, xgbutil will be of great use to you as well: -https://github.com/BurntSushi/xgbutil +also require neXGB. Example @@ -106,13 +104,13 @@ can be found in examples/xinerama. Parallelism -XGB can benefit greatly from parallelism due to its concurrent design. For +neXGB can benefit greatly from parallelism due to its concurrent design. For evidence of this claim, please see the benchmarks in xproto/xproto_test.go. Tests xproto/xproto_test.go contains a number of contrived tests that stress -particular corners of XGB that I presume could be problem areas. Namely: +particular corners of neXGB that I presume could be problem areas. Namely: requests with no replies, requests with replies, checked errors, unchecked errors, sequence number wrapping, cookie buffer flushing (i.e., forcing a round trip every N requests made that don't have a reply), getting/setting properties @@ -120,12 +118,12 @@ and creating a window and listening to StructureNotify events. Code Generator -Both XCB and xpyb use the same Python module (xcbgen) for a code generator. XGB -(before this fork) used the same code generator as well, but in my attempt to -add support for more extensions, I found the code generator extremely difficult -to work with. Therefore, I re-wrote the code generator in Go. It can be found -in its own sub-package, xgbgen, of xgb. My design of xgbgen includes a rough -consideration that it could be used for other languages. +Both XCB and xpyb use the same Python module (xcbgen) for a code generator. +neXGB (before BurntSushi's fork) used the same code generator as well, but in my +attempt to add support for more extensions, I found the code generator extremely +difficult to work with. Therefore, I re-wrote the code generator in Go. It can +be found in its own sub-package, xgbgen, of xgb. My design of xgbgen includes a +rough consideration that it could be used for other languages. What works @@ -143,4 +141,4 @@ compiles, unlike XKB). I don't currently have any intention of getting XKB working, due to its complexity and my current mental incapacity to test it. */ -package xgb +package nexgb diff --git a/nexgb/help.go b/nexgb/help.go index f692442..e2a62ec 100644 --- a/nexgb/help.go +++ b/nexgb/help.go @@ -1,4 +1,4 @@ -package xgb +package nexgb /* help.go is meant to contain a rough hodge podge of functions that are mainly diff --git a/nexgb/sync.go b/nexgb/sync.go index 59d0de1..72f30b6 100644 --- a/nexgb/sync.go +++ b/nexgb/sync.go @@ -1,4 +1,4 @@ -package xgb +package nexgb // Sync sends a round trip request and waits for the response. // This forces all pending cookies to be dealt with. diff --git a/nexgb/xgb.go b/nexgb/xgb.go index 3d2c61f..64fc464 100644 --- a/nexgb/xgb.go +++ b/nexgb/xgb.go @@ -1,4 +1,4 @@ -package xgb +package nexgb import ( "errors" diff --git a/nexgb/xgbgen/translation.go b/nexgb/xgbgen/translation.go index d35fa88..62fe9db 100644 --- a/nexgb/xgbgen/translation.go +++ b/nexgb/xgbgen/translation.go @@ -1,15 +1,15 @@ package main /* - translation.go provides a 'Translate' method on every XML type that converts - the XML type into our "better" representation. +translation.go provides a 'Translate' method on every XML type that converts +the XML type into our "better" representation. - i.e., the representation of Fields and Expressions is just too general. - We end up losing a lot of the advantages of static typing if we keep - the types that encoding/xml forces us into. +i.e., the representation of Fields and Expressions is just too general. +We end up losing a lot of the advantages of static typing if we keep +the types that encoding/xml forces us into. - Please see 'representation.go' for the type definitions that we're - translating to. +Please see 'representation.go' for the type definitions that we're +translating to. */ import (