]> code.delx.au - gnu-emacs/blobdiff - src/msdos.c
*** empty log message ***
[gnu-emacs] / src / msdos.c
index 3ab3597b8ed211567aa2696d2a3f94628117cf94..6134c1beabe83156e4abbf651a6b3a89f5d9e870 100644 (file)
@@ -1,5 +1,5 @@
 /* MS-DOS specific C utilities.          -*- coding: raw-text -*-
-   Copyright (C) 1993, 94, 95, 96, 97, 1999, 2000, 2001
+   Copyright (C) 1993, 94, 95, 96, 97, 1999, 2000, 01, 2003
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -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 */
@@ -64,6 +65,7 @@ Boston, MA 02111-1307, USA.  */
 #include "commands.h"
 #include "blockinput.h"
 #include "keyboard.h"
+#include "intervals.h"
 #include <go32.h>
 #include <pc.h>
 #include <ctype.h>
@@ -412,7 +414,8 @@ static unsigned short screen_virtual_offset = 0;
 /* A flag to control how to display unibyte 8-bit characters.  */
 extern int unibyte_display_via_language_environment;
 
-Lisp_Object Qbar, Qhbar;
+extern Lisp_Object Qcursor_type;
+extern Lisp_Object Qbar, Qhbar;
 
 /* The screen colors of the current frame, which serve as the default
    colors for newly-created frames.  */
@@ -1260,8 +1263,8 @@ show_mouse_face (struct display_info *dpyinfo, int hl)
       row->mouse_face_p = hl > 0;
       if (hl > 0)
        {
-         int vpos = row->y + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w);
-         int kstart = start_hpos + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w);
+         int vpos = row->y + WINDOW_TOP_EDGE_Y (w);
+         int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w);
          int nglyphs = end_hpos - start_hpos;
          int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1;
          int start_offset = offset;
@@ -1303,8 +1306,8 @@ show_mouse_face (struct display_info *dpyinfo, int hl)
          /* IT_write_glyphs writes at cursor position, so we need to
             temporarily move cursor coordinates to the beginning of
             the highlight region.  */
-         new_pos_X = start_hpos + WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w);
-         new_pos_Y = row->y + WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w);
+         new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w);
+         new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w);
 
          if (termscript)
            fprintf (termscript, "<MH- %d-%d:%d>",
@@ -1327,7 +1330,7 @@ show_mouse_face (struct display_info *dpyinfo, int hl)
 static void
 clear_mouse_face (struct display_info *dpyinfo)
 {
-  if (! NILP (dpyinfo->mouse_face_window))
+  if (!dpyinfo->mouse_face_hidden && ! NILP (dpyinfo->mouse_face_window))
     show_mouse_face (dpyinfo, 0);
 
   dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
@@ -1433,8 +1436,10 @@ IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
       Lisp_Object help, map;
 
       /* Find the glyph under X.  */
-      glyph = row->glyphs[TEXT_AREA]
-       + x - FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);
+      glyph = (row->glyphs[TEXT_AREA]
+              + x
+              /* in case someone implements scroll bars some day... */
+              - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w));
       end = glyph + row->used[TEXT_AREA];
       if (glyph < end
          && STRINGP (glyph->object)
@@ -1492,7 +1497,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
     }
 
   /* Which window is that in?  */
-  window = window_from_coordinates (f, x, y, &part, 0);
+  window = window_from_coordinates (f, x, y, &part, &x, &y, 0);
 
   /* If we were displaying active text in another window, clear that.  */
   if (! EQ (window, dpyinfo->mouse_face_window))
@@ -1504,8 +1509,6 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
 
   /* Convert to window-relative coordinates.  */
   w = XWINDOW (window);
-  x -= WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X (w);
-  y -= WINDOW_DISPLAY_TOP_EDGE_PIXEL_Y (w);
 
   if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
     {
@@ -1513,8 +1516,8 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
       IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE);
       return;
     }
-  else
-    IT_set_mouse_pointer (0);
+
+  IT_set_mouse_pointer (0);
 
   /* Are we in a window whose display is up to date?
      And verify the buffer's text has not changed.  */
@@ -1881,7 +1884,7 @@ IT_cmgoto (FRAME_PTR f)
   /* If we are in the echo area, put the cursor at the
      end of the echo area message.  */
   if (!update_cursor_pos
-      && XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top) <= new_pos_Y)
+      && WINDOW_TOP_EDGE_LINE (XWINDOW (FRAME_MINIBUF_WINDOW (f))) <= new_pos_Y)
     {
       int tem_X = current_pos_X, dummy;
 
@@ -1992,8 +1995,6 @@ IT_update_end (struct frame *f)
   FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0;
 }
 
