From d4414a60f454b87c2d3dcdf6eccd039d4b628649 Mon Sep 17 00:00:00 2001
From: Andrew Hodgkinson <ahodgkin@gitlab.riscosopen.org>
Date: Thu, 2 Oct 1997 14:18:03 +0000
Subject: [PATCH] Didn't redraw browsers which would be immediately affected by
 a change to the Choices when 'Set' was used. Appropriate redraw calls added.
 Reversed decision to toe in the pane window by 8 OS units relative to the
 placeholder icon sides.

---
 c/Choices | 57 ++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/c/Choices b/c/Choices
index 4913002..34a8cc8 100644
--- a/c/Choices
+++ b/c/Choices
@@ -139,13 +139,6 @@ static _kernel_oserror * choices_show_subwindow(ObjectId choices_window, int sub
   show_block.visible_area.ymin = coords_y_toscreen(show_block.visible_area.ymin, (WimpRedrawWindowBlock *) &state);
   show_block.visible_area.ymax = coords_y_toscreen(show_block.visible_area.ymax, (WimpRedrawWindowBlock *) &state);
 
-  /* Toe it in for the borders */
-
-  show_block.visible_area.xmin += 8;
-  show_block.visible_area.ymin += 8;
-  show_block.visible_area.xmax -= 8;
-  show_block.visible_area.ymax -= 8;
-
   /* Adjustments for different types of window */
 
   #ifdef TRACE
@@ -422,9 +415,9 @@ static int choices_radio_click_handler(int eventcode, ToolboxEvent * event, IdBl
 /* Returns:    pointer to _kernel_oserror.       */
 /*************************************************/
 
-static _kernel_oserror *choices_set_contents(void)
+static _kernel_oserror * choices_set_contents(void)
 {
-  _kernel_oserror *e;
+  _kernel_oserror * e;
 
   /* Check that the BrowseDefaults subwindow exists */
 
@@ -442,7 +435,8 @@ static _kernel_oserror *choices_set_contents(void)
     RetError(choices_set_encoding_field());
   }
 
-  /* Check that the Windows subwindow exists */
+  /* Check that the various subwindows exist before reading */
+  /* their contents.                                        */
 
   if (*(subwindows + CDSubWindows))
   {
@@ -466,7 +460,9 @@ static _kernel_oserror *choices_set_contents(void)
   {
     RetError(numberrange_set_value(0, *(subwindows + CDSubHotlist), CD_HlAutoOpen,   new_choices->auto_open_delay));
     RetError(numberrange_set_value(0, *(subwindows + CDSubHotlist), CD_HlAutoScroll, new_choices->auto_scroll_delay));
+
     RetError(choices_set_display_field(*(subwindows + CDSubHotlist), CD_HlDispDisp, new_choices->hotlist_show));
+
     RetError(choices_set_save_field(*(subwindows + CDSubHotlist), CD_HlSaveDisp, new_choices->save_hotlist));
   }
 
@@ -474,10 +470,11 @@ static _kernel_oserror *choices_set_contents(void)
   {
     RetError(numberrange_set_value(0, *(subwindows + CDSubHistory), CD_HiLines,   new_choices->v_hist_size));
     RetError(numberrange_set_value(0, *(subwindows + CDSubHistory), CD_HiMaxSize, new_choices->g_hist_size));
+
     RetError(choices_set_display_field(*(subwindows + CDSubHistory), CD_HiDispDisp, new_choices->show_urls));
+
     RetError(choices_set_save_field(*(subwindows + CDSubHistory), CD_HiSaveDisp, new_choices->save_history));
   }
-
   return NULL;
 }
 
@@ -493,10 +490,12 @@ static _kernel_oserror *choices_set_contents(void)
 
 static _kernel_oserror * choices_get_contents(void)
 {
-  _kernel_oserror *e;
-  int state;
-  char *tempstring;
-  int reqsize;
+  _kernel_oserror         * e;
+  WimpGetWindowStateBlock   s;
+  browser_data            * b;
+  char                    * tempstring;
+  int                       state;
+  int                       reqsize;
 
   /* Check that the BrowseDefaults subwindow exists */
 
@@ -562,6 +561,34 @@ static _kernel_oserror * choices_get_contents(void)
 
   memcpy(&choices, new_choices, sizeof(global_choices));
 
+  /* Update browsers */
+
+  b = last_browser;
+
+  while (b)
+  {
+    /* The Choices are only used directly for browsers which are */
+    /* set to override document colours. Otherwise defaults will */
+    /* have been read locally and possibly overridden by HTML,   */
+    /* and a reload will be needed to reflect the changes.       */
+
+    if (!b->use_source_cols)
+    {
+      s.window_handle = b->window_handle;
+      RetError(wimp_get_window_state(&s));
+
+      coords_box_toworkarea(&s.visible_area, (WimpRedrawWindowBlock *) &s);
+
+      RetError(wimp_force_redraw(b->window_handle,
+                                 s.visible_area.xmin,
+                                 s.visible_area.ymin,
+                                 s.visible_area.xmax,
+                                 s.visible_area.ymax));
+    }
+
+    b = b->previous;
+  }
+
   return NULL;
 }
 
-- 
GitLab