MCPcopy Create free account
hub / github.com/cogentcore/core / SetSystemWindow

Method SetSystemWindow

system/driver/ios/app.go:111–143  ·  view source on GitHub ↗

SetSystemWindow sets the underlying system window pointer, surface, system, and drawer. It should only be called when [App.Mu] is already locked.

(winptr uintptr)

Source from the content-addressed store, hash-verified

109// SetSystemWindow sets the underlying system window pointer, surface, system, and drawer.
110// It should only be called when [App.Mu] is already locked.
111func (a *App) SetSystemWindow(winptr uintptr) error {
112 defer func() { system.HandleRecover(recover()) }()
113 var vsf vk.Surface
114 // we have to remake the surface, system, and drawer every time someone reopens the window
115 // because the operating system changes the underlying window
116 ret := vk.CreateWindowSurface(a.GPU.Instance, winptr, nil, &vsf)
117 if err := vk.Error(ret); err != nil {
118 return err
119 }
120 sf := vgpu.NewSurface(a.GPU, vsf)
121
122 sys := a.GPU.NewGraphicsSystem(a.Name(), &sf.Device)
123 sys.ConfigRender(&sf.Format, vgpu.UndefType)
124 sf.SetRender(&sys.Render)
125 // sys.Mem.Vars.NDescs = vgpu.MaxTexturesPerSet
126 sys.Config()
127 a.Draw = &vdraw.Drawer{
128 Sys: *sys,
129 YIsDown: true,
130 }
131 // a.Draw.ConfigSys()
132 a.Draw.ConfigSurface(sf, vgpu.MaxTexturesPerSet)
133
134 a.Winptr = winptr
135
136 // if the window already exists, we are coming back to it, so we need to show it
137 // again and send a screen update
138 if a.Win != nil {
139 a.Event.Window(events.WinShow)
140 a.Event.Window(events.ScreenUpdate)
141 }
142 return nil
143}
144
145func (a *App) DataDir() string {
146 usr, err := user.Current()

Callers 1

setWindowPtrFunction · 0.45

Calls 9

NameMethod · 0.95
SetRenderMethod · 0.95
NewSurfaceFunction · 0.92
NewGraphicsSystemMethod · 0.80
ConfigSurfaceMethod · 0.80
ErrorMethod · 0.65
ConfigMethod · 0.65
WindowMethod · 0.65
ConfigRenderMethod · 0.45

Tested by

no test coverage detected