/[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 by jasonr, Mon Nov 12 23:51:11 2001 UTC revision 1.32.4.1 by miles, Fri Apr 4 06:21:04 2003 UTC
# Line 108  move_cursor (int row, int col) Line 108  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;
111      
112    if (updating_frame == (struct frame *) NULL)    if (updating_frame == (struct frame *) NULL)
113      {      {
114        SetConsoleCursorPosition (cur_screen, cursor_coords);        SetConsoleCursorPosition (cur_screen, cursor_coords);
# Line 120  void Line 120  void
120  clear_to_end (void)  clear_to_end (void)
121  {  {
122    struct frame * f = PICK_FRAME ();    struct frame * f = PICK_FRAME ();
123      
124    clear_end_of_line (FRAME_WIDTH (f) - 1);    clear_end_of_line (FRAME_WIDTH (f) - 1);
125    ins_del_lines (cursor_coords.Y, FRAME_HEIGHT (f) - cursor_coords.Y - 1);    ins_del_lines (cursor_coords.Y, FRAME_HEIGHT (f) - cursor_coords.Y - 1);
126  }  }
# Line 191  ins_del_lines (int vpos, int n) Line 191  ins_del_lines (int vpos, int n)
191      }      }
192    scroll.Left = 0;    scroll.Left = 0;
193    scroll.Right = FRAME_WIDTH (f);    scroll.Right = FRAME_WIDTH (f);
194      
195    dest.X = 0;    dest.X = 0;
196      
197    fill.Char.AsciiChar = 0x20;    fill.Char.AsciiChar = 0x20;
198    fill.Attributes = char_attr_normal;    fill.Attributes = char_attr_normal;
199      
200    ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill);    ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill);
201    
202    /* Here we have to deal with a w32 console flake: If the scroll    /* Here we have to deal with a w32 console flake: If the scroll
# Line 222  ins_del_lines (int vpos, int n) Line 222  ins_del_lines (int vpos, int n)
222        nb = dest.Y + (scroll.Bottom - scroll.Top) + 1;        nb = dest.Y + (scroll.Bottom - scroll.Top) + 1;
223    
224        if (nb < scroll.Top)        if (nb < scroll.Top)
225          {          {
226            for (i = nb; i < scroll.Top; i++)            for (i = nb; i < scroll.Top; i++)
227              {              {
228                move_cursor (i, 0);                move_cursor (i, 0);
# Line 230  ins_del_lines (int vpos, int n) Line 230  ins_del_lines (int vpos, int n)
230              }              }
231          }          }
232      }      }
233      
234    cursor_coords.X = 0;    cursor_coords.X = 0;
235    cursor_coords.Y = vpos;    cursor_coords.Y = vpos;
236  }  }
# Line 249  scroll_line (int dist, int direction) Line 249  scroll_line (int dist, int direction)
249    COORD      dest;    COORD      dest;
250    CHAR_INFO  fill;    CHAR_INFO  fill;
251    struct frame *  f = PICK_FRAME ();    struct frame *  f = PICK_FRAME ();
252      
253    scroll.Top = cursor_coords.Y;    scroll.Top = cursor_coords.Y;
254    scroll.Bottom = cursor_coords.Y;    scroll.Bottom = cursor_coords.Y;
255      
256    if (direction == LEFT)    if (direction == LEFT)
257      {      {
258        scroll.Left = cursor_coords.X + dist;        scroll.Left = cursor_coords.X + dist;
# Line 263  scroll_line (int dist, int direction) Line 263  scroll_line (int dist, int direction)
263        scroll.Left = cursor_coords.X;        scroll.Left = cursor_coords.X;
264        scroll.Right = FRAME_WIDTH (f) - dist - 1;        scroll.Right = FRAME_WIDTH (f) - dist - 1;
265      }      }
266      
267    dest.X = cursor_coords.X;    dest.X = cursor_coords.X;
268    dest.Y = cursor_coords.Y;    dest.Y = cursor_coords.Y;
269      
270    fill.Char.AsciiChar = 0x20;    fill.Char.AsciiChar = 0x20;
271    fill.Attributes = char_attr_normal;    fill.Attributes = char_attr_normal;
272    
# Line 285  insert_glyphs (register struct glyph *st Line 285  insert_glyphs (register struct glyph *st
285      {      {
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);        write_glyphs (start, len);
290      }      }
291    else    else
# Line 316  write_glyphs (register struct glyph *str Line 316  write_glyphs (register struct glyph *str
316        /* Identify a run of glyphs with the same face.  */        /* Identify a run of glyphs with the same face.  */
317        int face_id = string->face_id;        int face_id = string->face_id;
318        int n;        int n;
319          
320        for (n = 1; n < len; ++n)        for (n = 1; n < len; ++n)
321          if (string[n].face_id != face_id)          if (string[n].face_id != face_id)
322            break;            break;
# Line 336  write_glyphs (register struct glyph *str Line 336  write_glyphs (register struct glyph *str
336              {              {
337                /* Set the attribute for these characters.  */                /* Set the attribute for these characters.  */
338                if (!FillConsoleOutputAttribute (cur_screen, char_attr,                if (!FillConsoleOutputAttribute (cur_screen, char_attr,
339                                                 produced, cursor_coords, &r))                                                 produced, cursor_coords, &r))
340                  {                  {
341                    printf ("Failed writing console attributes: %d\n",                    printf ("Failed writing console attributes: %d\n",
342                            GetLastError ());                            GetLastError ());
# Line 354  write_glyphs (register struct glyph *str Line 354  write_glyphs (register struct glyph *str
354    
355                cursor_coords.X += produced;                cursor_coords.X += produced;
356                move_cursor (cursor_coords.Y, cursor_coords.X);                move_cursor (cursor_coords.Y, cursor_coords.X);
357              }                  }
358            len -= consumed;            len -= consumed;
359            n -= consumed;            n -= consumed;
360            string += consumed;            string += consumed;
# Line 371  write_glyphs (register struct glyph *str Line 371  write_glyphs (register struct glyph *str
371          {          {
372            if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal,            if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal,
373                                             terminal_coding.produced,                                             terminal_coding.produced,
374                                             cursor_coords, &r))                                             cursor_coords, &r))
375              {              {
376                printf ("Failed writing console attributes: %d\n",                printf ("Failed writing console attributes: %d\n",
377                        GetLastError ());                        GetLastError ());
# Line 394  write_glyphs (register struct glyph *str Line 394  write_glyphs (register struct glyph *str
394  void  void
395  delete_glyphs (int n)  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
399       come out empty...  */       come out empty...  */
400    
401    scroll_line (n, LEFT);    scroll_line (n, LEFT);
# Line 407  static unsigned int sound_type = 0xFFFFF Line 407  static unsigned int sound_type = 0xFFFFF
407  void  void
408  w32_sys_ring_bell (void)  w32_sys_ring_bell (void)
409  {  {
410    if (sound_type == 0xFFFFFFFF)    if (sound_type == 0xFFFFFFFF)
411      {      {
412        Beep (666, 100);        Beep (666, 100);
413      }      }
# Line 430  SOUND is nil to use the normal beep.  */ Line 430  SOUND is nil to use the normal beep.  */
430  {  {
431    CHECK_SYMBOL (sound);    CHECK_SYMBOL (sound);
432    
433    if (NILP (sound))    if (NILP (sound))
434        sound_type = 0xFFFFFFFF;        sound_type = 0xFFFFFFFF;
435    else if (EQ (sound, intern ("asterisk")))    else if (EQ (sound, intern ("asterisk")))
436        sound_type = MB_ICONASTERISK;        sound_type = MB_ICONASTERISK;
437    else if (EQ (sound, intern ("exclamation")))    else if (EQ (sound, intern ("exclamation")))
438        sound_type = MB_ICONEXCLAMATION;        sound_type = MB_ICONEXCLAMATION;
439    else if (EQ (sound, intern ("hand")))    else if (EQ (sound, intern ("hand")))
440        sound_type = MB_ICONHAND;        sound_type = MB_ICONHAND;
441    else if (EQ (sound, intern ("question")))    else if (EQ (sound, intern ("question")))
442        sound_type = MB_ICONQUESTION;        sound_type = MB_ICONQUESTION;
443    else if (EQ (sound, intern ("ok")))    else if (EQ (sound, intern ("ok")))
444        sound_type = MB_OK;        sound_type = MB_OK;
445    else if (EQ (sound, intern ("silent")))    else if (EQ (sound, intern ("silent")))
446        sound_type = MB_EMACS_SILENT;        sound_type = MB_EMACS_SILENT;
# Line 449  SOUND is nil to use the normal beep.  */ Line 449  SOUND is nil to use the normal beep.  */
449    
450    return sound;    return sound;
451  }  }
452      
453  void  void
454  reset_terminal_modes (void)  reset_terminal_modes (void)
455  {  {
# Line 482  set_terminal_modes (void) Line 482  set_terminal_modes (void)
482    
483  /* hmmm... perhaps these let us bracket screen changes so that we can flush  /* hmmm... perhaps these let us bracket screen changes so that we can flush
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  void
488  update_begin (struct frame * f)  update_begin (struct frame * f)
# Line 525  w32_face_attributes (f, face_id) Line 525  w32_face_attributes (f, face_id)
525    
526    if (face->background != FACE_TTY_DEFAULT_BG_COLOR    if (face->background != FACE_TTY_DEFAULT_BG_COLOR
527        && face->background != FACE_TTY_DEFAULT_COLOR)        && face->background != FACE_TTY_DEFAULT_COLOR)
528      char_attr = (char_attr & 0xff0f) + ((face->background % 16) << 4);      char_attr = (char_attr & 0xff0f) + ((face->background % 16) << 4);
529    
530    
531    /* NTEMACS_TODO: Faces defined during startup get both foreground    /* NTEMACS_TODO: Faces defined during startup get both foreground
# Line 573  void Line 573  void
573  initialize_w32_display (void)  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                = move_cursor;
578    raw_cursor_to_hook            = move_cursor;    raw_cursor_to_hook            = move_cursor;
579    clear_to_end_hook             = clear_to_end;    clear_to_end_hook             = clear_to_end;
# Line 589  initialize_w32_display (void) Line 589  initialize_w32_display (void)
589    set_terminal_window_hook      = set_terminal_window;    set_terminal_window_hook      = set_terminal_window;
590    update_begin_hook             = update_begin;    update_begin_hook             = update_begin;
591    update_end_hook               = update_end;    update_end_hook               = 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;
   estimate_mode_line_height_hook = 0;  
595    
596    /* Initialize interrupt_handle.  */    /* Initialize interrupt_handle.  */
597    init_crit ();    init_crit ();
# Line 602  initialize_w32_display (void) Line 601  initialize_w32_display (void)
601    GetConsoleMode (keyboard_handle, &prev_console_mode);    GetConsoleMode (keyboard_handle, &prev_console_mode);
602    
603    prev_screen = GetStdHandle (STD_OUTPUT_HANDLE);    prev_screen = GetStdHandle (STD_OUTPUT_HANDLE);
604      
605  #ifdef USE_SEPARATE_SCREEN  #ifdef USE_SEPARATE_SCREEN
606    cur_screen = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE,    cur_screen = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE,
607                                            0, NULL,                                            0, NULL,
# Line 656  initialize_w32_display (void) Line 655  initialize_w32_display (void)
655    }    }
656    
657    GetConsoleScreenBufferInfo (cur_screen, &info);    GetConsoleScreenBufferInfo (cur_screen, &info);
658      
659    meta_key = 1;    meta_key = 1;
660    char_attr_normal = info.wAttributes;    char_attr_normal = info.wAttributes;
661    
# Line 668  initialize_w32_display (void) Line 667  initialize_w32_display (void)
667    else    else
668      {      {
669        /* Lines per page.  Use buffer coords instead of buffer size.  */        /* Lines per page.  Use buffer coords instead of buffer size.  */
670        FRAME_HEIGHT (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom -        FRAME_HEIGHT (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom -
671          info.srWindow.Top;          info.srWindow.Top;
672        /* Characters per line.  Use buffer coords instead of buffer size.  */        /* Characters per line.  Use buffer coords instead of buffer size.  */
673        SET_FRAME_WIDTH (SELECTED_FRAME (), 1 + info.srWindow.Right -        SET_FRAME_WIDTH (SELECTED_FRAME (), 1 + info.srWindow.Right -
674                         info.srWindow.Left);                         info.srWindow.Left);
675      }      }
676    
# Line 702  DEFUN ("set-cursor-size", Fset_cursor_si Line 701  DEFUN ("set-cursor-size", Fset_cursor_si
701    cci.dwSize = XFASTINT (size);    cci.dwSize = XFASTINT (size);
702    cci.bVisible = TRUE;    cci.bVisible = TRUE;
703    (void) SetConsoleCursorInfo (cur_screen, &cci);    (void) SetConsoleCursorInfo (cur_screen, &cci);
     
   return Qt;  
 }  
704    
705  #ifndef HAVE_NTGUI    return Qt;
 void  
 pixel_to_glyph_coords (struct frame * f, int pix_x, int pix_y, int *x, int *y,  
                       void *bounds, int noclip)  
 {  
   *x = pix_x;  
   *y = pix_y;  
 }  
   
 void  
 glyph_to_pixel_coords (struct window * f, int x, int y, int *pix_x, int *pix_y)  
 {  
   *pix_x = x;  
   *pix_y = y;  
706  }  }
 #endif /* !HAVE_NTGUI */  
707    
708  void  void
709  syms_of_ntterm ()  syms_of_ntterm ()

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.32.4.1

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