1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-16 09:50:25 +00:00

(file_dialog_unmap_cb): New function.

(Fx_file_dialog): Use it as XmNunmapCallback to capture the case
where a dialog is closed via the window manager.
This commit is contained in:
Gerd Moellmann 2001-05-03 17:10:00 +00:00
parent 2fa2f461f0
commit a779d21374
2 changed files with 22 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2001-05-03 Gerd Moellmann <gerd@gnu.org> 2001-05-03 Gerd Moellmann <gerd@gnu.org>
* xfns.c (file_dialog_unmap_cb): New function.
(Fx_file_dialog): Use it as XmNunmapCallback to capture the case
where a dialog is closed via the window manager.
* xdisp.c (try_window_id): Cases of changes all in front of * xdisp.c (try_window_id): Cases of changes all in front of
the window start or all below the window end mostly rewritten. the window start or all below the window end mostly rewritten.
(redisplay_window): Move the tests if try_window_id is (redisplay_window): Move the tests if try_window_id is

View File

@ -11083,6 +11083,21 @@ file_dialog_cb (widget, client_data, call_data)
} }
/* Callback for unmapping a file selection dialog. This is used to
capture the case where a dialog is closed via a window manager's
closer button, for example. Using a XmNdestroyCallback didn't work
in this case. */
static void
file_dialog_unmap_cb (widget, client_data, call_data)
Widget widget;
XtPointer call_data, client_data;
{
int *result = (int *) client_data;
*result = XmCR_CANCEL;
}
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
"Read file name, prompting with PROMPT in directory DIR.\n\ "Read file name, prompting with PROMPT in directory DIR.\n\
Use a file selection dialog.\n\ Use a file selection dialog.\n\
@ -11135,6 +11150,8 @@ selection dialog's entry field, if MUSTMATCH is non-nil.")
(XtPointer) &result); (XtPointer) &result);
XtAddCallback (dialog, XmNcancelCallback, file_dialog_cb, XtAddCallback (dialog, XmNcancelCallback, file_dialog_cb,
(XtPointer) &result); (XtPointer) &result);
XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb,
(XtPointer) &result);
/* Disable the help button since we can't display help. */ /* Disable the help button since we can't display help. */
help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
@ -11188,7 +11205,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil.")
/* Process events until the user presses Cancel or OK. */ /* Process events until the user presses Cancel or OK. */
result = 0; result = 0;
while (result == 0 || XtAppPending (Xt_app_con)) while (result == 0)
XtAppProcessEvent (Xt_app_con, XtIMAll); XtAppProcessEvent (Xt_app_con, XtIMAll);
/* Get the result. */ /* Get the result. */