emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32term.c [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/w32term.c [emacs-unicode-2]
Date: Mon, 28 Jun 2004 03:55:07 -0400

Index: emacs/src/w32term.c
diff -c emacs/src/w32term.c:1.193.4.5 emacs/src/w32term.c:1.193.4.6
*** emacs/src/w32term.c:1.193.4.5       Fri Apr 16 12:50:51 2004
--- emacs/src/w32term.c Mon Jun 28 07:29:24 2004
***************
*** 204,210 ****
  static RECT last_mouse_glyph;
  static Lisp_Object last_mouse_press_frame;
  
! Lisp_Object Vw32_num_mouse_buttons;
  
  Lisp_Object Vw32_swap_mouse_buttons;
  
--- 204,210 ----
  static RECT last_mouse_glyph;
  static Lisp_Object last_mouse_press_frame;
  
! int w32_num_mouse_buttons;
  
  Lisp_Object Vw32_swap_mouse_buttons;
  
***************
*** 1371,1377 ****
  static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
                                           int, int, int));
  static void w32_draw_relief_rect P_ ((struct frame *, int, int, int, int,
!                                   int, int, int, int, RECT *));
  static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
                                 int, int, int, RECT *));
  
--- 1371,1378 ----
  static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
                                           int, int, int));
  static void w32_draw_relief_rect P_ ((struct frame *, int, int, int, int,
!                                     int, int, int, int, int, int,
!                                     RECT *));
  static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int,
                                 int, int, int, RECT *));
  
***************
*** 1952,1960 ****
  
  static void
  w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
!                       raised_p, left_p, right_p, clip_rect)
       struct frame *f;
!      int left_x, top_y, right_x, bottom_y, width, left_p, right_p, raised_p;
       RECT *clip_rect;
  {
    int i;
--- 1953,1962 ----
  
  static void
  w32_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
!                       raised_p, top_p, bot_p, left_p, right_p, clip_rect)
       struct frame *f;
!      int left_x, top_y, right_x, bottom_y, width;
!      int top_p, bot_p, left_p, right_p, raised_p;
       RECT *clip_rect;
  {
    int i;
***************
*** 1969,1978 ****
    w32_set_clip_rectangle (hdc, clip_rect);
  
    /* Top.  */
!   for (i = 0; i < width; ++i)
!     w32_fill_area (f, hdc, gc.foreground,
!                  left_x + i * left_p, top_y + i,
!                  right_x - left_x - i * (left_p + right_p ) + 1, 1);
  
    /* Left.  */
    if (left_p)
--- 1971,1981 ----
    w32_set_clip_rectangle (hdc, clip_rect);
  
    /* Top.  */
!   if (top_p)
!     for (i = 0; i < width; ++i)
!       w32_fill_area (f, hdc, gc.foreground,
!                    left_x + i * left_p, top_y + i,
!                    right_x - left_x - i * (left_p + right_p ) + 1, 1);
  
    /* Left.  */
    if (left_p)
***************
*** 1987,1996 ****
      gc.foreground = f->output_data.w32->white_relief.gc->foreground;
  
    /* Bottom.  */
!   for (i = 0; i < width; ++i)
!     w32_fill_area (f, hdc, gc.foreground,
!                  left_x + i * left_p, bottom_y - i,
!                  right_x - left_x - i * (left_p + right_p) + 1, 1);
  
    /* Right.  */
    if (right_p)
--- 1990,2000 ----
      gc.foreground = f->output_data.w32->white_relief.gc->foreground;
  
    /* Bottom.  */
!   if (bot_p)
!     for (i = 0; i < width; ++i)
!       w32_fill_area (f, hdc, gc.foreground,
!                    left_x + i * left_p, bottom_y - i,
!                    right_x - left_x - i * (left_p + right_p) + 1, 1);
  
    /* Right.  */
    if (right_p)
***************
*** 2100,2106 ****
      {
        x_setup_relief_colors (s);
        w32_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
!                             width, raised_p, left_p, right_p, &clip_rect);
      }
  }
  
