Skip to content

Commit 08f3376

Browse files
committed
gofmt
1 parent 09f64e5 commit 08f3376

File tree

34 files changed

+273
-273
lines changed

34 files changed

+273
-273
lines changed

_examples/compress-events/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ MotionNotify events by displaying two windows that listen for MotionNotify
99
events. The green window compresses them while the red window does not.
1010
Hovering over each window will print the x and y positions in each
1111
MotionNotify event received. You should notice that the red window
12-
lags behind the pointer (particularly if you moved the pointer quickly in
13-
and out of the window) while the green window always keeps up, regardless
12+
lags behind the pointer (particularly if you moved the pointer quickly in
13+
and out of the window) while the green window always keeps up, regardless
1414
of the speed of the pointer.
1515
1616
In each case, we simulate work by sleeping for some amount of time. (The
@@ -33,8 +33,8 @@ compressed events in the usual way.)
3333
N.B. This functionality isn't included in xgbutil because event compression
3434
isn't something that is always desirable, and the conditions under which
3535
compression happens can vary. In particular, compressing ConfigureRequest
36-
events from the perspective of the window manager can be faulty, since
37-
changes to other properties (like WM_NORMAL_HINTS) can change the semantics
36+
events from the perspective of the window manager can be faulty, since
37+
changes to other properties (like WM_NORMAL_HINTS) can change the semantics
3838
of a ConfigureRequest event. (i.e., your compression would need to
3939
specifically look for events that could change future ConfigureRequest
4040
events.)
@@ -83,7 +83,7 @@ func newWindow(X *xgbutil.XUtil, color uint32) *xwindow.Window {
8383
// queue for any future MotionNotify events that can be received without
8484
// blocking. The most recent MotionNotify event is then returned.
8585
// Note that we need to make sure that the Event, Child, Detail, State, Root
86-
// and SameScreen fields are the same to ensure the same window/action is
86+
// and SameScreen fields are the same to ensure the same window/action is
8787
// generating events. That is, we are only compressing the RootX, RootY,
8888
// EventX and EventY fields.
8989
// This function is not thread safe, since Peek returns a *copy* of the

_examples/pointer-painting/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ func main() {
239239

240240
// midRect takes an (x, y) position where the pointer was clicked, along with
241241
// the width and height of the thing being drawn and the width and height of
242-
// the canvas, and returns a Rectangle whose midpoint (roughly) is (x, y) and
243-
// whose width and height match the parameters when the rectangle doesn't
244-
// extend past the border of the canvas. Make sure to check if the rectange is
242+
// the canvas, and returns a Rectangle whose midpoint (roughly) is (x, y) and
243+
// whose width and height match the parameters when the rectangle doesn't
244+
// extend past the border of the canvas. Make sure to check if the rectange is
245245
// empty or not before using it!
246246
func midRect(x, y, width, height, canWidth, canHeight int) image.Rectangle {
247247
return image.Rect(

_examples/screenshot/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ func main() {
3434
ximg.XShowExtra("Screenshot", true)
3535

3636
// If you'd like to save it as a png, use:
37-
// err = ximg.SavePng("screenshot.png")
38-
// if err != nil {
39-
// log.Fatal(err)
40-
// }
37+
// err = ximg.SavePng("screenshot.png")
38+
// if err != nil {
39+
// log.Fatal(err)
40+
// }
4141

4242
xevent.Main(X)
4343
}

_examples/simple-mousebinding/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func main() {
4444
// See the documentation for the Connect method for more details.
4545
err = cb1.Connect(X, X.RootWin(), "Mod4-1", false, true)
4646

47-
// A mouse binding can fail if the mouse string could not be parsed, or if
48-
// you're trying to bind a button that has already been grabbed by another
47+
// A mouse binding can fail if the mouse string could not be parsed, or if
48+
// you're trying to bind a button that has already been grabbed by another
4949
// client.
5050
if err != nil {
5151
log.Fatal(err)

_examples/window-gradient/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func paintGradient(X *xgbutil.XUtil, wid xproto.Window, width, height int,
135135
// at which ConfigureNotify events are sent to us, thereby creating a "lag".
136136
// Compression works by examining the "future" of the event queue, and skipping
137137
// ahead to the most recent ConfigureNotify event and throwing away the rest.
138-
//
138+
//
139139
// A more detailed treatment of event compression can be found in
140140
// xgbutil/examples/compress-events.
141141
func compressConfigureNotify(X *xgbutil.XUtil,

doc.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
Package xgbutil is a utility library designed to make common tasks with the X
3-
server easier. The central design choice that has driven development is to hide
2+
Package xgbutil is a utility library designed to make common tasks with the X
3+
server easier. The central design choice that has driven development is to hide
44
the complexity of X wherever possible but expose it when necessary.
55
6-
For example, the xevent package provides an implementation of an X event loop
7-
that acts as a dispatcher to event handlers set up with the xevent, keybind and
8-
mousebind packages. At the same time, the event queue is exposed and can be
6+
For example, the xevent package provides an implementation of an X event loop
7+
that acts as a dispatcher to event handlers set up with the xevent, keybind and
8+
mousebind packages. At the same time, the event queue is exposed and can be
99
modified using xevent.Peek and xevent.DequeueAt.
1010
1111
Sub-packages
1212
13-
The xgbutil package is considerably small, and only contains some type
14-
definitions and the initial setup for an X connection. Much of the
15-
functionality of xgbutil comes from its sub-packages. Each sub-package is
13+
The xgbutil package is considerably small, and only contains some type
14+
definitions and the initial setup for an X connection. Much of the
15+
functionality of xgbutil comes from its sub-packages. Each sub-package is
1616
appropriately documented.
1717
1818
Installation
@@ -34,33 +34,33 @@ A quick example to demonstrate that xgbutil is working correctly:
3434
go get github.com/BurntSushi/xgbutil/examples/window-name-sizes
3535
GO/PATH/bin/window-name-sizes
3636
37-
The output will be a list of names of all top-level windows and their geometry
38-
including window manager decorations. (Assuming your window manager supports
37+
The output will be a list of names of all top-level windows and their geometry
38+
including window manager decorations. (Assuming your window manager supports
3939
some basic EWMH properties.)
4040
4141
Examples
4242
43-
The examples directory contains a sizable number of examples demonstrating
44-
common tasks with X. They are intended to demonstrate a single thing each,
43+
The examples directory contains a sizable number of examples demonstrating
44+
common tasks with X. They are intended to demonstrate a single thing each,
4545
although a few that require setup are necessarily long. Each example is
4646
heavily documented.
4747
48-
The examples directory should be your first stop when learning how to use
48+
The examples directory should be your first stop when learning how to use
4949
xgbutil.
5050
51-
xgbutil is also used heavily throughout my window manager, Wingo. It may be
51+
xgbutil is also used heavily throughout my window manager, Wingo. It may be
5252
useful reference material.
5353
5454
Wingo project page: https://github.com/BurntSushi/wingo
5555
5656
Thread Safety
5757
58-
While I am fairly confident that XGB is thread safe, I am only somewhat
59-
confident that xgbutil is thread safe. It simply has not been tested enough for
58+
While I am fairly confident that XGB is thread safe, I am only somewhat
59+
confident that xgbutil is thread safe. It simply has not been tested enough for
6060
my confidence to be higher.
6161
62-
Note that the xevent package's X event loop is not concurrent. Namely,
63-
designing a generally concurrent X event loop is extremely complex. Instead,
62+
Note that the xevent package's X event loop is not concurrent. Namely,
63+
designing a generally concurrent X event loop is extremely complex. Instead,
6464
the onus is on you, the user, to design concurrent callback functions if
6565
concurrency is desired.
6666
*/

ewmh/doc.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Package ewmh provides a comprehensive API to get and set properties specified
33
by the EWMH spec, as well as perform actions specified by the EWMH spec.
44
5-
Since there are so many functions and they adhere to an existing spec,
5+
Since there are so many functions and they adhere to an existing spec,
66
this package file does not contain much documentation. Indeed, each
77
method has only a single comment associated with it: the EWMH property name.
88
@@ -14,10 +14,10 @@ Naming scheme
1414
1515
Using "_NET_ACTIVE_WINDOW" as an example,
1616
functions "ActiveWindowGet" and "ActiveWindowSet" get and set the
17-
property, respectively. Both of these functions exist for most EWMH
18-
properties. Additionally, some EWMH properties support sending a client
19-
message event to request the window manager to perform some action. In the
20-
case of "_NET_ACTIVE_WINDOW", this request is used to set the active
17+
property, respectively. Both of these functions exist for most EWMH
18+
properties. Additionally, some EWMH properties support sending a client
19+
message event to request the window manager to perform some action. In the
20+
case of "_NET_ACTIVE_WINDOW", this request is used to set the active
2121
window.
2222
2323
These sorts of functions end in "Req". So for "_NET_ACTIVE_WINDOW",
@@ -38,7 +38,7 @@ functions.)
3838
3939
For properties that store more than just a simple integer, name or list
4040
of integers, structs have been created and exposed to organize the
41-
information returned in a sensible manner. For example, the
41+
information returned in a sensible manner. For example, the
4242
"_NET_DESKTOP_GEOMETRY" property would typically return a slice of integers
4343
of length 2, where the first integer is the width and the second is the
4444
height. Xgbutil will wrap this in a struct with the obvious members. These

ewmh/ewmh.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ func WmSyncRequestExtra(xu *xgbutil.XUtil, win xproto.Window, reqNum uint64,
999999
low, high)
10001000
}
10011001

1002-
// _NET_WM_SYNC_REQUEST_COUNTER get
1002+
// _NET_WM_SYNC_REQUEST_COUNTER get
10031003
// I'm pretty sure this needs 64 bit integers, but I'm not quite sure
10041004
// how to go about that yet. Any ideas?
10051005
func WmSyncRequestCounter(xu *xgbutil.XUtil, win xproto.Window) (uint, error) {

icccm/doc.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*
22
Package icccm provides an API for a portion of the ICCCM, namely, getters
3-
and setters for many of the properties specified in the ICCCM. There is also a
4-
smattering of support for other protocols specified by ICCCM. For example, to
3+
and setters for many of the properties specified in the ICCCM. There is also a
4+
smattering of support for other protocols specified by ICCCM. For example, to
55
satisfy the WM_DELETE_WINDOW protocol, package icccm provides 'IsDeleteProtocol'
66
which returns whether a ClientMessage event satisfies the WM_DELETE_WINDOW
77
protocol.
88
9-
If a property has values that aren't simple strings or integers, struct types
9+
If a property has values that aren't simple strings or integers, struct types
1010
are provided to organize the data. In particular, WM_NORMAL_HINTS and WM_HINTS.
1111
1212
Also note that properties like WM_NORMAL_HINTS and WM_HINTS contain a 'Flags'
13-
field (a bit mask) that specifies which values are "active". This is of
14-
importance when setting and reading WM_NORMAL_HINTS and WM_HINTS; one must make
13+
field (a bit mask) that specifies which values are "active". This is of
14+
importance when setting and reading WM_NORMAL_HINTS and WM_HINTS; one must make
1515
sure the appropriate bit is set in Flags.
1616
17-
For example, you might want to check if a window has specified a resize
17+
For example, you might want to check if a window has specified a resize
1818
increment in the WM_NORMAL_HINTS property. The values in the corresponding
19-
NormalHints struct are WidthInc and HeightInc. So to check if such values exist
19+
NormalHints struct are WidthInc and HeightInc. So to check if such values exist
2020
*and* should be used:
2121
2222
normalHints, err := icccm.WmNormalHintsGet(XUtilValue, window-id)
@@ -29,13 +29,13 @@ NormalHints struct are WidthInc and HeightInc. So to check if such values exist
2929
3030
When you should use icccm
3131
32-
Although the ICCCM is extremely old, a lot of it is still used. In fact, the
33-
EWMH spec itself specifically states that the ICCCM should still be used unless
34-
otherwise noted by the EWMH. For example, WM_HINTS and WM_NORMAL_HINTS are
32+
Although the ICCCM is extremely old, a lot of it is still used. In fact, the
33+
EWMH spec itself specifically states that the ICCCM should still be used unless
34+
otherwise noted by the EWMH. For example, WM_HINTS and WM_NORMAL_HINTS are
3535
still used, but _NET_WM_NAME replaces WM_NAME.
3636
37-
With that said, many applications (like xterm or LibreOffice) have not been
38-
updated to be fully EWMH compliant. Therefore, code that finds a window's name
37+
With that said, many applications (like xterm or LibreOffice) have not been
38+
updated to be fully EWMH compliant. Therefore, code that finds a window's name
3939
often looks like this:
4040
4141
winName, err := ewmh.WmNameGet(XUtilValue, window-id)
@@ -53,8 +53,8 @@ Naming scheme
5353
5454
The naming scheme is precisely the same as the one found in the ewmh package.
5555
The documentation for the ewmh package describes the naming scheme in more
56-
detail. The only difference (currently) is that the icccm package only contains
57-
functions ending in "Get" and "Set". It is planned to add "Req" functions. (An
56+
detail. The only difference (currently) is that the icccm package only contains
57+
functions ending in "Get" and "Set". It is planned to add "Req" functions. (An
5858
example of a Req function would be to send a ClientMessage implementing the
5959
WM_DELETE_WINDOW protocol to a client window.)
6060
*/

keybind/doc.go

+24-24
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Package keybind provides an easy to use interface to assign callback functions
33
to human readable key sequences.
44
5-
Working with the X keyboard encoding is not an easy task, and the keybind
5+
Working with the X keyboard encoding is not an easy task, and the keybind
66
package attempts to encapsulate much of the complexity. Namely, the keybind
77
package exports two function types: KeyPressFun and KeyReleaseFun. Values of
88
these types are functions, and have a method called 'Connect' that attaches
@@ -44,30 +44,30 @@ shift---are pressed along with the 't' key.
4444
4545
When to issue a passive grab
4646
47-
One of the parameters of the 'Connect' method is whether to issue a passive
47+
One of the parameters of the 'Connect' method is whether to issue a passive
4848
grab or not. A passive grab is useful when you need to respond to a key press
49-
on some parent window (like the root window) without actually focusing that
50-
window. Not using a passive grab is useful when you only need to read key
49+
on some parent window (like the root window) without actually focusing that
50+
window. Not using a passive grab is useful when you only need to read key
5151
presses when the window is focused.
5252
5353
For more information on the semantics of passive grabs, please see
5454
http://tronche.com/gui/x/xlib/input/XGrabKey.html.
5555
56-
Also, by default, when issuing a grab on a particular (modifiers, keycode)
57-
tuple, several grabs are actually made. In particular, for each grab requested,
56+
Also, by default, when issuing a grab on a particular (modifiers, keycode)
57+
tuple, several grabs are actually made. In particular, for each grab requested,
5858
another grab is made with the "num lock" mask, another grab is made with the
59-
"caps lock" mask, and another grab is made with both the "num lock" and "caps
59+
"caps lock" mask, and another grab is made with both the "num lock" and "caps
6060
locks" masks. This allows key events to be reported regardless of whether
6161
caps lock or num lock is enabled.
6262
63-
The extra masks added can be modified by changing the xevent.IgnoreMods slice.
64-
If you modify xevent.IgnoreMods, it should be modified once on program startup
65-
(i.e., before any key or mouse bindings are established) and never modified
63+
The extra masks added can be modified by changing the xevent.IgnoreMods slice.
64+
If you modify xevent.IgnoreMods, it should be modified once on program startup
65+
(i.e., before any key or mouse bindings are established) and never modified
6666
again.
6767
6868
Key bindings on the root window example
6969
70-
To run a particular function whenever the 'Mod4-Control-Shift-t' key
70+
To run a particular function whenever the 'Mod4-Control-Shift-t' key
7171
combination is pressed (mod4 is typically the 'super' or 'windows' key, but can
7272
vary based on your system), use something like:
7373
@@ -83,8 +83,8 @@ window will only be reported when the root window has focus if no grab exists.
8383
8484
Key bindings on a window you create example
8585
86-
This code snippet attaches an event handler to some window you've created
87-
without using a grab. Thus, the function will only be activated when the key
86+
This code snippet attaches an event handler to some window you've created
87+
without using a grab. Thus, the function will only be activated when the key
8888
sequence is pressed and your window has focus.
8989
9090
keybind.Initialize(XUtilValue) // call once before using keybind package
@@ -95,23 +95,23 @@ sequence is pressed and your window has focus.
9595
9696
Run a function on all key press events example
9797
98-
This code snippet actually does *not* use the keybind package, but illustrates
99-
how the Key{Press,Release} event handlers in the xevent package can still be
100-
useful. Namely, the keybind package discriminates among events depending upon
101-
the key sequences pressed, whereas the xevent package is more general: it can
98+
This code snippet actually does *not* use the keybind package, but illustrates
99+
how the Key{Press,Release} event handlers in the xevent package can still be
100+
useful. Namely, the keybind package discriminates among events depending upon
101+
the key sequences pressed, whereas the xevent package is more general: it can
102102
only discriminate at the event level.
103103
104104
xevent.KeyPressFun(
105105
func(X *xgbutil.XUtil, ev xevent.KeyPressEvent) {
106106
// do something when any key is pressed
107107
}).Connect(XUtilValue, your-window-id)
108108
109-
This is the kind of handler you might use to capture all key press events.
110-
(i.e., if you have a text box for a user to type in.) Additionally, if you're
111-
using this sort of event handler, keybind.LookupString will probably be of some
112-
use. Its contract is that given a (modifiers, keycode) tuple
113-
(information found in all Key{Press,Release} events) it will return a string
114-
representation of the key pressed. We can modify the above example slightly to
109+
This is the kind of handler you might use to capture all key press events.
110+
(i.e., if you have a text box for a user to type in.) Additionally, if you're
111+
using this sort of event handler, keybind.LookupString will probably be of some
112+
use. Its contract is that given a (modifiers, keycode) tuple
113+
(information found in all Key{Press,Release} events) it will return a string
114+
representation of the key pressed. We can modify the above example slightly to
115115
echo the key pressed:
116116
117117
xevent.KeyPressFun(
@@ -122,7 +122,7 @@ echo the key pressed:
122122
123123
More examples
124124
125-
Complete working examples can be found in the examples directory of xgbutil. Of
125+
Complete working examples can be found in the examples directory of xgbutil. Of
126126
particular interest are probably 'keypress-english' and 'simple-keybinding'.
127127
128128
*/

keybind/encoding.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func ModifierString(mods uint16) string {
7070
}
7171

7272
// KeyMatch returns true if a string representation of a key can
73-
// be matched (case insensitive) to the (modifiers, keycode) tuple provided.
73+
// be matched (case insensitive) to the (modifiers, keycode) tuple provided.
7474
// String representations can be found in keybind/keysymdef.go
7575
func KeyMatch(xu *xgbutil.XUtil,
7676
keyStr string, mods uint16, keycode xproto.Keycode) bool {

0 commit comments

Comments
 (0)