Skip to content

Commit

Permalink
Fix: Call quit fn before destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
malisipi committed Feb 8, 2023
1 parent ee99032 commit 8377046
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions mui.v
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
}

Expand Down
4 changes: 2 additions & 2 deletions types.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 //= ""
Expand Down

0 comments on commit 8377046

Please sign in to comment.