diff --git a/breadcrumbs b/breadcrumbs index ff99a16..cf8cb1c 100644 --- a/breadcrumbs +++ b/breadcrumbs @@ -18,3 +18,16 @@ saved and reloaded. A possible solution to this is to allow geometry state "copying." i.e., copy the "layout_before_tiling" to "monitor_switch", and load that geometry after all is said and done. + +Wed Apr 25 22:39:57 EDT 2012 + +So the problem is that when both montitors are tiling and we use +'HeadFocusWithClient', the client is removed from its current workspace and it +is automatically restored to 'before tiling' state. It is then added to the new +workspace as is, and since that new workspace is also tiling, its current state +on the old monitor is saved---but it is saved under the context of the new +monitor. This screws everything up. + +My brain isn't thinking too clearly, but I suspect that I may need to rethink +how clients are added and removed from workspaces. + diff --git a/client_geometry.go b/client_geometry.go index 54c159d..3be346f 100644 --- a/client_geometry.go +++ b/client_geometry.go @@ -5,6 +5,8 @@ import ( "github.com/BurntSushi/xgbutil/icccm" "github.com/BurntSushi/xgbutil/xrect" + + "github.com/BurntSushi/wingo/logger" ) func (c *client) GravitizeX(x int, gravity int) int { @@ -251,6 +253,21 @@ func (c *client) saveGeomNoClobber(key string) { } } +func (c *client) copyGeom(src, dest string) { + c.geomStore[dest] = c.geomStore[src] +} + +func (c *client) copyGeomTransients(src, dest string) { + for _, c2 := range WM.clients { + if c.transient(c2) && c2.workspace != nil && + c2.workspace.id == c.workspace.id { + + c2.copyGeom(src, dest) + } + } + c.copyGeom(src, dest) +} + func (c *client) loadGeom(key string) { if cgeom, ok := c.geomStore[key]; ok { c.frameSet(cgeom.frame) @@ -260,6 +277,7 @@ func (c *client) loadGeom(key string) { if c.workspace.visible() && cgeom.headGeom != nil && c.workspace.headGeom() != cgeom.headGeom { + logger.Debug.Println(c, cgeom.headGeom, c.workspace.headGeom()) newGeom = WM.headConvert(cgeom, cgeom.headGeom, c.workspace.headGeom()) } diff --git a/command.go b/command.go index 9f1c25e..afa9c7d 100644 --- a/command.go +++ b/command.go @@ -299,8 +299,16 @@ func cmdHeadFocus(withClient bool, args ...string) func() { c.Unmap() // prevent flickering defer c.Map() - c.Raise() - c.saveGeomTransients("monitor_switch") + // If the client is tiling, then we copy its "before tiling" + // state to 'monitor switch'. This is so we restore its + // proper geometry and not its geometry while in a tiling + // layout. + if c.layout().floating() { + c.saveGeomTransients("monitor_switch") + } else { + c.copyGeomTransients( + "layout_before_tiling", "monitor_switch") + } wrk.add(c) // If the new layout is floating, then load geometry @@ -310,6 +318,8 @@ func cmdHeadFocus(withClient bool, args ...string) func() { } else { c.deleteGeomTransients("monitor_switch") } + + // c.Raise() }) } wrk.activate(true, greedy)