diff options
| author | Gerd Moellmann | 2001-05-03 17:10:00 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-03 17:10:00 +0000 |
| commit | a779d21374a1fdb38f7a9ed3a664b7321d9af7bd (patch) | |
| tree | 0f41d2d35ffa75610e0d77c8354997ed8f2cce33 /src | |
| parent | 2fa2f461f06f072402dfa764480c4a368bf582f5 (diff) | |
| download | emacs-a779d21374a1fdb38f7a9ed3a664b7321d9af7bd.tar.gz emacs-a779d21374a1fdb38f7a9ed3a664b7321d9af7bd.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xfns.c | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d49c9417118..6dd403357e7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2001-05-03 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-05-03 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xfns.c (file_dialog_unmap_cb): New function. | ||
| 4 | (Fx_file_dialog): Use it as XmNunmapCallback to capture the case | ||
| 5 | where a dialog is closed via the window manager. | ||
| 6 | |||
| 3 | * xdisp.c (try_window_id): Cases of changes all in front of | 7 | * xdisp.c (try_window_id): Cases of changes all in front of |
| 4 | the window start or all below the window end mostly rewritten. | 8 | the window start or all below the window end mostly rewritten. |
| 5 | (redisplay_window): Move the tests if try_window_id is | 9 | (redisplay_window): Move the tests if try_window_id is |
diff --git a/src/xfns.c b/src/xfns.c index 4f718fa9020..f6972f9c12b 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -11083,6 +11083,21 @@ file_dialog_cb (widget, client_data, call_data) | |||
| 11083 | } | 11083 | } |
| 11084 | 11084 | ||
| 11085 | 11085 | ||
| 11086 | /* Callback for unmapping a file selection dialog. This is used to | ||
| 11087 | capture the case where a dialog is closed via a window manager's | ||
| 11088 | closer button, for example. Using a XmNdestroyCallback didn't work | ||
| 11089 | in this case. */ | ||
| 11090 | |||
| 11091 | static void | ||
| 11092 | file_dialog_unmap_cb (widget, client_data, call_data) | ||
| 11093 | Widget widget; | ||
| 11094 | XtPointer call_data, client_data; | ||
| 11095 | { | ||
| 11096 | int *result = (int *) client_data; | ||
| 11097 | *result = XmCR_CANCEL; | ||
| 11098 | } | ||
| 11099 | |||
| 11100 | |||
| 11086 | DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, | 11101 | DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, |
| 11087 | "Read file name, prompting with PROMPT in directory DIR.\n\ | 11102 | "Read file name, prompting with PROMPT in directory DIR.\n\ |
| 11088 | Use a file selection dialog.\n\ | 11103 | Use a file selection dialog.\n\ |
| @@ -11135,6 +11150,8 @@ selection dialog's entry field, if MUSTMATCH is non-nil.") | |||
| 11135 | (XtPointer) &result); | 11150 | (XtPointer) &result); |
| 11136 | XtAddCallback (dialog, XmNcancelCallback, file_dialog_cb, | 11151 | XtAddCallback (dialog, XmNcancelCallback, file_dialog_cb, |
| 11137 | (XtPointer) &result); | 11152 | (XtPointer) &result); |
| 11153 | XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb, | ||
| 11154 | (XtPointer) &result); | ||
| 11138 | 11155 | ||
| 11139 | /* Disable the help button since we can't display help. */ | 11156 | /* Disable the help button since we can't display help. */ |
| 11140 | help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); | 11157 | help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); |
| @@ -11188,7 +11205,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil.") | |||
| 11188 | 11205 | ||
| 11189 | /* Process events until the user presses Cancel or OK. */ | 11206 | /* Process events until the user presses Cancel or OK. */ |
| 11190 | result = 0; | 11207 | result = 0; |
| 11191 | while (result == 0 || XtAppPending (Xt_app_con)) | 11208 | while (result == 0) |
| 11192 | XtAppProcessEvent (Xt_app_con, XtIMAll); | 11209 | XtAppProcessEvent (Xt_app_con, XtIMAll); |
| 11193 | 11210 | ||
| 11194 | /* Get the result. */ | 11211 | /* Get the result. */ |