[PATCH 25/45] [WinHelp]: properly handle the back button (in multiple windows, in empty stack...)

Eric Pouech eric.pouech at orange.fr
Sun Mar 23 04:19:51 CDT 2008




A+
---

 programs/winhelp/macro.c   |   12 +-----------
 programs/winhelp/winhelp.c |   18 ++++++++++++++++++
 programs/winhelp/winhelp.h |    1 +
 3 files changed, 20 insertions(+), 11 deletions(-)


diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index ca11b5a..877d33f 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -230,17 +230,7 @@ void CALLBACK MACRO_BackFlush(void)
 
     WINE_TRACE("()\n");
 
-    if (win)
-    {
-        unsigned int i;
-
-        for (i = 0; i < win->back.index; i++)
-        {
-            HLPFILE_FreeHlpFile(win->back.set[i].page->file);
-            win->back.set[i].page = NULL;
-        }
-        win->back.index = 0;
-    }
+    if (win) WINHELP_DeleteBackSet(win);
 }
 
 void CALLBACK MACRO_BookmarkDefine(void)
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 7f75caf..e0cbfd5 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -550,6 +550,8 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
                                  0, 0,
                                  wpage->wininfo->size.cx, wpage->wininfo->size.cy,
                                  SWP_NOMOVE);
+                if (wpage->page && wpage->page->file != win->page->file)
+                    WINHELP_DeleteBackSet(win);
                 break;
             }
         }
@@ -1271,6 +1273,22 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW* win)
     win->first_button = NULL;
 }
 
+/******************************************************************
+ *		WINHELP_DeleteButtons
+ *
+ */
+void WINHELP_DeleteBackSet(WINHELP_WINDOW* win)
+{
+    unsigned int i;
+
+    for (i = 0; i < win->back.index; i++)
+    {
+        HLPFILE_FreeHlpFile(win->back.set[i].page->file);
+        win->back.set[i].page = NULL;
+    }
+    win->back.index = 0;
+}
+
 /***********************************************************************
  *
  *           WINHELP_DeleteWindow
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index 5f2424f..ee13d30 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -142,6 +142,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
 BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int);
 BOOL WINHELP_GetOpenFileName(LPSTR, int);
 BOOL WINHELP_CreateIndexWindow(void);
+void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
 INT  WINHELP_MessageBoxIDS(UINT, UINT, WORD);
 INT  WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);





More information about the wine-patches mailing list