aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-09-18 11:26:03 +0300
committerEli Zaretskii2013-09-18 11:26:03 +0300
commit28a16449218739dc41387b71233e9f9c0d62ceb9 (patch)
treee2fe0cf02a1be92e8a0444a30876bfdc3bed0131 /src
parentf1303b5259c58809845b1f223b34567786afbac4 (diff)
downloademacs-28a16449218739dc41387b71233e9f9c0d62ceb9.tar.gz
emacs-28a16449218739dc41387b71233e9f9c0d62ceb9.zip
Turn off text cursor when dropping down menus.
Diffstat (limited to 'src')
-rw-r--r--src/term.c24
-rw-r--r--src/w32console.c17
-rw-r--r--src/w32term.h4
3 files changed, 35 insertions, 10 deletions
diff --git a/src/term.c b/src/term.c
index 5dd70ac9249..b3d0faa8597 100644
--- a/src/term.c
+++ b/src/term.c
@@ -304,7 +304,11 @@ tty_hide_cursor (struct tty_display_info *tty)
304 if (tty->cursor_hidden == 0) 304 if (tty->cursor_hidden == 0)
305 { 305 {
306 tty->cursor_hidden = 1; 306 tty->cursor_hidden = 1;
307#ifdef WINDOWSNT
308 w32con_hide_cursor ();
309#else
307 OUTPUT_IF (tty, tty->TS_cursor_invisible); 310 OUTPUT_IF (tty, tty->TS_cursor_invisible);
311#endif
308 } 312 }
309} 313}
310 314
@@ -317,9 +321,13 @@ tty_show_cursor (struct tty_display_info *tty)
317 if (tty->cursor_hidden) 321 if (tty->cursor_hidden)
318 { 322 {
319 tty->cursor_hidden = 0; 323 tty->cursor_hidden = 0;
324#ifdef WINDOWSNT
325 w32con_show_cursor ();
326#else
320 OUTPUT_IF (tty, tty->TS_cursor_normal); 327 OUTPUT_IF (tty, tty->TS_cursor_normal);
321 if (visible_cursor) 328 if (visible_cursor)
322 OUTPUT_IF (tty, tty->TS_cursor_visible); 329 OUTPUT_IF (tty, tty->TS_cursor_visible);
330#endif
323 } 331 }
324} 332}
325 333
@@ -3244,6 +3252,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3244 int title_faces[4]; /* face to display the menu title */ 3252 int title_faces[4]; /* face to display the menu title */
3245 int faces[4], buffers_num_deleted = 0; 3253 int faces[4], buffers_num_deleted = 0;
3246 struct frame *sf = SELECTED_FRAME (); 3254 struct frame *sf = SELECTED_FRAME ();
3255 struct tty_display_info *tty = FRAME_TTY (sf);
3247 bool first_time; 3256 bool first_time;
3248 Lisp_Object saved_echo_area_message, selectface; 3257 Lisp_Object saved_echo_area_message, selectface;
3249 3258
@@ -3307,9 +3316,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3307 3316
3308 /* Turn off the cursor. Otherwise it shows through the menu 3317 /* Turn off the cursor. Otherwise it shows through the menu
3309 panes, which is ugly. */ 3318 panes, which is ugly. */
3310#if 0 3319 tty_hide_cursor (tty);
3311 show_cursor (0); /* FIXME: need a new hook, for w32console. */
3312#endif
3313 3320
3314 /* Display the menu title. We subtract 1 from x0 and y0 because we 3321 /* Display the menu title. We subtract 1 from x0 and y0 because we
3315 want to interpret them as zero-based column and row coordinates, 3322 want to interpret them as zero-based column and row coordinates,
@@ -3405,9 +3412,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3405 { 3412 {
3406 help_callback (menu_help_message, 3413 help_callback (menu_help_message,
3407 menu_help_paneno, menu_help_itemno); 3414 menu_help_paneno, menu_help_itemno);
3408#if 0 3415 tty_hide_cursor (tty);
3409 show_cursor (0); /* FIXME */
3410#endif
3411 prev_menu_help_message = menu_help_message; 3416 prev_menu_help_message = menu_help_message;
3412 } 3417 }
3413 /* We are busy-waiting for the mouse to move, so let's be nice 3418 /* We are busy-waiting for the mouse to move, so let's be nice
@@ -3459,10 +3464,9 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3459#endif 3464#endif
3460 while (statecount--) 3465 while (statecount--)
3461 free_saved_screen (state[statecount].screen_behind); 3466 free_saved_screen (state[statecount].screen_behind);
3462#if 0 3467 tty_show_cursor (tty); /* turn cursor back on */
3463 show_cursor (1); /* turn cursor back on */ 3468
3464#endif 3469/* Clean up any mouse events that are waiting inside Emacs event queue.
3465 /* Clean up any mouse events that are waiting inside Emacs event queue.
3466 These events are likely to be generated before the menu was even 3470 These events are likely to be generated before the menu was even
3467 displayed, probably because the user pressed and released the button 3471 displayed, probably because the user pressed and released the button
3468 (which invoked the menu) too quickly. If we don't remove these events, 3472 (which invoked the menu) too quickly. If we don't remove these events,
diff --git a/src/w32console.c b/src/w32console.c
index cb42bae1421..94bb5df07a4 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -62,6 +62,7 @@ static HANDLE prev_screen, cur_screen;
62static WORD char_attr_normal; 62static WORD char_attr_normal;
63static DWORD prev_console_mode; 63static DWORD prev_console_mode;
64 64
65static CONSOLE_CURSOR_INFO console_cursor_info;
65#ifndef USE_SEPARATE_SCREEN 66#ifndef USE_SEPARATE_SCREEN
66static CONSOLE_CURSOR_INFO prev_console_cursor; 67static CONSOLE_CURSOR_INFO prev_console_cursor;
67#endif 68#endif
@@ -95,6 +96,22 @@ w32con_move_cursor (struct frame *f, int row, int col)
95 SetConsoleCursorPosition (cur_screen, cursor_coords); 96 SetConsoleCursorPosition (cur_screen, cursor_coords);
96} 97}
97 98
99void
100w32con_hide_cursor (void)
101{
102 GetConsoleCursorInfo (cur_screen, &console_cursor_info);
103 console_cursor_info.bVisible = FALSE;
104 SetConsoleCursorInfo (cur_screen, &console_cursor_info);
105}
106
107void
108w32con_show_cursor (void)
109{
110 GetConsoleCursorInfo (cur_screen, &console_cursor_info);
111 console_cursor_info.bVisible = TRUE;
112 SetConsoleCursorInfo (cur_screen, &console_cursor_info);
113}
114
98/* Clear from cursor to end of screen. */ 115/* Clear from cursor to end of screen. */
99static void 116static void
100w32con_clear_to_end (struct frame *f) 117w32con_clear_to_end (struct frame *f)
diff --git a/src/w32term.h b/src/w32term.h
index 41c5c71832a..e65c1146294 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -236,6 +236,10 @@ extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key);
236 236
237extern Lisp_Object x_get_focus_frame (struct frame *); 237extern Lisp_Object x_get_focus_frame (struct frame *);
238 238
239/* w32console.c */
240extern void w32con_hide_cursor (void);
241extern void w32con_show_cursor (void);
242
239 243
240#define PIX_TYPE COLORREF 244#define PIX_TYPE COLORREF
241 245