changeset 401:0f87e84d57fd

fix: do not try to change fullscreen if already in correct status
author sam <sam@basx.dev>
date Wed, 27 Dec 2023 16:14:36 +0700
parents 7c31e5a780f1
children 6001079399a6
files semicongine/engine.nim
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/engine.nim	Wed Dec 27 16:08:13 2023 +0700
+++ b/semicongine/engine.nim	Wed Dec 27 16:14:36 2023 +0700
@@ -210,5 +210,6 @@
 func hideSystemCursor*(engine: Engine) = engine.window.hideSystemCursor()
 func fullscreen*(engine: Engine): bool = engine.fullscreen
 proc `fullscreen=`*(engine: var Engine, enable: bool) =
-  engine.fullscreen = enable
-  engine.window.fullscreen(engine.fullscreen)
+  if enable != engine.fullscreen:
+    engine.fullscreen = enable
+    engine.window.fullscreen(engine.fullscreen)