diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-02-18 12:44:40 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-02-18 12:44:40 -0800 |
commit | 2b7825b2ab93b5ac41d295d0fa0c2b081e624cb7 (patch) | |
tree | 09e6621aef5c7398190fde3436a9e0a1e42da304 | |
parent | d6c728b4d7c86fb486cd9f18c749f3b61ff8fb63 (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.c | 23 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | man.h | 2 |
3 files changed, 26 insertions, 0 deletions
@@ -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. @@ -117,6 +117,7 @@ static XtActionsRec xman_actions[] = { {"Search", Search}, {"PopupHelp", PopupHelp}, {"PopupSearch", PopupSearch}, + {"RemoveSearch", RemoveSearch}, {"CreateNewManpage", CreateNewManpage}, {"RemoveThisManpage", RemoveThisManpage}, {"SaveFormattedPage", SaveFormattedPage}, @@ -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); |