/[emacs]/emacs/src/w32term.c
ViewVC logotype

Diff of /emacs/src/w32term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.109.4.16 by eliz, Thu May 16 16:11:41 2002 UTC revision 1.109.4.17 by lektu, Mon Nov 11 07:34:59 2002 UTC
# Line 153  Lisp_Object Vx_toolkit_scroll_bars; Line 153  Lisp_Object Vx_toolkit_scroll_bars;
153    
154  /* If a string, w32_read_socket generates an event to display that string.  /* If a string, w32_read_socket generates an event to display that string.
155     (The display is done in read_char.)  */     (The display is done in read_char.)  */
156      
157  static Lisp_Object help_echo;  static Lisp_Object help_echo;
158  static Lisp_Object help_echo_window;  static Lisp_Object help_echo_window;
159  static Lisp_Object help_echo_object;  static Lisp_Object help_echo_object;
# Line 398  static void x_update_window_cursor P_ (( Line 398  static void x_update_window_cursor P_ ((
398  static void x_erase_phys_cursor P_ ((struct window *));  static void x_erase_phys_cursor P_ ((struct window *));
399  void x_display_cursor P_ ((struct window *w, int, int, int, int, int));  void x_display_cursor P_ ((struct window *w, int, int, int, int, int));
400  void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int));  void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int));
401  static void w32_draw_bitmap P_ ((struct window *, HDC hdc, struct glyph_row *,  static void w32_draw_bitmap P_ ((struct window *, HDC hdc, struct glyph_row *,
402                                   enum bitmap_type));                                   enum bitmap_type));
403  static void w32_clip_to_row P_ ((struct window *, struct glyph_row *,  static void w32_clip_to_row P_ ((struct window *, struct glyph_row *,
404                                   HDC, int));                                   HDC, int));
# Line 418  static Lisp_Object Qvendor_specific_keys Line 418  static Lisp_Object Qvendor_specific_keys
418  /* This is a function useful for recording debugging information about  /* This is a function useful for recording debugging information about
419     the sequence of occurrences in this file.  */     the sequence of occurrences in this file.  */
420    
421  struct record  struct record
422  {  {
423    char *locus;    char *locus;
424    int type;    int type;
# Line 507  w32_draw_rectangle (HDC hdc, XGCValues * Line 507  w32_draw_rectangle (HDC hdc, XGCValues *
507  }  }
508    
509  /* Draw a filled rectangle at the specified position. */  /* Draw a filled rectangle at the specified position. */
510  void  void
511  w32_fill_rect (f, hdc, pix, lprect)  w32_fill_rect (f, hdc, pix, lprect)
512       FRAME_PTR f;       FRAME_PTR f;
513       HDC hdc;       HDC hdc;
# Line 521  w32_fill_rect (f, hdc, pix, lprect) Line 521  w32_fill_rect (f, hdc, pix, lprect)
521    DeleteObject (hb);    DeleteObject (hb);
522  }  }
523    
524  void  void
525  w32_clear_window (f)  w32_clear_window (f)
526       FRAME_PTR f;       FRAME_PTR f;
527  {  {
# Line 544  w32_clear_window (f) Line 544  w32_clear_window (f)
544  /***********************************************************************  /***********************************************************************
545                      Starting and ending an update                      Starting and ending an update
546   ***********************************************************************/   ***********************************************************************/
547                                                                            
548  /* Start an update of frame F.  This function is installed as a hook  /* Start an update of frame F.  This function is installed as a hook
549     for update_begin, i.e. it is called when update_begin is called.     for update_begin, i.e. it is called when update_begin is called.
550     This function is called prior to calls to x_update_window_begin for     This function is called prior to calls to x_update_window_begin for
# Line 601  x_update_window_begin (w) Line 601  x_update_window_begin (w)
601           flag set.  So, rows containing mouse-face glyphs are never           flag set.  So, rows containing mouse-face glyphs are never
602           scrolled, and we don't have to switch the mouse highlight off           scrolled, and we don't have to switch the mouse highlight off
603           here to prevent it from being scrolled.  */           here to prevent it from being scrolled.  */
604          
605        /* Can we tell that this update does not affect the window        /* Can we tell that this update does not affect the window
606           where the mouse highlight is?  If so, no need to turn off.           where the mouse highlight is?  If so, no need to turn off.
607           Likewise, don't do anything if the frame is garbaged;           Likewise, don't do anything if the frame is garbaged;
# Line 634  x_draw_vertical_border (w) Line 634  x_draw_vertical_border (w)
634       struct window *w;       struct window *w;
635  {  {
636    struct frame *f = XFRAME (WINDOW_FRAME (w));    struct frame *f = XFRAME (WINDOW_FRAME (w));
637      
638    /* Redraw borders between horizontally adjacent windows.  Don't    /* Redraw borders between horizontally adjacent windows.  Don't
639       do it for frames with vertical scroll bars because either the       do it for frames with vertical scroll bars because either the
640       right scroll bar of a window, or the left scroll bar of its       right scroll bar of a window, or the left scroll bar of its
# Line 657  x_draw_vertical_border (w) Line 657  x_draw_vertical_border (w)
657      }      }
658  }  }
659    
660      
661  /* End update of window W (which is equal to updated_window).  /* End update of window W (which is equal to updated_window).
662    
663     Draw vertical borders between horizontally adjacent windows, and     Draw vertical borders between horizontally adjacent windows, and
# Line 687  x_update_window_end (w, cursor_on_p, mou Line 687  x_update_window_end (w, cursor_on_p, mou
687          x_display_and_set_cursor (w, 1, output_cursor.hpos,          x_display_and_set_cursor (w, 1, output_cursor.hpos,
688                                    output_cursor.vpos,                                    output_cursor.vpos,
689                                    output_cursor.x, output_cursor.y);                                    output_cursor.x, output_cursor.y);
690          
691        x_draw_vertical_border (w);        x_draw_vertical_border (w);
692        UNBLOCK_INPUT;        UNBLOCK_INPUT;
693      }      }
# Line 762  x_after_update_window_line (desired_row) Line 762  x_after_update_window_line (desired_row)
762    int width, height;    int width, height;
763    
764    xassert (w);    xassert (w);
765      
766    if (!desired_row->mode_line_p && !w->pseudo_window_p)    if (!desired_row->mode_line_p && !w->pseudo_window_p)
767      {      {
768        BLOCK_INPUT;        BLOCK_INPUT;
# Line 838  w32_draw_bitmap (w, hdc, row, which) Line 838  w32_draw_bitmap (w, hdc, row, which)
838             - wd             - wd
839             - (FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) - wd) / 2);             - (FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) - wd) / 2);
840        break;        break;
841          
842      case OVERLAY_ARROW_BITMAP:      case OVERLAY_ARROW_BITMAP:
843        wd = ov_width;        wd = ov_width;
844        h = ov_height;        h = ov_height;
# Line 847  w32_draw_bitmap (w, hdc, row, which) Line 847  w32_draw_bitmap (w, hdc, row, which)
847             - wd             - wd
848             - (FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) - wd) / 2);             - (FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) - wd) / 2);
849        break;        break;
850          
851      case RIGHT_TRUNCATION_BITMAP:      case RIGHT_TRUNCATION_BITMAP:
852        wd = right_width;        wd = right_width;
853        h = right_height;        h = right_height;
# Line 863  w32_draw_bitmap (w, hdc, row, which) Line 863  w32_draw_bitmap (w, hdc, row, which)
863        x = window_box_right (w, -1);        x = window_box_right (w, -1);
864        x += (FRAME_X_RIGHT_FLAGS_AREA_WIDTH (f) - wd) / 2;        x += (FRAME_X_RIGHT_FLAGS_AREA_WIDTH (f) - wd) / 2;
865        break;        break;
866          
867      case CONTINUATION_LINE_BITMAP:      case CONTINUATION_LINE_BITMAP:
868        wd = continuation_width;        wd = continuation_width;
869        h = continuation_height;        h = continuation_height;
# Line 961  x_draw_row_bitmaps (w, row) Line 961  x_draw_row_bitmaps (w, row)
961    
962        if (header_line_height < 0)        if (header_line_height < 0)
963          header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);          header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
964          
965        w32_fill_area (f, hdc, face->background,        w32_fill_area (f, hdc, face->background,
966                       left - FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) + border,                       left - FRAME_X_LEFT_FLAGS_AREA_WIDTH (f) + border,
967                       WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,                       WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
# Line 1098  set_output_cursor (cursor) Line 1098  set_output_cursor (cursor)
1098    
1099     HPOS and VPOS are column/row positions in a window glyph matrix.  X     HPOS and VPOS are column/row positions in a window glyph matrix.  X
1100     and Y are window text area relative pixel positions.     and Y are window text area relative pixel positions.
1101      
1102     If this is done during an update, updated_window will contain the     If this is done during an update, updated_window will contain the
1103     window that is being updated and the position is the future output     window that is being updated and the position is the future output
1104     cursor position for that window.  If updated_window is null, use     cursor position for that window.  If updated_window is null, use
# Line 1396  int w32_font_is_double_byte (XFontStruct Line 1396  int w32_font_is_double_byte (XFontStruct
1396  }  }
1397    
1398    
1399  static BOOL  static BOOL
1400  w32_use_unicode_for_codepage (codepage)  w32_use_unicode_for_codepage (codepage)
1401       int codepage;       int codepage;
1402  {  {
# Line 1460  w32_encode_char (c, char2b, font_info, t Line 1460  w32_encode_char (c, char2b, font_info, t
1460        /* Fixed encoding scheme.  See fontset.h for the meaning of the        /* Fixed encoding scheme.  See fontset.h for the meaning of the
1461           encoding numbers.  */           encoding numbers.  */
1462        int enc = font_info->encoding[charset];        int enc = font_info->encoding[charset];
1463          
1464        if ((enc == 1 || enc == 2)        if ((enc == 1 || enc == 2)
1465            && CHARSET_DIMENSION (charset) == 2)            && CHARSET_DIMENSION (charset) == 2)
1466          *char2b = BUILD_WCHAR_T (BYTE1 (*char2b) | 0x80, BYTE2 (*char2b));          *char2b = BUILD_WCHAR_T (BYTE1 (*char2b) | 0x80, BYTE2 (*char2b));
1467          
1468        if (enc == 1 || enc == 3        if (enc == 1 || enc == 3
1469            || (enc == 4 && CHARSET_DIMENSION (charset) == 1))            || (enc == 4 && CHARSET_DIMENSION (charset) == 1))
1470          *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), BYTE2 (*char2b) | 0x80);          *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), BYTE2 (*char2b) | 0x80);
# Line 1542  x_get_char_face_and_encoding (f, c, face Line 1542  x_get_char_face_and_encoding (f, c, face
1542    else    else
1543      {      {
1544        int c1, c2, charset;        int c1, c2, charset;
1545          
1546        /* Split characters into bytes.  If c2 is -1 afterwards, C is        /* Split characters into bytes.  If c2 is -1 afterwards, C is
1547           really a one-byte character so that byte1 is zero.  */           really a one-byte character so that byte1 is zero.  */
1548        SPLIT_CHAR (c, charset, c1, c2);        SPLIT_CHAR (c, charset, c1, c2);
# Line 1550  x_get_char_face_and_encoding (f, c, face Line 1550  x_get_char_face_and_encoding (f, c, face
1550          *char2b = BUILD_WCHAR_T (c1, c2);          *char2b = BUILD_WCHAR_T (c1, c2);
1551        else        else
1552          *char2b = BUILD_WCHAR_T (0, c1);          *char2b = BUILD_WCHAR_T (0, c1);
1553      
1554        /* Maybe encode the character in *CHAR2B.  */        /* Maybe encode the character in *CHAR2B.  */
1555        if (face->font != NULL)        if (face->font != NULL)
1556          {          {
# Line 1564  x_get_char_face_and_encoding (f, c, face Line 1564  x_get_char_face_and_encoding (f, c, face
1564    /* Make sure X resources of the face are allocated.  */    /* Make sure X resources of the face are allocated.  */
1565    xassert (face != NULL);    xassert (face != NULL);
1566    PREPARE_FACE_FOR_DISPLAY (f, face);    PREPARE_FACE_FOR_DISPLAY (f, face);
1567      
1568    return face;    return face;
1569  }  }
1570    
# Line 1606  x_get_glyph_face_and_encoding (f, glyph, Line 1606  x_get_glyph_face_and_encoding (f, glyph,
1606    else    else
1607      {      {
1608        int c1, c2, charset;        int c1, c2, charset;
1609          
1610        /* Split characters into bytes.  If c2 is -1 afterwards, C is        /* Split characters into bytes.  If c2 is -1 afterwards, C is
1611           really a one-byte character so that byte1 is zero.  */           really a one-byte character so that byte1 is zero.  */
1612        SPLIT_CHAR (glyph->u.ch, charset, c1, c2);        SPLIT_CHAR (glyph->u.ch, charset, c1, c2);
# Line 1635  x_get_glyph_face_and_encoding (f, glyph, Line 1635  x_get_glyph_face_and_encoding (f, glyph,
1635  }  }
1636    
1637    
1638  /* Store one glyph for IT->char_to_display in IT->glyph_row.    /* Store one glyph for IT->char_to_display in IT->glyph_row.
1639     Called from x_produce_glyphs when IT->glyph_row is non-null.  */     Called from x_produce_glyphs when IT->glyph_row is non-null.  */
1640    
1641  static INLINE void  static INLINE void
# Line 1644  x_append_glyph (it) Line 1644  x_append_glyph (it)
1644  {  {
1645    struct glyph *glyph;    struct glyph *glyph;
1646    enum glyph_row_area area = it->area;    enum glyph_row_area area = it->area;
1647      
1648    xassert (it->glyph_row);    xassert (it->glyph_row);
1649    xassert (it->char_to_display != '\n' && it->char_to_display != '\t');    xassert (it->char_to_display != '\n' && it->char_to_display != '\t');
1650      
1651    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1652    if (glyph < it->glyph_row->glyphs[area + 1])    if (glyph < it->glyph_row->glyphs[area + 1])
1653      {      {
# Line 1670  x_append_glyph (it) Line 1670  x_append_glyph (it)
1670      }      }
1671  }  }
1672    
1673  /* Store one glyph for the composition IT->cmp_id in IT->glyph_row.    /* Store one glyph for the composition IT->cmp_id in IT->glyph_row.
1674     Called from x_produce_glyphs when IT->glyph_row is non-null.  */     Called from x_produce_glyphs when IT->glyph_row is non-null.  */
1675    
1676  static INLINE void  static INLINE void
# Line 1679  x_append_composite_glyph (it) Line 1679  x_append_composite_glyph (it)
1679  {  {
1680    struct glyph *glyph;    struct glyph *glyph;
1681    enum glyph_row_area area = it->area;    enum glyph_row_area area = it->area;
1682      
1683    xassert (it->glyph_row);    xassert (it->glyph_row);
1684      
1685    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1686    if (glyph < it->glyph_row->glyphs[area + 1])    if (glyph < it->glyph_row->glyphs[area + 1])
1687      {      {
# Line 1752  x_produce_image_glyph (it) Line 1752  x_produce_image_glyph (it)
1752    it->pixel_width = img->width + 2 * img->hmargin;    it->pixel_width = img->width + 2 * img->hmargin;
1753    
1754    it->nglyphs = 1;    it->nglyphs = 1;
1755      
1756    if (face->box != FACE_NO_BOX)    if (face->box != FACE_NO_BOX)
1757      {      {
1758        if (face->box_line_width > 0)        if (face->box_line_width > 0)
# Line 1760  x_produce_image_glyph (it) Line 1760  x_produce_image_glyph (it)
1760            it->ascent += face->box_line_width;            it->ascent += face->box_line_width;
1761            it->descent += face->box_line_width;            it->descent += face->box_line_width;
1762          }          }
1763          
1764        if (it->start_of_box_run_p)        if (it->start_of_box_run_p)
1765          it->pixel_width += abs (face->box_line_width);          it->pixel_width += abs (face->box_line_width);
1766        if (it->end_of_box_run_p)        if (it->end_of_box_run_p)
# Line 1768  x_produce_image_glyph (it) Line 1768  x_produce_image_glyph (it)
1768      }      }
1769    
1770    take_vertical_position_into_account (it);    take_vertical_position_into_account (it);
1771      
1772    if (it->glyph_row)    if (it->glyph_row)
1773      {      {
1774        struct glyph *glyph;        struct glyph *glyph;
1775        enum glyph_row_area area = it->area;        enum glyph_row_area area = it->area;
1776          
1777        glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];        glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1778        if (glyph < it->glyph_row->glyphs[area + 1])        if (glyph < it->glyph_row->glyphs[area + 1])
1779          {          {
# Line 1798  x_produce_image_glyph (it) Line 1798  x_produce_image_glyph (it)
1798    
1799    
1800  /* Append a stretch glyph to IT->glyph_row.  OBJECT is the source  /* Append a stretch glyph to IT->glyph_row.  OBJECT is the source
1801     of the glyph, WIDTH and HEIGHT are the width and height of the     of the glyph, WIDTH and HEIGHT are the width and height of the
1802     stretch.  ASCENT is the percentage/100 of HEIGHT to use for the     stretch.  ASCENT is the percentage/100 of HEIGHT to use for the
1803     ascent of the glyph (0 <= ASCENT <= 1).  */     ascent of the glyph (0 <= ASCENT <= 1).  */
1804      
1805  static void  static void
1806  x_append_stretch_glyph (it, object, width, height, ascent)  x_append_stretch_glyph (it, object, width, height, ascent)
1807       struct it *it;       struct it *it;
# Line 1813  x_append_stretch_glyph (it, object, widt Line 1813  x_append_stretch_glyph (it, object, widt
1813    enum glyph_row_area area = it->area;    enum glyph_row_area area = it->area;
1814    
1815    xassert (ascent >= 0 && ascent <= 1);    xassert (ascent >= 0 && ascent <= 1);
1816      
1817    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];    glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
1818    if (glyph < it->glyph_row->glyphs[area + 1])    if (glyph < it->glyph_row->glyphs[area + 1])
1819      {      {
# Line 1843  x_append_stretch_glyph (it, object, widt Line 1843  x_append_stretch_glyph (it, object, widt
1843     being recognized:     being recognized:
1844    
1845     1. `:width WIDTH' specifies that the space should be WIDTH *     1. `:width WIDTH' specifies that the space should be WIDTH *
1846     canonical char width wide.  WIDTH may be an integer or floating     canonical char width wide.  WIDTH may be an integer or floating
1847     point number.     point number.
1848    
1849     2. `:relative-width FACTOR' specifies that the width of the stretch     2. `:relative-width FACTOR' specifies that the width of the stretch
# Line 1853  x_append_stretch_glyph (it, object, widt Line 1853  x_append_stretch_glyph (it, object, widt
1853     3. `:align-to HPOS' specifies that the space should be wide enough     3. `:align-to HPOS' specifies that the space should be wide enough
1854     to reach HPOS, a value in canonical character units.     to reach HPOS, a value in canonical character units.
1855    
1856     Exactly one of the above pairs must be present.       Exactly one of the above pairs must be present.
1857    
1858     4. `:height HEIGHT' specifies that the height of the stretch produced     4. `:height HEIGHT' specifies that the height of the stretch produced
1859     should be HEIGHT, measured in canonical character units.     should be HEIGHT, measured in canonical character units.
# Line 1891  x_produce_stretch_glyph (it) Line 1891  x_produce_stretch_glyph (it)
1891    XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f);    XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f);
1892    
1893    PREPARE_FACE_FOR_DISPLAY (it->f, face);    PREPARE_FACE_FOR_DISPLAY (it->f, face);
1894      
1895    /* List should start with `space'.  */    /* List should start with `space'.  */
1896    xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));    xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
1897    plist = XCDR (it->object);    plist = XCDR (it->object);
# Line 1909  x_produce_stretch_glyph (it) Line 1909  x_produce_stretch_glyph (it)
1909           property.  */           property.  */
1910        struct it it2;        struct it it2;
1911        unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it));        unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
1912          
1913        it2 = *it;        it2 = *it;
1914        if (it->multibyte_p)        if (it->multibyte_p)
1915          {          {
# Line 1931  x_produce_stretch_glyph (it) Line 1931  x_produce_stretch_glyph (it)
1931    else    else
1932      /* Nothing specified -> width defaults to canonical char width.  */      /* Nothing specified -> width defaults to canonical char width.  */
1933      width = CANON_X_UNIT (it->f);      width = CANON_X_UNIT (it->f);
1934      
1935    /* Compute height.  */    /* Compute height.  */
1936    if (prop = Fplist_get (plist, QCheight),    if (prop = Fplist_get (plist, QCheight),
1937        NUMVAL (prop) > 0)        NUMVAL (prop) > 0)
# Line 1942  x_produce_stretch_glyph (it) Line 1942  x_produce_stretch_glyph (it)
1942    else    else
1943      height = FONT_HEIGHT (font);      height = FONT_HEIGHT (font);
1944    
1945    /* Compute percentage of height used for ascent.  If    /* Compute percentage of height used for ascent.  If
1946       `:ascent ASCENT' is present and valid, use that.  Otherwise,       `:ascent ASCENT' is present and valid, use that.  Otherwise,
1947       derive the ascent from the font in use.  */       derive the ascent from the font in use.  */
1948    if (prop = Fplist_get (plist, QCascent),    if (prop = Fplist_get (plist, QCascent),
# Line 1976  x_produce_stretch_glyph (it) Line 1976  x_produce_stretch_glyph (it)
1976            it->ascent += face->box_line_width;            it->ascent += face->box_line_width;
1977            it->descent += face->box_line_width;            it->descent += face->box_line_width;
1978          }          }
1979          
1980        if (it->start_of_box_run_p)        if (it->start_of_box_run_p)
1981          it->pixel_width += abs (face->box_line_width);          it->pixel_width += abs (face->box_line_width);
1982        if (it->end_of_box_run_p)        if (it->end_of_box_run_p)
1983          it->pixel_width += abs (face->box_line_width);          it->pixel_width += abs (face->box_line_width);
1984      }      }
1985      
1986    take_vertical_position_into_account (it);    take_vertical_position_into_account (it);
1987  }  }
1988    
# Line 2074  x_produce_glyphs (it) Line 2074  x_produce_glyphs (it)
2074                face = FACE_FROM_ID (it->f, it->face_id);                face = FACE_FROM_ID (it->f, it->face_id);
2075              }              }
2076          }          }
2077          
2078        /* Get font to use.  Encode IT->char_to_display.  */        /* Get font to use.  Encode IT->char_to_display.  */
2079        x_get_char_face_and_encoding (it->f, it->char_to_display,        x_get_char_face_and_encoding (it->f, it->char_to_display,
2080                                      it->face_id, &char2b,                                      it->face_id, &char2b,
# Line 2123  x_produce_glyphs (it) Line 2123  x_produce_glyphs (it)
2123                it->phys_descent = FONT_DESCENT (font) - boff;                it->phys_descent = FONT_DESCENT (font) - boff;
2124                it->pixel_width = FONT_WIDTH (font);                it->pixel_width = FONT_WIDTH (font);
2125              }              }
2126              
2127            /* If this is a space inside a region of text with            /* If this is a space inside a region of text with
2128               `space-width' property, change its width.  */               `space-width' property, change its width.  */
2129            stretched_p = it->char_to_display == ' ' && !NILP (it->space_width);            stretched_p = it->char_to_display == ' ' && !NILP (it->space_width);
# Line 2136  x_produce_glyphs (it) Line 2136  x_produce_glyphs (it)
2136            if (face->box != FACE_NO_BOX)            if (face->box != FACE_NO_BOX)
2137              {              {
2138                int thick = face->box_line_width;                int thick = face->box_line_width;
2139                  
2140                if (thick > 0)                if (thick > 0)
2141                  {                  {
2142                    it->ascent += thick;                    it->ascent += thick;
# Line 2144  x_produce_glyphs (it) Line 2144  x_produce_glyphs (it)
2144                  }                  }
2145                else                else
2146                  thick = -thick;                  thick = -thick;
2147                  
2148                if (it->start_of_box_run_p)                if (it->start_of_box_run_p)
2149                  it->pixel_width += thick;                  it->pixel_width += thick;
2150                if (it->end_of_box_run_p)                if (it->end_of_box_run_p)
# Line 2157  x_produce_glyphs (it) Line 2157  x_produce_glyphs (it)
2157              it->ascent += 2;              it->ascent += 2;
2158    
2159            take_vertical_position_into_account (it);            take_vertical_position_into_account (it);
2160      
2161            /* If we have to actually produce glyphs, do it.  */            /* If we have to actually produce glyphs, do it.  */
2162            if (it->glyph_row)            if (it->glyph_row)
2163              {              {
# Line 2167  x_produce_glyphs (it) Line 2167  x_produce_glyphs (it)
2167                       into a stretch glyph.  */                       into a stretch glyph.  */
2168                    double ascent = (double) FONT_BASE (font)                    double ascent = (double) FONT_BASE (font)
2169                                  / FONT_HEIGHT (font);                                  / FONT_HEIGHT (font);
2170                    x_append_stretch_glyph (it, it->object, it->pixel_width,                    x_append_stretch_glyph (it, it->object, it->pixel_width,
2171                                            it->ascent + it->descent, ascent);                                            it->ascent + it->descent, ascent);
2172                  }                  }
2173                else                else
# Line 2187  x_produce_glyphs (it) Line 2187  x_produce_glyphs (it)
2187            it->nglyphs = 0;            it->nglyphs = 0;
2188            it->ascent = it->phys_ascent = FONT_BASE (font) + boff;            it->ascent = it->phys_ascent = FONT_BASE (font) + boff;
2189            it->descent = it->phys_descent = FONT_DESCENT (font) - boff;            it->descent = it->phys_descent = FONT_DESCENT (font) - boff;
2190          
2191            if (face->box != FACE_NO_BOX            if (face->box != FACE_NO_BOX
2192                && face->box_line_width > 0)                && face->box_line_width > 0)
2193              {              {
# Line 2200  x_produce_glyphs (it) Line 2200  x_produce_glyphs (it)
2200            int tab_width = it->tab_width * CANON_X_UNIT (it->f);            int tab_width = it->tab_width * CANON_X_UNIT (it->f);
2201            int x = it->current_x + it->continuation_lines_width;            int x = it->current_x + it->continuation_lines_width;
2202            int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;            int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
2203          
2204            /* If the distance from the current position to the next tab            /* If the distance from the current position to the next tab
2205               stop is less than a canonical character width, use the               stop is less than a canonical character width, use the
2206               tab stop after that.  */               tab stop after that.  */
# Line 2211  x_produce_glyphs (it) Line 2211  x_produce_glyphs (it)
2211            it->nglyphs = 1;            it->nglyphs = 1;
2212            it->ascent = it->phys_ascent = FONT_BASE (font) + boff;            it->ascent = it->phys_ascent = FONT_BASE (font) + boff;
2213            it->descent = it->phys_descent = FONT_DESCENT (font) - boff;            it->descent = it->phys_descent = FONT_DESCENT (font) - boff;
2214              
2215            if (it->glyph_row)            if (it->glyph_row)
2216              {              {
2217                double ascent = (double) it->ascent / (it->ascent + it->descent);                double ascent = (double) it->ascent / (it->ascent + it->descent);
2218                x_append_stretch_glyph (it, it->object, it->pixel_width,                x_append_stretch_glyph (it, it->object, it->pixel_width,
2219                                        it->ascent + it->descent, ascent);                                        it->ascent + it->descent, ascent);
2220              }              }
2221          }          }
2222        else        else
2223          {          {
2224            /* A multi-byte character.            /* A multi-byte character.
2225               If we found a font, this font should give us the right               If we found a font, this font should give us the right
# Line 2272  x_produce_glyphs (it) Line 2272  x_produce_glyphs (it)
2272                  }                  }
2273                else                else
2274                  thick = - thick;                  thick = - thick;
2275              
2276                if (it->start_of_box_run_p)                if (it->start_of_box_run_p)
2277                  it->pixel_width += thick;                  it->pixel_width += thick;
2278                if (it->end_of_box_run_p)                if (it->end_of_box_run_p)
2279                  it->pixel_width += thick;                  it->pixel_width += thick;
2280              }              }
2281      
2282            /* If face has an overline, add the height of the overline            /* If face has an overline, add the height of the overline
2283               (1 pixel) and a 1 pixel margin to the character height.  */               (1 pixel) and a 1 pixel margin to the character height.  */
2284            if (face->overline_p)            if (face->overline_p)
2285              it->ascent += 2;              it->ascent += 2;
2286    
2287            take_vertical_position_into_account (it);            take_vertical_position_into_account (it);
2288      
2289            if (it->glyph_row)            if (it->glyph_row)
2290              x_append_glyph (it);              x_append_glyph (it);
2291          }          }
# Line 2387  x_produce_glyphs (it) Line 2387  x_produce_glyphs (it)
2387                ascent = FONT_BASE (font);                ascent = FONT_BASE (font);
2388                descent = FONT_DESCENT (font);                descent = FONT_DESCENT (font);
2389              }              }
2390              
2391            rightmost = width;            rightmost = width;
2392            lowest = - descent + boff;            lowest = - descent + boff;
2393            highest = ascent + boff;            highest = ascent + boff;
2394            leftmost = 0;            leftmost = 0;
2395              
2396            if (font_info            if (font_info
2397                && font_info->default_ascent                && font_info->default_ascent
2398                && CHAR_TABLE_P (Vuse_default_ascent)                && CHAR_TABLE_P (Vuse_default_ascent)
# Line 2560  x_produce_glyphs (it) Line 2560  x_produce_glyphs (it)
2560              }              }
2561            else            else
2562              thick = - thick;              thick = - thick;
2563              
2564            if (it->start_of_box_run_p)            if (it->start_of_box_run_p)
2565              it->pixel_width += thick;              it->pixel_width += thick;
2566            if (it->end_of_box_run_p)            if (it->end_of_box_run_p)
2567              it->pixel_width += thick;              it->pixel_width += thick;
2568          }          }
2569      
2570        /* If face has an overline, add the height of the overline        /* If face has an overline, add the height of the overline
2571           (1 pixel) and a 1 pixel margin to the character height.  */           (1 pixel) and a 1 pixel margin to the character height.  */
2572        if (face->overline_p)        if (face->overline_p)
2573          it->ascent += 2;          it->ascent += 2;
2574    
2575        take_vertical_position_into_account (it);        take_vertical_position_into_account (it);
2576      
2577        if (it->glyph_row)        if (it->glyph_row)
2578          x_append_composite_glyph (it);          x_append_composite_glyph (it);
2579      }      }
# Line 2620  x_estimate_mode_line_height (f, face_id) Line 2620  x_estimate_mode_line_height (f, face_id)
2620                height += 2 * face->box_line_width;                height += 2 * face->box_line_width;
2621            }            }
2622        }        }
2623      
2624    return height;    return height;
2625  }  }
2626    
# Line 2811  static int x_fill_glyph_string P_ ((stru Line 2811  static int x_fill_glyph_string P_ ((stru
2811  static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc,  static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc,
2812                                         wchar_t *, struct window *,                                         wchar_t *, struct window *,
2813                                         struct glyph_row *,                                         struct glyph_row *,
2814                                         enum glyph_row_area, int,                                         enum glyph_row_area, int,
2815                                         enum draw_glyphs_face));                                         enum draw_glyphs_face));
2816  static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *,  static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *,
2817                                enum glyph_row_area, int, int,                                enum glyph_row_area, int, int,
# Line 2857  static int x_fill_stretch_glyph_string P Line 2857  static int x_fill_stretch_glyph_string P
2857  static void x_check_font P_ ((struct frame *, XFontStruct *));  static void x_check_font P_ ((struct frame *, XFontStruct *));
2858  #endif  #endif
2859    
2860        
2861  /* Append the list of glyph strings with head H and tail T to the list  /* Append the list of glyph strings with head H and tail T to the list
2862     with head *HEAD and tail *TAIL.  Set *HEAD and *TAIL to the result.  */     with head *HEAD and tail *TAIL.  Set *HEAD and *TAIL to the result.  */
2863    
# Line 2966  x_set_cursor_gc (s) Line 2966  x_set_cursor_gc (s)
2966    
2967    
2968  /* Set up S->gc of glyph string S for drawing text in mouse face.  */  /* Set up S->gc of glyph string S for drawing text in mouse face.  */
2969      
2970  static void  static void
2971  x_set_mouse_face_gc (s)  x_set_mouse_face_gc (s)
2972       struct glyph_string *s;       struct glyph_string *s;
2973  {      {
2974    int face_id;    int face_id;
2975    struct face *face;    struct face *face;
2976    
# Line 2979  x_set_mouse_face_gc (s) Line 2979  x_set_mouse_face_gc (s)
2979    face = FACE_FROM_ID (s->f, face_id);    face = FACE_FROM_ID (s->f, face_id);
2980    if (face == NULL)    if (face == NULL)
2981      face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);      face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
2982      
2983    if (s->first_glyph->type == CHAR_GLYPH)    if (s->first_glyph->type == CHAR_GLYPH)
2984      face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch);      face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch);
2985    else    else
# Line 2996  x_set_mouse_face_gc (s) Line 2996  x_set_mouse_face_gc (s)
2996           but font FONT.  */           but font FONT.  */
2997        XGCValues xgcv;        XGCValues xgcv;
2998        unsigned long mask;        unsigned long mask;
2999          
3000        xgcv.background = s->face->background;        xgcv.background = s->face->background;
3001        xgcv.foreground = s->face->foreground;        xgcv.foreground = s->face->foreground;
3002        IF_DEBUG (x_check_font (s->f, s->font));        IF_DEBUG (x_check_font (s->f, s->font));
3003        xgcv.font = s->font;        xgcv.font = s->font;
3004        mask = GCForeground | GCBackground | GCFont;        mask = GCForeground | GCBackground | GCFont;
3005          
3006        if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc)        if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc)
3007          XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc,          XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc,
3008                     mask, &xgcv);                     mask, &xgcv);
3009        else        else
3010          FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc          FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc
3011            = XCreateGC (NULL, s->window, mask, &xgcv);            = XCreateGC (NULL, s->window, mask, &xgcv);
3012          
3013        s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc;        s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc;
3014      }      }
3015    
# Line 3024  x_set_mouse_face_gc (s) Line 3024  x_set_mouse_face_gc (s)
3024  static INLINE void  static INLINE void
3025  x_set_mode_line_face_gc (s)  x_set_mode_line_face_gc (s)
3026       struct glyph_string *s;       struct glyph_string *s;
3027  {      {
3028    s->gc = s->face->gc;    s->gc = s->face->gc;
3029  }  }
3030    
# Line 3038  x_set_glyph_string_gc (s) Line 3038  x_set_glyph_string_gc (s)
3038       struct glyph_string *s;       struct glyph_string *s;
3039  {  {
3040    PREPARE_FACE_FOR_DISPLAY (s->f, s->face);    PREPARE_FACE_FOR_DISPLAY (s->f, s->face);
3041      
3042    if (s->hl == DRAW_NORMAL_TEXT)    if (s->hl == DRAW_NORMAL_TEXT)
3043      {      {
3044        s->gc = s->face->gc;        s->gc = s->face->gc;
# Line 3089  w32_get_glyph_string_clip_rect (s, r) Line 3089  w32_get_glyph_string_clip_rect (s, r)
3089      {      {
3090        /* Draw full-width.  X coordinates are relative to S->w->left.  */        /* Draw full-width.  X coordinates are relative to S->w->left.  */
3091        int canon_x = CANON_X_UNIT (s->f);        int canon_x = CANON_X_UNIT (s->f);
3092          
3093        r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x;        r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x;
3094        r_width = XFASTINT (s->w->width) * canon_x;        r_width = XFASTINT (s->w->width) * canon_x;
3095    
# Line 3099  w32_get_glyph_string_clip_rect (s, r) Line 3099  w32_get_glyph_string_clip_rect (s, r)
3099            if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f))            if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f))
3100              r->left -= width;              r->left -= width;
3101          }          }
3102          
3103        r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f);        r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f);
3104    
3105        /* Unless displaying a mode or menu bar line, which are always        /* Unless displaying a mode or menu bar line, which are always
# Line 3178  x_compute_glyph_string_overhangs (s) Line 3178  x_compute_glyph_string_overhangs (s)
3178  /* Compute overhangs and x-positions for glyph string S and its  /* Compute overhangs and x-positions for glyph string S and its
3179     predecessors, or successors.  X is the starting x-position for S.     predecessors, or successors.  X is the starting x-position for S.
3180     BACKWARD_P non-zero means process predecessors.  */     BACKWARD_P non-zero means process predecessors.  */
3181      
3182  static void  static void
3183  x_compute_overhangs_and_x (s, x, backward_p)  x_compute_overhangs_and_x (s, x, backward_p)
3184       struct glyph_string *s;       struct glyph_string *s;
# Line 3220  w32_get_glyph_overhangs (hdc, glyph, f, Line 3220  w32_get_glyph_overhangs (hdc, glyph, f,
3220       int *left, *right;       int *left, *right;
3221  {  {
3222    *left = *right = 0;    *left = *right = 0;
3223      
3224    if (glyph->type == CHAR_GLYPH)    if (glyph->type == CHAR_GLYPH)
3225      {      {
3226        XFontStruct *font;        XFontStruct *font;
# Line 3266  x_left_overwritten (s) Line 3266  x_left_overwritten (s)
3266       struct glyph_string *s;       struct glyph_string *s;
3267  {  {
3268    int k;    int k;
3269        
3270    if (s->left_overhang)    if (s->left_overhang)
3271      {      {
3272        int x = 0, i;        int x = 0, i;
# Line 3328  x_right_overwritten (s) Line 3328  x_right_overwritten (s)
3328        struct glyph *glyphs = s->row->glyphs[s->area];        struct glyph *glyphs = s->row->glyphs[s->area];
3329        int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars);        int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars);
3330        int end = s->row->used[s->area];        int end = s->row->used[s->area];
3331          
3332        for (i = first; i < end && s->right_overhang > x; ++i)        for (i = first; i < end && s->right_overhang > x; ++i)
3333          x += glyphs[i].pixel_width;          x += glyphs[i].pixel_width;
3334    
# Line 3607  w32_alloc_lighter_color (f, color, facto Line 3607  w32_alloc_lighter_color (f, color, facto
3607        double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT;        double dimness = 1 - (double)bright / HIGHLIGHT_COLOR_DARK_BOOST_LIMIT;
3608        /* The additive adjustment.  */        /* The additive adjustment.  */
3609        int min_delta = delta * dimness * factor / 2;        int min_delta = delta * dimness * factor / 2;
3610          
3611        if (factor < 1)        if (factor < 1)
3612          new = PALETTERGB (max (0, min (0xff, min_delta - GetRValue (*color))),          new = PALETTERGB (max (0, min (0xff, min_delta - GetRValue (*color))),
3613                            max (0, min (0xff, min_delta - GetGValue (*color))),                            max (0, min (0xff, min_delta - GetGValue (*color))),
# Line 3617  w32_alloc_lighter_color (f, color, facto Line 3617  w32_alloc_lighter_color (f, color, facto
3617                            max (0, min (0xff, min_delta + GetGValue (*color))),                            max (0, min (0xff, min_delta + GetGValue (*color))),
3618                            max (0, min (0xff, min_delta + GetBValue (*color))));                            max (0, min (0xff, min_delta + GetBValue (*color))));
3619      }      }
3620      
3621    if (new == *color)    if (new == *color)
3622      new = PALETTERGB (max (0, min (0xff, delta + GetRValue (*color))),      new = PALETTERGB (max (0, min (0xff, delta + GetRValue (*color))),
3623                        max (0, min (0xff, delta + GetGValue (*color))),                        max (0, min (0xff, delta + GetGValue (*color))),
# Line 3641  w32_alloc_lighter_color (f, color, facto Line 3641  w32_alloc_lighter_color (f, color, facto
3641     DELTA lighter or darker than the relief's background which is found     DELTA lighter or darker than the relief's background which is found
3642     in S->f->output_data.x->relief_background.  If such a color cannot     in S->f->output_data.x->relief_background.  If such a color cannot
3643     be allocated, use DEFAULT_PIXEL, instead.  */     be allocated, use DEFAULT_PIXEL, instead.  */
3644      
3645  static void  static void
3646  w32_setup_relief_color (f, relief, factor, delta, default_pixel)  w32_setup_relief_color (f, relief, factor, delta, default_pixel)
3647       struct frame *f;       struct frame *f;
# Line 3667  w32_setup_relief_color (f, relief, facto Line 3667  w32_setup_relief_color (f, relief, facto
3667        relief->allocated_p = 1;        relief->allocated_p = 1;
3668        xgcv.foreground = relief->pixel = pixel;        xgcv.foreground = relief->pixel = pixel;
3669      }      }
3670      
3671    if (relief->gc == 0)    if (relief->gc == 0)
3672      {      {
3673  #if 0 /* TODO: stipple */  #if 0 /* TODO: stipple */
# Line 3760  w32_draw_relief_rect (f, left_x, top_y, Line 3760  w32_draw_relief_rect (f, left_x, top_y,
3760    
3761    
3762    w32_set_clip_rectangle (hdc, clip_rect);    w32_set_clip_rectangle (hdc, clip_rect);
3763      
3764    /* Bottom.  */    /* Bottom.  */
3765    for (i = 0; i < width; ++i)    for (i = 0; i < width; ++i)
3766      {      {
3767        w32_fill_area (f, hdc, gc.foreground,        w32_fill_area (f, hdc, gc.foreground,
3768                       left_x + i * left_p, bottom_y - i,                       left_x + i * left_p, bottom_y - i,
3769                       (right_x - i * right_p) - (left_x + i * left_p) + 2, 1);                       (right_x - i * right_p) - (left_x + i * left_p) + 2, 1);
3770      }      }
# Line 3779  w32_draw_relief_rect (f, left_x, top_y, Line 3779  w32_draw_relief_rect (f, left_x, top_y,
3779        }        }
3780    
3781    w32_set_clip_rectangle (hdc, NULL);    w32_set_clip_rectangle (hdc, NULL);
3782      
3783    release_frame_dc (f, hdc);    release_frame_dc (f, hdc);
3784  }  }
3785    
# Line 3799  w32_draw_box_rect (s, left_x, top_y, rig Line 3799  w32_draw_box_rect (s, left_x, top_y, rig
3799       RECT *clip_rect;       RECT *clip_rect;
3800  {  {
3801    w32_set_clip_rectangle (s->hdc, clip_rect);    w32_set_clip_rectangle (s->hdc, clip_rect);
3802      
3803    /* Top.  */    /* Top.  */
3804    w32_fill_area (s->f, s->hdc, s->face->box_color,    w32_fill_area (s->f, s->hdc, s->face->box_color,
3805                    left_x, top_y, right_x - left_x + 1, width);                    left_x, top_y, right_x - left_x + 1, width);
# Line 3810  w32_draw_box_rect (s, left_x, top_y, rig Line 3810  w32_draw_box_rect (s, left_x, top_y, rig
3810        w32_fill_area (s->f, s->hdc, s->face->box_color,        w32_fill_area (s->f, s->hdc, s->face->box_color,
3811                       left_x, top_y, width, bottom_y - top_y + 1);                       left_x, top_y, width, bottom_y - top_y + 1);
3812      }      }
3813      
3814    /* Bottom.  */    /* Bottom.  */
3815    w32_fill_area (s->f, s->hdc, s->face->box_color,    w32_fill_area (s->f, s->hdc, s->face->box_color,
3816                   left_x, bottom_y - width + 1, right_x - left_x + 1, width);                   left_x, bottom_y - width + 1, right_x - left_x + 1, width);
3817      
3818    /* Right.  */    /* Right.  */
3819    if (right_p)    if (right_p)
3820      {      {
# Line 3845  x_draw_glyph_string_box (s) Line 3845  x_draw_glyph_string_box (s)
3845        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f))        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f))
3846          last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f);          last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f);
3847      }      }
3848      
3849    /* The glyph that may have a right box line.  */    /* The glyph that may have a right box line.  */
3850    last_glyph = (s->cmp || s->img    last_glyph = (s->cmp || s->img
3851                  ? s->first_glyph                  ? s->first_glyph
# Line 3868  x_draw_glyph_string_box (s) Line 3868  x_draw_glyph_string_box (s)
3868               || (s->hl == DRAW_MOUSE_FACE               || (s->hl == DRAW_MOUSE_FACE
3869                   && (s->next == NULL                   && (s->next == NULL
3870                       || s->next->hl != s->hl)));                       || s->next->hl != s->hl)));
3871      
3872    w32_get_glyph_string_clip_rect (s, &clip_rect);    w32_get_glyph_string_clip_rect (s, &clip_rect);
3873    
3874    if (s->face->box == FACE_SIMPLE_BOX)    if (s->face->box == FACE_SIMPLE_BOX)
# Line 3927  x_draw_image_foreground (s) Line 3927  x_draw_image_foreground (s)
3927            xgcv.clip_y_origin = y;            xgcv.clip_y_origin = y;
3928            xgcv.function = GXcopy;            xgcv.function = GXcopy;
3929            XChangeGC (s->display, s->gc, mask, &xgcv);            XChangeGC (s->display, s->gc, mask, &xgcv);
3930              
3931            w32_get_glyph_string_clip_rect (s, &clip_rect);            w32_get_glyph_string_clip_rect (s, &clip_rect);
3932            image_rect.x = x;            image_rect.x = x;
3933            image_rect.y = y;            image_rect.y = y;
# Line 3993  x_draw_image_relief (s) Line 3993  x_draw_image_relief (s)
3993    RECT r;    RECT r;
3994    int x;    int x;
3995    int y = s->ybase - image_ascent (s->img, s->face);    int y = s->ybase - image_ascent (s->img, s->face);
3996    
3997    /* If first glyph of S has a left box line, start drawing it to the    /* If first glyph of S has a left box line, start drawing it to the
3998       right of that line.  */       right of that line.  */
3999    if (s->face->box != FACE_NO_BOX    if (s->face->box != FACE_NO_BOX
# Line 4001  x_draw_image_relief (s) Line 4001  x_draw_image_relief (s)
4001      x = s->x + abs (s->face->box_line_width);      x = s->x + abs (s->face->box_line_width);
4002    else    else
4003      x = s->x;      x = s->x;
4004      
4005    /* If there is a margin around the image, adjust x- and y-position    /* If there is a margin around the image, adjust x- and y-position
4006       by that margin.  */       by that margin.  */
4007    x += s->img->hmargin;    x += s->img->hmargin;
4008    y += s->img->vmargin;    y += s->img->vmargin;
4009      
4010    if (s->hl == DRAW_IMAGE_SUNKEN    if (s->hl == DRAW_IMAGE_SUNKEN
4011        || s->hl == DRAW_IMAGE_RAISED)        || s->hl == DRAW_IMAGE_RAISED)
4012      {      {
# Line 4018  x_draw_image_relief (s) Line 4018  x_draw_image_relief (s)
4018        thick = abs (s->img->relief);        thick = abs (s->img->relief);
4019        raised_p = s->img->relief > 0;        raised_p = s->img->relief > 0;
4020      }      }
4021      
4022    x0 = x - thick;    x0 = x - thick;
4023    y0 = y - thick;    y0 = y - thick;
4024    x1 = x + s->img->width + thick - 1;    x1 = x + s->img->width + thick - 1;
4025    y1 = y + s->img->height + thick - 1;    y1 = y + s->img->height + thick - 1;
4026      
4027    x_setup_relief_colors (s);    x_setup_relief_colors (s);
4028    w32_get_glyph_string_clip_rect (s, &r);    w32_get_glyph_string_clip_rect (s, &r);
4029    w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);    w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r);
# Line 4145  x_draw_glyph_string_bg_rect (s, x, y, w, Line 4145  x_draw_glyph_string_bg_rect (s, x, y, w,
4145  }  }
4146    
4147    
4148  /* Draw image glyph string S.    /* Draw image glyph string S.
4149    
4150              s->y              s->y
4151     s->x      +-------------------------     s->x      +-------------------------
# Line 4188  x_draw_image_glyph_string (s) Line 4188  x_draw_image_glyph_string (s)
4188          x = s->x + box_line_hwidth;          x = s->x + box_line_hwidth;
4189        else        else
4190          x = s->x;          x = s->x;
4191          
4192        y = s->y + box_line_vwidth;        y = s->y + box_line_vwidth;
4193  #if 0 /* TODO: image mask */  #if 0 /* TODO: image mask */
4194        if (s->img->mask)        if (s->img->mask)
# Line 4203  x_draw_image_glyph_string (s) Line 4203  x_draw_image_glyph_string (s)
4203            pixmap = XCreatePixmap (s->display, s->window,            pixmap = XCreatePixmap (s->display, s->window,
4204                                    s->background_width,                                    s->background_width,
4205                                    s->height, depth);                                    s->height, depth);
4206              
4207            /* Don't clip in the following because we're working on the            /* Don't clip in the following because we're working on the
4208               pixmap.  */               pixmap.  */
4209            XSetClipMask (s->display, s->gc, None);            XSetClipMask (s->display, s->gc, None);
# Line 4231  x_draw_image_glyph_string (s) Line 4231  x_draw_image_glyph_string (s)
4231        else        else
4232  #endif  #endif
4233          x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);          x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
4234          
4235        s->background_filled_p = 1;        s->background_filled_p = 1;
4236      }      }
4237    
# Line 4334  x_draw_stretch_glyph_string (s) Line 4334  x_draw_stretch_glyph_string (s)
4334    else if (!s->background_filled_p)    else if (!s->background_filled_p)
4335      x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,      x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width,
4336                                   s->height);                                   s->height);
4337      
4338    s->background_filled_p = 1;    s->background_filled_p = 1;
4339  }  }
4340    
# Line 4480  static int x_fill_composite_glyph_string Line 4480  static int x_fill_composite_glyph_string
4480    
4481    
4482  /* Fill glyph string S with composition components specified by S->cmp.  /* Fill glyph string S with composition components specified by S->cmp.
4483      
4484     FACES is an array of faces for all components of this composition.     FACES is an array of faces for all components of this composition.
4485     S->gidx is the index of the first component for S.     S->gidx is the index of the first component for S.
4486     OVERLAPS_P non-zero means S should draw the foreground only, and     OVERLAPS_P non-zero means S should draw the foreground only, and
# Line 4528  x_fill_composite_glyph_string (s, faces, Line 4528  x_fill_composite_glyph_string (s, faces,
4528    
4529    /* Adjust base line for subscript/superscript text.  */    /* Adjust base line for subscript/superscript text.  */
4530    s->ybase += s->first_glyph->voffset;    s->ybase += s->first_glyph->voffset;
4531      
4532    xassert (s->face && s->face->gc);    xassert (s->face && s->face->gc);
4533    
4534    /* This glyph string must always be drawn with 16-bit functions.  */    /* This glyph string must always be drawn with 16-bit functions.  */
# Line 4539  x_fill_composite_glyph_string (s, faces, Line 4539  x_fill_composite_glyph_string (s, faces,
4539    
4540    
4541  /* Fill glyph string S from a sequence of character glyphs.  /* Fill glyph string S from a sequence of character glyphs.
4542      
4543     FACE_ID is the face id of the string.  START is the index of the     FACE_ID is the face id of the string.  START is the index of the
4544     first glyph to consider, END is the index of the last + 1.     first glyph to consider, END is the index of the last + 1.
4545     OVERLAPS_P non-zero means S should draw the foreground only, and     OVERLAPS_P non-zero means S should draw the foreground only, and
# Line 4589  x_fill_glyph_string (s, face_id, start, Line 4589  x_fill_glyph_string (s, face_id, start,
4589    
4590    s->font = s->face->font;    s->font = s->face->font;
4591    s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id);    s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id);
4592      
4593    /* If the specified font could not be loaded, use the frame's font,    /* If the specified font could not be loaded, use the frame's font,
4594       but record the fact that we couldn't load it in       but record the fact that we couldn't load it in
4595       S->font_not_found_p so that we can draw rectangles for the       S->font_not_found_p so that we can draw rectangles for the
# Line 4602  x_fill_glyph_string (s, face_id, start, Line 4602  x_fill_glyph_string (s, face_id, start,
4602    
4603    /* Adjust base line for subscript/superscript text.  */    /* Adjust base line for subscript/superscript text.  */
4604    s->ybase += voffset;    s->ybase += voffset;
4605      
4606    xassert (s->face && s->face->gc);    xassert (s->face && s->face->gc);
4607    return glyph - s->row->glyphs[s->area];    return glyph - s->row->glyphs[s->area];
4608  }  }
# Line 4620  x_fill_image_glyph_string (s) Line 4620  x_fill_image_glyph_string (s)
4620    s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);    s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
4621    s->font = s->face->font;    s->font = s->face->font;
4622    s->width = s->first_glyph->pixel_width;    s->width = s->first_glyph->pixel_width;
4623      
4624    /* Adjust base line for subscript/superscript text.  */    /* Adjust base line for subscript/superscript text.  */
4625    s->ybase += s->first_glyph->voffset;    s->ybase += s->first_glyph->voffset;
4626  }  }
# Line 4643  x_fill_stretch_glyph_string (s, row, are Line 4643  x_fill_stretch_glyph_string (s, row, are
4643  {  {
4644    struct glyph *glyph, *last;    struct glyph *glyph, *last;
4645    int voffset, face_id;    int voffset, face_id;
4646      
4647    xassert (s->first_glyph->type == STRETCH_GLYPH);    xassert (s->first_glyph->type == STRETCH_GLYPH);
4648      
4649    glyph = s->row->glyphs[s->area] + start;    glyph = s->row->glyphs[s->area] + start;
4650    last = s->row->glyphs[s->area] + end;    last = s->row->glyphs[s->area] + end;
4651    face_id = glyph->face_id;    face_id = glyph->face_id;
# Line 4662  x_fill_stretch_glyph_string (s, row, are Line 4662  x_fill_stretch_glyph_string (s, row, are
4662          && glyph->face_id == face_id);          && glyph->face_id == face_id);
4663         ++glyph)         ++glyph)
4664      s->width += glyph->pixel_width;      s->width += glyph->pixel_width;
4665      
4666    /* Adjust base line for subscript/superscript text.  */    /* Adjust base line for subscript/superscript text.  */
4667    s->ybase += voffset;    s->ybase += voffset;
4668    
# Line 4678  x_fill_stretch_glyph_string (s, row, are Line 4678  x_fill_stretch_glyph_string (s, row, are
4678     and area within the row from which S is constructed.  START is the     and area within the row from which S is constructed.  START is the
4679     index of the first glyph structure covered by S.  HL is a     index of the first glyph structure covered by S.  HL is a
4680     face-override for drawing S.  */     face-override for drawing S.  */
4681      
4682  static void  static void
4683  w32_init_glyph_string (s, hdc, char2b, w, row, area, start, hl)  w32_init_glyph_string (s, hdc, char2b, w, row, area, start, hl)
4684       struct glyph_string *s;       struct glyph_string *s;
# Line 4706  w32_init_glyph_string (s, hdc, char2b, w Line 4706  w32_init_glyph_string (s, hdc, char2b, w
4706    /* Display the internal border below the tool-bar window.  */    /* Display the internal border below the tool-bar window.  */
4707    if (s->w == XWINDOW (s->f->tool_bar_window))    if (s->w == XWINDOW (s->f->tool_bar_window))
4708      s->y -= s->f->output_data.w32->internal_border_width;      s->y -= s->f->output_data.w32->internal_border_width;
4709      
4710    s->ybase = s->y + row->ascent;    s->ybase = s->y + row->ascent;
4711  }  }
4712    
# Line 4724  x_set_glyph_string_background_width (s, Line 4724  x_set_glyph_string_background_width (s,
4724    /* If the face of this glyph string has to be drawn to the end of    /* If the face of this glyph string has to be drawn to the end of
4725       the drawing area, set S->extends_to_end_of_line_p.  */       the drawing area, set S->extends_to_end_of_line_p.  */
4726    struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID);    struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID);
4727      
4728    if (start == s->row->used[s->area]    if (start == s->row->used[s->area]
4729        && s->area == TEXT_AREA        && s->area == TEXT_AREA
4730        && ((s->hl == DRAW_NORMAL_TEXT        && ((s->hl == DRAW_NORMAL_TEXT
# Line 4736  x_set_glyph_string_background_width (s, Line 4736  x_set_glyph_string_background_width (s,
4736            || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN)            || ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN)
4737                && s->row->fill_line_p)))                && s->row->fill_line_p)))
4738      s->extends_to_end_of_line_p = 1;      s->extends_to_end_of_line_p = 1;
4739      
4740    /* If S extends its face to the end of the line, set its    /* If S extends its face to the end of the line, set its
4741       background_width to the distance to the right edge of the drawing       background_width to the distance to the right edge of the drawing
4742       area.  */       area.  */
# Line 4815  x_set_glyph_string_background_width (s, Line 4815  x_set_glyph_string_background_width (s,
4815                                            OVERLAPS_P);                     \                                            OVERLAPS_P);                     \
4816         }                                                                   \         }                                                                   \
4817       while (0)       while (0)
4818        
4819    
4820  /* Add a glyph string for a composite sequence to the list of strings  /* Add a glyph string for a composite sequence to the list of strings
4821     between HEAD and TAIL.  START is the index of the first glyph in     between HEAD and TAIL.  START is the index of the first glyph in
# Line 4940  x_set_glyph_string_background_width (s, Line 4940  x_set_glyph_string_background_width (s,
4940     and clip to the physical height of ROW.     and clip to the physical height of ROW.
4941    
4942     Value is the x-position reached, relative to AREA of W.  */     Value is the x-position reached, relative to AREA of W.  */
4943        
4944  static int  static int
4945  x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)  x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
4946       struct window *w;       struct window *w;
# Line 5023  x_draw_glyphs (w, x, row, area, start, e Line 5023  x_draw_glyphs (w, x, row, area, start, e
5023        /* Prepend glyph strings for glyphs in front of the first glyph        /* Prepend glyph strings for glyphs in front of the first glyph
5024           string that are overwritten because of the first glyph           string that are overwritten because of the first glyph
5025           string's left overhang.  The background of all strings           string's left overhang.  The background of all strings
5026           prepended must be drawn because the first glyph string           prepended must be drawn because the first glyph string
5027           draws over it.  */           draws over it.  */
5028        i = x_left_overwritten (head);        i = x_left_overwritten (head);
5029        if (i >= 0)        if (i >= 0)
# Line 5101  x_draw_glyphs (w, x, row, area, start, e Line 5101  x_draw_glyphs (w, x, row, area, start, e
5101      {      {
5102        int x0 = head ? head->x : x;        int x0 = head ? head->x : x;
5103        int x1 = tail ? tail->x + tail->background_width : x;        int x1 = tail ? tail->x + tail->background_width : x;
5104          
5105        x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);        x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);
5106        x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);        x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);
5107          
5108        if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)        if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)
5109          {          {
5110            int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);            int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);
# Line 5141  x_fix_overlapping_area (w, row, area) Line 5141  x_fix_overlapping_area (w, row, area)
5141       enum glyph_row_area area;       enum glyph_row_area area;
5142  {  {
5143    int i, x;    int i, x;
5144      
5145    BLOCK_INPUT;    BLOCK_INPUT;
5146      
5147    if (area == LEFT_MARGIN_AREA)    if (area == LEFT_MARGIN_AREA)
5148      x = 0;      x = 0;
5149    else if (area == TEXT_AREA)    else if (area == TEXT_AREA)
# Line 5176  x_fix_overlapping_area (w, row, area) Line 5176  x_fix_overlapping_area (w, row, area)
5176            ++i;            ++i;
5177          }          }
5178      }      }
5179      
5180    UNBLOCK_INPUT;    UNBLOCK_INPUT;
5181  }  }
5182    
# Line 5196  x_write_glyphs (start, len) Line 5196  x_write_glyphs (start, len)
5196    
5197    xassert (updated_window && updated_row);    xassert (updated_window && updated_row);
5198    BLOCK_INPUT;    BLOCK_INPUT;
5199      
5200    /* Write glyphs.  */    /* Write glyphs.  */
5201    
5202    hpos = start - updated_row->glyphs[updated_area];    hpos = start - updated_row->glyphs[updated_area];
# Line 5208  x_write_glyphs (start, len) Line 5208  x_write_glyphs (start, len)
5208                       0);                       0);
5209    
5210    UNBLOCK_INPUT;    UNBLOCK_INPUT;
5211      
5212    /* Advance the output cursor.  */    /* Advance the output cursor.  */
5213    output_cursor.hpos += len;    output_cursor.hpos += len;
5214    output_cursor.x = x;    output_cursor.x = x;
# Line 5261  x_insert_glyphs (start, len) Line 5261  x_insert_glyphs (start, len)
5261    hpos = start - row->glyphs[updated_area];    hpos = start - row->glyphs[updated_area];
5262    x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len,    x_draw_glyphs (w, output_cursor.x, row, updated_area, hpos, hpos + len,
5263                   DRAW_NORMAL_TEXT, 0);                   DRAW_NORMAL_TEXT, 0);
5264      
5265    /* Advance the output cursor.  */    /* Advance the output cursor.  */
5266    output_cursor.hpos += len;    output_cursor.hpos += len;
5267    output_cursor.x += shift_by_width;    output_cursor.x += shift_by_width;
# Line 5307  x_clear_end_of_line (to_x) Line 5307  x_clear_end_of_line (to_x)
5307    struct window *w = updated_window;    struct window *w = updated_window;
5308    int max_x, min_y, max_y;    int max_x, min_y, max_y;
5309    int from_x, from_y, to_y;    int from_x, from_y, to_y;
5310      
5311    xassert (updated_window && updated_row);    xassert (updated_window && updated_row);
5312    f = XFRAME (w->frame);    f = XFRAME (w->frame);
5313      
5314    if (updated_row->full_width_p)    if (updated_row->full_width_p)
5315      {      {
5316        max_x = XFASTINT (w->width) * CANON_X_UNIT (f);        max_x = XFASTINT (w->width) * CANON_X_UNIT (f);
# Line 5332  x_clear_end_of_line (to_x) Line 5332  x_clear_end_of_line (to_x)
5332      to_x = min (to_x, max_x);      to_x = min (to_x, max_x);
5333    
5334    to_y = min (max_y, output_cursor.y + updated_row->height);    to_y = min (max_y, output_cursor.y + updated_row->height);
5335      
5336    /* Notice if the cursor will be cleared by this operation.  */    /* Notice if the cursor will be cleared by this operation.  */
5337    if (!updated_row->full_width_p)    if (!updated_row->full_width_p)
5338      notice_overwritten_cursor (w, output_cursor.x, -1);      notice_overwritten_cursor (w, output_cursor.x, -1);
5339    
5340    from_x = output_cursor.x;    from_x = output_cursor.x;
5341        
5342    /* Translate to frame coordinates.  */    /* Translate to frame coordinates.  */
5343    if (updated_row->full_width_p)    if (updated_row->full_width_p)
5344      {      {
# Line 5350  x_clear_end_of_line (to_x) Line 5350  x_clear_end_of_line (to_x)
5350        from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x);        from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x);
5351        to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x);        to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x);
5352      }      }
5353      
5354    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
5355    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
5356    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
5357      
5358    /* Prevent inadvertently clearing to end of the X window.  */    /* Prevent inadvertently clearing to end of the X window.  */
5359    if (to_x > from_x && to_y > from_y)    if (to_x > from_x && to_y > from_y)
5360      {      {
# Line 5421  w32_ring_bell (void) Line 5421  w32_ring_bell (void)
5421        int i;        int i;
5422        HWND hwnd = FRAME_W32_WINDOW (SELECTED_FRAME ());        HWND hwnd = FRAME_W32_WINDOW (SELECTED_FRAME ());
5423    
5424        for (i = 0; i < 5; i++)        for (i = 0; i < 5; i++)
5425          {          {
5426            FlashWindow (hwnd, TRUE);            FlashWindow (hwnd, TRUE);
5427            Sleep (10);            Sleep (10);
# Line 5519  x_scroll_run (w, run) Line 5519  x_scroll_run (w, run)
5519      }      }
5520    
5521    BLOCK_INPUT;    BLOCK_INPUT;
5522      
5523    /* Cursor off.  Will be switched on again in x_update_window_end.  */    /* Cursor off.  Will be switched on again in x_update_window_end.  */
5524    updated_window = w;    updated_window = w;
5525    x_clear_cursor (w);    x_clear_cursor (w);
# Line 5571  x_scroll_run (w, run) Line 5571  x_scroll_run (w, run)
5571  /***********************************************************************  /***********************************************************************
5572                             Exposure Events                             Exposure Events
5573   ***********************************************************************/   ***********************************************************************/
5574                                                                            
5575  /* Redisplay an exposed area of frame F.  X and Y are the upper-left  /* Redisplay an exposed area of frame F.  X and Y are the upper-left
5576     corner of the exposed rectangle.  W and H are width and height of     corner of the exposed rectangle.  W and H are width and height of
5577     the exposed area.  All are pixel values.  W or H zero means redraw     the exposed area.  All are pixel values.  W or H zero means redraw
# Line 5698  expose_area (w, row, r, area) Line 5698  expose_area (w, row, r, area)
5698            x += first->pixel_width;            x += first->pixel_width;
5699            ++first;            ++first;
5700          }          }
5701      
5702        /* Find the last one.  */        /* Find the last one.  */
5703        last = first;        last = first;
5704        first_x = x;        first_x = x;
# Line 5730  expose_line (w, row, r) Line 5730  expose_line (w, row, r)
5730       RECT *r;       RECT *r;
5731  {  {
5732    xassert (row->enabled_p);    xassert (row->enabled_p);
5733      
5734    if (row->mode_line_p || w->pseudo_window_p)    if (row->mode_line_p || w->pseudo_window_p)
5735      x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA],      x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA],
5736                     row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT,                     row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT,
# Line 6102  glyph_to_pixel_coords (w, hpos, vpos, fr Line 6102  glyph_to_pixel_coords (w, hpos, vpos, fr
6102    return success_p;    return success_p;
6103  }  }
6104    
6105  BOOL  BOOL
6106  parse_button (message, pbutton, pup)  parse_button (message, pbutton, pup)
6107       int message;       int message;
6108       int * pbutton;       int * pbutton;
# Line 6110  parse_button (message, pbutton, pup) Line 6110  parse_button (message, pbutton, pup)
6110  {  {
6111    int button = 0;    int button = 0;
6112    int up = 0;    int up = 0;
6113      
6114    switch (message)    switch (message)
6115      {      {
6116      case WM_LBUTTONDOWN:      case WM_LBUTTONDOWN:
# Line 6152  parse_button (message, pbutton, pup) Line 6152  parse_button (message, pbutton, pup)
6152      default:      default:
6153        return (FALSE);        return (FALSE);
6154      }      }
6155      
6156    if (pup) *pup = up;    if (pup) *pup = up;
6157    if (pbutton) *pbutton = button;    if (pbutton) *pbutton = button;
6158      
6159    return (TRUE);    return (TRUE);
6160  }  }
6161    
# Line 6400  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a Line 6400  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a
6400            else if (!buffer_only_p || BUFFERP (glyph->object))            else if (!buffer_only_p || BUFFERP (glyph->object))
6401              break;              break;
6402          }          }
6403          
6404        x0 += glyph->pixel_width;        x0 += glyph->pixel_width;
6405        ++glyph;        ++glyph;
6406      }      }
# Line 6463  note_mode_line_highlight (w, x, mode_lin Line 6463  note_mode_line_highlight (w, x, mode_lin
6463        struct glyph *glyph, *end;        struct glyph *glyph, *end;
6464        Lisp_Object help, map;        Lisp_Object help, map;
6465        int x0;        int x0;
6466          
6467        /* Find the glyph under X.  */        /* Find the glyph under X.  */
6468        glyph = row->glyphs[TEXT_AREA];        glyph = row->glyphs[TEXT_AREA];
6469        end = glyph + row->used[TEXT_AREA];        end = glyph + row->used[TEXT_AREA];
6470        x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f)        x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f)
6471                + FRAME_X_LEFT_FLAGS_AREA_WIDTH (f));                + FRAME_X_LEFT_FLAGS_AREA_WIDTH (f));
6472          
6473        while (glyph < end        while (glyph < end
6474               && x >= x0 + glyph->pixel_width)               && x >= x0 + glyph->pixel_width)
6475          {          {
# Line 6823  note_mouse_highlight (f, x, y) Line 6823  note_mouse_highlight (f, x, y)
6823                   the text ``under'' it might have.  */                   the text ``under'' it might have.  */
6824                struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);                struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
6825                int start = MATRIX_ROW_START_CHARPOS (r);                int start = MATRIX_ROW_START_CHARPOS (r);
6826                  
6827                pos = string_buffer_position (w, object, start);                pos = string_buffer_position (w, object, start);
6828                if (pos > 0)                if (pos > 0)
6829                  mouse_face = get_char_property_and_overlay (make_number (pos),                  mouse_face = get_char_property_and_overlay (make_number (pos),
# Line 6847  note_mouse_highlight (f, x, y) Line 6847  note_mouse_highlight (f, x, y)
6847                                        &dpyinfo->mouse_face_beg_x,                                        &dpyinfo->mouse_face_beg_x,
6848                                        &dpyinfo->mouse_face_beg_y,                                        &dpyinfo->mouse_face_beg_y,
6849                                        object);                                        object);
6850                          
6851                    dpyinfo->mouse_face_past_end                    dpyinfo->mouse_face_past_end
6852                      = !fast_find_position (w, XFASTINT (after),                      = !fast_find_position (w, XFASTINT (after),
6853                                             &dpyinfo->mouse_face_end_col,                                             &dpyinfo->mouse_face_end_col,
# Line 6877  note_mouse_highlight (f, x, y) Line 6877  note_mouse_highlight (f, x, y)
6877          for (i = noverlays - 1; i >= 0 && NILP (help); --i)          for (i = noverlays - 1; i >= 0 && NILP (help); --i)
6878            {            {
6879              overlay = overlay_vec[i];              overlay = overlay_vec[i];
6880              help = Foverlay_get (overlay, Qhelp_echo);              help = Foverlay_get (overlay, Qhelp_echo);
6881            }            }
6882    
6883          if (!NILP (help))          if (!NILP (help))
# Line 6934  note_mouse_highlight (f, x, y) Line 6934  note_mouse_highlight (f, x, y)
6934                }                }
6935            }            }
6936        }        }
6937            
6938        BEGV = obegv;        BEGV = obegv;
6939        ZV = ozv;        ZV = ozv;
6940        current_buffer = obuf;        current_buffer = obuf;
# Line 7007  x_tool_bar_item (f, x, y, glyph, hpos, v Line 7007  x_tool_bar_item (f, x, y, glyph, hpos, v
7007            || *hpos < dpyinfo->mouse_face_end_col            || *hpos < dpyinfo->mouse_face_end_col
7008            || dpyinfo->mouse_face_past_end))            || dpyinfo->mouse_face_past_end))
7009      return 0;      return 0;
7010      
7011    return 1;    return 1;
7012  }  }
7013    
# Line 7028  w32_handle_tool_bar_click (f, button_eve Line 7028  w32_handle_tool_bar_click (f, button_eve
7028    Lisp_Object enabled_p;    Lisp_Object enabled_p;
7029    int x = XFASTINT (button_event->x);    int x = XFASTINT (button_event->x);
7030    int y = XFASTINT (button_event->y);    int y = XFASTINT (button_event->y);
7031      
7032    /* If not on the highlighted tool-bar item, return.  */    /* If not on the highlighted tool-bar item, return.  */
7033    frame_to_window_pixel_xy (w, &x, &y);    frame_to_window_pixel_xy (w, &x, &y);
7034    if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0)    if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0)
# Line 7038  w32_handle_tool_bar_click (f, button_eve Line 7038  w32_handle_tool_bar_click (f, button_eve
7038    enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);    enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
7039    if (NILP (enabled_p))    if (NILP (enabled_p))
7040      return;      return;
7041      
7042    if (button_event->kind == mouse_click)    if (button_event->kind == mouse_click)
7043      {      {
7044        /* Show item in pressed state.  */        /* Show item in pressed state.  */
# Line 7114  note_tool_bar_highlight (f, x, y) Line 7114  note_tool_bar_highlight (f, x, y)
7114      goto set_help_echo;      goto set_help_echo;
7115    
7116    clear_mouse_face (dpyinfo);    clear_mouse_face (dpyinfo);
7117      
7118    /* Mouse is down, but on different tool-bar item?  */    /* Mouse is down, but on different tool-bar item?  */
7119    mouse_down_p = (dpyinfo->grabbed    mouse_down_p = (dpyinfo->grabbed
7120                    && f == last_mouse_frame                    && f == last_mouse_frame
# Line 7125  note_tool_bar_highlight (f, x, y) Line 7125  note_tool_bar_highlight (f, x, y)
7125    
7126    dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;    dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT;
7127    draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;    draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
7128      
7129    /* If tool-bar item is not enabled, don't highlight it.  */    /* If tool-bar item is not enabled, don't highlight it.  */
7130    enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);    enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
7131    if (!NILP (enabled_p))    if (!NILP (enabled_p))
# Line 7135  note_tool_bar_highlight (f, x, y) Line 7135  note_tool_bar_highlight (f, x, y)
7135        row = MATRIX_ROW (w->current_matrix, vpos);        row = MATRIX_ROW (w->current_matrix, vpos);
7136        for (i = x = 0; i < hpos; ++i)        for (i = x = 0; i < hpos; ++i)
7137          x += row->glyphs[TEXT_AREA][i].pixel_width;          x += row->glyphs[TEXT_AREA][i].pixel_width;
7138          
7139        /* Record this as the current active region.  */        /* Record this as the current active region.  */
7140        dpyinfo->mouse_face_beg_col = hpos;        dpyinfo->mouse_face_beg_col = hpos;
7141        dpyinfo->mouse_face_beg_row = vpos;        dpyinfo->mouse_face_beg_row = vpos;
7142        dpyinfo->mouse_face_beg_x = x;        dpyinfo->mouse_face_beg_x = x;
7143        dpyinfo->mouse_face_beg_y = row->y;        dpyinfo->mouse_face_beg_y = row->y;
7144        dpyinfo->mouse_face_past_end = 0;        dpyinfo->mouse_face_past_end = 0;
7145          
7146        dpyinfo->mouse_face_end_col = hpos + 1;        dpyinfo->mouse_face_end_col = hpos + 1;
7147        dpyinfo->mouse_face_end_row = vpos;        dpyinfo->mouse_face_end_row = vpos;
7148        dpyinfo->mouse_face_end_x = x + glyph->pixel_width;        dpyinfo->mouse_face_end_x = x + glyph->pixel_width;
7149        dpyinfo->mouse_face_end_y = row->y;        dpyinfo->mouse_face_end_y = row->y;
7150        dpyinfo->mouse_face_window = window;        dpyinfo->mouse_face_window = window;
7151        dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;        dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID;
7152          
7153        /* Display it as active.  */        /* Display it as active.  */
7154        show_mouse_face (dpyinfo, draw);        show_mouse_face (dpyinfo, draw);
7155        dpyinfo->mouse_face_image_state = draw;        dpyinfo->mouse_face_image_state = draw;
7156      }      }
7157          
7158   set_help_echo:   set_help_echo:
7159      
7160    /* Set help_echo to a help string.to display for this tool-bar item.    /* Set help_echo to a help string.to display for this tool-bar item.
7161       w32_read_socket does the rest.  */       w32_read_socket does the rest.  */
7162    help_echo_object = help_echo_window = Qnil;    help_echo_object = help_echo_window = Qnil;
# Line 7346  fast_find_string_pos (w, pos, object, hp Line 7346  fast_find_string_pos (w, pos, object, hp
7346            *x += best_glyph->pixel_width;            *x += best_glyph->pixel_width;
7347            ++*hpos;            ++*hpos;
7348          }          }
7349          
7350        *y = best_row->y;        *y = best_row->y;
7351        *vpos = best_row - w->current_matrix->rows;        *vpos = best_row - w->current_matrix->rows;
7352      }      }
# Line 7365  show_mouse_face (dpyinfo, draw) Line 7365  show_mouse_face (dpyinfo, draw)
7365  {  {
7366    struct window *w = XWINDOW (dpyinfo->mouse_face_window);    struct window *w = XWINDOW (dpyinfo->mouse_face_window);
7367    struct frame *f = XFRAME (WINDOW_FRAME (w));    struct frame *f = XFRAME (WINDOW_FRAME (w));
7368      
7369    if (/* If window is in the process of being destroyed, don't bother    if (/* If window is in the process of being destroyed, don't bother
7370           to do anything.  */           to do anything.  */
7371        w->current_matrix != NULL        w->current_matrix != NULL
# Line 7378  show_mouse_face (dpyinfo, draw) Line 7378  show_mouse_face (dpyinfo, draw)
7378    
7379        first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);        first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row);
7380        last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);        last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row);
7381          
7382        for (row = first; row <= last && row->enabled_p; ++row)        for (row = first; row <= last && row->enabled_p; ++row)
7383          {          {
7384            int start_hpos, end_hpos, start_x;            int start_hpos, end_hpos, start_x;
# Line 7402  show_mouse_face (dpyinfo, draw) Line 7402  show_mouse_face (dpyinfo, draw)
7402    
7403            if (end_hpos > start_hpos)            if (end_hpos > start_hpos)
7404              {              {
7405                x_draw_glyphs (w, start_x, row, TEXT_AREA,                x_draw_glyphs (w, start_x, row, TEXT_AREA,
7406                               start_hpos, end_hpos, draw, 0);                               start_hpos, end_hpos, draw, 0);
7407    
7408                row->mouse_face_p                row->mouse_face_p
# Line 7644  w32_mouse_position (fp, insist, bar_wind Line 7644  w32_mouse_position (fp, insist, bar_wind
7644          XFRAME (frame)->mouse_moved = 0;          XFRAME (frame)->mouse_moved = 0;
7645    
7646        last_mouse_scroll_bar = Qnil;        last_mouse_scroll_bar = Qnil;
7647          
7648        GetCursorPos (&pt);        GetCursorPos (&pt);
7649    
7650        /* Now we have a position on the root; find the innermost window        /* Now we have a position on the root; find the innermost window
# Line 7821  w32_set_scroll_bar_thumb (bar, portion, Line 7821  w32_set_scroll_bar_thumb (bar, portion,
7821  /************************************************************************  /************************************************************************
7822                           Scroll bars, general                           Scroll bars, general
7823   ************************************************************************/   ************************************************************************/
7824                                                                            
7825  HWND  HWND
7826  my_create_scrollbar (f, bar)  my_create_scrollbar (f, bar)
7827       struct frame * f;       struct frame * f;
7828       struct scroll_bar * bar;       struct scroll_bar * bar;
7829  {  {
7830    return (HWND) SendMessage (FRAME_W32_WINDOW (f),    return (HWND) SendMessage (FRAME_W32_WINDOW (f),
7831                               WM_EMACS_CREATESCROLLBAR, (WPARAM) f,                               WM_EMACS_CREATESCROLLBAR, (WPARAM) f,
7832                               (LPARAM) bar);                               (LPARAM) bar);
7833  }  }
7834    
# Line 7868  my_set_focus (f, hwnd) Line 7868  my_set_focus (f, hwnd)
7868       struct frame * f;       struct frame * f;
7869       HWND hwnd;       HWND hwnd;
7870  {  {
7871    SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,    SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
7872                 (WPARAM) hwnd, 0);                 (WPARAM) hwnd, 0);
7873  }  }
7874    
# Line 7884  my_destroy_window (f, hwnd) Line 7884  my_destroy_window (f, hwnd)
7884       struct frame * f;       struct frame * f;
7885       HWND hwnd;       HWND hwnd;
7886  {  {
7887    SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,    SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
7888                 (WPARAM) hwnd, 0);                 (WPARAM) hwnd, 0);
7889  }  }
7890    
# Line 8011  w32_set_vertical_scroll_bar (w, portion, Line 8011  w32_set_vertical_scroll_bar (w, portion,
8011    
8012    /* Compute the left edge of the scroll bar.  */    /* Compute the left edge of the scroll bar.  */
8013    if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))    if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
8014      sb_left = left + width - sb_width - (width - sb_width) / 2;      sb_left = left + width - sb_width - (width - sb_width) / 2;
8015    else    else
8016      sb_left = left + (width - sb_width) / 2;      sb_left = left + (width - sb_width) / 2;
8017    
# Line 8032  w32_set_vertical_scroll_bar (w, portion, Line 8032  w32_set_vertical_scroll_bar (w, portion,
8032      }      }
8033    else    else
8034      {      {
8035        /* It may just need to be moved and resized.  */              /* It may just need to be moved and resized.  */
8036        HWND hwnd;        HWND hwnd;
8037    
8038        bar = XSCROLL_BAR (w->vertical_scroll_bar);        bar = XSCROLL_BAR (w->vertical_scroll_bar);
# Line 8255  w32_scroll_bar_handle_click (bar, msg, e Line 8255  w32_scroll_bar_handle_click (bar, msg, e
8255    
8256    
8257      last_mouse_scroll_bar_pos = msg->msg.wParam;      last_mouse_scroll_bar_pos = msg->msg.wParam;
8258    
8259      switch (LOWORD (msg->msg.wParam))      switch (LOWORD (msg->msg.wParam))
8260        {        {
8261        case SB_LINEDOWN:        case SB_LINEDOWN:
# Line 8461  static short temp_buffer[100]; Line 8461  static short temp_buffer[100];
8461     We return the number of characters stored into the buffer,     We return the number of characters stored into the buffer,
8462     thus pretending to be `read'.     thus pretending to be `read'.
8463    
8464     EXPECTED is nonzero if the caller knows input is available.       EXPECTED is nonzero if the caller knows input is available.
8465    
8466     Some of these messages are reposted back to the message queue since the     Some of these messages are reposted back to the message queue since the
8467     system calls the windows proc directly in a context where we cannot return     system calls the windows proc directly in a context where we cannot return
8468     the data nor can we guarantee the state we are in.  So if we dispatch  them     the data nor can we guarantee the state we are in.  So if we dispatch  them
8469     we will get into an infinite loop.  To prevent this from ever happening we     we will get into an infinite loop.  To prevent this from ever happening we
8470     will set a variable to indicate we are in the read_socket call and indicate     will set a variable to indicate we are in the read_socket call and indicate
8471     which message we are processing since the windows proc gets called     which message we are processing since the windows proc gets called
8472     recursively with different messages by the system.     recursively with different messages by the system.
8473  */  */
8474    
# Line 8509  w32_read_socket (sd, bufp, numchars, exp Line 8509  w32_read_socket (sd, bufp, numchars, exp
8509          case WM_PAINT:          case WM_PAINT:
8510              f = x_window_to_frame (dpyinfo, msg.msg.hwnd);              f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8511    
8512              if (f)              if (f)
8513                {                {
8514                  if (msg.rect.right == msg.rect.left ||                  if (msg.rect.right == msg.rect.left ||
8515                      msg.rect.bottom == msg.rect.top)                      msg.rect.bottom == msg.rect.top)
# Line 8569  w32_read_socket (sd, bufp, numchars, exp Line 8569  w32_read_socket (sd, bufp, numchars, exp
8569              {              {
8570                if (numchars == 0)                if (numchars == 0)
8571                  abort ();                  abort ();
8572              
8573                bufp->kind = language_change_event;                bufp->kind = language_change_event;
8574                XSETFRAME (bufp->frame_or_window, f);                XSETFRAME (bufp->frame_or_window, f);
8575                bufp->arg = Qnil;                bufp->arg = Qnil;
# Line 8584  w32_read_socket (sd, bufp, numchars, exp Line 8584  w32_read_socket (sd, bufp, numchars, exp
8584          case WM_KEYDOWN:          case WM_KEYDOWN:
8585          case WM_SYSKEYDOWN:          case WM_SYSKEYDOWN:
8586            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8587              
8588            if (f && !f->iconified)            if (f && !f->iconified)
8589              {              {
8590                if (temp_index == sizeof temp_buffer / sizeof (short))                if (temp_index == sizeof temp_buffer / sizeof (short))
# Line 8605  w32_read_socket (sd, bufp, numchars, exp Line 8605  w32_read_socket (sd, bufp, numchars, exp
8605          case WM_SYSCHAR:          case WM_SYSCHAR:
8606          case WM_CHAR:          case WM_CHAR:
8607            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8608              
8609            if (f && !f->iconified)            if (f && !f->iconified)
8610              {              {
8611                if (temp_index == sizeof temp_buffer / sizeof (short))                if (temp_index == sizeof temp_buffer / sizeof (short))
# Line 8633  w32_read_socket (sd, bufp, numchars, exp Line 8633  w32_read_socket (sd, bufp, numchars, exp
8633              f = last_mouse_frame;              f = last_mouse_frame;
8634            else            else
8635              f = x_window_to_frame (dpyinfo, msg.msg.hwnd);              f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8636              
8637            if (f)            if (f)
8638              note_mouse_movement (f, &msg.msg);              note_mouse_movement (f, &msg.msg);
8639            else            else
# Line 8678  w32_read_socket (sd, bufp, numchars, exp Line 8678  w32_read_socket (sd, bufp, numchars, exp
8678              int up;              int up;
8679    
8680              emacs_event.kind = no_event;              emacs_event.kind = no_event;
8681                
8682              if (dpyinfo->grabbed && last_mouse_frame              if (dpyinfo->grabbed && last_mouse_frame
8683                  && FRAME_LIVE_P (last_mouse_frame))                  && FRAME_LIVE_P (last_mouse_frame))
8684                f = last_mouse_frame;                f = last_mouse_frame;
8685              else              else
8686                f = x_window_to_frame (dpyinfo, msg.msg.hwnd);                f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8687                
8688              if (f)              if (f)
8689                {                {
8690                  construct_mouse_click (&emacs_event, &msg, f);                  construct_mouse_click (&emacs_event, &msg, f);
8691                    
8692                  /* Is this in the tool-bar?  */                  /* Is this in the tool-bar?  */
8693                  if (WINDOWP (f->tool_bar_window)                  if (WINDOWP (f->tool_bar_window)
8694                      && XFASTINT (XWINDOW (f->tool_bar_window)->height))                      && XFASTINT (XWINDOW (f->tool_bar_window)->height))
# Line 8719  w32_read_socket (sd, bufp, numchars, exp Line 8719  w32_read_socket (sd, bufp, numchars, exp
8719                        numchars--;                        numchars--;
8720                      }                      }
8721                }                }
8722                
8723              parse_button (msg.msg.message, &button, &up);              parse_button (msg.msg.message, &button, &up);
8724                
8725              if (up)              if (up)
8726                {                {
8727                  dpyinfo->grabbed &= ~ (1 << button);                  dpyinfo->grabbed &= ~ (1 << button);
# Line 8742  w32_read_socket (sd, bufp, numchars, exp Line 8742  w32_read_socket (sd, bufp, numchars, exp
8742                }                }
8743              break;              break;
8744            }            }
8745              
8746        case WM_MOUSEWHEEL:        case WM_MOUSEWHEEL:
8747            if (dpyinfo->grabbed && last_mouse_frame            if (dpyinfo->grabbed && last_mouse_frame
8748                && FRAME_LIVE_P (last_mouse_frame))                && FRAME_LIVE_P (last_mouse_frame))
# Line 8752  w32_read_socket (sd, bufp, numchars, exp Line 8752  w32_read_socket (sd, bufp, numchars, exp
8752    
8753            if (f)            if (f)
8754              {              {
8755                if ((!dpyinfo->w32_focus_frame                if ((!dpyinfo->w32_focus_frame
8756                     || f == dpyinfo->w32_focus_frame)                     || f == dpyinfo->w32_focus_frame)
8757                    && (numchars >= 1))                    && (numchars >= 1))
8758                  {                  {
# Line 8790  w32_read_socket (sd, bufp, numchars, exp Line 8790  w32_read_socket (sd, bufp, numchars, exp
8790            {            {
8791              struct scroll_bar *bar =              struct scroll_bar *bar =
8792                x_window_to_scroll_bar ((HWND)msg.msg.lParam);                x_window_to_scroll_bar ((HWND)msg.msg.lParam);
8793                  
8794              if (bar && numchars >= 1)              if (bar && numchars >= 1)
8795                {                {
8796                  if (w32_scroll_bar_handle_click (bar, &msg, bufp))                  if (w32_scroll_bar_handle_click (bar, &msg, bufp))
# Line 8802  w32_read_socket (sd, bufp, numchars, exp Line 8802  w32_read_socket (sd, bufp, numchars, exp
8802                }                }
8803              break;              break;
8804            }            }
8805              
8806          case WM_WINDOWPOSCHANGED:          case WM_WINDOWPOSCHANGED:
8807          case WM_ACTIVATE:          case WM_ACTIVATE:
8808          case WM_ACTIVATEAPP:          case WM_ACTIVATEAPP:
# Line 8811  w32_read_socket (sd, bufp, numchars, exp Line 8811  w32_read_socket (sd, bufp, numchars, exp
8811    
8812          case WM_MOVE:          case WM_MOVE:
8813            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8814              
8815            if (f && !f->async_iconified)            if (f && !f->async_iconified)
8816              {              {
8817                int x, y;                int x, y;
# Line 8844  w32_read_socket (sd, bufp, numchars, exp Line 8844  w32_read_socket (sd, bufp, numchars, exp
8844    
8845          case WM_SIZE:          case WM_SIZE:
8846            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8847              
8848            /* Inform lisp of whether frame has been iconified etc. */            /* Inform lisp of whether frame has been iconified etc. */
8849            if (f)            if (f)
8850              {              {
# Line 8853  w32_read_socket (sd, bufp, numchars, exp Line 8853  w32_read_socket (sd, bufp, numchars, exp
8853                  case SIZE_MINIMIZED:                  case SIZE_MINIMIZED:
8854                    f->async_visible = 0;                    f->async_visible = 0;
8855                    f->async_iconified = 1;                    f->async_iconified = 1;
8856                      
8857                    bufp->kind = iconify_event;                    bufp->kind = iconify_event;
8858                    XSETFRAME (bufp->frame_or_window, f);                    XSETFRAME (bufp->frame_or_window, f);
8859                    bufp->arg = Qnil;                    bufp->arg = Qnil;
# Line 8866  w32_read_socket (sd, bufp, numchars, exp Line 8866  w32_read_socket (sd, bufp, numchars, exp
8866                  case SIZE_RESTORED:                  case SIZE_RESTORED:
8867                    f->async_visible = 1;                    f->async_visible = 1;
8868                    f->async_iconified = 0;                    f->async_iconified = 0;
8869                      
8870                    /* wait_reading_process_input will notice this and update                    /* wait_reading_process_input will notice this and update
8871                       the frame's display structures.  */                       the frame's display structures.  */
8872                    SET_FRAME_GARBAGED (f);                    SET_FRAME_GARBAGED (f);
8873                      
8874                    if (f->iconified)                    if (f->iconified)
8875                      {                      {
8876                        int x, y;                        int x, y;
# Line 8908  w32_read_socket (sd, bufp, numchars, exp Line 8908  w32_read_socket (sd, bufp, numchars, exp
8908                int columns;                int columns;
8909                int width;                int width;
8910                int height;                int height;
8911                  
8912                GetClientRect (msg.msg.hwnd, &rect);                GetClientRect (msg.msg.hwnd, &rect);
8913                  
8914                height = rect.bottom - rect.top;                height = rect.bottom - rect.top;
8915                width = rect.right - rect.left;                width = rect.right - rect.left;
8916                  
8917                rows = PIXEL_TO_CHAR_HEIGHT (f, height);                rows = PIXEL_TO_CHAR_HEIGHT (f, height);
8918                columns = PIXEL_TO_CHAR_WIDTH (f, width);                columns = PIXEL_TO_CHAR_WIDTH (f, width);
8919                  
8920                /* TODO: Clip size to the screen dimensions.  */                /* TODO: Clip size to the screen dimensions.  */
8921                  
8922                /* Even if the number of character rows and columns has                /* Even if the number of character rows and columns has
8923                   not changed, the font size may have changed, so we need                   not changed, the font size may have changed, so we need
8924                   to check the pixel dimensions as well.  */                   to check the pixel dimensions as well.  */
8925                  
8926                if (columns != f->width                if (columns != f->width
8927                    || rows != f->height                    || rows != f->height
8928                    || width != f->output_data.w32->pixel_width                    || width != f->output_data.w32->pixel_width
# Line 8944  w32_read_socket (sd, bufp, numchars, exp Line 8944  w32_read_socket (sd, bufp, numchars, exp
8944            f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);
8945    
8946            dpyinfo->w32_focus_event_frame = f;            dpyinfo->w32_focus_event_frame = f;
8947              
8948            if (f)            if (f)
8949              x_new_focus_frame (dpyinfo, f);              x_new_focus_frame (dpyinfo, f);
8950    
# Line 8996  w32_read_socket (sd, bufp, numchars, exp Line 8996  w32_read_socket (sd, bufp, numchars, exp
8996    
8997          case WM_CLOSE:          case WM_CLOSE:
8998            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
8999              
9000            if (f)            if (f)
9001              {              {
9002                if (numchars == 0)                if (numchars == 0)
9003                  abort ();                  abort ();
9004                  
9005                bufp->kind = delete_window_event;                bufp->kind = delete_window_event;
9006                XSETFRAME (bufp->frame_or_window, f);                XSETFRAME (bufp->frame_or_window, f);
9007                bufp->arg = Qnil;                bufp->arg = Qnil;
# Line 9013  w32_read_socket (sd, bufp, numchars, exp Line 9013  w32_read_socket (sd, bufp, numchars, exp
9013    
9014          case WM_INITMENU:          case WM_INITMENU:
9015            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
9016              
9017            if (f)            if (f)
9018              {              {
9019                if (numchars == 0)                if (numchars == 0)
9020                  abort ();                  abort ();
9021              
9022                bufp->kind = menu_bar_activate_event;                bufp->kind = menu_bar_activate_event;
9023                XSETFRAME (bufp->frame_or_window, f);                XSETFRAME (bufp->frame_or_window, f);
9024                bufp->arg = Qnil;                bufp->arg = Qnil;
# Line 9044  w32_read_socket (sd, bufp, numchars, exp Line 9044  w32_read_socket (sd, bufp, numchars, exp
9044          case WM_DISPLAYCHANGE:          case WM_DISPLAYCHANGE:
9045            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
9046    
9047            if (f)            if (f)
9048              {              {
9049                dpyinfo->width = (short) LOWORD (msg.msg.lParam);                dpyinfo->width = (short) LOWORD (msg.msg.lParam);
9050                dpyinfo->height = (short) HIWORD (msg.msg.lParam);                dpyinfo->height = (short) HIWORD (msg.msg.lParam);
# Line 9052  w32_read_socket (sd, bufp, numchars, exp Line 9052  w32_read_socket (sd, bufp, numchars, exp
9052                DebPrint (("display change: %d %d\n", dpyinfo->width,                DebPrint (("display change: %d %d\n", dpyinfo->width,
9053                           dpyinfo->height));                           dpyinfo->height));
9054              }              }
9055              
9056            check_visibility = 1;            check_visibility = 1;
9057            break;            break;
9058    
# Line 9060  w32_read_socket (sd, bufp, numchars, exp Line 9060  w32_read_socket (sd, bufp, numchars, exp
9060            /* Check for messages registered at runtime. */            /* Check for messages registered at runtime. */
9061            if (msg.msg.message == msh_mousewheel)            if (msg.msg.message == msh_mousewheel)
9062              {              {
9063                if (dpyinfo->grabbed && last_mouse_frame                if (dpyinfo->grabbed && last_mouse_frame
9064                    && FRAME_LIVE_P (last_mouse_frame))                    && FRAME_LIVE_P (last_mouse_frame))
9065                  f = last_mouse_frame;                  f = last_mouse_frame;
9066                else                else
9067                  f = x_window_to_frame (dpyinfo, msg.msg.hwnd);                  f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
9068              
9069                if (f)                if (f)
9070                  {                  {
9071                    if ((!dpyinfo->w32_focus_frame                    if ((!dpyinfo->w32_focus_frame
9072                         || f == dpyinfo->w32_focus_frame)                         || f == dpyinfo->w32_focus_frame)
9073                        && (numchars >= 1))                        && (numchars >= 1))
9074                      {                      {
# Line 9407  x_erase_phys_cursor (w) Line 9407  x_erase_phys_cursor (w)
9407       screen.  */       screen.  */
9408    if (w->phys_cursor_type == NO_CURSOR)    if (w->phys_cursor_type == NO_CURSOR)
9409      goto mark_cursor_off;      goto mark_cursor_off;
9410              
9411    /* VPOS >= active_glyphs->nrows means that window has been resized.    /* VPOS >= active_glyphs->nrows means that window has been resized.
9412       Don't bother to erase the cursor.  */       Don't bother to erase the cursor.  */
9413    if (vpos >= active_glyphs->nrows)    if (vpos >= active_glyphs->nrows)
# Line 9418  x_erase_phys_cursor (w) Line 9418  x_erase_phys_cursor (w)
9418    cursor_row = MATRIX_ROW (active_glyphs, vpos);    cursor_row = MATRIX_ROW (active_glyphs, vpos);
9419    if (!cursor_row->enabled_p)    if (!cursor_row->enabled_p)
9420      goto mark_cursor_off;      goto mark_cursor_off;
9421      
9422    /* If row is completely invisible, don't attempt to delete a cursor which    /* If row is completely invisible, don't attempt to delete a cursor which
9423       isn't there.  This can happen if cursor is at top of a window, and       isn't there.  This can happen if cursor is at top of a window, and
9424       we switch to a buffer with a header line in that window.  */       we switch to a buffer with a header line in that window.  */
9425    if (cursor_row->visible_height <= 0)    if (cursor_row->visible_height <= 0)
9426      goto mark_cursor_off;      goto mark_cursor_off;
9427      
9428    /* This can happen when the new row is shorter than the old one.    /* This can happen when the new row is shorter than the old one.
9429       In this case, either x_draw_glyphs or clear_end_of_line       In this case, either x_draw_glyphs or clear_end_of_line
9430       should have cleared the cursor.  Note that we wouldn't be       should have cleared the cursor.  Note that we wouldn't be
# Line 9432  x_erase_phys_cursor (w) Line 9432  x_erase_phys_cursor (w)
9432       cursor glyph at hand.  */       cursor glyph at hand.  */
9433    if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])    if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])
9434      goto mark_cursor_off;      goto mark_cursor_off;
9435            
9436    /* If the cursor is in the mouse face area, redisplay that when    /* If the cursor is in the mouse face area, redisplay that when
9437       we clear the cursor.  */       we clear the cursor.  */
9438    if (! NILP (dpyinfo->mouse_face_window)    if (! NILP (dpyinfo->mouse_face_window)
# Line 9470  x_erase_phys_cursor (w) Line 9470  x_erase_phys_cursor (w)
9470                        cursor_row->visible_height);                        cursor_row->visible_height);
9471        release_frame_dc (f, hdc);        release_frame_dc (f, hdc);
9472      }      }
9473      
9474    /* Erase the cursor by redrawing the character underneath it.  */    /* Erase the cursor by redrawing the character underneath it.  */
9475    if (mouse_face_here_p)    if (mouse_face_here_p)
9476      hl = DRAW_MOUSE_FACE;      hl = DRAW_MOUSE_FACE;
# Line 9495  cursor_in_mouse_face_p (w) Line 9495  cursor_in_mouse_face_p (w)
9495    struct w32_display_info *dpyinfo    struct w32_display_info *dpyinfo
9496      = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame));      = FRAME_W32_DISPLAY_INFO (XFRAME (w->frame));
9497    int in_mouse_face = 0;    int in_mouse_face = 0;
9498      
9499    if (WINDOWP (dpyinfo->mouse_face_window)    if (WINDOWP (dpyinfo->mouse_face_window)
9500        && XWINDOW (dpyinfo->mouse_face_window) == w)        && XWINDOW (dpyinfo->mouse_face_window) == w)
9501      {      {
# Line 9549  x_display_and_set_cursor (w, on, hpos, v Line 9549  x_display_and_set_cursor (w, on, hpos, v
9549    current_glyphs = w->current_matrix;    current_glyphs = w->current_matrix;
9550    glyph_row = MATRIX_ROW (current_glyphs, vpos);    glyph_row = MATRIX_ROW (current_glyphs, vpos);
9551    glyph = glyph_row->glyphs[TEXT_AREA] + hpos;    glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
9552      
9553    /* If cursor row is not enabled, we don't really know where to    /* If cursor row is not enabled, we don't really know where to
9554       display the cursor.  */       display the cursor.  */
9555    if (!glyph_row->enabled_p)    if (!glyph_row->enabled_p)
9556      {      {
# Line 9585  x_display_and_set_cursor (w, on, hpos, v Line 9585  x_display_and_set_cursor (w, on, hpos, v
9585          {          {
9586            extern int cursor_in_non_selected_windows;            extern int cursor_in_non_selected_windows;
9587    
9588            if (MINI_WINDOW_P (w)            if (MINI_WINDOW_P (w)
9589                || !cursor_in_non_selected_windows                || !cursor_in_non_selected_windows
9590                || NILP (XBUFFER (w->buffer)->cursor_type))                || NILP (XBUFFER (w->buffer)->cursor_type))
9591              new_cursor_type = NO_CURSOR;              new_cursor_type = NO_CURSOR;
# Line 9601  x_display_and_set_cursor (w, on, hpos, v Line 9601  x_display_and_set_cursor (w, on, hpos, v
9601            if (EQ (b->cursor_type, Qt))            if (EQ (b->cursor_type, Qt))
9602              new_cursor_type = FRAME_DESIRED_CURSOR (f);              new_cursor_type = FRAME_DESIRED_CURSOR (f);
9603            else            else
9604              new_cursor_type = x_specified_cursor_type (b->cursor_type,              new_cursor_type = x_specified_cursor_type (b->cursor_type,
9605                                                         &new_cursor_width);                                                         &new_cursor_width);
9606          }          }
9607      }      }
# Line 9622  x_display_and_set_cursor (w, on, hpos, v Line 9622  x_display_and_set_cursor (w, on, hpos, v
9622      {      {
9623        w->phys_cursor_ascent = glyph_row->ascent;        w->phys_cursor_ascent = glyph_row->ascent;
9624        w->phys_cursor_height = glyph_row->height;        w->phys_cursor_height = glyph_row->height;
9625          
9626        /* Set phys_cursor_.* before x_draw_.* is called because some        /* Set phys_cursor_.* before x_draw_.* is called because some
9627           of them may need the information.  */           of them may need the information.  */
9628        w->phys_cursor.x = x;        w->phys_cursor.x = x;
# Line 9930  x_calc_absolute_position (f) Line 9930  x_calc_absolute_position (f)
9930    {    {
9931        RECT rt;        RECT rt;
9932        rt.left = rt.right = rt.top = rt.bottom = 0;        rt.left = rt.right = rt.top = rt.bottom = 0;
9933          
9934        BLOCK_INPUT;        BLOCK_INPUT;
9935        AdjustWindowRect(&rt, f->output_data.w32->dwStyle,        AdjustWindowRect(&rt, f->output_data.w32->dwStyle,
9936                         FRAME_EXTERNAL_MENU_BAR (f));                         FRAME_EXTERNAL_MENU_BAR (f));
# Line 10012  x_set_window_size (f, change_gravity, co Line 10012  x_set_window_size (f, change_gravity, co
10012       int cols, rows;       int cols, rows;
10013  {  {
10014    int pixelwidth, pixelheight;    int pixelwidth, pixelheight;
10015      
10016    BLOCK_INPUT;    BLOCK_INPUT;
10017      
10018    check_frame_size (f, &rows, &cols);    check_frame_size (f, &rows, &cols);
10019    f->output_data.w32->vertical_scroll_bar_extra    f->output_data.w32->vertical_scroll_bar_extra
10020      = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)      = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
# Line 10024  x_set_window_size (f, change_gravity, co Line 10024  x_set_window_size (f, change_gravity, co
10024      = FRAME_FLAGS_AREA_WIDTH (f);      = FRAME_FLAGS_AREA_WIDTH (f);
10025    pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);    pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
10026    pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);    pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
10027      
10028    f->output_data.w32->win_gravity = NorthWestGravity;    f->output_data.w32->win_gravity = NorthWestGravity;
10029    x_wm_set_size_hint (f, (long) 0, 0);    x_wm_set_size_hint (f, (long) 0, 0);
10030      
10031    {    {
10032      RECT rect;      RECT rect;
10033    
10034      rect.left = rect.top = 0;      rect.left = rect.top = 0;
10035      rect.right = pixelwidth;      rect.right = pixelwidth;
10036      rect.bottom = pixelheight;      rect.bottom = pixelheight;
10037          
10038      AdjustWindowRect(&rect, f->output_data.w32->dwStyle,      AdjustWindowRect(&rect, f->output_data.w32->dwStyle,
10039                       FRAME_EXTERNAL_MENU_BAR (f));                       FRAME_EXTERNAL_MENU_BAR (f));
10040          
10041      my_set_window_pos (FRAME_W32_WINDOW (f),      my_set_window_pos (FRAME_W32_WINDOW (f),
10042                         NULL,                         NULL,
10043                         0, 0,                         0, 0,
10044                         rect.right - rect.left,                         rect.right - rect.left,
10045                         rect.bottom - rect.top,                         rect.bottom - rect.top,
10046                         SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);                         SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
10047    }    }
10048      
10049    /* Now, strictly speaking, we can't be sure that this is accurate,    /* Now, strictly speaking, we can't be sure that this is accurate,
10050       but the window manager will get around to dealing with the size       but the window manager will get around to dealing with the size
10051       change request eventually, and we'll hear how it went when the       change request eventually, and we'll hear how it went when the
10052       ConfigureNotify event gets here.       ConfigureNotify event gets here.
10053        
10054       We could just not bother storing any of this information here,       We could just not bother storing any of this information here,
10055       and let the ConfigureNotify event set everything up, but that       and let the ConfigureNotify event set everything up, but that
10056       might be kind of confusing to the Lisp code, since size changes       might be kind of confusing to the Lisp code, since size changes
# Line 10073  x_set_window_size (f, change_gravity, co Line 10073  x_set_window_size (f, change_gravity, co
10073    mark_window_cursors_off (XWINDOW (f->root_window));    mark_window_cursors_off (XWINDOW (f->root_window));
10074    
10075    /* Clear out any recollection of where the mouse highlighting was,    /* Clear out any recollection of where the mouse highlighting was,
10076       since it might be in a place that's outside the new frame size.       since it might be in a place that's outside the new frame size.
10077       Actually checking whether it is outside is a pain in the neck,       Actually checking whether it is outside is a pain in the neck,
10078       so don't try--just let the highlighting be done afresh with new size.  */       so don't try--just let the highlighting be done afresh with new size.  */
10079    cancel_mouse_face (f);    cancel_mouse_face (f);
# Line 10325  x_make_frame_invisible (f) Line 10325  x_make_frame_invisible (f)
10325    /* Don't keep the highlight on an invisible frame.  */    /* Don't keep the highlight on an invisible frame.  */
10326    if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f)    if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f)
10327      FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0;      FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0;
10328      
10329    BLOCK_INPUT;    BLOCK_INPUT;
10330      
10331    my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE);    my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE);
10332      
10333    /* We can't distinguish this from iconification    /* We can't distinguish this from iconification
10334       just by the event that we get from the server.       just by the event that we get from the server.
10335       So we can't win using the usual strategy of letting       So we can't win using the usual strategy of letting
# Line 10339  x_make_frame_invisible (f) Line 10339  x_make_frame_invisible (f)
10339    FRAME_ICONIFIED_P (f) = 0;    FRAME_ICONIFIED_P (f) = 0;
10340    f->async_visible = 0;    f->async_visible = 0;
10341    f->async_iconified = 0;    f->async_iconified = 0;
10342      
10343    UNBLOCK_INPUT;    UNBLOCK_INPUT;
10344  }  }
10345    
# Line 10383  x_free_frame_resources (f) Line 10383  x_free_frame_resources (f)
10383    
10384    if (FRAME_W32_WINDOW (f))    if (FRAME_W32_WINDOW (f))
10385      my_destroy_window (f, FRAME_W32_WINDOW (f));      my_destroy_window (f, FRAME_W32_WINDOW (f));
10386          
10387    free_frame_menubar (f);    free_frame_menubar (f);
10388    
10389    unload_color (f, f->output_data.x->foreground_pixel);    unload_color (f, f->output_data.x->foreground_pixel);
# Line 10399  x_free_frame_resources (f) Line 10399  x_free_frame_resources (f)
10399    
10400    if (FRAME_FACE_CACHE (f))    if (FRAME_FACE_CACHE (f))
10401      free_frame_faces (f);      free_frame_faces (f);
10402          
10403    xfree (f->output_data.w32);    xfree (f->output_data.w32);
10404    f->output_data.w32 = NULL;    f->output_data.w32 = NULL;
10405      
10406    if (f == dpyinfo->w32_focus_frame)    if (f == dpyinfo->w32_focus_frame)
10407      dpyinfo->w32_focus_frame = 0;      dpyinfo->w32_focus_frame = 0;
10408    if (f == dpyinfo->w32_focus_event_frame)    if (f == dpyinfo->w32_focus_event_frame)
# Line 10508  x_check_font (f, font) Line 10508  x_check_font (f, font)
10508    xassert (font != NULL);    xassert (font != NULL);
10509    
10510    for (i = 0; i < dpyinfo->n_fonts; i++)    for (i = 0; i < dpyinfo->n_fonts; i++)
10511      if (dpyinfo->font_table[i].name      if (dpyinfo->font_table[i].name
10512          && font == dpyinfo->font_table[i].font)          && font == dpyinfo->font_table[i].font)
10513        break;        break;
10514    
# Line 10552  x_compute_min_glyph_bounds (f) Line 10552  x_compute_min_glyph_bounds (f)
10552    XFontStruct *font;    XFontStruct *font;
10553    int old_width = dpyinfo->smallest_char_width;    int old_width = dpyinfo->smallest_char_width;
10554    int old_height = dpyinfo->smallest_font_height;    int old_height = dpyinfo->smallest_font_height;
10555      
10556    dpyinfo->smallest_font_height = 100000;    dpyinfo->smallest_font_height = 100000;
10557    dpyinfo->smallest_char_width = 100000;    dpyinfo->smallest_char_width = 100000;
10558      
10559    for (i = 0; i < dpyinfo->n_fonts; ++i)    for (i = 0; i < dpyinfo->n_fonts; ++i)
10560      if (dpyinfo->font_table[i].name)      if (dpyinfo->font_table[i].name)
10561        {        {
10562          struct font_info *fontp = dpyinfo->font_table + i;          struct font_info *fontp = dpyinfo->font_table + i;
10563          int w, h;          int w, h;
10564            
10565          font = (XFontStruct *) fontp->font;          font = (XFontStruct *) fontp->font;
10566          xassert (font != (XFontStruct *) ~0);          xassert (font != (XFontStruct *) ~0);
10567          x_font_min_bounds (font, &w, &h);          x_font_min_bounds (font, &w, &h);
10568            
10569          dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h);          dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h);
10570          dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w);          dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w);
10571        }        }
# Line 10605  w32_initialize_display_info (display_nam Line 10605  w32_initialize_display_info (display_nam
10605    w32_display_name_list = Fcons (Fcons (display_name, Qnil),    w32_display_name_list = Fcons (Fcons (display_name, Qnil),
10606                                   w32_display_name_list);                                   w32_display_name_list);
10607    dpyinfo->name_list_element = XCAR (w32_display_name_list);    dpyinfo->name_list_element = XCAR (w32_display_name_list);
10608      
10609    dpyinfo->w32_id_name    dpyinfo->w32_id_name
10610      = (char *) xmalloc (XSTRING (Vinvocation_name)->size      = (char *) xmalloc (XSTRING (Vinvocation_name)->size
10611                          + XSTRING (Vsystem_name)->size                          + XSTRING (Vsystem_name)->size
# Line 10642  w32_term_init (display_name, xrm_option, Line 10642  w32_term_init (display_name, xrm_option,
10642  {  {
10643    struct w32_display_info *dpyinfo;    struct w32_display_info *dpyinfo;
10644    HDC hdc;    HDC hdc;
10645      
10646    BLOCK_INPUT;    BLOCK_INPUT;
10647      
10648    if (!w32_initialized)    if (!w32_initialized)
10649      {      {
10650        w32_initialize ();        w32_initialize ();
10651        w32_initialized = 1;        w32_initialized = 1;
10652      }      }
10653      
10654    {    {
10655      int argc = 0;      int argc = 0;
10656      char *argv[3];      char *argv[3];
# Line 10663  w32_term_init (display_name, xrm_option, Line 10663  w32_term_init (display_name, xrm_option,
10663          argv[argc++] = xrm_option;          argv[argc++] = xrm_option;
10664        }        }
10665    }    }
10666      
10667    w32_initialize_display_info (display_name);    w32_initialize_display_info (display_name);
10668    
10669    dpyinfo = &one_w32_display_info;    dpyinfo = &one_w32_display_info;
# Line 10671  w32_term_init (display_name, xrm_option, Line 10671  w32_term_init (display_name, xrm_option,
10671    /* Put this display on the chain.  */    /* Put this display on the chain.  */
10672    dpyinfo->next = x_display_list;    dpyinfo->next = x_display_list;
10673    x_display_list = dpyinfo;    x_display_list = dpyinfo;
10674      
10675    hdc = GetDC (GetDesktopWindow ());    hdc = GetDC (GetDesktopWindow ());
10676    
10677    dpyinfo->height = GetDeviceCaps (hdc, VERTRES);    dpyinfo->height = GetDeviceCaps (hdc, VERTRES);
# Line 10689  w32_term_init (display_name, xrm_option, Line 10689  w32_term_init (display_name, xrm_option,
10689    
10690    /* initialise palette with white and black */    /* initialise palette with white and black */
10691    {    {
10692      COLORREF color;      XColor color;
10693      w32_defined_color (0, "white", &color, 1);      w32_defined_color (0, "white", &color, 1);
10694      w32_defined_color (0, "black", &color, 1);      w32_defined_color (0, "black", &color, 1);
10695    }    }
# Line 10849  w32_initialize () Line 10849  w32_initialize ()
10849    init_crit ();    init_crit ();
10850    
10851    dwMainThreadId = GetCurrentThreadId ();    dwMainThreadId = GetCurrentThreadId ();
10852    DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),    DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
10853                     GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS);                     GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS);
10854    
10855    /* Wait for thread to start */    /* Wait for thread to start */
# Line 10859  w32_initialize () Line 10859  w32_initialize ()
10859    
10860      PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);      PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
10861    
10862      hWindowsThread = CreateThread (NULL, 0,      hWindowsThread = CreateThread (NULL, 0,
10863                                 (LPTHREAD_START_ROUTINE) w32_msg_worker,                                 (LPTHREAD_START_ROUTINE) w32_msg_worker,
10864                                 0, 0, &dwWindowsThreadId);                                 0, 0, &dwWindowsThreadId);
10865    
10866      GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);      GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
10867    }    }
10868      
10869    /* It is desirable that mainThread should have the same notion of    /* It is desirable that mainThread should have the same notion of
10870       focus window and active window as windowsThread.  Unfortunately, the       focus window and active window as windowsThread.  Unfortunately, the
10871       following call to AttachThreadInput, which should do precisely what       following call to AttachThreadInput, which should do precisely what
# Line 10945  When nil, CapsLock only affects normal c Line 10945  When nil, CapsLock only affects normal c
10945                 &Vw32_recognize_altgr,                 &Vw32_recognize_altgr,
10946                 "Recognize right-alt and left-ctrl as AltGr.\n\                 "Recognize right-alt and left-ctrl as AltGr.\n\
10947  When nil, the right-alt and left-ctrl key combination is\n\  When nil, the right-alt and left-ctrl key combination is\n\
10948  interpreted normally.");  interpreted normally.");
10949    Vw32_recognize_altgr = Qt;    Vw32_recognize_altgr = Qt;
10950    
10951    DEFVAR_BOOL ("w32-enable-unicode-output",    DEFVAR_BOOL ("w32-enable-unicode-output",

Legend:
Removed from v.1.109.4.16  
changed lines
  Added in v.1.109.4.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26