summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-18 12:44:40 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-18 12:44:40 -0800
commit2b7825b2ab93b5ac41d295d0fa0c2b081e624cb7 (patch)
tree09e6621aef5c7398190fde3436a9e0a1e42da304
parentd6c728b4d7c86fb486cd9f18c749f3b61ff8fb63 (diff)
Install WM_DELETE_WINDOW handler for search window
Allows using window manager close icon to close search window without killing the entire program. Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720266 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--handler.c23
-rw-r--r--main.c1
-rw-r--r--man.h2
3 files changed, 26 insertions, 0 deletions
diff --git a/handler.c b/handler.c
index fec793d..e34995e 100644
--- a/handler.c
+++ b/handler.c
@@ -487,11 +487,34 @@ PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params)
XtRealizeWidget(man_globals->search_widget);
AddCursor(man_globals->search_widget,
resources.cursors.search_entry);
+/*
+ * Set up ICCCM delete window.
+ */
+ XtOverrideTranslations(man_globals->search_widget,
+ XtParseTranslationTable("<Message>WM_PROTOCOLS: RemoveSearch()"));
+ XSetWMProtocols(XtDisplay(man_globals->search_widget),
+ XtWindow(man_globals->search_widget),
+ &wm_delete_window, 1);
}
Popup(man_globals->search_widget, XtGrabNone);
}
}
+/* Function Name: RemoveSearch
+ * Description: Removes this search widget.
+ * Arguments: w - search widget
+ * event - NOT USED.
+ * params, num_params - NOT USED.
+ * Returns: none.
+ */
+
+/*ARGSUSED*/
+void
+RemoveSearch(Widget w, XEvent * event, String * params, Cardinal * num_params)
+{
+ XtPopdown(w);
+}
+
/* Function Name: CreateNewManpage
* Description: Creates A New Manual Page.
* Arguments: w - NOT USED.
diff --git a/main.c b/main.c
index 64cf9ed..0d9f3fe 100644
--- a/main.c
+++ b/main.c
@@ -117,6 +117,7 @@ static XtActionsRec xman_actions[] = {
{"Search", Search},
{"PopupHelp", PopupHelp},
{"PopupSearch", PopupSearch},
+ {"RemoveSearch", RemoveSearch},
{"CreateNewManpage", CreateNewManpage},
{"RemoveThisManpage", RemoveThisManpage},
{"SaveFormattedPage", SaveFormattedPage},
diff --git a/man.h b/man.h
index 2004dc2..bdb66e4 100644
--- a/man.h
+++ b/man.h
@@ -235,6 +235,8 @@ void PopupHelp(Widget w, XEvent * event, String * params,
Cardinal * num_params);
void PopupSearch(Widget w, XEvent * event, String * params,
Cardinal * num_params);
+void RemoveSearch(Widget w, XEvent * event, String * params,
+ Cardinal * num_params);
void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params);
void RemoveThisManpage(Widget w, XEvent * event, String * params,
Cardinal * num_params);