/
motion.go
66 lines (57 loc) · 1.01 KB
/
motion.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package handler
import (
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
"github.com/thrisp/scpwm/euclid/window"
)
type Motion interface {
Enable()
Disable()
Renew()
}
type motion struct {
window.Window
}
func NewMotion(c *xgb.Conn, w, r xproto.Window) Motion {
return &motion{
Window: window.New(c, w, r),
}
}
func (m *motion) Enable() {
m.Raise()
m.Show()
}
func (m *motion) Disable() {
m.Hide()
}
func (m *motion) Renew() {
geo, _ := xproto.GetGeometry(m.Conn(), xproto.Drawable(m.XRoot())).Reply()
if geo != nil {
m.Resize(geo.Width, geo.Height)
}
}
/*
func mkMotion(s *xproto.ScreenInfo, c *xgb.Conn) (xproto.Window, error) {
motion, err := xproto.NewWindowId(c)
if err != nil {
return motion, err
}
xproto.CreateWindow(
c,
s.RootDepth,
motion,
s.Root,
0,
0,
s.WidthInPixels,
s.HeightInPixels,
0,
xproto.WindowClassInputOnly,
s.RootVisual,
xproto.CwEventMask,
[]uint32{xproto.EventMaskPointerMotion},
)
xproto.MapWindow(c, motion)
return motion, nil
}
*/