--- 2104,2110 ----
      {
        x_setup_relief_colors (s);
        w32_draw_relief_rect (s->f, left_x, top_y, right_x, bottom_y,
!                             width, raised_p, 1, 1, left_p, right_p, 
&clip_rect);
      }
  }
  
***************
*** 2111,2131 ****
  x_draw_image_foreground (s)
       struct glyph_string *s;
  {
!   int x;
!   int y = s->ybase - image_ascent (s->img, s->face);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p)
!     x = s->x + abs (s->face->box_line_width);
!   else
!     x = s->x;
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   x += s->img->hmargin;
!   y += s->img->vmargin;
  
    SaveDC (s->hdc);
  
--- 2115,2136 ----
  x_draw_image_foreground (s)
       struct glyph_string *s;
  {
!   int x = s->x;
!   int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p
!       && s->slice.x == 0)
!     x += abs (s->face->box_line_width);
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   if (s->slice.x == 0)
!     x += s->img->hmargin;
!   if (s->slice.y == 0)
!     y += s->img->vmargin;
  
    SaveDC (s->hdc);
  
***************
*** 2147,2158 ****
          SetTextColor (s->hdc, RGB (255, 255, 255));
          SetBkColor (s->hdc, RGB (0, 0, 0));
  
!         BitBlt (s->hdc, x, y, s->img->width, s->img->height,
!                 compat_hdc, 0, 0, SRCINVERT);
!         BitBlt (s->hdc, x, y, s->img->width, s->img->height,
!                 mask_dc, 0, 0, SRCAND);
!         BitBlt (s->hdc, x, y, s->img->width, s->img->height,
!                 compat_hdc, 0, 0, SRCINVERT);
  
          SelectObject (mask_dc, mask_orig_obj);
          DeleteDC (mask_dc);
--- 2152,2163 ----
          SetTextColor (s->hdc, RGB (255, 255, 255));
          SetBkColor (s->hdc, RGB (0, 0, 0));
  
!         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
!                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
!         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
!                 mask_dc, s->slice.x, s->slice.y, SRCAND);
!         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
!                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
  
          SelectObject (mask_dc, mask_orig_obj);
          DeleteDC (mask_dc);
***************
*** 2162,2169 ****
          SetTextColor (s->hdc, s->gc->foreground);
          SetBkColor (s->hdc, s->gc->background);
  
!           BitBlt (s->hdc, x, y, s->img->width, s->img->height,
!                   compat_hdc, 0, 0, SRCCOPY);
  
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
--- 2167,2174 ----
          SetTextColor (s->hdc, s->gc->foreground);
          SetBkColor (s->hdc, s->gc->background);
  
!           BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
!                   compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
  
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
***************
*** 2176,2182 ****
              int r = s->img->relief;
              if (r < 0) r = -r;
              w32_draw_rectangle (s->hdc, s->gc, x - r, y - r ,
!                                 s->img->width + r*2 - 1, s->img->height + r*2 
- 1);
            }
        }
  
--- 2181,2188 ----
              int r = s->img->relief;
              if (r < 0) r = -r;
              w32_draw_rectangle (s->hdc, s->gc, x - r, y - r ,
!                                 s->slice.width + r*2 - 1,
!                                 s->slice.height + r*2 - 1);
            }
        }
  
***************
*** 2187,2194 ****
        DeleteDC (compat_hdc);
      }
    else
!     w32_draw_rectangle (s->hdc, s->gc, x, y, s->img->width -1,
!                         s->img->height - 1);
  
    RestoreDC (s->hdc ,-1);
  }
--- 2193,2200 ----
        DeleteDC (compat_hdc);
      }
    else
!     w32_draw_rectangle (s->hdc, s->gc, x, y,
!                       s->slice.width - 1, s->slice.height - 1);
  
    RestoreDC (s->hdc ,-1);
  }
***************
*** 2203,2223 ****
  {
    int x0, y0, x1, y1, thick, raised_p;
    RECT r;
!   int x;
!   int y = s->ybase - image_ascent (s->img, s->face);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p)
!     x = s->x + abs (s->face->box_line_width);
!   else
!     x = s->x;
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   x += s->img->hmargin;
!   y += s->img->vmargin;
  
    if (s->hl == DRAW_IMAGE_SUNKEN
        || s->hl == DRAW_IMAGE_RAISED)
