]> code.delx.au - gnu-emacs/blobdiff - src/msdos.c
(x_draw_hollow_cursor): Delay obtaining the frame's DC to avoid
[gnu-emacs] / src / msdos.c
index 1ba98f64a56ecdfdb605f83fa3d5c2c4d07d25b6..6312d5dc2c077e796459eedfee0323cc6e947db7 100644 (file)
@@ -195,8 +195,15 @@ them.  This happens with wheeled mice on Windows 9X, for example.")
   (nbuttons)
      Lisp_Object nbuttons;
 {
+  int n;
+
   CHECK_NUMBER (nbuttons, 0);
-  mouse_setup_buttons (XINT (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)));
+  mouse_setup_buttons (n);
   return Qnil;
 }
 
@@ -670,6 +677,11 @@ dos_set_window_size (rows, cols)
   *rows = ScreenRows ();
   *cols = ScreenCols ();
 
+  /* Update Emacs' notion of screen dimensions.  */
+  screen_size_X = *cols;
+  screen_size_Y = *rows;
+  screen_size = *cols * *rows;
+
 #if __DJGPP__ > 1
   /* If the dimensions changed, the mouse highlight info is invalid.  */
   if (current_rows != *rows || current_cols != *cols)
@@ -906,6 +918,14 @@ IT_set_face (int face)
       fg = bg;
       bg = tem;
     }
+  /* If the user requested inverse video, obey.  */
+  if (inverse_video)
+    {
+      unsigned long tem2 = fg;
+
+      fg = bg;
+      bg = tem2;
+    }
   if (termscript)
     fprintf (termscript, "<FACE %d%s: %d/%d[FG:%d/BG:%d]>", face,
             highlight ? "H" : "", fp->foreground, fp->background, fg, bg);
@@ -987,6 +1007,9 @@ IT_write_glyphs (struct glyph *str, int str_len)
          register GLYPH g = GLYPH_FROM_CHAR_GLYPH (*str);
          int glyph_not_in_table = 0;
 
+         /* If g is negative, it means we have a multibyte character
+            in *str.  That's what GLYPH_FROM_CHAR_GLYPH returns for
+            multibyte characters.  */
          if (g < 0 || g >= tlen)
            {
              /* This glyph doesn't have an entry in Vglyph_table.  */
@@ -1022,7 +1045,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
 
          /* If the face of this glyph is different from the current
             screen face, update the screen attribute byte.  */
-         cf = FAST_GLYPH_FACE (g);
+         cf = str->face_id;
          if (cf != screen_face)
            IT_set_face (cf);   /* handles invalid faces gracefully */
 
@@ -1355,6 +1378,11 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
        }
       else if (line_start_position > 0)
        best_row = row;
+
+      /* Don't overstep the last matrix row, lest we get into the
+        never-never land... */
+      if (row->y + 1 >= yb)
+       break;
       
       ++row;
     }
@@ -1451,7 +1479,7 @@ static void
 IT_note_mouse_highlight (struct frame *f, int x, int y)
 {
   struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
-  int portion;
+  int portion = -1;
   Lisp_Object window;
   struct window *w;
 
@@ -1510,16 +1538,22 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
       && (XFASTINT (w->last_overlay_modified)
          == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))))
     {
-      int pos, i, area;
+      int pos, i;
       struct glyph_row *row;
       struct glyph *glyph;
+      int nrows = w->current_matrix->nrows;
 
       /* Find the glyph under X/Y.  */
       glyph = NULL;
-      if (y < w->current_matrix->nrows)
+      if (y >= 0 && y < nrows)
        {
          row = MATRIX_ROW (w->current_matrix, y);
-         if (row->enabled_p
+         /* Give up if some row before the one we are looking for is
+            not enabled.  */
+         for (i = 0; i <= y; i++)
+           if (!MATRIX_ROW (w->current_matrix, i)->enabled_p)
+             break;
+         if (i > y  /* all rows upto and including the one at Y are enabled */
              && row->displays_text_p
              && x <  window_box_width (w, TEXT_AREA))
            {