-Lisp_Object Qcursor_type;
-
 static void
 IT_frame_up_to_date (struct frame *f)
 {
@@ -2548,7 +2549,6 @@ internal_terminal_init ()
       if (colors[1] >= 0 && colors[1] < 16)
         the_only_x_display.background_pixel = colors[1];
     }
-  the_only_x_display.line_height = 1;
   the_only_x_display.font = (XFontStruct *)1;   /* must *not* be zero */
   the_only_x_display.display_info.mouse_face_mouse_frame = NULL;
   the_only_x_display.display_info.mouse_face_deferred_gc = 0;
@@ -3131,6 +3131,7 @@ dos_rawgetc ()
   struct input_event event;
   union REGS regs;
   struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());
+  EVENT_INIT (event);
 
 #ifndef HAVE_X_WINDOWS
   /* Maybe put the cursor where it should be.  */
@@ -3342,8 +3343,8 @@ dos_rawgetc ()
 
       if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
        {
-         dpyinfo->mouse_face_hidden = 1;
          clear_mouse_face (dpyinfo);
+         dpyinfo->mouse_face_hidden = 1;
        }
 
       if (code >= 0x100)
@@ -3383,7 +3384,7 @@ dos_rawgetc ()
              mouse_window = window_from_coordinates (SELECTED_FRAME(),
                                                      mouse_last_x,
                                                      mouse_last_y,
-                                                     0, 0);
+                                                     0, 0, 0, 0);
              /* A window will be selected only when it is not
                 selected now, and the last mouse movement event was
                 not in it.  A minibuffer window will be selected iff
@@ -3500,31 +3501,7 @@ dos_keyread ()
 }
 \f
 #ifndef HAVE_X_WINDOWS
-/* See xterm.c for more info.  */
-void
-pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
-     FRAME_PTR f;
-     register int pix_x, pix_y, *x, *y;
-     XRectangle *bounds;
-     int noclip;
-{
-  if (bounds) abort ();
-
-  /* Ignore clipping.  */
-
-  *x = pix_x;
-  *y = pix_y;
-}
 
-void
-glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
-     FRAME_PTR f;
-     register int x, y, *pix_x, *pix_y;
-{
-  *pix_x = x;
-  *pix_y = y;
-}
-\f
 /* Simulation of X's menus.  Nothing too fancy here -- just make it work
    for now.
 
@@ -4035,13 +4012,13 @@ XMenuDestroy (Display *foo, XMenu *menu)
 int
 x_pixel_width (struct frame *f)
 {
-  return FRAME_WIDTH (f);
+  return FRAME_COLS (f);
 }
 
 int
 x_pixel_height (struct frame *f)
 {
-  return FRAME_HEIGHT (f);
+  return FRAME_LINES (f);
 }
 #endif /* !HAVE_X_WINDOWS */
 \f
@@ -4432,9 +4409,28 @@ init_environment (argc, argv, skip_args)
   for (i = 0; i < imax ; i++)
     {
       const char *tmp = tempdirs[i];
+      char buf[FILENAME_MAX];
 
       if (*tmp == '$')
-       tmp = getenv (tmp + 1);
+       {
+         int tmp_len;
+
+         tmp = getenv (tmp + 1);
+         if (!tmp)
+           continue;
+
+         /* Some lusers set TMPDIR=e:, probably because some losing
+            programs cannot handle multiple slashes if they use e:/.
+            e: fails in `access' below, so we interpret e: as e:/.  */
+         tmp_len = strlen(tmp);
+         if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\')
+           {
+             strcpy(buf, tmp);
+             buf[tmp_len++] = '/', buf[tmp_len] = 0;
+             tmp = buf;
+           }
+       }
+
       /* Note that `access' can lie to us if the directory resides on a
         read-only filesystem, like CD-ROM or a write-protected floppy.
         The only way to be really sure is to actually create a file and
@@ -5290,18 +5286,11 @@ syms_of_msdos ()
 #ifndef HAVE_X_WINDOWS
 
   /* The following two are from xfns.c:  */
-  Qbar = intern ("bar");
-  staticpro (&Qbar);
-  Qhbar = intern ("hbar");
-  staticpro (&Qhbar);
-  Qcursor_type = intern ("cursor-type");
-  staticpro (&Qcursor_type);
   Qreverse = intern ("reverse");
   staticpro (&Qreverse);
 
   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';
 
@@ -5321,3 +5310,6 @@ nil means don't delete them until `list-processes' is run.  */);
 }
 
 #endif /* MSDOS */
+
+/* arch-tag: db404e92-52a5-475f-9eb2-1cb78dd05f30
+   (do not change this comment) */