--- 2209,2230 ----
  {
    int x0, y0, x1, y1, thick, raised_p;
    RECT r;
!   int x = s->x;
!   int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p
!       && s->slice.x == 0)
!     x += abs (s->face->box_line_width);
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   if (s->slice.x == 0)
!     x += s->img->hmargin;
!   if (s->slice.y == 0)
!     y += s->img->vmargin;
  
    if (s->hl == DRAW_IMAGE_SUNKEN
        || s->hl == DRAW_IMAGE_RAISED)
***************
*** 2233,2244 ****
  
    x0 = x - thick;
    y0 = y - thick;
!   x1 = x + s->img->width + thick - 1;
!   y1 = y + s->img->height + thick - 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
  }
  
  
--- 2240,2256 ----
  
    x0 = x - thick;
    y0 = y - thick;
!   x1 = x + s->slice.width + thick - 1;
!   y1 = y + s->slice.height + thick - 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
!                       s->slice.y == 0,
!                       s->slice.y + s->slice.height == s->img->height,
!                       s->slice.x == 0,
!                       s->slice.x + s->slice.width == s->img->width,
!                       &r);
  }
  
  
***************
*** 2251,2271 ****
  {
    HDC hdc = CreateCompatibleDC (s->hdc);
    HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap);
!   int x;
!   int y = s->ybase - s->y - image_ascent (s->img, s->face);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p)
!     x = abs (s->face->box_line_width);
!   else
!     x = 0;
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   x += s->img->hmargin;
!   y += s->img->vmargin;
  
    if (s->img->pixmap)
      {
--- 2263,2284 ----
  {
    HDC hdc = CreateCompatibleDC (s->hdc);
    HGDIOBJ orig_hdc_obj = SelectObject (hdc, pixmap);
!   int x = 0;
!   int y = s->ybase - s->y - image_ascent (s->img, s->face, &s->slice);
  
    /* If first glyph of S has a left box line, start drawing it to the
       right of that line.  */
    if (s->face->box != FACE_NO_BOX
!       && s->first_glyph->left_box_line_p
!       && s->slice.x == 0)
!     x += abs (s->face->box_line_width);
  
    /* If there is a margin around the image, adjust x- and y-position
       by that margin.  */
!   if (s->slice.x == 0)
!     x += s->img->hmargin;
!   if (s->slice.y == 0)
!     y += s->img->vmargin;
  
    if (s->img->pixmap)
      {
***************
*** 2281,2292 ****
  
          SetTextColor (hdc, RGB (0, 0, 0));
          SetBkColor (hdc, RGB (255, 255, 255));
!         BitBlt (hdc, x, y, s->img->width, s->img->height,
!                 compat_hdc, 0, 0, SRCINVERT);
!         BitBlt (hdc, x, y, s->img->width, s->img->height,
!                 mask_dc, 0, 0, SRCAND);
!         BitBlt (hdc, x, y, s->img->width, s->img->height,
!                 compat_hdc, 0, 0, SRCINVERT);
  
          SelectObject (mask_dc, mask_orig_obj);
          DeleteDC (mask_dc);
--- 2294,2305 ----
  
          SetTextColor (hdc, RGB (0, 0, 0));
          SetBkColor (hdc, RGB (255, 255, 255));
!         BitBlt (hdc, x, y, s->slice.width, s->slice.height,
!                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
!         BitBlt (hdc, x, y, s->slice.width, s->slice.height,
!                 mask_dc, s->slice.x, s->slice.y, SRCAND);
!         BitBlt (hdc, x, y, s->slice.width, s->slice.height,
!                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
  
          SelectObject (mask_dc, mask_orig_obj);
          DeleteDC (mask_dc);
***************
*** 2296,2303 ****
          SetTextColor (hdc, s->gc->foreground);
          SetBkColor (hdc, s->gc->background);
  
!           BitBlt (hdc, x, y, s->img->width, s->img->height,
!                   compat_hdc, 0, 0, SRCCOPY);
  
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
--- 2309,2316 ----
          SetTextColor (hdc, s->gc->foreground);
          SetBkColor (hdc, s->gc->background);
  
!           BitBlt (hdc, x, y, s->slice.width, s->slice.height,
!                   compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
  
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
***************
*** 2309,2316 ****
            {
              int r = s->img->relief;
              if (r < 0) r = -r;
!             w32_draw_rectangle (hdc, s->gc, x - r, y - r ,
!                                 s->img->width + r*2 - 1, s->img->height + r*2 
- 1);
            }
        }
  
--- 2322,2330 ----
            {
              int r = s->img->relief;
              if (r < 0) r = -r;
!             w32_draw_rectangle (hdc, s->gc, x - r, y - r,
!                                 s->slice.width + r*2 - 1,
!                                 s->slice.height + r*2 - 1);
            }
        }
  
***************
*** 2320,2327 ****
        DeleteDC (compat_hdc);
      }
    else
!     w32_draw_rectangle (hdc, s->gc, x, y, s->img->width - 1,
!                         s->img->height - 1);
  
    SelectObject (hdc, orig_hdc_obj);
    DeleteDC (hdc);
--- 2334,2341 ----
        DeleteDC (compat_hdc);
      }
    else
!     w32_draw_rectangle (hdc, s->gc, x, y,
!                       s->slice.width - 1, s->slice.height - 1);
  
    SelectObject (hdc, orig_hdc_obj);
    DeleteDC (hdc);
***************
*** 2380,2398 ****
       taller than image or if image has a clip mask to reduce
       flickering.  */
    s->stippled_p = s->face->stipple != 0;
!   if (height > s->img->height
        || s->img->hmargin
        || s->img->vmargin
        || s->img->mask
        || s->img->pixmap == 0
        || s->width != s->background_width)
      {
!       if (box_line_hwidth && s->first_glyph->left_box_line_p)
!       x = s->x + box_line_hwidth;
!       else
!       x = s->x;
  
-       y = s->y + box_line_vwidth;
  #if 0 /* TODO: figure out if we need to do this on Windows.  */
        if (s->img->mask)
        {
--- 2394,2415 ----
       taller than image or if image has a clip mask to reduce
       flickering.  */
    s->stippled_p = s->face->stipple != 0;
!   if (height > s->slice.height
        || s->img->hmargin
        || s->img->vmargin
        || s->img->mask
        || s->img->pixmap == 0
        || s->width != s->background_width)
      {
!       x = s->x;
!       if (s->first_glyph->left_box_line_p
!         && s->slice.x == 0)
!       x += box_line_hwidth;
! 
!       y = s->y;
!       if (s->slice.y == 0)
!       y += box_line_vwidth;
  
  #if 0 /* TODO: figure out if we need to do this on Windows.  */
        if (s->img->mask)
        {
***************
*** 4311,4318 ****
    /* So people can tell when we have read the available input.  */
    input_signal_count++;
  
!   /* TODO: tool-bars, ghostscript integration, mouse
!      cursors. */
    while (get_next_msg (&msg, FALSE))
      {
        struct input_event inev;
--- 4328,4334 ----
    /* So people can tell when we have read the available input.  */
    input_signal_count++;
  
!   /* TODO: ghostscript integration. */
    while (get_next_msg (&msg, FALSE))
      {
        struct input_event inev;
***************
*** 4495,4504 ****
  
            /* If the contents of the global variable help_echo_string
               has changed, generate a HELP_EVENT.  */
            if (help_echo_string != previous_help_echo_string ||
              (!NILP (help_echo_string) && !STRINGP (help_echo_string) && 
f->mouse_moved))
            do_help = 1;
! 
            break;
  
        case WM_LBUTTONDOWN:
--- 4511,4526 ----
  
            /* If the contents of the global variable help_echo_string
               has changed, generate a HELP_EVENT.  */
+ #if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE.
+        But it was originally changed to this to fix a bug, so I have
+        not removed it completely in case the bug is still there.  */
            if (help_echo_string != previous_help_echo_string ||
              (!NILP (help_echo_string) && !STRINGP (help_echo_string) && 
f->mouse_moved))
+ #else /* This is what xterm.c does.  */
+           if (!NILP (help_echo_string)
+               || !NILP (previous_help_echo_string))
            do_help = 1;
! #endif
            break;
  
        case WM_LBUTTONDOWN:
***************
*** 4919,4925 ****
  
          if (do_help > 0)
            {
!             if (help_echo_string == Qnil)
                {
                  help_echo_object = help_echo_window = Qnil;
                  help_echo_pos = -1;
--- 4941,4947 ----
  
          if (do_help > 0)
            {
!             if (NILP (help_echo_string))
                {
                  help_echo_object = help_echo_window = Qnil;
                  help_echo_pos = -1;
***************
*** 5068,5095 ****
    struct frame *f = XFRAME (WINDOW_FRAME (w));
    HDC hdc;
    RECT rect;
!   int wd;
    struct glyph *cursor_glyph;
    HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
  
    /* Compute frame-relative coordinates from window-relative
       coordinates.  */
    rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
    rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
                + row->ascent - w->phys_cursor_ascent);
-   rect.bottom = rect.top + row->height;
  
!   /* Get the glyph the cursor is on.  If we can't tell because
!      the current matrix is invalid or such, give up.  */
!   cursor_glyph = get_phys_cursor_glyph (w);
!   if (cursor_glyph == NULL)
!     return;
  
    /* Compute the width of the rectangle to draw.  If on a stretch
       glyph, and `x-stretch-block-cursor' is nil, don't draw a
       rectangle as wide as the glyph, but use a canonical character
       width instead.  */
!   wd = cursor_glyph->pixel_width;
    if (cursor_glyph->type == STRETCH_GLYPH
        && !x_stretch_cursor_p)
      wd = min (FRAME_COLUMN_WIDTH (f), wd);
--- 5090,5127 ----
    struct frame *f = XFRAME (WINDOW_FRAME (w));
    HDC hdc;
    RECT rect;
!   int wd, h;
    struct glyph *cursor_glyph;
    HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
  
+   /* Get the glyph the cursor is on.  If we can't tell because
+      the current matrix is invalid or such, give up.  */
+   cursor_glyph = get_phys_cursor_glyph (w);
+   if (cursor_glyph == NULL)
+     return;
+ 
    /* Compute frame-relative coordinates from window-relative
       coordinates.  */
    rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
    rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
                + row->ascent - w->phys_cursor_ascent);
  
!   /* Compute the proper height and ascent of the rectangle, based
!      on the actual glyph.  Using the full height of the row looks
!      bad when there are tall images on that row.  */
!   h = max (min (FRAME_LINE_HEIGHT (f), row->height),
!          cursor_glyph->ascent + cursor_glyph->descent);
!   if (h < row->height)
!     rect.top += row->ascent /* - w->phys_cursor_ascent */ + 
cursor_glyph->descent - h;
!   h--;
! 
!   rect.bottom = rect.top + h;
  
    /* Compute the width of the rectangle to draw.  If on a stretch
       glyph, and `x-stretch-block-cursor' is nil, don't draw a
       rectangle as wide as the glyph, but use a canonical character
       width instead.  */
!   wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
    if (cursor_glyph->type == STRETCH_GLYPH
        && !x_stretch_cursor_p)
      wd = min (FRAME_COLUMN_WIDTH (f), wd);
***************
*** 6604,6612 ****
    Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
  
    DEFVAR_INT ("w32-num-mouse-buttons",
!             &Vw32_num_mouse_buttons,
              doc: /* Number of physical mouse buttons.  */);
!   Vw32_num_mouse_buttons = Qnil;
  
    DEFVAR_LISP ("w32-swap-mouse-buttons",
              &Vw32_swap_mouse_buttons,
--- 6636,6644 ----
    Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
  
    DEFVAR_INT ("w32-num-mouse-buttons",
!             &w32_num_mouse_buttons,
              doc: /* Number of physical mouse buttons.  */);
!   w32_num_mouse_buttons = 2;
  
    DEFVAR_LISP ("w32-swap-mouse-buttons",
              &Vw32_swap_mouse_buttons,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]