Skip to content

Commit 31a4be5

Browse files
committed
add go mod support and gofmt code
1 parent ad855c7 commit 31a4be5

File tree

8 files changed

+44
-18
lines changed

8 files changed

+44
-18
lines changed

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
# Object files
2+
.DS_Store
3+
.vscode
4+
.idea
5+
6+
vendor
7+
18
*.swp
29
*.png
310
tst_first
411
tst_graphics
5-
TAGS
6-
12+
TAGS

_examples/pointer-painting/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ var (
3232
// The keys represent the key sequences that must be pressed to
3333
// switch to the color value.
3434
pencils = map[string]xgraphics.BGRA{
35-
"1": xgraphics.BGRA{0xff, 0xff, 0xff, 0xff}, // white
36-
"2": xgraphics.BGRA{0xff, 0x0, 0x0, 0xff}, // blue
37-
"3": xgraphics.BGRA{0x0, 0xff, 0x0, 0xff}, // green
38-
"4": xgraphics.BGRA{0x0, 0x0, 0xff, 0xff}, // red
39-
"5": xgraphics.BGRA{0x0, 0x7f, 0xff, 0xff}, // orange
40-
"6": xgraphics.BGRA{0xaa, 0x0, 0xff, 0x55}, // transparent pink
35+
"1": {0xff, 0xff, 0xff, 0xff}, // white
36+
"2": {0xff, 0x0, 0x0, 0xff}, // blue
37+
"3": {0x0, 0xff, 0x0, 0xff}, // green
38+
"4": {0x0, 0x0, 0xff, 0xff}, // red
39+
"5": {0x0, 0x7f, 0xff, 0xff}, // orange
40+
"6": {0xaa, 0x0, 0xff, 0x55}, // transparent pink
4141
}
4242

4343
// The current pencil color.

ewmh/ewmh.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func DesktopViewportGet(xu *xgbutil.XUtil) ([]DesktopViewport, error) {
233233
}
234234

235235
viewports := make([]DesktopViewport, len(coords)/2)
236-
for i, _ := range viewports {
236+
for i := range viewports {
237237
viewports[i] = DesktopViewport{
238238
X: int(coords[i*2]),
239239
Y: int(coords[i*2+1]),
@@ -770,7 +770,7 @@ func WmOpaqueRegionGet(xu *xgbutil.XUtil,
770770
}
771771

772772
regions := make([]WmOpaqueRegion, len(raw)/4)
773-
for i, _ := range regions {
773+
for i := range regions {
774774
regions[i] = WmOpaqueRegion{
775775
X: int(raw[i*4+0]),
776776
Y: int(raw[i*4+1]),
@@ -1133,7 +1133,7 @@ func WorkareaGet(xu *xgbutil.XUtil) ([]Workarea, error) {
11331133
}
11341134

11351135
workareas := make([]Workarea, len(rects)/4)
1136-
for i, _ := range workareas {
1136+
for i := range workareas {
11371137
workareas[i] = Workarea{
11381138
X: int(rects[i*4]),
11391139
Y: int(rects[i*4+1]),

go.mod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module github.com/robotn/xgbutil
2+
3+
go 1.13
4+
5+
require (
6+
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298
7+
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966
8+
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
9+
github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046
10+
)
11+
12+
replace github.com/BurntSushi/xgb => github.com/robotn/xgb v0.0.0-20190910151114-b250faa511c2

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 h1:1qlsVAQJXZHsaM8b6OLVo6muQUQd4CwkH/D3fnnbHXA=
2+
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298/go.mod h1:D+QujdIlUNfa0igpNMk6UIvlb6C252URs4yupRUV4lQ=
3+
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 h1:lTG4HQym5oPKjL7nGs+csTgiDna685ZXjxijkne828g=
4+
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966/go.mod h1:Mid70uvE93zn9wgF92A/r5ixgnvX8Lh68fxp9KQBaI0=
5+
github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046 h1:O/r2Sj+8QcMF7V5IcmiE2sMFV2q3J47BEirxbXJAdzA=
6+
github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k=
7+
github.com/robotn/xgb v0.0.0-20190910151114-b250faa511c2 h1:xqEFcO1uUaZ/keHtQkz9gVMWeDxs+zkzLNroyj9sjEI=
8+
github.com/robotn/xgb v0.0.0-20190910151114-b250faa511c2/go.mod h1:SxQhJskUJ4rleVU44YvnrdvxQr0tKy5SRSigBrCgyyQ=

keybind/xutil.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func keyKeys(xu *xgbutil.XUtil) []xgbutil.KeyKey {
6161

6262
keys := make([]xgbutil.KeyKey, len(xu.Keybinds))
6363
i := 0
64-
for key, _ := range xu.Keybinds {
64+
for key := range xu.Keybinds {
6565
keys[i] = key
6666
i++
6767
}
@@ -100,7 +100,7 @@ func connectedKeyBind(xu *xgbutil.XUtil, evtype int, win xproto.Window) bool {
100100

101101
// Since we can't create a full key, loop through all key binds
102102
// and check if evtype and window match.
103-
for key, _ := range xu.Keybinds {
103+
for key := range xu.Keybinds {
104104
if key.Evtype == evtype && key.Win == win {
105105
return true
106106
}
@@ -121,7 +121,7 @@ func detachKeyBindWindow(xu *xgbutil.XUtil, evtype int, win xproto.Window) {
121121

122122
// Since we can't create a full key, loop through all key binds
123123
// and check if evtype and window match.
124-
for key, _ := range xu.Keybinds {
124+
for key := range xu.Keybinds {
125125
if key.Evtype == evtype && key.Win == win {
126126
xu.Keygrabs[key] -= len(xu.Keybinds[key])
127127
delete(xu.Keybinds, key)

mousebind/xutil.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func mouseKeys(xu *xgbutil.XUtil) []xgbutil.MouseKey {
4242

4343
keys := make([]xgbutil.MouseKey, len(xu.Mousebinds))
4444
i := 0
45-
for key, _ := range xu.Mousebinds {
45+
for key := range xu.Mousebinds {
4646
keys[i] = key
4747
i++
4848
}
@@ -81,7 +81,7 @@ func connectedMouseBind(xu *xgbutil.XUtil, evtype int, win xproto.Window) bool {
8181

8282
// Since we can't create a full key, loop through all mouse binds
8383
// and check if evtype and window match.
84-
for key, _ := range xu.Mousebinds {
84+
for key := range xu.Mousebinds {
8585
if key.Evtype == evtype && key.Win == win {
8686
return true
8787
}
@@ -99,7 +99,7 @@ func detachMouseBindWindow(xu *xgbutil.XUtil, evtype int, win xproto.Window) {
9999

100100
// Since we can't create a full key, loop through all mouse binds
101101
// and check if evtype and window match.
102-
for key, _ := range xu.Mousebinds {
102+
for key := range xu.Mousebinds {
103103
if key.Evtype == evtype && key.Win == win {
104104
xu.Mousegrabs[key] -= len(xu.Mousebinds[key])
105105
delete(xu.Mousebinds, key)

xevent/xevent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func Detach(xu *xgbutil.XUtil, win xproto.Window) {
219219
xu.CallbacksLck.Lock()
220220
defer xu.CallbacksLck.Unlock()
221221

222-
for evtype, _ := range xu.Callbacks {
222+
for evtype := range xu.Callbacks {
223223
delete(xu.Callbacks[evtype], win)
224224
}
225225
}

0 commit comments

Comments
 (0)