From 852d85b3a978baaae230bd34ad5841c157061a4b Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 7 Nov 2021 09:16:49 +0200 Subject: [PATCH] gg: cleanup the minimal gg program more --- examples/gg/polygons.v | 1 - vlib/gg/gg.c.v | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/gg/polygons.v b/examples/gg/polygons.v index 1bf205a213..c7ec0de52b 100644 --- a/examples/gg/polygons.v +++ b/examples/gg/polygons.v @@ -11,7 +11,6 @@ fn main() { window_title: 'Polygons' frame_fn: frame ) - context.user_data = context context.run() } diff --git a/vlib/gg/gg.c.v b/vlib/gg/gg.c.v index 1d6d1095ab..15c0c44e62 100644 --- a/vlib/gg/gg.c.v +++ b/vlib/gg/gg.c.v @@ -179,6 +179,9 @@ pub fn new_context(cfg Config) &Context { ui_mode: cfg.ui_mode native_rendering: cfg.native_rendering } + if isnil(cfg.user_data) { + g.user_data = g + } g.set_bg_color(cfg.bg_color) // C.printf('new_context() %p\n', cfg.user_data) window := C.sapp_desc{