From 218ea625d9799753856c0c7e701ea4258f6c8237 Mon Sep 17 00:00:00 2001
From: Neil Turton <nturton@gitlab.riscosopen.org>
Date: Fri, 29 Nov 1996 19:39:04 +0000
Subject: [PATCH] NCOS 1.06 Imported from Zip drive

---
 c/auxiliary     | 25 +++++++++++++++++++++----
 c/create        |  3 ++-
 cmhg/Modhdr     |  5 +++--
 cmhg/Modhdr_NoD |  4 +++-
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/c/auxiliary b/c/auxiliary
index 9503986..628d90f 100644
--- a/c/auxiliary
+++ b/c/auxiliary
@@ -90,11 +90,28 @@ extern _kernel_oserror *menu_update_size(MenuInternal *menu_int) {
       if (entry->icon_flags & wimp_ICONFLAGS_TEXT) {
          width = (entry->icon_data.indirect_text.buff_len+1)<<4;
       } else {
-         regs.r[0] = os_SpriteOp_ReadInfo;
-         regs.r[2] = (int) entry->icon_data.indirect_sprite.sprite.name;
+         /* IDJ: 22-May-95: bug-fix AQU-01264: look in user sprite area if
+            one is defined first, then in wimp sprite area as a
+            fall-back.
+         */
+         e = NULL;
+
+         if (entry->icon_data.indirect_sprite.sprite_area != (void *)1 /* user area */)
+         {
+            regs.r[0] = os_SpriteOp_ReadInfo + 256;
+            regs.r[1] = (int) entry->icon_data.indirect_sprite.sprite_area;
+            regs.r[2] = (int) entry->icon_data.indirect_sprite.sprite.name;
+
+            e = _kernel_swi (OS_SpriteOp, &regs, &regs);
+         }
 
-         if ((e = _kernel_swi (Wimp_SpriteOp, &regs, &regs)) != NULL) {
-            return e;
+         if (e != NULL || entry->icon_data.indirect_sprite.sprite_area == (void *)1 /* WIMP area */)
+         {
+            regs.r[0] = os_SpriteOp_ReadInfo;
+            regs.r[2] = (int) entry->icon_data.indirect_sprite.sprite.name;
+
+            if ((e = _kernel_swi (Wimp_SpriteOp, &regs, &regs)) != NULL)
+               return e;
          }
          width = regs.r[3];
          mode  = regs.r[6];
diff --git a/c/create b/c/create
index c3e3a76..5f8e09d 100644
--- a/c/create
+++ b/c/create
@@ -229,7 +229,8 @@ _kernel_oserror *create_menu_aux (MenuTemplate *menu_temp, ObjectID object_id, T
    }
 
    if (num_entries>0) {
-      wimp_menu_entry(menu,0)->flags             |= wimp_MENUFLAGS_TITLE_INDIRECT;
+      if (menu->hdr.title.indirect_text.buffer)  /* SJM: 14/06/96: Only set indirect bit if there is a title */
+         wimp_menu_entry(menu,0)->flags          |= wimp_MENUFLAGS_TITLE_INDIRECT;
       wimp_menu_entry(menu,num_entries-1)->flags |= wimp_MENUFLAGS_LAST_ITEM;
    }
    if ((e = menu_update_size(menu_int)) != NULL) {
diff --git a/cmhg/Modhdr b/cmhg/Modhdr
index e259f00..8793659 100644
--- a/cmhg/Modhdr
+++ b/cmhg/Modhdr
@@ -22,7 +22,8 @@
 ;         PRODUCT RELEASE
 ;         06-Feb-95: IDJ: version 0.22
 ;                 fixes AQU-01203 (menu_set_entry_text bug) for Black ROM
-;
+;         14-Jun-96: SJM: version 0.25
+;                 fixes no title width problem
 
 
 initialisation-code:            Menu_init
@@ -33,7 +34,7 @@ service-call-handler:           Menu_services 0x44ec1, 0x44ec2, 0x44ec3
 
 title-string:                   Menu
 
-help-string:                    Menu 0.23
+help-string:                    Menu 0.25
 
 command-keyword-table:          Menu_commands
                                 Menu_Memory()
diff --git a/cmhg/Modhdr_NoD b/cmhg/Modhdr_NoD
index 3c033a7..8c51d9e 100644
--- a/cmhg/Modhdr_NoD
+++ b/cmhg/Modhdr_NoD
@@ -22,6 +22,8 @@
 ;         PRODUCT RELEASE
 ;         06-Feb-95: IDJ: version 0.22
 ;                 fixes AQU-01203 (menu_set_entry_text bug) for Black ROM
+;         14-Jun-96: SJM: version 0.25
+;                 fixes no title width problem
 ;
 
 
@@ -33,7 +35,7 @@ service-call-handler:           Menu_services 0x44ec1, 0x44ec2, 0x44ec3
 
 title-string:                   Menu
 
-help-string:                    Menu 0.23
+help-string:                    Menu 0.25
 
 swi-chunk-base-number:          0x828c0
 
-- 
GitLab