saveCached saves the cached prefs -- called after timer delay, under the Mu.Lock
()
| 282 | // saveCached saves the cached prefs -- called after timer delay, |
| 283 | // under the Mu.Lock |
| 284 | func (ws *windowGeometrySaver) saveCached() { |
| 285 | ws.lockFile() // not going to change our behavior if we can't lock! |
| 286 | if ws.needToReload() { |
| 287 | ws.open() |
| 288 | } |
| 289 | for winName, scmap := range ws.cache { |
| 290 | for scName, wgr := range scmap { |
| 291 | sc := system.TheApp.ScreenByName(scName) |
| 292 | if sc == nil { |
| 293 | continue |
| 294 | } |
| 295 | if ws.geometries[winName] == nil { |
| 296 | ws.geometries[winName] = make(map[string]windowGeometry) |
| 297 | } |
| 298 | ws.geometries[winName][sc.Name] = wgr |
| 299 | if DebugSettings.WinGeomTrace { |
| 300 | log.Printf("WindowGeometry: RecordPref: Saving for window: %v pos: %v size: %v screen: %v dpi: %v device pixel ratio: %v\n", winName, wgr.pos(), wgr.size(), sc.Name, sc.LogicalDPI, sc.DevicePixelRatio) |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | ws.resetCache() |
| 305 | ws.save() |
| 306 | ws.unlockFile() |
| 307 | } |
| 308 | |
| 309 | // pref returns an existing preference for given window name, for given screen. |
| 310 | // if the window name has a colon, only the part prior to the colon is used. |
no test coverage detected