]> code.delx.au - gnu-emacs/blobdiff - src/w32console.c
Rework C source files to avoid ^(
[gnu-emacs] / src / w32console.c
index e530e09f9d7a446e511b27fabde31a049f54835a..512d20dd2424d14a8a14f14459cf75385169fa27 100644 (file)
@@ -1,12 +1,12 @@
 /* Terminal hooks for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1992, 1999, 2001-2015 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1999, 2001-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,21 +28,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <windows.h>
 
 #include "lisp.h"
-#include "character.h"
 #include "coding.h"
-#include "disptab.h"
-#include "frame.h"
-#include "window.h"
-#include "termhooks.h"
-#include "termchar.h"
-#include "dispextern.h"
+#include "termchar.h"  /* for FRAME_TTY */
+#include "menu.h"      /* for tty_menu_show */
 #include "w32term.h"
-#include "w32common.h" /* for os_subtype */
+#include "w32common.h" /* for os_subtype */
 #include "w32inevt.h"
 
-/* from window.c */
-extern Lisp_Object Frecenter (Lisp_Object);
-
 static void w32con_move_cursor (struct frame *f, int row, int col);
 static void w32con_clear_to_end (struct frame *f);
 static void w32con_clear_frame (struct frame *f);
@@ -117,7 +109,7 @@ static void
 w32con_clear_to_end (struct frame *f)
 {
   w32con_clear_end_of_line (f, FRAME_COLS (f) - 1);
-  w32con_ins_del_lines (f, cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);
+  w32con_ins_del_lines (f, cursor_coords.Y, FRAME_TOTAL_LINES (f) - cursor_coords.Y - 1);
 }
 
 /* Clear the frame.  */
@@ -132,7 +124,7 @@ w32con_clear_frame (struct frame *f)
   GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
 
   /* Remember that the screen buffer might be wider than the window.  */
-  n = FRAME_LINES (f) * info.dwSize.X;
+  n = FRAME_TOTAL_LINES (f) * info.dwSize.X;
   dest.X = dest.Y = 0;
 
   FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
@@ -174,18 +166,18 @@ w32con_ins_del_lines (struct frame *f, int vpos, int n)
   if (n < 0)
     {
       scroll.Top = vpos - n;
-      scroll.Bottom = FRAME_LINES (f);
+      scroll.Bottom = FRAME_TOTAL_LINES (f);
       dest.Y = vpos;
     }
   else
     {
       scroll.Top = vpos;
-      scroll.Bottom = FRAME_LINES (f) - n;
+      scroll.Bottom = FRAME_TOTAL_LINES (f) - n;
       dest.Y = vpos + n;
     }
   clip.Top = clip.Left = scroll.Left = 0;
   clip.Right = scroll.Right = FRAME_COLS (f);
-  clip.Bottom = FRAME_LINES (f);
+  clip.Bottom = FRAME_TOTAL_LINES (f);
 
   dest.X = 0;
 
@@ -296,7 +288,7 @@ w32con_write_glyphs (struct frame *f, register struct glyph *string,
 {
   DWORD r;
   WORD char_attr;
-  unsigned char *conversion_buffer;
+  LPCSTR conversion_buffer;
   struct coding_system *coding;
 
   if (len <= 0)
@@ -327,7 +319,7 @@ w32con_write_glyphs (struct frame *f, register struct glyph *string,
       if (n == len)
        /* This is the last run.  */
        coding->mode |= CODING_MODE_LAST_BLOCK;
-      conversion_buffer = encode_terminal_code (string, n, coding);
+      conversion_buffer = (LPCSTR) encode_terminal_code (string, n, coding);
       if (coding->produced > 0)
        {
          /* Set the attribute for these characters.  */
@@ -364,7 +356,7 @@ w32con_write_glyphs_with_face (struct frame *f, register int x, register int y,
                               register struct glyph *string, register int len,
                               register int face_id)
 {
-  unsigned char *conversion_buffer;
+  LPCSTR conversion_buffer;
   struct coding_system *coding;
 
   if (len <= 0)
@@ -379,7 +371,7 @@ w32con_write_glyphs_with_face (struct frame *f, register int x, register int y,
      they all have the same face.  So this _is_ the last block.  */
   coding->mode |= CODING_MODE_LAST_BLOCK;
 
-  conversion_buffer = encode_terminal_code (string, len, coding);
+  conversion_buffer = (LPCSTR) encode_terminal_code (string, len, coding);
   if (coding->produced > 0)
     {
       DWORD filled, written;
@@ -650,11 +642,13 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
 
   term->read_socket_hook = w32_console_read_socket;
   term->mouse_position_hook = w32_console_mouse_position;
+  term->menu_show_hook = tty_menu_show;
 
   /* The following are not used on the console.  */
   term->frame_rehighlight_hook = 0;
   term->frame_raise_lower_hook = 0;
   term->set_vertical_scroll_bar_hook = 0;
+  term->set_horizontal_scroll_bar_hook = 0;
   term->condemn_scroll_bars_hook = 0;
   term->redeem_scroll_bar_hook = 0;
   term->judge_scroll_bars_hook = 0;
@@ -763,13 +757,8 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
   else
     w32_console_unicode_input = 0;
 
-  /* This is needed by w32notify.c:send_notifications.  */
-  dwMainThreadId = GetCurrentThreadId ();
-
   /* Setup w32_display_info structure for this frame. */
-
   w32_initialize_display_info (build_string ("Console"));
-
 }