Skip to content

Commit

Permalink
trying to flush out the state transitions surrounding monitors, works…
Browse files Browse the repository at this point in the history
…paces and layouts
  • Loading branch information
Andrew Gallant (Ocelot) authored and Andrew Gallant (Ocelot) committed Apr 26, 2012
1 parent 6be1cb3 commit d058152
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
13 changes: 13 additions & 0 deletions breadcrumbs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

18 changes: 18 additions & 0 deletions client_geometry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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())
}
Expand Down
14 changes: 12 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -310,6 +318,8 @@ func cmdHeadFocus(withClient bool, args ...string) func() {
} else {
c.deleteGeomTransients("monitor_switch")
}

// c.Raise()
})
}
wrk.activate(true, greedy)
Expand Down

0 comments on commit d058152

Please sign in to comment.