Mercurial > emacs
comparison src/w32fns.c @ 42865:40d08b8571ec
(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.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sun, 20 Jan 2002 23:13:29 +0000 |
parents | ebb3a20bc357 |
children | 9b06036a8c5e |
comparison
equal
deleted
inserted
replaced
42864:c1af6a7f3dd4 | 42865:40d08b8571ec |
---|---|
313 /* From w32term.c. */ | 313 /* From w32term.c. */ |
314 extern Lisp_Object Vw32_num_mouse_buttons; | 314 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. */ |
325 void | 328 void |
326 check_w32 () | 329 check_w32 () |
4876 /* Relinquish the system caret. */ | 4879 /* Relinquish the system caret. */ |
4877 if (w32_system_caret_hwnd) | 4880 if (w32_system_caret_hwnd) |
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: |
4884 case WM_COMMAND: | 4888 case WM_COMMAND: |
4885 command: | 4889 command: |
5021 | 5025 |
5022 case WM_EMACS_DESTROYWINDOW: | 5026 case WM_EMACS_DESTROYWINDOW: |
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 { |
5042 UINT flags; | 5073 UINT flags; |
5043 POINT *pos; | 5074 POINT *pos; |