From f5ce841e961d5e879c2f582c946ea7dc912c6592 Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <jlee@gitlab.riscosopen.org>
Date: Mon, 8 Oct 2012 23:14:39 +0000
Subject: [PATCH] Fix text window remaining active after desktop has been
 reached

Detail:
  c/bootfx - Make sure not_in_desktop returns false once Service_DesktopWelcome has been seen. This ensures mode_has_changed doesn't fiddle with the text window or try to do anything else if single-tasking apps are run once the desktop has been reached.
Admin:
  Tested on Raspberry Pi
  F12 -> *BASIC -> MODE MODE, or executing mode changes from a double-clicked BASIC file, no longer results in BootFX's text window being applied.


Version 0.05. Tagged as 'BootFX-0_05'
---
 VersionNum | 20 ++++++++++----------
 c/bootfx   |  9 +++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/VersionNum b/VersionNum
index 242278e..c42f882 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,23 +1,23 @@
-/* (0.04)
+/* (0.05)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  * Last processed by srccommit version: 1.1.
  *
  */
-#define Module_MajorVersion_CMHG        0.04
+#define Module_MajorVersion_CMHG        0.05
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                08 Oct 2012
+#define Module_Date_CMHG                09 Oct 2012
 
-#define Module_MajorVersion             "0.04"
-#define Module_Version                  4
+#define Module_MajorVersion             "0.05"
+#define Module_Version                  5
 #define Module_MinorVersion             ""
-#define Module_Date                     "08 Oct 2012"
+#define Module_Date                     "09 Oct 2012"
 
-#define Module_ApplicationDate          "08-Oct-12"
+#define Module_ApplicationDate          "09-Oct-12"
 
 #define Module_ComponentName            "BootFX"
 #define Module_ComponentPath            "bsd/RiscOS/Sources/Video/UserI/BootFX"
 
-#define Module_FullVersion              "0.04"
-#define Module_HelpVersion              "0.04 (08 Oct 2012)"
-#define Module_LibraryVersionInfo       "0:4"
+#define Module_FullVersion              "0.05"
+#define Module_HelpVersion              "0.05 (09 Oct 2012)"
+#define Module_LibraryVersionInfo       "0:5"
diff --git a/c/bootfx b/c/bootfx
index 4287ad5..b41aee5 100644
--- a/c/bootfx
+++ b/c/bootfx
@@ -198,6 +198,7 @@ static size_t         splash_size    = 0;      /**< Size (bytes) of the splash s
 static void          *Workspace      = NULL;   /**< Module workspace pointer. */
 static uint32_t       scale_matrix[4];         /**< Scale factor block (for current mode). */
 static uint32_t       pixel_trans[4];          /**< Pixel translation table (for current mode). */
+static bool           desktop_welcome = false; /**< Seen Service_DesktopWelcome yet? */
 
 
 /********************************************************************************
@@ -558,6 +559,11 @@ static bool not_in_desktop(void)
   _kernel_oserror *err;
   uint32_t         state;
 
+  /* Always claim we're in the desktop once Service_DesktopWelcome has been seen
+     Avoids us messing with things if a single-tasking app is run */
+  if (desktop_welcome)
+    return false;
+
   err = _swix(Wimp_ReadSysInfo, _IN(0) | _OUT(0), 3, &state);
   return (err || state == 1) ? false : true;
 }
@@ -1055,6 +1061,9 @@ void Module_Service(int service_number, _kernel_swi_regs *r, void *pw)
       /* Discard the progress bar sprite data (and free the buffer) */
       (void) cli_free(NULL);
 
+      /* Remember that the desktop has now been reached */
+      desktop_welcome = true;
+
       /* Claim this service call to stop the desktop banner window */
       r->r[1] = 0;
       break;
-- 
GitLab