From c3df57ce613f75b609b83dfd45ad181d3674f925 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 17 Dec 2023 13:16:08 -0800 Subject: [PATCH] bugfix: keep Viewport dimensions more up to date Scenario: 1. I connect to carousel.love 2. I try to press C-n, nothing seems to happen 3. I quit and restart and get this cryptic error: SDL error: window too large "width": 19103, "height": 9849.984375 I can manually edit config to adjust width and height and restart driver.love. I don't really understand all the details of how this comes about. While investigating this, however, I noticed one thing: in step 2 the new node is indeed being spawned, it's just happening out of viewport because Viewport dimensions are much larger than the window. Once I started looking for it, I noticed this stale information in many apps. Let's see if keeping viewport dimensions up to date causes the scenario above to stop occurring. --- 0012-on.initialize | 5 ++++- 0132-on.resize | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 0132-on.resize diff --git a/0012-on.initialize b/0012-on.initialize index 32eb433..9cdd87f 100644 --- a/0012-on.initialize +++ b/0012-on.initialize @@ -9,6 +9,9 @@ on.initialize = function() Settings[App_name].definitions = get_default_map() end Viewport = Settings[App_name].viewport + -- We might have resized the window since the last time we connected to this app, so don't trust viewport dimensions + Viewport.w = App.screen.width + Viewport.h = App.screen.height Definitions = Settings[App_name].definitions local names = {} for name, _ in pairs(Definitions) do @@ -40,4 +43,4 @@ on.initialize = function() else survey_animation() -- calls A internally end -end +end \ No newline at end of file diff --git a/0132-on.resize b/0132-on.resize new file mode 100644 index 0000000..e9b61cd --- /dev/null +++ b/0132-on.resize @@ -0,0 +1,4 @@ +on.resize = function(w, h) + Viewport.w = w + Viewort.h = h +end \ No newline at end of file