]> code.delx.au - gnu-emacs/blobdiff - src/msdos.c
(custom-save-all): Use find-file-visit-truename for visiting the custom file.
[gnu-emacs] / src / msdos.c
index 47fdf7fa03db839df9816b306456802a0ec4ff6e..61e167a194611073ca1d9097e665174926df1682 100644 (file)
@@ -1,6 +1,6 @@
 /* MS-DOS specific C utilities.          -*- coding: raw-text -*-
-   Copyright (C) 1993, 94, 95, 96, 97, 1999, 2000, 01, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
+                 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -16,8 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* Contributed by Morten Welinder */
 /* New display, keyboard, and mouse control by Kim F. Storm */
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA.  */
 #include <unistd.h>     /* for chdir, dup, dup2, etc. */
 #include <dir.h>        /* for getdisk */
 #if __DJGPP__ >= 2
+#pragma pack(0)                 /* dir.h does a pack(4), which isn't GCC's default */
 #include <fcntl.h>
 #include <io.h>                 /* for setmode */
 #include <dpmi.h>       /* for __dpmi_xxx stuff */
@@ -203,9 +204,9 @@ them.  This happens with wheeled mice on Windows 9X, for example.  */)
   CHECK_NUMBER (nbuttons);
   n = XINT (nbuttons);
   if (n < 2 || n > 3)
-    Fsignal (Qargs_out_of_range,
-            Fcons (build_string ("only 2 or 3 mouse buttons are supported"),
-                   Fcons (nbuttons, Qnil)));
+    xsignal2 (Qargs_out_of_range,
+             build_string ("only 2 or 3 mouse buttons are supported"),
+             nbuttons);
   mouse_setup_buttons (n);
   return Qnil;
 }
@@ -751,6 +752,9 @@ msdos_set_cursor_shape (struct frame *f, int start_line, int width)
   if (f && f != SELECTED_FRAME())
     return;
 
+  if (termscript)
+    fprintf (termscript, "\nCURSOR SHAPE=(%d,%d)", start_line, width);
+
   /* The character cell size in scan lines is stored at 40:85 in the
      BIOS data area.  */
   max_line = _farpeekw (_dos_ds, 0x485) - 1;
@@ -850,10 +854,12 @@ IT_set_cursor_type (struct frame *f, Lisp_Object cursor_type)
        }
     }
   else
-    /* Treat anything unknown as "box cursor".  This includes nil, so
-       that a frame which doesn't specify a cursor type gets a box,
-       which is the default in Emacs.  */
-    msdos_set_cursor_shape (f, 0, BOX_CURSOR_WIDTH);
+    {
+      /* Treat anything unknown as "box cursor".  This includes nil, so
+        that a frame which doesn't specify a cursor type gets a box,
+        which is the default in Emacs.  */
+      msdos_set_cursor_shape (f, 0, BOX_CURSOR_WIDTH);
+    }
 }
 
 static void
@@ -950,8 +956,8 @@ static void
 IT_write_glyphs (struct glyph *str, int str_len)
 {
   unsigned char *screen_buf, *screen_bp, *screen_buf_end, *bp;
-  int unsupported_face = FAST_GLYPH_FACE (Vdos_unsupported_char_glyph);
-  unsigned unsupported_char= FAST_GLYPH_CHAR (Vdos_unsupported_char_glyph);
+  int unsupported_face = 0;
+  unsigned unsupported_char = '\177';
   int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
   register int sl = str_len;
   register int tlen = GLYPH_TABLE_LENGTH;
@@ -977,6 +983,13 @@ IT_write_glyphs (struct glyph *str, int str_len)
 
   if (str_len <= 0) return;
 
+  /* Set up the unsupported character glyph */
+  if (!NILP (Vdos_unsupported_char_glyph))
+    {
+      unsupported_char = FAST_GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph));
+      unsupported_face = FAST_GLYPH_FACE (XINT (Vdos_unsupported_char_glyph));
+    }
+
   screen_buf = screen_bp = alloca (str_len * 2);
   screen_buf_end = screen_buf + str_len * 2;
   sf = SELECTED_FRAME();
@@ -1041,7 +1054,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
          if (! CHAR_VALID_P (ch, 0))
            {
              g = !NILP (Vdos_unsupported_char_glyph)
-               ? Vdos_unsupported_char_glyph
+               ? XINT (Vdos_unsupported_char_glyph)
                : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g));
              ch = FAST_GLYPH_CHAR (g);
            }
