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

Method SetSystemWindow

system/driver/android/app.go:95–127  ·  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

93// SetSystemWindow sets the underlying system window pointer, surface, system, and drawer.
94// It should only be called when [App.Mu] is already locked.
95func (a *App) SetSystemWindow(winptr uintptr) error {
96 defer func() { system.HandleRecover(recover()) }()
97 var vsf vk.Surface
98 // we have to remake the surface, system, and drawer every time someone reopens the window
99 // because the operating system changes the underlying window
100 ret := vk.CreateWindowSurface(a.GPU.Instance, winptr, nil, &vsf)
101 if err := vk.Error(ret); err != nil {
102 return err
103 }
104 sf := vgpu.NewSurface(a.GPU, vsf)
105
106 sys := a.GPU.NewGraphicsSystem(a.Name(), &sf.Device)
107 sys.ConfigRender(&sf.Format, vgpu.UndefType)
108 sf.SetRender(&sys.Render)
109 // sys.Mem.Vars.NDescs = vgpu.MaxTexturesPerSet
110 sys.Config()
111 a.Draw = &vdraw.Drawer{
112 Sys: *sys,
113 YIsDown: true,
114 }
115 // a.Draw.ConfigSys()
116 a.Draw.ConfigSurface(sf, vgpu.MaxTexturesPerSet)
117
118 a.Winptr = winptr
119
120 // if the window already exists, we are coming back to it, so we need to show it
121 // again and send a screen update
122 if a.Win != nil {
123 a.Event.Window(events.WinShow)
124 a.Event.Window(events.ScreenUpdate)
125 }
126 return nil
127}
128
129func (a *App) DataDir() string {
130 return "/data/data"

Callers 1

onNativeWindowCreatedFunction · 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