diff options
| author | Jason Rumney | 2002-01-20 23:13:29 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-01-20 23:13:29 +0000 |
| commit | 93f2ca617b24f8c1aaa66af54757d39fde18f6f4 (patch) | |
| tree | 30ff93f34b776d35f2c367eb7133e45cb1e61125 /src | |
| parent | 99558ce8851c56c6e9c481a70c9a2feea57d22d4 (diff) | |
| download | emacs-93f2ca617b24f8c1aaa66af54757d39fde18f6f4.tar.gz emacs-93f2ca617b24f8c1aaa66af54757d39fde18f6f4.zip | |
(w32_visible_system_caret_hwnd): New static variable.
(w32_wnd_proc) <WM_KILL_FOCUS, WM_EMACS_DESTROY_CARET>: Set it.
<WM_EMACS_TRACK_CARET>: Arrange for system caret to be visible if
the user requests it. Use system default width when creating.
<WM_EMACS_HIDE_CARET, WM_EMACS_SHOW_CARET>: Handle new messages.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index e2a0f96331d..1ab46faac47 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -315,10 +315,13 @@ extern Lisp_Object Vw32_num_mouse_buttons; | |||
| 315 | extern Lisp_Object Vw32_recognize_altgr; | 315 | extern Lisp_Object Vw32_recognize_altgr; |
| 316 | 316 | ||
| 317 | extern HWND w32_system_caret_hwnd; | 317 | extern HWND w32_system_caret_hwnd; |
| 318 | extern int w32_system_caret_width; | 318 | |
| 319 | extern int w32_system_caret_height; | 319 | extern int w32_system_caret_height; |
| 320 | extern int w32_system_caret_x; | 320 | extern int w32_system_caret_x; |
| 321 | extern int w32_system_caret_y; | 321 | extern int w32_system_caret_y; |
| 322 | extern int w32_use_visible_system_caret; | ||
| 323 | |||
| 324 | HWND w32_visible_system_caret_hwnd; | ||
| 322 | 325 | ||
| 323 | 326 | ||
| 324 | /* Error if we are not connected to MS-Windows. */ | 327 | /* Error if we are not connected to MS-Windows. */ |
| @@ -4878,6 +4881,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 4878 | { | 4881 | { |
| 4879 | DestroyCaret (); | 4882 | DestroyCaret (); |
| 4880 | w32_system_caret_hwnd = NULL; | 4883 | w32_system_caret_hwnd = NULL; |
| 4884 | w32_visible_system_caret_hwnd = NULL; | ||
| 4881 | } | 4885 | } |
| 4882 | case WM_MOVE: | 4886 | case WM_MOVE: |
| 4883 | case WM_SIZE: | 4887 | case WM_SIZE: |
| @@ -5023,19 +5027,46 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 5023 | DragAcceptFiles ((HWND) wParam, FALSE); | 5027 | DragAcceptFiles ((HWND) wParam, FALSE); |
| 5024 | return DestroyWindow ((HWND) wParam); | 5028 | return DestroyWindow ((HWND) wParam); |
| 5025 | 5029 | ||
| 5030 | case WM_EMACS_HIDE_CARET: | ||
| 5031 | return HideCaret (hwnd); | ||
| 5032 | |||
| 5033 | case WM_EMACS_SHOW_CARET: | ||
| 5034 | return ShowCaret (hwnd); | ||
| 5035 | |||
| 5026 | case WM_EMACS_DESTROY_CARET: | 5036 | case WM_EMACS_DESTROY_CARET: |
| 5027 | w32_system_caret_hwnd = NULL; | 5037 | w32_system_caret_hwnd = NULL; |
| 5038 | w32_visible_system_caret_hwnd = NULL; | ||
| 5028 | return DestroyCaret (); | 5039 | return DestroyCaret (); |
| 5029 | 5040 | ||
| 5030 | case WM_EMACS_TRACK_CARET: | 5041 | case WM_EMACS_TRACK_CARET: |
| 5031 | /* If there is currently no system caret, create one. */ | 5042 | /* If there is currently no system caret, create one. */ |
| 5032 | if (w32_system_caret_hwnd == NULL) | 5043 | if (w32_system_caret_hwnd == NULL) |
| 5033 | { | 5044 | { |
| 5045 | /* Use the default caret width, and avoid changing it | ||
| 5046 | unneccesarily, as it confuses screen reader software. */ | ||
| 5034 | w32_system_caret_hwnd = hwnd; | 5047 | w32_system_caret_hwnd = hwnd; |
| 5035 | CreateCaret (hwnd, NULL, w32_system_caret_width, | 5048 | CreateCaret (hwnd, NULL, 0, |
| 5036 | w32_system_caret_height); | 5049 | w32_system_caret_height); |
| 5037 | } | 5050 | } |
| 5038 | return SetCaretPos (w32_system_caret_x, w32_system_caret_y); | 5051 | |
| 5052 | if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y)) | ||
| 5053 | return 0; | ||
| 5054 | /* Ensure visible caret gets turned on when requested. */ | ||
| 5055 | else if (w32_use_visible_system_caret | ||
| 5056 | && w32_visible_system_caret_hwnd != hwnd) | ||
| 5057 | { | ||
| 5058 | w32_visible_system_caret_hwnd = hwnd; | ||
| 5059 | return ShowCaret (hwnd); | ||
| 5060 | } | ||
| 5061 | /* Ensure visible caret gets turned off when requested. */ | ||
| 5062 | else if (!w32_use_visible_system_caret | ||
| 5063 | && w32_visible_system_caret_hwnd) | ||
| 5064 | { | ||
| 5065 | w32_visible_system_caret_hwnd = NULL; | ||
| 5066 | return HideCaret (hwnd); | ||
| 5067 | } | ||
| 5068 | else | ||
| 5069 | return 1; | ||
| 5039 | 5070 | ||
| 5040 | case WM_EMACS_TRACKPOPUPMENU: | 5071 | case WM_EMACS_TRACKPOPUPMENU: |
| 5041 | { | 5072 | { |