From 8377046af9aa520dac39895cce495876c1ff8b2a Mon Sep 17 00:00:00 2001 From: Mehmet Ali Date: Wed, 8 Feb 2023 22:59:55 +0300 Subject: [PATCH] Fix: Call quit fn before destroy --- mui.v | 17 ++++++++++------- types.v | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mui.v b/mui.v index 9dbad02..4aa6aa7 100644 --- a/mui.v +++ b/mui.v @@ -6,17 +6,13 @@ import os import math import sokol.sapp -$if clang { - #flag -Wno-everything -} - pub fn create(args &WindowConfig) &Window { color_scheme, light_mode := if args.color!=[-1,-1,-1] { create_gx_color_from_manuel_color(args.color) } else { create_gx_color_from_color_scheme() } mut app := &Window{ objects: [] focus: "" color_scheme: color_scheme - light_mode: light_mode + light_mode: light_mode gg: 0 menubar: args.menubar scrollbar: args.scrollbar @@ -30,8 +26,8 @@ pub fn create(args &WindowConfig) &Window { ask_quit: args.ask_quit init_fn: args.init_fn quit_fn: args.quit_fn - resized_fn: args.resized_fn - menubar_config: args.menubar_config + resized_fn: args.resized_fn + menubar_config: args.menubar_config } mut emoji_font:=args.font @@ -233,6 +229,13 @@ pub fn (mut app Window) run () { } pub fn (mut app Window) destroy () { + app.quit_fn( EventDetails{ + event:"destroy", + trigger:"non_user", + value:"true", + target_type:"window", + target_id:""}, + mut app, mut app.app_data) sapp.quit() } diff --git a/types.v b/types.v index 33519d4..83d3dc0 100644 --- a/types.v +++ b/types.v @@ -71,8 +71,8 @@ pub mut: pub struct EventDetails{ pub mut: - event string // click, value_change, unclick, keypress, files_drop, resize - trigger string // mouse_left, mouse_right, mouse_middle, keyboard + event string // click, value_change, unclick, keypress, files_drop, resize, destroy + trigger string // mouse_left, mouse_right, mouse_middle, keyboard, non_user value string = "true" target_type string = "window" //window, menubar, and widget_types target_id string //= ""