MCPcopy Create free account
hub / github.com/BobdaProgrammer/doWM / resizeTiledY

Method resizeTiledY

wm/window_manager.go:1255–1316  ·  view source on GitHub ↗
(increase bool, ev xproto.KeyPressEvent)

Source from the content-addressed store, hash-verified

1253}
1254
1255func (wm *WindowManager) resizeTiledY(increase bool, ev xproto.KeyPressEvent) bool{
1256 geom, err := xproto.GetGeometry(wm.conn, xproto.Drawable(ev.Child)).Reply()
1257 if err != nil{
1258 return false
1259 }
1260 Y := uint16(geom.Y - int16(wm.config.Gap)-int16(wm.tilingspace.Y))
1261 H := geom.Height + uint16(wm.config.Gap*2)
1262 if math.Abs(float64(uint16(wm.tilingspace.X+wm.tilingspace.Height)-(Y+H)))<=10{
1263 return false
1264 }
1265
1266 var resizeLayout ResizeLayout
1267 var ok bool = true
1268 for _, win := range wm.currWorkspace.windowList{
1269 geomwin, err := xproto.GetGeometry(wm.conn, xproto.Drawable(win.id)).Reply()
1270 if err != nil {continue}
1271 winX := uint16(geomwin.X - int16(wm.config.Gap)-int16(wm.tilingspace.X))
1272 winY := uint16(geomwin.Y - int16(wm.config.Gap)-int16(wm.tilingspace.Y))
1273 winH := geomwin.Height + uint16(wm.config.Gap*2)
1274 winW := geomwin.Width + uint16(wm.config.Gap*2)
1275 // if diff between ends of windows it less than five, they are same column
1276 if math.Abs( float64( (int(Y)+int(H))-(int(winY)+int(winH)) ) ) <= 10{
1277 if increase{
1278 winH+=uint16(wm.config.Resize)
1279 }else{
1280 winH-=uint16(wm.config.Resize)
1281 }
1282 fmt.Println(winW)
1283 }else if math.Abs( float64( int(winY)-(int(Y)+int(H)) ) ) <= 10 {
1284 if increase{
1285 winY+=uint16(wm.config.Resize)
1286 winH-=uint16(wm.config.Resize)
1287 if winH < 50{
1288 ok = false
1289 break
1290 }
1291 }else{
1292 winY -= uint16(wm.config.Resize)
1293 winH += uint16(wm.config.Resize)
1294
1295 }
1296 }
1297
1298 fmt.Println(winX, winY, winW, winH)
1299 resizeLayout.Windows = append(resizeLayout.Windows, RLayoutWindow{
1300 X: winX,
1301 Y: winY,
1302 Width: winW,
1303 Height: winH,
1304 })
1305
1306 }
1307
1308 if ok{
1309 wm.currWorkspace.resized = true
1310 wm.currWorkspace.resizedLayout = resizeLayout
1311 wm.fitToLayout()
1312 return true

Callers 1

RunMethod · 0.95

Calls 1

fitToLayoutMethod · 0.95

Tested by

no test coverage detected