diff --git a/src/chatter_context.cr b/src/chatter_context.cr index 81ef726..c58d9bd 100644 --- a/src/chatter_context.cr +++ b/src/chatter_context.cr @@ -40,7 +40,9 @@ class Funfriend::ChatterContext < Funfriend::WindowContext def update_position if parent p = parent.not_nil! - window.position = (Vec2.new(p.window.position) + Vec2.new(p.window.size) / 2 + parent_relative_pos - window_size / 2).xy_i + if !p.closed + window.position = (Vec2.new(p.window.position) + Vec2.new(p.window.size) / 2 + parent_relative_pos - window_size / 2).xy_i + end end end diff --git a/src/window_context.cr b/src/window_context.cr index 19b1a8d..8dd6427 100644 --- a/src/window_context.cr +++ b/src/window_context.cr @@ -5,6 +5,7 @@ GLFW_FOCUS_ON_SHOW = 0x0002000C class Funfriend::WindowContext getter window : CrystGLFW::Window + property closed : Bool = false DEFAULT_HINTS = { # supposedly required on MacOS @@ -43,6 +44,7 @@ class Funfriend::WindowContext def close window.destroy + @closed = true end def clean_up