/[emacs]/emacs/src/w32console.c
ViewVC logotype

Diff of /emacs/src/w32console.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.32.4.3 by miles, Tue Jul 6 09:14:38 2004 UTC revision 1.32.4.4 by miles, Tue Jul 6 09:24:07 2004 UTC
# Line 53  extern int read_input_pending (); Line 53  extern int read_input_pending ();
53  extern struct frame * updating_frame;  extern struct frame * updating_frame;
54  extern int meta_key;  extern int meta_key;
55    
56  static void move_cursor (int row, int col);  static void w32con_move_cursor (int row, int col);
57  static void clear_to_end (void);  static void w32con_clear_to_end (void);
58  void clear_frame (void);  static void w32con_clear_frame (void);
59  void clear_end_of_line (int);  static void w32con_clear_end_of_line (int);
60  static void ins_del_lines (int vpos, int n);  static void w32con_ins_del_lines (int vpos, int n);
61  void insert_glyphs (struct glyph *start, int len);  static void w32con_insert_glyphs (struct glyph *start, int len);
62  void write_glyphs (struct glyph *string, int len);  static void w32con_write_glyphs (struct glyph *string, int len);
63  void delete_glyphs (int n);  static void w32con_delete_glyphs (int n);
64  void w32_sys_ring_bell (void);  void w32_sys_ring_bell (void);
65  void reset_terminal_modes (void);  static void w32con_reset_terminal_modes (void);
66  void set_terminal_modes (void);  static void w32con_set_terminal_modes (void);
67  void set_terminal_window (int size);  static void w32con_set_terminal_window (int size);
68  void update_begin (struct frame * f);  static void w32con_update_begin (struct frame * f);
69  void update_end (struct frame * f);  static void w32con_update_end (struct frame * f);
70  static WORD w32_face_attributes (struct frame *f, int face_id);  static WORD w32_face_attributes (struct frame *f, int face_id);
71    
72  static COORD    cursor_coords;  static COORD    cursor_coords;
# Line 104  ctrl_c_handler (unsigned long type) Line 104  ctrl_c_handler (unsigned long type)
104    
105  /* Move the cursor to (row, col).  */  /* Move the cursor to (row, col).  */
106  static void  static void
107  move_cursor (int row, int col)  w32con_move_cursor (int row, int col)
108  {  {
109    cursor_coords.X = col;    cursor_coords.X = col;
110    cursor_coords.Y = row;    cursor_coords.Y = row;
# Line 117  move_cursor (int row, int col) Line 117  move_cursor (int row, int col)
117    
118  /* Clear from cursor to end of screen.  */  /* Clear from cursor to end of screen.  */
119  static void  static void
120  clear_to_end (void)  w32con_clear_to_end (void)
121  {  {
122    struct frame * f = PICK_FRAME ();    struct frame * f = PICK_FRAME ();
123    
124    clear_end_of_line (FRAME_COLS (f) - 1);    w32con_clear_end_of_line (FRAME_COLS (f) - 1);
125    ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);    w32con_ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);
126  }  }
127    
128  /* Clear the frame.  */  /* Clear the frame.  */
129  void  static void
130  clear_frame (void)  w32con_clear_frame (void)
131  {  {
132    struct frame *  f = PICK_FRAME ();    struct frame *  f = PICK_FRAME ();
133    COORD      dest;    COORD      dest;
# Line 144  clear_frame (void) Line 144  clear_frame (void)
144    FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);    FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
145    FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);    FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
146    
147    move_cursor (0, 0);    w32con_move_cursor (0, 0);
148  }  }
149    
150    
# Line 152  static struct glyph glyph_base[256]; Line 152  static struct glyph glyph_base[256];
152  static BOOL  ceol_initialized = FALSE;  static BOOL  ceol_initialized = FALSE;
153    
154  /* Clear from Cursor to end (what's "standout marker"?).  */  /* Clear from Cursor to end (what's "standout marker"?).  */
155  void  static void
156  clear_end_of_line (int end)  w32con_clear_end_of_line (int end)
157  {  {
158    if (!ceol_initialized)    if (!ceol_initialized)
159      {      {
# Line 164  clear_end_of_line (int end) Line 164  clear_end_of_line (int end)
164          }          }
165        ceol_initialized = TRUE;        ceol_initialized = TRUE;
166      }      }
167    write_glyphs (glyph_base, end - cursor_coords.X);     /* fencepost ?  */    w32con_write_glyphs (glyph_base, end - cursor_coords.X);      /* fencepost ?  */
168  }  }
169    
170  /* Insert n lines at vpos. if n is negative delete -n lines.  */  /* Insert n lines at vpos. if n is negative delete -n lines.  */
171  void  static void
172  ins_del_lines (int vpos, int n)  w32con_ins_del_lines (int vpos, int n)
173  {  {
174    int        i, nb;    int        i, nb;
175    SMALL_RECT scroll;    SMALL_RECT scroll;
# Line 212  ins_del_lines (int vpos, int n) Line 212  ins_del_lines (int vpos, int n)
212          {          {
213            for (i = scroll.Bottom; i < dest.Y; i++)            for (i = scroll.Bottom; i < dest.Y; i++)
214              {              {
215                move_cursor (i, 0);                w32con_move_cursor (i, 0);
216                clear_end_of_line (FRAME_COLS (f));                w32con_clear_end_of_line (FRAME_COLS (f));
217              }              }
218          }          }
219      }      }
# Line 225  ins_del_lines (int vpos, int n) Line 225  ins_del_lines (int vpos, int n)
225          {          {
226            for (i = nb; i < scroll.Top; i++)            for (i = nb; i < scroll.Top; i++)
227              {              {
228                move_cursor (i, 0);                w32con_move_cursor (i, 0);
229                clear_end_of_line (FRAME_COLS (f));                w32con_clear_end_of_line (FRAME_COLS (f));
230              }              }
231          }          }
232      }      }
# Line 275  scroll_line (int dist, int direction) Line 275  scroll_line (int dist, int direction)
275    
276    
277  /* If start is zero insert blanks instead of a string at start ?. */  /* If start is zero insert blanks instead of a string at start ?. */
278  void  static void
279  insert_glyphs (register struct glyph *start, register int len)  w32con_insert_glyphs (register struct glyph *start, register int len)
280  {  {
281    scroll_line (len, RIGHT);    scroll_line (len, RIGHT);
282    
# Line 286  insert_glyphs (register struct glyph *st Line 286  insert_glyphs (register struct glyph *st
286        /* Print the first len characters of start, cursor_coords.X adjusted        /* Print the first len characters of start, cursor_coords.X adjusted
287           by write_glyphs.  */           by write_glyphs.  */
288    
289        write_glyphs (start, len);        w32con_write_glyphs (start, len);
290      }      }
291    else    else
292      {      {
293        clear_end_of_line (cursor_coords.X + len);        w32con_clear_end_of_line (cursor_coords.X + len);
294      }      }
295  }  }
296    
297  void  static void
298  write_glyphs (register struct glyph *string, register int len)  w32con_write_glyphs (register struct glyph *string, register int len)
299  {  {
300    int produced, consumed;    int produced, consumed;
301    DWORD r;    DWORD r;
# Line 353  write_glyphs (register struct glyph *str Line 353  write_glyphs (register struct glyph *str
353                  }                  }
354    
355                cursor_coords.X += produced;                cursor_coords.X += produced;
356                move_cursor (cursor_coords.Y, cursor_coords.X);                w32con_move_cursor (cursor_coords.Y, cursor_coords.X);
357              }              }
358            len -= consumed;            len -= consumed;
359            n -= consumed;            n -= consumed;
# Line 391  write_glyphs (register struct glyph *str Line 391  write_glyphs (register struct glyph *str
391  }  }
392    
393    
394  void  static void
395  delete_glyphs (int n)  w32con_delete_glyphs (int n)
396  {  {
397    /* delete chars means scroll chars from cursor_coords.X + n to    /* delete chars means scroll chars from cursor_coords.X + n to
398       cursor_coords.X, anything beyond the edge of the screen should       cursor_coords.X, anything beyond the edge of the screen should
# Line 450  SOUND is nil to use the normal beep.  */ Line 450  SOUND is nil to use the normal beep.  */
450    return sound;    return sound;
451  }  }
452    
453  void  static void
454  reset_terminal_modes (void)  w32con_reset_terminal_modes (void)
455  {  {
456  #ifdef USE_SEPARATE_SCREEN  #ifdef USE_SEPARATE_SCREEN
457    SetConsoleActiveScreenBuffer (prev_screen);    SetConsoleActiveScreenBuffer (prev_screen);
# Line 461  reset_terminal_modes (void) Line 461  reset_terminal_modes (void)
461    SetConsoleMode (keyboard_handle, prev_console_mode);    SetConsoleMode (keyboard_handle, prev_console_mode);
462  }  }
463    
464  void  static void
465  set_terminal_modes (void)  w32con_set_terminal_modes (void)
466  {  {
467    CONSOLE_CURSOR_INFO cci;    CONSOLE_CURSOR_INFO cci;
468    
# Line 484  set_terminal_modes (void) Line 484  set_terminal_modes (void)
484     clumps rather than one-character-at-a-time...     clumps rather than one-character-at-a-time...
485    
486     we'll start with not moving the cursor while an update is in progress.  */     we'll start with not moving the cursor while an update is in progress.  */
487  void  static void
488  update_begin (struct frame * f)  w32con_update_begin (struct frame * f)
489  {  {
490  }  }
491    
492  void  static void
493  update_end (struct frame * f)  w32con_update_end (struct frame * f)
494  {  {
495    SetConsoleCursorPosition (cur_screen, cursor_coords);    SetConsoleCursorPosition (cur_screen, cursor_coords);
496  }  }
497    
498  void  static void
499  set_terminal_window (int size)  w32con_set_terminal_window (int size)
500  {  {
501  }  }
502    
# Line 574  initialize_w32_display (void) Line 574  initialize_w32_display (void)
574  {  {
575    CONSOLE_SCREEN_BUFFER_INFO    info;    CONSOLE_SCREEN_BUFFER_INFO    info;
576    
577    cursor_to_hook                = move_cursor;    cursor_to_hook                = w32con_move_cursor;
578    raw_cursor_to_hook            = move_cursor;    raw_cursor_to_hook            = w32con_move_cursor;
579    clear_to_end_hook             = clear_to_end;    clear_to_end_hook             = w32con_clear_to_end;
580    clear_frame_hook              = clear_frame;    clear_frame_hook              = w32con_clear_frame;
581    clear_end_of_line_hook        = clear_end_of_line;    clear_end_of_line_hook        = w32con_clear_end_of_line;
582    ins_del_lines_hook            = ins_del_lines;    ins_del_lines_hook            = w32con_ins_del_lines;
583    insert_glyphs_hook            = insert_glyphs;    insert_glyphs_hook            = w32con_insert_glyphs;
584    write_glyphs_hook             = write_glyphs;    write_glyphs_hook             = w32con_write_glyphs;
585    delete_glyphs_hook            = delete_glyphs;    delete_glyphs_hook            = w32con_delete_glyphs;
586    ring_bell_hook                = w32_sys_ring_bell;    ring_bell_hook                = w32_sys_ring_bell;
587    reset_terminal_modes_hook     = reset_terminal_modes;    reset_terminal_modes_hook     = w32con_reset_terminal_modes;
588    set_terminal_modes_hook       = set_terminal_modes;    set_terminal_modes_hook       = w32con_set_terminal_modes;
589    set_terminal_window_hook      = set_terminal_window;    set_terminal_window_hook      = w32con_set_terminal_window;
590    update_begin_hook             = update_begin;    update_begin_hook             = w32con_update_begin;
591    update_end_hook               = update_end;    update_end_hook               = w32con_update_end;
592    
593    read_socket_hook = w32_console_read_socket;    read_socket_hook = w32_console_read_socket;
594    mouse_position_hook = w32_console_mouse_position;    mouse_position_hook = w32_console_mouse_position;

Legend:
Removed from v.1.32.4.3  
changed lines
  Added in v.1.32.4.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26