@@ -1571,7 +1584,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
       {
        extern Lisp_Object Qmouse_face;
        Lisp_Object mouse_face, overlay, position, *overlay_vec;
-       int len, noverlays, obegv, ozv;;
+       int noverlays, obegv, ozv;;
        struct buffer *obuf;
 
        /* If we get an out-of-range value, return now; avoid an error.  */
@@ -1590,20 +1603,8 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
        /* Is this char mouse-active or does it have help-echo?  */
        XSETINT (position, pos);
 
-       /* Put all the overlays we want in a vector in overlay_vec.
-          Store the length in len.  If there are more than 10, make
-          enough space for all, and try again.  */
-       len = 10;
-       overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
-       noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
-       if (noverlays > len)
-         {
-           len = noverlays;
-           overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
-           noverlays = overlays_at (pos,
-                                    0, &overlay_vec, &len, NULL, NULL, 0);
-         }
-
+       /* Put all the overlays we want in a vector in overlay_vec. */
+       GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
        /* Sort overlays into increasing priority order.  */
        noverlays = sort_overlays (overlay_vec, noverlays, w);
 
@@ -1830,6 +1831,8 @@ static int cursor_cleared;
 static void
 IT_display_cursor (int on)
 {
+  if (termscript)
+    fprintf (termscript, "\nCURSOR %s", on ? "ON" : "OFF");
   if (on && cursor_cleared)
     {
       ScreenSetCursor (current_pos_Y, current_pos_X);
@@ -2317,7 +2320,7 @@ IT_set_frame_parameters (f, alist)
 
   /* If we are creating a new frame, begin with the original screen colors
      used for the initial frame.  */
-  if (alist == Vdefault_frame_alist
+  if (EQ (alist, Vdefault_frame_alist)
       && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1)
     {
       FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0];
@@ -3378,7 +3381,7 @@ dos_rawgetc ()
            }
 
          /* Generate SELECT_WINDOW_EVENTs when needed.  */
-         if (mouse_autoselect_window)
+         if (!NILP (Vmouse_autoselect_window))
            {
              mouse_window = window_from_coordinates (SELECTED_FRAME(),
                                                      mouse_last_x,
@@ -3460,8 +3463,8 @@ dos_rawgetc ()
                event.code = button_num;
                event.modifiers = dos_get_modifiers (0)
                  | (press ? down_modifier : up_modifier);
-               event.x = x;
-               event.y = y;
+               event.x = make_number (x);
+               event.y = make_number (y);
                event.frame_or_window = selected_frame;
                event.arg = Qnil;
                event.timestamp = event_timestamp ();
@@ -3796,15 +3799,15 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
   screensize = screen_size * 2;
   faces[0]
     = lookup_derived_face (sf, intern ("msdos-menu-passive-face"),
-                          0, DEFAULT_FACE_ID);
+                          0, DEFAULT_FACE_ID, 1);
   faces[1]
     = lookup_derived_face (sf, intern ("msdos-menu-active-face"),
-                          0, DEFAULT_FACE_ID);
+                          0, DEFAULT_FACE_ID, 1);
   selectface = intern ("msdos-menu-select-face");
   faces[2] = lookup_derived_face (sf, selectface,
-                                 0, faces[0]);
+                                 0, faces[0], 1);
   faces[3] = lookup_derived_face (sf, selectface,
-                                 0, faces[1]);
+                                 0, faces[1], 1);
 
   /* Make sure the menu title is always displayed with
      `msdos-menu-active-face', no matter where the mouse pointer is.  */
@@ -5106,7 +5109,7 @@ dos_yield_time_slice (void)
 
 /* Only event queue is checked.  */
 /* We don't have to call timer_check here
-   because wait_reading_process_input takes care of that.  */
+   because wait_reading_process_output takes care of that.  */
 int
 sys_select (nfds, rfds, wfds, efds, timeout)
      int nfds;
@@ -5291,7 +5294,7 @@ syms_of_msdos ()
   DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph,
               doc: /* *Glyph to display instead of chars not supported by current codepage.
 This variable is used only by MSDOS terminals.  */);
-  Vdos_unsupported_char_glyph = '\177';
+  Vdos_unsupported_char_glyph = make_number ('\177');
 
 #endif
 #ifndef subprocesses