aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-05-01 10:10:26 +0000
committerJason Rumney2007-05-01 10:10:26 +0000
commit027f6f90b88188fbdbece961160f2447944541df (patch)
treeba9e410962b2bc29382f73b4bec16b21b8996689 /src
parent6ed29d7bd9e059a9bb8c048fb6dbce2799443fbd (diff)
downloademacs-027f6f90b88188fbdbece961160f2447944541df.tar.gz
emacs-027f6f90b88188fbdbece961160f2447944541df.zip
[USE_FONT_BACKEND]:
(x_get_font_repertory, note_mouse_movement, x_set_mouse_face_gc): (x_set_glyph_string_clipping, x_set_glyph_string_clipping_exactly): (x_draw_glyph_string, x_draw_glyph_string_foreground): (x_draw_composite_glyph_string_foreground, x_new_fontset2): (x_free_frame_resources): Sync with xterm.c.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c444
1 files changed, 402 insertions, 42 deletions
diff --git a/src/w32term.c b/src/w32term.c
index c886ca48b8a..604de982f50 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -60,6 +60,10 @@ Boston, MA 02110-1301, USA. */
60#include "w32bdf.h" 60#include "w32bdf.h"
61#include <shellapi.h> 61#include <shellapi.h>
62 62
63#ifdef USE_FONT_BACKEND
64#include "font.h"
65#endif /* USE_FONT_BACKEND */
66
63#define abs(x) ((x) < 0 ? -(x) : (x)) 67#define abs(x) ((x) < 0 ? -(x) : (x))
64 68
65 69
@@ -1220,6 +1224,9 @@ x_get_font_repertory (f, font_info)
1220 XFontStruct *font = (XFontStruct *) font_info->font; 1224 XFontStruct *font = (XFontStruct *) font_info->font;
1221 Lisp_Object table; 1225 Lisp_Object table;
1222 int min_byte1, max_byte1, min_byte2, max_byte2; 1226 int min_byte1, max_byte1, min_byte2, max_byte2;
1227 int c;
1228 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
1229 int offset = CHARSET_OFFSET (charset);
1223 1230
1224 table = Fmake_char_table (Qnil, Qnil); 1231 table = Fmake_char_table (Qnil, Qnil);
1225 1232
@@ -1274,7 +1281,17 @@ x_get_font_repertory (f, font_info)
1274 if (min_byte1 == 0 && max_byte1 == 0) 1281 if (min_byte1 == 0 && max_byte1 == 0)
1275 { 1282 {
1276 if (! font->per_char || font->all_chars_exist == True) 1283 if (! font->per_char || font->all_chars_exist == True)
1277 char_table_set_range (table, min_byte2, max_byte2, Qt); 1284 {
1285 if (offset >= 0)
1286 char_table_set_range (table, offset + min_byte2,
1287 offset + max_byte2, Qt);
1288 else
1289 for (; min_byte2 <= max_byte2; min_byte2++)
1290 {
1291 c = DECODE_CHAR (charset, min_byte2);
1292 CHAR_TABLE_SET (table, c, Qt);
1293 }
1294 }
1278 else 1295 else
1279 { 1296 {
1280 XCharStruct *pcm = font->per_char; 1297 XCharStruct *pcm = font->per_char;
@@ -1287,7 +1304,15 @@ x_get_font_repertory (f, font_info)
1287 { 1304 {
1288 if (from >= 0) 1305 if (from >= 0)
1289 { 1306 {
1290 char_table_set_range (table, from, i - 1, Qt); 1307 if (offset >= 0)
1308 char_table_set_range (table, offset + from,
1309 offset + i - 1, Qt);
1310 else
1311 for (; from < i; from++)
1312 {
1313 c = DECODE_CHAR (charset, from);
1314 CHAR_TABLE_SET (table, c, Qt);
1315 }
1291 from = -1; 1316 from = -1;
1292 } 1317 }
1293 } 1318 }
@@ -1295,19 +1320,38 @@ x_get_font_repertory (f, font_info)
1295 from = i; 1320 from = i;
1296 } 1321 }
1297 if (from >= 0) 1322 if (from >= 0)
1298 char_table_set_range (table, from, i - 1, Qt); 1323 {
1324 if (offset >= 0)
1325 char_table_set_range (table, offset + from, offset + i - 1,
1326 Qt);
1327 else
1328 for (; from < i; from++)
1329 {
1330 c = DECODE_CHAR (charset, from);
1331 CHAR_TABLE_SET (table, c, Qt);
1332 }
1333 }
1299 } 1334 }
1300 } 1335 }
1301 else 1336 else
1302 { 1337 {
1303 if (! font->per_char || font->all_chars_exist == True) 1338 if (! font->per_char || font->all_chars_exist == True)
1304 { 1339 {
1305 int i; 1340 int i, j;
1306 1341
1307 for (i = min_byte1; i <= max_byte1; i++) 1342 if (offset >= 0)
1308 char_table_set_range (table, 1343 for (i = min_byte1; i <= max_byte1; i++)
1309 (i << 8) | min_byte2, (i << 8) | max_byte2, 1344 char_table_set_range
1310 Qt); 1345 (table, offset + ((i << 8) | min_byte2),
1346 offset + ((i << 8) | max_byte2), Qt);
1347 else
1348 for (i = min_byte1; i <= max_byte1; i++)
1349 for (j = min_byte2; j <= max_byte2; j++)
1350 {
1351 unsiged code = (i << 8) | j;
1352 c = DECODE_CHAR (charset, code);
1353 CHAR_TABLE_SET (table, c, Qt);
1354 }
1311 } 1355 }
1312 else 1356 else
1313 { 1357 {
@@ -1325,8 +1369,19 @@ x_get_font_repertory (f, font_info)
1325 { 1369 {
1326 if (from >= 0) 1370 if (from >= 0)
1327 { 1371 {
1328 char_table_set_range (table, (i << 8) | from, 1372 if (offset >= 0)
1329 (i << 8) | (j - 1), Qt); 1373 char_table_set_range
1374 (table, offset + ((i << 8) | from),
1375 offset + ((i << 8) | (j - 1)), Qt);
1376 else
1377 {
1378 for (; from < j; from++)
1379 {
1380 unsigned code = (i << 8) | from;
1381 c = ENCODE_CHAR (charset, code);
1382 CHAR_TABLE_SET (table, c, Qt);
1383 }
1384 }
1330 from = -1; 1385 from = -1;
1331 } 1386 }
1332 } 1387 }
@@ -1334,8 +1389,21 @@ x_get_font_repertory (f, font_info)
1334 from = j; 1389 from = j;
1335 } 1390 }
1336 if (from >= 0) 1391 if (from >= 0)
1337 char_table_set_range (table, (i << 8) | from, 1392 {
1338 (i << 8) | (j - 1), Qt); 1393 if (offset >= 0)
1394 char_table_set_range
1395 (table, offset + ((i << 8) | from),
1396 offset + ((i << 8) | (j - 1)), Qt);
1397 else
1398 {
1399 for (; from < j; from++)
1400 {
1401 unsigned code = (i << 8) | from;
1402 c = DECODE_CHAR (charset, code);
1403 CHAR_TABLE_SET (table, c, Qt);
1404 }
1405 }
1406 }
1339 } 1407 }
1340 } 1408 }
1341 } 1409 }
@@ -1481,6 +1549,11 @@ x_set_mouse_face_gc (s)
1481 /* If font in this face is same as S->font, use it. */ 1549 /* If font in this face is same as S->font, use it. */
1482 if (s->font == s->face->font) 1550 if (s->font == s->face->font)
1483 s->gc = s->face->gc; 1551 s->gc = s->face->gc;
1552#ifdef USE_FONT_BACKEND
1553 else if (enable_font_backend)
1554 /* No need of setting a font for s->gc. */
1555 s->gc = s->face->gc;
1556#endif /* USE_FONT_BACKEND */
1484 else 1557 else
1485 { 1558 {
1486 /* Otherwise construct scratch_cursor_gc with values from FACE 1559 /* Otherwise construct scratch_cursor_gc with values from FACE
@@ -1577,8 +1650,45 @@ x_set_glyph_string_clipping (s)
1577 RECT r; 1650 RECT r;
1578 get_glyph_string_clip_rect (s, &r); 1651 get_glyph_string_clip_rect (s, &r);
1579 w32_set_clip_rectangle (s->hdc, &r); 1652 w32_set_clip_rectangle (s->hdc, &r);
1653#ifdef USE_FONT_BACKEND
1654 s->clip_x = r.left, s->clip_y = r.top;
1655 s->clip_width = r.right - r.left, s->clip_height = r.bottom - r.top;
1656#endif /* USE_FONT_BACKEND */
1580} 1657}
1581 1658
1659/* Set SRC's clipping for output of glyph string DST. This is called
1660 when we are drawing DST's left_overhang or right_overhang only in
1661 the area of SRC. */
1662
1663static void
1664x_set_glyph_string_clipping_exactly (src, dst)
1665 struct glyph_string *src, *dst;
1666{
1667 RECT r;
1668
1669#ifdef USE_FONT_BACKEND
1670 if (enable_font_backend)
1671 {
1672 r.left = dst->clip_x = src->x;
1673 r.right = r.left + (dst->clip_width = src->width);
1674 r.top = dst->clip_y = src->y;
1675 r.bottom = r.top + (dst->clip_height = src->height);
1676 }
1677 else
1678 {
1679#endif /* USE_FONT_BACKEND */
1680 struct glyph_string *clip_head = src->clip_head;
1681 struct glyph_string *clip_tail = src->clip_tail;
1682
1683 /* This foces clipping just this glyph string. */
1684 src->clip_head = src->clip_tail = src;
1685 get_glyph_string_clip_rect (src, &r);
1686 src->clip_head = clip_head, src->clip_tail = clip_tail;
1687#ifdef USE_FONT_BACKEND
1688 }
1689#endif /* USE_FONT_BACKEND */
1690 w32_set_clip_rectangle (dst->hdc, &r);
1691}
1582 1692
1583/* RIF: 1693/* RIF:
1584 Compute left and right overhang of glyph string S. If S is a glyph 1694 Compute left and right overhang of glyph string S. If S is a glyph
@@ -1723,6 +1833,30 @@ x_draw_glyph_string_foreground (s)
1723 x += g->pixel_width; 1833 x += g->pixel_width;
1724 } 1834 }
1725 } 1835 }
1836#ifdef USE_FONT_BACKEND
1837 else if (enable_font_backend)
1838 {
1839 unsigned *code = alloca (sizeof (unsigned) * s->nchars);
1840 int boff = s->font_info->baseline_offset;
1841 struct font *font = (struct font *) s->font_info;
1842 int y;
1843
1844 for (i = 0; i < s->nchars; i++)
1845 code[i] = (s->char2b[i].byte1 << 8) | s->char2b[i].byte2;
1846
1847 if (s->font_info->vertical_centering)
1848 boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff;
1849
1850 y = s->ybase - boff;
1851 if (s->for_overlaps
1852 || (s->background_filled_p && s->hl != DRAW_CURSOR))
1853 font->driver->draw (s, 0, s->nchars, x, y, 0);
1854 else
1855 font->driver->draw (s, 0, s->nchars, x, y, 1);
1856 if (s->face->overstrike)
1857 font->driver->draw (s, 0, s->nchars, x + 1, y, 0);
1858 }
1859#endif /* USE_FONT_BACKEND */
1726 else 1860 else
1727 { 1861 {
1728 char *char1b = (char *) s->char2b; 1862 char *char1b = (char *) s->char2b;
@@ -1759,12 +1893,12 @@ static void
1759x_draw_composite_glyph_string_foreground (s) 1893x_draw_composite_glyph_string_foreground (s)
1760 struct glyph_string *s; 1894 struct glyph_string *s;
1761{ 1895{
1762 int i, x; 1896 int i, j, x;
1763 HFONT old_font; 1897 HFONT old_font;
1764 1898
1765 /* If first glyph of S has a left box line, start drawing the text 1899 /* If first glyph of S has a left box line, start drawing the text
1766 of S to the right of that box line. */ 1900 of S to the right of that box line. */
1767 if (s->face->box != FACE_NO_BOX 1901 if (s->face && s->face->box != FACE_NO_BOX
1768 && s->first_glyph->left_box_line_p) 1902 && s->first_glyph->left_box_line_p)
1769 x = s->x + abs (s->face->box_line_width); 1903 x = s->x + abs (s->face->box_line_width);
1770 else 1904 else
@@ -1791,19 +1925,77 @@ x_draw_composite_glyph_string_foreground (s)
1791 w32_draw_rectangle (s->hdc, s->gc, x, s->y, s->width - 1, 1925 w32_draw_rectangle (s->hdc, s->gc, x, s->y, s->width - 1,
1792 s->height - 1); 1926 s->height - 1);
1793 } 1927 }
1794 else 1928#ifdef USE_FONT_BACKEND
1929 else if (enable_font_backend)
1795 { 1930 {
1796 for (i = 0; i < s->nchars; i++, ++s->gidx) 1931 struct font *font = (struct font *) s->font_info;
1932 int y = s->ybase;
1933 int width = 0;
1934
1935 if (s->cmp->method == COMPOSITION_WITH_GLYPH_STRING)
1936 {
1937 Lisp_Object gstring = AREF (XHASH_TABLE (composition_hash_table)
1938 ->key_and_value,
1939 s->cmp->hash_index * 2);
1940 int from;
1941
1942 for (i = from = 0; i < s->nchars; i++)
1943 {
1944 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
1945 Lisp_Object adjustment = LGLYPH_ADJUSTMENT (g);
1946 int xoff, yoff, wadjust;
1947
1948 if (! VECTORP (adjustment))
1949 {
1950 width += XINT (LGLYPH_WIDTH (g));
1951 continue;
1952 }
1953 if (from < i)
1954 {
1955 font->driver->draw (s, from, i, x, y, 0);
1956 x += width;
1957 }
1958 xoff = XINT (AREF (adjustment, 0));
1959 yoff = XINT (AREF (adjustment, 1));
1960 wadjust = XINT (AREF (adjustment, 2));
1961
1962 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0);
1963 x += XINT (LGLYPH_WIDTH (g)) + wadjust;
1964 from = i + 1;
1965 width = 0;
1966 }
1967 if (from < i)
1968 font->driver->draw (s, from, i, x, y, 0);
1969 }
1970 else
1797 { 1971 {
1798 w32_text_out (s, x + s->cmp->offsets[s->gidx * 2], 1972 for (i = 0, j = s->gidx; i < s->nchars; i++, j++)
1799 s->ybase - s->cmp->offsets[s->gidx * 2 + 1], 1973 if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
1800 s->char2b + i, 1); 1974 {
1801 if (s->face->overstrike) 1975 int xx = x + s->cmp->offsets[j * 2];
1802 w32_text_out (s, x + s->cmp->offsets[s->gidx * 2] + 1, 1976 int yy = y - s->cmp->offsets[j * 2 + 1];
1803 s->ybase - s->cmp->offsets[s->gidx * 2 + 1], 1977
1804 s->char2b + i, 1); 1978 font->driver->draw (s, j, j + 1, xx, yy, 0);
1979 if (s->face->overstrike)
1980 font->driver->draw (s, j, j + 1, xx + 1, yy, 0);
1981 }
1805 } 1982 }
1806 } 1983 }
1984#endif /* USE_FONT_BACKEND */
1985 else
1986 {
1987 for (i = 0, j = s->gidx; i < s->nchars; i++, j++)
1988 if (s->face)
1989 {
1990 w32_text_out (s, x + s->cmp->offsets[j * 2],
1991 s->ybase - s->cmp->offsets[j * 2 + 1],
1992 s->char2b + j, 1);
1993 if (s->face->overstrike)
1994 w32_text_out (s, x + s->cmp->offsets[j * 2] + 1,
1995 s->ybase - s->cmp->offsets[j + 1],
1996 s->char2b + j, 1);
1997 }
1998 }
1807 1999
1808 if (s->font && s->font->hfont) 2000 if (s->font && s->font->hfont)
1809 SelectObject (s->hdc, old_font); 2001 SelectObject (s->hdc, old_font);
@@ -2605,10 +2797,19 @@ x_draw_glyph_string (s)
2605 This makes S->next use XDrawString instead of XDrawImageString. */ 2797 This makes S->next use XDrawString instead of XDrawImageString. */
2606 if (s->next && s->right_overhang && !s->for_overlaps) 2798 if (s->next && s->right_overhang && !s->for_overlaps)
2607 { 2799 {
2608 xassert (s->next->img == NULL); 2800 int width;
2609 x_set_glyph_string_gc (s->next); 2801 struct glyph_string *next;
2610 x_set_glyph_string_clipping (s->next); 2802 for (width = 0, next = s->next; next;
2611 x_draw_glyph_string_background (s->next, 1); 2803 width += next->width, next = next->next)
2804 if (next->first_glyph->type != IMAGE_GLYPH)
2805 {
2806 x_set_glyph_string_gc (next);
2807 x_set_glyph_string_clipping (next);
2808 x_draw_glyph_string_background (next, 1);
2809#ifdef USE_FONT_BACKEND
2810 next->clip_width = 0;
2811#endif /* USE_FONT_BACKEND */
2812 }
2612 } 2813 }
2613 2814
2614 /* Set up S->gc, set clipping and draw S. */ 2815 /* Set up S->gc, set clipping and draw S. */
@@ -2628,6 +2829,12 @@ x_draw_glyph_string (s)
2628 x_set_glyph_string_clipping (s); 2829 x_set_glyph_string_clipping (s);
2629 relief_drawn_p = 1; 2830 relief_drawn_p = 1;
2630 } 2831 }
2832 else if ((s->prev && s->prev->hl != s->hl && s->left_overhang)
2833 || (s->next && s->next->hl != s->hl && s->right_overhang))
2834 /* We must clip just this glyph. left_overhang part has already
2835 drawn when s->prev was drawn, and right_overhang part will be
2836 drawn later when s->next is drawn. */
2837 x_set_glyph_string_clipping_exactly (s, s);
2631 else 2838 else
2632 x_set_glyph_string_clipping (s); 2839 x_set_glyph_string_clipping (s);
2633 2840
@@ -2667,18 +2874,41 @@ x_draw_glyph_string (s)
2667 if (s->face->underline_p 2874 if (s->face->underline_p
2668 && (s->font->bdf || !s->font->tm.tmUnderlined)) 2875 && (s->font->bdf || !s->font->tm.tmUnderlined))
2669 { 2876 {
2670 unsigned long h = 1; 2877 unsigned long h;
2671 unsigned long dy = 0; 2878 unsigned long dy = 0;
2879 /* Get the underline thickness. Default is 1 pixel. */
2880#ifdef USE_FONT_BACKEND
2881 if (enable_font_backend)
2882 /* In the future, we must use information of font. */
2883 h = 1;
2884 else
2885#endif /* USE_FONT_BACKEND */
2886 h = 1;
2672 2887
2673 if (x_underline_at_descent_line) 2888#ifdef USE_FONT_BACKEND
2674 dy = s->height - h; 2889 if (enable_font_backend)
2675 else 2890 {
2891 if (s->face->font)
2892 /* In the future, we must use information of font. */
2893 y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
2894 else
2895 y = s->y + s->height - h;
2896 }
2897 else
2898#endif
2676 { 2899 {
2677 /* TODO: Use font information for positioning and thickness of 2900 if (x_underline_at_descent_line)
2678 underline. See OUTLINETEXTMETRIC, and xterm.c. Note: If 2901 dy = s->height - h;
2679 you make this work, don't forget to change the doc string of 2902 else
2680 x-use-underline-position-properties below. */ 2903 {
2681 dy = s->height - h; 2904 /* TODO: Use font information for positioning and
2905 thickness of underline. See OUTLINETEXTMETRIC,
2906 and xterm.c. Note: If you makedev this work,
2907 don't forget to change the doc string of
2908 x-use-underline_color-position-properties
2909 below. */
2910 dy = s->height - h;
2911 }
2682 } 2912 }
2683 if (s->face->underline_defaulted_p) 2913 if (s->face->underline_defaulted_p)
2684 { 2914 {
@@ -2691,17 +2921,16 @@ x_draw_glyph_string (s)
2691 s->y + dy, s->background_width, 1); 2921 s->y + dy, s->background_width, 1);
2692 } 2922 }
2693 } 2923 }
2694
2695 /* Draw overline. */ 2924 /* Draw overline. */
2696 if (s->face->overline_p) 2925 if (s->face->overline_p)
2697 { 2926 {
2698 unsigned long dy = 0, h = 1; 2927 unsigned long dy = 0, h = 1;
2699 2928
2700 if (s->face->overline_color_defaulted_p) 2929 if (s->face->overline_color_defaulted_p)
2701 { 2930 {
2702 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, 2931 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
2703 s->y + dy, s->background_width, h); 2932 s->y + dy, s->background_width, h);
2704 } 2933 }
2705 else 2934 else
2706 { 2935 {
2707 w32_fill_area (s->f, s->hdc, s->face->overline_color, s->x, 2936 w32_fill_area (s->f, s->hdc, s->face->overline_color, s->x,
@@ -2728,13 +2957,70 @@ x_draw_glyph_string (s)
2728 } 2957 }
2729 } 2958 }
2730 2959
2731 /* Draw relief. */ 2960 /* Draw relief if not yet drawn. */
2732 if (!relief_drawn_p && s->face->box != FACE_NO_BOX) 2961 if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
2733 x_draw_glyph_string_box (s); 2962 x_draw_glyph_string_box (s);
2963
2964 if (s->prev)
2965 {
2966 struct glyph_string *prev;
2967
2968 for (prev = s->prev; prev; prev = prev->prev)
2969 if (prev->hl != s->hl
2970 && prev->x + prev->width + prev->right_overhang > s->x)
2971 {
2972 /* As prev was drawn while clipped to its own area, we
2973 must draw the right_overhang part using s->hl now. */
2974 enum draw_glyphs_face save = prev->hl;
2975
2976 prev->hl = s->hl;
2977 x_set_glyph_string_gc (prev);
2978 x_set_glyph_string_clipping_exactly (s, prev);
2979 if (prev->first_glyph->type == CHAR_GLYPH)
2980 x_draw_glyph_string_foreground (prev);
2981 else
2982 x_draw_composite_glyph_string_foreground (prev);
2983 w32_set_clip_rectangle (prev->hdc, NULL);
2984 prev->hl = save;
2985#ifdef USE_FONT_BACKEND
2986 prev->clip_width = 0;
2987#endif /* USE_FONT_BACKEND */
2988 }
2989 }
2990
2991 if (s->next)
2992 {
2993 struct glyph_string *next;
2994
2995 for (next = s->next; next; next = next->next)
2996 if (next->hl != s->hl
2997 && next->x - next->left_overhang < s->x + s->width)
2998 {
2999 /* As next will be drawn while clipped to its own area,
3000 we must draw the left_overhang part using s->hl now. */
3001 enum draw_glyphs_face save = next->hl;
3002
3003 next->hl = s->hl;
3004 x_set_glyph_string_gc (next);
3005 x_set_glyph_string_clipping_exactly (s, next);
3006 if (next->first_glyph->type == CHAR_GLYPH)
3007 x_draw_glyph_string_foreground (next);
3008 else
3009 x_draw_composite_glyph_string_foreground (next);
3010 w32_set_clip_rectangle (next->hdc, NULL);
3011 next->hl = save;
3012#ifdef USE_FONT_BACKEND
3013 next->clip_width = 0;
3014#endif /* USE_FONT_BACKEND */
3015 }
3016 }
2734 } 3017 }
2735 3018
2736 /* Reset clipping. */ 3019 /* Reset clipping. */
2737 w32_set_clip_rectangle (s->hdc, NULL); 3020 w32_set_clip_rectangle (s->hdc, NULL);
3021#ifdef USE_FONT_BACKEND
3022 s->clip_width = 0;
3023#endif /* USE_FONT_BACKEND */
2738} 3024}
2739 3025
2740 3026
@@ -3379,6 +3665,9 @@ note_mouse_movement (frame, msg)
3379 memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); 3665 memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event));
3380 XSETFRAME (last_mouse_motion_frame, frame); 3666 XSETFRAME (last_mouse_motion_frame, frame);
3381 3667
3668 if (!FRAME_X_OUTPUT (frame))
3669 return 0;
3670
3382 if (msg->hwnd != FRAME_W32_WINDOW (frame)) 3671 if (msg->hwnd != FRAME_W32_WINDOW (frame))
3383 { 3672 {
3384 frame->mouse_moved = 1; 3673 frame->mouse_moved = 1;
@@ -5494,6 +5783,68 @@ x_new_fontset (f, fontsetname)
5494 return fontset_name (fontset); 5783 return fontset_name (fontset);
5495} 5784}
5496 5785
5786#ifdef USE_FONT_BACKEND
5787Lisp_Object
5788x_new_fontset2 (f, fontset, font_object)
5789 struct frame *f;
5790 int fontset;
5791 Lisp_Object font_object;
5792{
5793 struct font *font = XSAVE_VALUE (font_object)->pointer;
5794
5795 if (FRAME_FONT_OBJECT (f) == font)
5796 /* This font is already set in frame F. There's nothing more to
5797 do. */
5798 return fontset_name (fontset);
5799
5800 BLOCK_INPUT;
5801
5802 FRAME_FONT_OBJECT (f) = font;
5803 FRAME_FONT (f) = font->font.font;
5804 FRAME_BASELINE_OFFSET (f) = font->font.baseline_offset;
5805 FRAME_FONTSET (f) = fontset;
5806
5807 FRAME_COLUMN_WIDTH (f) = font->font.average_width;
5808 FRAME_SPACE_WIDTH (f) = font->font.space_width;
5809 FRAME_LINE_HEIGHT (f) = font->font.height;
5810
5811 compute_fringe_widths (f, 1);
5812
5813 /* Compute the scroll bar width in character columns. */
5814 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
5815 {
5816 int wid = FRAME_COLUMN_WIDTH (f);
5817 FRAME_CONFIG_SCROLL_BAR_COLS (f)
5818 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid - 1) / wid;
5819 }
5820 else
5821 {
5822 int wid = FRAME_COLUMN_WIDTH (f);
5823 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
5824 }
5825
5826 /* Now make the frame display the given font. */
5827 if (FRAME_X_WINDOW (f) != 0)
5828 {
5829 /* Don't change the size of a tip frame; there's no point in
5830 doing it because it's done in Fx_show_tip, and it leads to
5831 problems because the tip frame has no widget. */
5832 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
5833 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
5834 }
5835
5836#ifdef HAVE_X_I18N
5837 if (FRAME_XIC (f)
5838 && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea)))
5839 xic_set_xfontset (f, SDATA (fontset_ascii (fontset)));
5840#endif
5841
5842 UNBLOCK_INPUT;
5843
5844 return fontset_name (fontset);
5845}
5846#endif /* USE_FONT_BACKEND */
5847
5497 5848
5498/*********************************************************************** 5849/***********************************************************************
5499 TODO: W32 Input Methods 5850 TODO: W32 Input Methods
@@ -6033,6 +6384,15 @@ x_free_frame_resources (f)
6033 6384
6034 BLOCK_INPUT; 6385 BLOCK_INPUT;
6035 6386
6387#ifdef USE_FONT_BACKEND
6388 /* We must free faces before destroying windows because some
6389 font-driver (e.g. xft) access a window while finishing a
6390 face. */
6391 if (enable_font_backend
6392 && FRAME_FACE_CACHE (f))
6393 free_frame_faces (f);
6394#endif /* USE_FONT_BACKEND */
6395
6036 if (FRAME_W32_WINDOW (f)) 6396 if (FRAME_W32_WINDOW (f))
6037 my_destroy_window (f, FRAME_W32_WINDOW (f)); 6397 my_destroy_window (f, FRAME_W32_WINDOW (f));
6038 6398