diff options
| author | Ben Key | 2011-03-07 22:11:24 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2011-03-07 22:11:24 +0100 |
| commit | 7faeca66c766912265dea911f92c64b9608c0872 (patch) | |
| tree | 5354339f2df95fdc70d850aacd78c378be5bac0a /src | |
| parent | 7600cf45994d0c1d6fb42d8b0ddf725d9600bd1d (diff) | |
| download | emacs-7faeca66c766912265dea911f92c64b9608c0872.tar.gz emacs-7faeca66c766912265dea911f92c64b9608c0872.zip | |
Fix bug#8181.
* src/w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define.
(file_dialog_callback): Fix locating the window handle of the File Name
text field. After disabling it, set focus on the list control.
(Fx_file_dialog): If only_dir_p is non-nil, set the text of the File
Name text field to "Current Directory" if it does not already have
another value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/w32fns.c | 35 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7fbf3e1ef6c..9c612e0e09f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-03-07 Ben Key <bkey76@gmail.com> | ||
| 2 | |||
| 3 | * w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define. | ||
| 4 | (file_dialog_callback): Fix locating the window handle of the File Name | ||
| 5 | text field. After disabling it, set focus on the list control. | ||
| 6 | (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File | ||
| 7 | Name text field to "Current Directory" if it does not already have | ||
| 8 | another value. (Bug#8181) | ||
| 9 | |||
| 1 | 2011-03-07 Adrian Robert <Adrian.B.Robert@gmail.com> | 10 | 2011-03-07 Adrian Robert <Adrian.B.Robert@gmail.com> |
| 2 | 11 | ||
| 3 | * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" | 12 | * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width" |
diff --git a/src/w32fns.c b/src/w32fns.c index ec48397657a..09442d41e14 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -60,6 +60,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 60 | #include <dlgs.h> | 60 | #include <dlgs.h> |
| 61 | #include <imm.h> | 61 | #include <imm.h> |
| 62 | #define FILE_NAME_TEXT_FIELD edt1 | 62 | #define FILE_NAME_TEXT_FIELD edt1 |
| 63 | #define FILE_NAME_COMBO_BOX cmb13 | ||
| 64 | #define FILE_NAME_LIST lst1 | ||
| 63 | 65 | ||
| 64 | #include "font.h" | 66 | #include "font.h" |
| 65 | #include "w32font.h" | 67 | #include "w32font.h" |
| @@ -5868,13 +5870,37 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 5868 | { | 5870 | { |
| 5869 | HWND dialog = GetParent (hwnd); | 5871 | HWND dialog = GetParent (hwnd); |
| 5870 | HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); | 5872 | HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); |
| 5873 | HWND list = GetDlgItem (dialog, FILE_NAME_LIST); | ||
| 5871 | 5874 | ||
| 5872 | /* Directories is in index 2. */ | 5875 | /* At least on Windows 7, the above attempt to get the window handle |
| 5876 | to the File Name Text Field fails. The following code does the | ||
| 5877 | job though. Note that this code is based on my examination of the | ||
| 5878 | window hierarchy using Microsoft Spy++. bk */ | ||
| 5879 | if (edit_control == NULL) | ||
| 5880 | { | ||
| 5881 | HWND tmp = GetDlgItem (dialog, FILE_NAME_COMBO_BOX); | ||
| 5882 | if (tmp) | ||
| 5883 | { | ||
| 5884 | tmp = GetWindow (tmp, GW_CHILD); | ||
| 5885 | if (tmp) | ||
| 5886 | edit_control = GetWindow (tmp, GW_CHILD); | ||
| 5887 | } | ||
| 5888 | } | ||
| 5889 | |||
| 5890 | /* Directories is in index 2. */ | ||
| 5873 | if (notify->lpOFN->nFilterIndex == 2) | 5891 | if (notify->lpOFN->nFilterIndex == 2) |
| 5874 | { | 5892 | { |
| 5875 | CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, | 5893 | CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, |
| 5876 | "Current Directory"); | 5894 | "Current Directory"); |
| 5877 | EnableWindow (edit_control, FALSE); | 5895 | EnableWindow (edit_control, FALSE); |
| 5896 | /* Note that at least on Windows 7, the above call to EnableWindow | ||
| 5897 | disables the window that would ordinarily have focus. If we | ||
| 5898 | do not set focus to some other window here, focus will land in | ||
| 5899 | no man's land and the user will be unable to tab through the | ||
| 5900 | dialog box (pressing tab will only result in a beep). | ||
| 5901 | Avoid that problem by setting focus to the list here. */ | ||
| 5902 | if (CDN_INITDONE == notify->hdr.code) | ||
| 5903 | SetFocus (list); | ||
| 5878 | } | 5904 | } |
| 5879 | else | 5905 | else |
| 5880 | { | 5906 | { |
| @@ -5951,6 +5977,13 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5951 | else | 5977 | else |
| 5952 | filename[0] = '\0'; | 5978 | filename[0] = '\0'; |
| 5953 | 5979 | ||
| 5980 | /* The code in file_dialog_callback that attempts to set the text | ||
| 5981 | of the file name edit window when handling the CDN_INITDONE | ||
| 5982 | WM_NOTIFY message does not work. Setting filename to "Current | ||
| 5983 | Directory" in the only_dir_p case here does work however. */ | ||
| 5984 | if (filename[0] == 0 && ! NILP (only_dir_p)) | ||
| 5985 | strcpy (filename, "Current Directory"); | ||
| 5986 | |||
| 5954 | { | 5987 | { |
| 5955 | NEWOPENFILENAME new_file_details; | 5988 | NEWOPENFILENAME new_file_details; |
| 5956 | BOOL file_opened = FALSE; | 5989 | BOOL file_opened = FALSE; |