Changeset 1687

Show
Ignore:
Timestamp:
02/17/98 01:45:18 (11 years ago)
Author:
himi
Message:

Emacs 20.3.5 FSF import

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/GNU/src/w32inevt.c

    r1663 r1687  
    4949/* from dispnew.c */ 
    5050extern int change_frame_size (FRAME_PTR, int, int, int, int); 
    51  
    52 /* from w32console.c */ 
    53 extern int w32_use_full_screen_buffer; 
    5451 
    5552/* from w32fns.c */ 
     
    624621} 
    625622 
    626 static void 
    627 maybe_generate_resize_event () 
    628 { 
    629   CONSOLE_SCREEN_BUFFER_INFO info; 
    630   FRAME_PTR f = get_frame (); 
    631  
    632   GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); 
    633  
    634   /* It is okay to call this unconditionally, since it will do nothing 
    635      if the size hasn't actually changed.  */ 
    636   change_frame_size (f, 
    637                      1 + info.srWindow.Bottom - info.srWindow.Top, 
    638                      1 + info.srWindow.Right - info.srWindow.Left, 
    639                      0, 0); 
    640 } 
    641  
    642623int  
    643624w32_console_read_socket (int sd, struct input_event *bufp, int numchars, 
     
    693674 
    694675            case WINDOW_BUFFER_SIZE_EVENT: 
    695               if (w32_use_full_screen_buffer) 
    696                 resize_event (&queue_ptr->Event.WindowBufferSizeEvent); 
     676              resize_event (&queue_ptr->Event.WindowBufferSizeEvent); 
    697677              break; 
    698678             
     
    710690        break; 
    711691    } 
    712  
    713   /* We don't get told about changes in the window size (only the buffer 
    714      size, which we no longer care about), so we have to check it 
    715      periodically.  */ 
    716   if (!w32_use_full_screen_buffer) 
    717     maybe_generate_resize_event (); 
    718  
     692   
    719693  UNBLOCK_INPUT; 
    720694  return ret; 
  • branches/GNU/src/w32proc.c

    r1663 r1687  
    11761176    } 
    11771177   
     1178  /* Wait for input or child death to be signalled.  */ 
    11781179  start_time = GetTickCount (); 
    1179  
    1180   /* Wait for input or child death to be signalled.  If user input is 
    1181      allowed, then also accept window messages.  */ 
    1182   if (FD_ISSET (0, &orfds)) 
    1183     active = MsgWaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms, 
    1184                                         QS_ALLINPUT); 
    1185   else 
    1186     active = WaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms); 
     1180  active = WaitForMultipleObjects (nh + nc, wait_hnd, FALSE, timeout_ms); 
    11871181 
    11881182  if (active == WAIT_FAILED) 
     
    12201214  do 
    12211215    { 
    1222       if (active == nh + nc) 
    1223         { 
    1224           /* There are messages in the lisp thread's queue; we must 
    1225              drain the queue now to ensure they are processed promptly, 
    1226              because if we don't do so, we will not be woken again until 
    1227              further messages arrive. 
    1228  
    1229              NB. If ever we allow window message procedures to callback 
    1230              into lisp, we will need to ensure messages are dispatched 
    1231              at a safe time for lisp code to be run (*), and we may also 
    1232              want to provide some hooks in the dispatch loop to cater 
    1233              for modeless dialogs created by lisp (ie. to register 
    1234              window handles to pass to IsDialogMessage). 
    1235  
    1236              (*) Note that MsgWaitForMultipleObjects above is an 
    1237              internal dispatch point for messages that are sent to 
    1238              windows created by this thread.  */ 
    1239           drain_message_queue (); 
    1240         } 
    1241       else if (active >= nh) 
     1216      if (active >= nh) 
    12421217        { 
    12431218          cp = cps[active - nh]; 
     
    13851360 
    13861361          foreground_window = GetForegroundWindow (); 
    1387           if (foreground_window
     1362          if (foreground_window && SetForegroundWindow (cp->hwnd)
    13881363            { 
    1389               /* NT 5.0, and apparently also Windows 98, will not allow 
    1390                  a Window to be set to foreground directly without the 
    1391                  user's involvement. The workaround is to attach 
    1392                  ourselves to the thread that owns the foreground 
    1393                  window, since that is the only thread that can set the 
    1394                  foreground window.  */ 
    1395               DWORD foreground_thread, child_thread; 
    1396               foreground_thread = 
    1397                 GetWindowThreadProcessId (foreground_window, NULL); 
    1398               if (foreground_thread == GetCurrentThreadId () 
    1399                   || !AttachThreadInput (GetCurrentThreadId (), 
    1400                                          foreground_thread, TRUE)) 
    1401                 foreground_thread = 0; 
    1402  
    1403               child_thread = GetWindowThreadProcessId (cp->hwnd, NULL); 
    1404               if (child_thread == GetCurrentThreadId () 
    1405                   || !AttachThreadInput (GetCurrentThreadId (), 
    1406                                          child_thread, TRUE)) 
    1407                 child_thread = 0; 
    1408  
    1409               /* Set the foreground window to the child.  */ 
    1410               if (SetForegroundWindow (cp->hwnd)) 
    1411                 { 
    1412                   /* Generate keystrokes as if user had typed Ctrl-Break or 
    1413                      Ctrl-C.  */ 
    1414                   keybd_event (VK_CONTROL, control_scan_code, 0, 0); 
    1415                   keybd_event (vk_break_code, break_scan_code, 
    1416                     (vk_break_code == 'C' ? 0 : KEYEVENTF_EXTENDEDKEY), 0); 
    1417                   keybd_event (vk_break_code, break_scan_code, 
    1418                     (vk_break_code == 'C' ? 0 : KEYEVENTF_EXTENDEDKEY) 
    1419                     | KEYEVENTF_KEYUP, 0); 
    1420                   keybd_event (VK_CONTROL, control_scan_code, 
    1421                                KEYEVENTF_KEYUP, 0); 
    1422  
    1423                   /* Sleep for a bit to give time for Emacs frame to respond 
    1424                      to focus change events (if Emacs was active app).  */ 
    1425                   Sleep (100); 
    1426  
    1427                   SetForegroundWindow (foreground_window); 
    1428                 } 
    1429               /* Detach from the foreground and child threads now that 
    1430                  the foreground switching is over.  */ 
    1431               if (foreground_thread) 
    1432                 AttachThreadInput (GetCurrentThreadId (), 
    1433                                    foreground_thread, FALSE); 
    1434               if (child_thread) 
    1435                 AttachThreadInput (GetCurrentThreadId (), 
    1436                                    child_thread, FALSE); 
    1437             } 
    1438         } 
     1364              /* Generate keystrokes as if user had typed Ctrl-Break or 
     1365                 Ctrl-C.  */ 
     1366              keybd_event (VK_CONTROL, control_scan_code, 0, 0); 
     1367              keybd_event (vk_break_code, break_scan_code, 
     1368                           (vk_break_code == 'C' ? 0 : KEYEVENTF_EXTENDEDKEY), 0); 
     1369              keybd_event (vk_break_code, break_scan_code, 
     1370                           (vk_break_code == 'C' ? 0 : KEYEVENTF_EXTENDEDKEY) 
     1371                           | KEYEVENTF_KEYUP, 0); 
     1372              keybd_event (VK_CONTROL, control_scan_code, KEYEVENTF_KEYUP, 0); 
     1373 
     1374              /* Sleep for a bit to give time for Emacs frame to respond 
     1375                 to focus change events (if Emacs was active app).  */ 
     1376              Sleep (10); 
     1377 
     1378              SetForegroundWindow (foreground_window); 
     1379            } 
     1380        } 
    14391381      /* Ctrl-Break is NT equivalent of SIGINT.  */ 
    14401382      else if (!GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, pid)) 
  • branches/GNU/src/w32select.c

    r1667 r1687  
    100100  HANDLE htext; 
    101101  int nbytes; 
    102   int truelen, nlines = 0
     102  int truelen
    103103  unsigned char *src; 
    104104  unsigned char *dst; 
    105  
     105   
    106106  CHECK_STRING (string, 0); 
    107107   
     
    113113  nbytes = STRING_BYTES (XSTRING (string)) + 1; 
    114114  src = XSTRING (string)->data; 
    115   dst = src; 
    116  
    117   /* We need to know how many lines there are, since we need CRLF line 
    118      termination for compatibility with other Windows Programs. 
    119      avoid using strchr because it recomputes the length every time */ 
    120   while ((dst = memchr (dst, '\n', nbytes - (dst - src))) != NULL) 
    121     { 
    122       nlines++; 
    123       dst++; 
    124     } 
    125115 
    126116  { 
     
    145135           while Emacs uses just LF internally).  */ 
    146136 
    147         truelen = nbytes + nlines; 
     137        truelen = nbytes; 
     138        dst = src; 
     139        /* avoid using strchr because it recomputes the length everytime */ 
     140        while ((dst = memchr (dst, '\n', nbytes - (dst - src))) != NULL) 
     141          { 
     142            truelen++; 
     143            dst++; 
     144          } 
    148145 
    149146        if ((htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, truelen)) == NULL) 
     
    195192        Vnext_selection_coding_system = Qnil; 
    196193        coding.mode |= CODING_MODE_LAST_BLOCK; 
    197         bufsize = encoding_buffer_size (&coding, nbytes) + nlines
     194        bufsize = encoding_buffer_size (&coding, nbytes)
    198195        if ((htext = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, bufsize)) == NULL) 
    199196          goto error; 
  • branches/GNU/src/w32term.c

    r1667 r1687  
    543543 (ch & 0x00ff) 
    544544 
    545 #define W32_TEXTOUT(start_offset,nchars)                             \ 
    546 {                                                                    \ 
    547   int charset_dim = CHARSET_DIMENSION(charset);                      \ 
    548   if (font->bdf)                                                     \ 
    549     w32_BDF_TextOut (font->bdf, hdc, left + xoffset,                 \ 
    550                      top + yoffset,                                  \ 
    551                      x_1byte_buffer + start_offset,                  \ 
    552                      charset_dim, nchars, 0);                        \ 
    553   else if (print_via_unicode)                                        \ 
    554     ExtTextOutW (hdc, left + xoffset, top + yoffset,                 \ 
    555                  fuOptions, clip_region,                             \ 
    556                  x_2byte_buffer + start_offset, nchars, NULL);       \ 
    557   else                                                               \ 
    558     ExtTextOut (hdc, left + xoffset, top + yoffset,                  \ 
    559                 fuOptions, clip_region,                              \ 
    560                 x_1byte_buffer + start_offset,                       \ 
    561                 nchars * charset_dim, NULL);                         \ 
    562     start_offset += nchars * (print_via_unicode ? 1 : charset_dim ); \ 
    563     xoffset += nchars * glyph_width;                                 \ 
    564 } 
    565545  
    566546/* Display a sequence of N glyphs found at GP. 
     
    710690           3) Drawing a composite character. 
    711691           4) Font has non-zero _MULE_BASELINE_OFFSET property. 
    712            5) Font is a bdf font. 
    713692           After filling background, we draw glyphs by XDrawString16.  */ 
    714693        int background_filled; 
     
    720699        /* 1 if we find no font or a font of inappropriate size.  */ 
    721700        int require_clipping; 
    722         RECT clip_rectangle; 
    723         LPRECT clip_region = NULL; 
    724         UINT fuOptions = 0; 
    725  
    726701        int codepage = CP_DEFAULT; 
    727702        BOOL print_via_unicode = FALSE; 
     
    770745            font = (XFontStruct *) (fontp->font); 
    771746            codepage = w32_codepage_for_font (fontp->name); 
    772  
    773             if ( font && !font->bdf ) 
    774               print_via_unicode = w32_use_unicode_for_codepage (codepage); 
    775  
    776             baseline = FONT_BASE (font) + fontp->baseline_offset; 
     747            print_via_unicode = w32_use_unicode_for_codepage (codepage); 
     748 
     749            /* tmLastChar will only exceed 255 if TEXTMETRICW is used 
     750               (ie on NT but not on 95). In this case there is no harm 
     751               in being wrong, so have a go anyway.  */ 
     752            baseline =  
     753              (font->tm.tmLastChar > 255 
     754                 ? (line_height + font->tm.tmAscent - font->tm.tmDescent) / 2 
     755                 : f->output_data.w32->font_baseline - fontp->baseline_offset); 
     756            if (FONT_HEIGHT (font) <= line_height 
     757                && (font->tm.tmAscent > baseline 
     758                    || font->tm.tmDescent > line_height - baseline)) 
     759              /* Adjust baseline for this font to show the whole 
     760                 glyphs in a line.  */ 
     761              baseline = line_height - font->tm.tmDescent; 
    777762 
    778763            if (cmpcharp && cmpcharp->cmp_rule == NULL) 
     
    824809                    } 
    825810              } 
     811            /* Japanese Kanji are a special case under w32, as they 
     812               must be printed in SJIS rather than EUC.  */ 
     813            else if ((charset == charset_jisx0208) 
     814                     || (charset == charset_jisx0208_1978) 
     815                     || (charset == charset_id_internal ("japanese-jisx0212"))) 
     816              { 
     817                int sjis1, sjis2; 
     818                for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) 
     819                  { 
     820                    ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp), sjis1, sjis2); 
     821                    *cp = BUILD_WCHAR_T (sjis1, sjis2); 
     822                  } 
     823              } 
    826824            else if (fontp->encoding[charset]) 
    827825              { 
     
    834832                  for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) 
    835833                    *cp = BUILD_WCHAR_T (BYTE1 (*cp), BYTE2 (*cp) | 0x80); 
    836                 /* Special encoding for SJIS Kanji.  */ 
    837                 if (enc == 4) 
    838                   { 
    839                     if (CHARSET_DIMENSION (charset) == 2) 
    840                       { 
    841                         int sjis1, sjis2; 
    842                         for (cp = x_2byte_buffer; 
    843                              cp < x_2byte_buffer + len; cp++) 
    844                           { 
    845                             ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp), 
    846                                          sjis1, sjis2); 
    847                             *cp = BUILD_WCHAR_T (sjis1, sjis2); 
    848                           } 
    849                       } 
    850                     else 
    851                       for (cp = x_2byte_buffer; 
    852                            cp < x_2byte_buffer + len; cp++) 
    853                         *cp = BUILD_WCHAR_T (BYTE1 (*cp), 
    854                                              BYTE2 (*cp) | 0x80); 
    855                   } 
    856834              } 
    857835          } 
     
    867845                if (charset == charset_latin_iso8859_1) 
    868846                  { 
    869                     if (!font->bdf && font->tm.tmLastChar < 0x80) 
     847                    if (font->tm.tmLastChar < 0x80) 
    870848                      /* This font can't display Latin1 characters.  */ 
    871849                      font = NULL; 
     
    934912        if (font) 
    935913          require_clipping = (!NILP (Vclip_large_size_font) 
    936              && ((font->bdf 
    937                   ? (font->bdf->ury > baseline 
    938                      || font->bdf->lly > line_height - baseline) 
    939                   : (font->tm.tmAscent > baseline 
    940                      || font->tm.tmDescent > line_height - baseline)) 
    941                  || (!cmpcharp && FONT_MAX_WIDTH (font) > glyph_width))); 
     914                              && (font->tm.tmAscent > baseline 
     915                                  || font->tm.tmDescent > 
     916                                     line_height - baseline 
     917                                  || (!cmpcharp 
     918                                      && FONT_MAX_WIDTH (font) > glyph_width))); 
    942919 
    943920        if (font && (just_foreground || (cmpcharp && gidx > 0))) 
     
    947924 
    948925        else if (!font 
    949                  || font->bdf 
    950926                 || FONT_HEIGHT (font) < line_height 
    951927                 || FONT_WIDTH (font) < glyph_width 
     
    971947        SetTextColor (hdc, fg); 
    972948        SetBkColor (hdc, bg); 
    973         SetTextAlign (hdc, TA_BASELINE | TA_LEFT); 
    974  
    975         if (print_via_unicode) 
     949 
     950        if ( print_via_unicode ) 
    976951          n_chars = MultiByteToWideChar 
    977952            (codepage, 0, x_1byte_buffer, n_chars, 
     
    980955        if (font) 
    981956          { 
    982             if (font->hfont) 
    983957            SelectObject (hdc, font->hfont); 
    984958 
    985959            if (!cmpcharp) 
    986960              { 
    987                 int xoffset = 0, yoffset = baseline
     961                int multibyte_pos_offset = 0
    988962                if (require_clipping || FONT_WIDTH (font) != glyph_width 
    989963                    || FONT_MAX_WIDTH (font) != FONT_WIDTH (font)) 
    990964                  { 
    991                     /* The incrementing of i in this loop is done 
    992                        inside the W32_CHAROUT macro.  */ 
    993                     for (i = 0; i < n_chars; ) 
     965                    RECT clip_rectangle; 
     966                    LPRECT clip_region = NULL; 
     967                    UINT fuOptions = 0; 
     968 
     969                    for (i = 0; i < n_chars; i++) 
    994970                      { 
    995971                        if (require_clipping) 
     
    1004980                            clip_region = &clip_rectangle; 
    1005981                          } 
    1006                         W32_TEXTOUT (i, 1); 
     982 
     983                        /* baseline works differently on w32 than X, 
     984                           leave it out for now.  */ 
     985                        if (print_via_unicode) 
     986                          ExtTextOutW (hdc, left + glyph_width * i, 
     987                                       top /*+ baseline*/, fuOptions, 
     988                                       clip_region, x_2byte_buffer + i, 
     989                                       1, NULL); 
     990                        else if (CHARSET_DIMENSION (charset) > 1) 
     991                          { 
     992                            /* Keep character together */ 
     993                            int n = CHARSET_DIMENSION (charset) ; 
     994                            ExtTextOut (hdc, left + multibyte_pos_offset, 
     995                                        top /*+ baseline*/, fuOptions, 
     996                                        clip_region, x_1byte_buffer + i, 
     997                                        n, NULL); 
     998                            /* fiddle i.  */ 
     999                            i += n - 1; 
     1000                            multibyte_pos_offset += glyph_width; 
     1001                          } 
     1002                        else 
     1003                          ExtTextOut (hdc, left + glyph_width * i, 
     1004                                      top /*+ baseline*/, fuOptions, 
     1005                                      clip_region, x_1byte_buffer + i, 
     1006                                      1, NULL); 
    10071007                      } 
    10081008                  } 
    10091009                else 
    10101010                  { 
    1011                     i = 0; 
    1012                     W32_TEXTOUT (i, n_chars); 
     1011                    /* Print the whole run of characters.  */ 
     1012                    if (print_via_unicode) 
     1013                      TextOutW (hdc, left, top /*+ baseline*/, 
     1014                                x_2byte_buffer, n_chars); 
     1015                    else 
     1016                      TextOut (hdc, left, top /*+ baseline*/, 
     1017                               x_1byte_buffer, n_chars); 
    10131018                  } 
    10141019              } 
     
    10381043                       HIGHEST is the highest position of glyphs ever 
    10391044                       written, LOWEST the lowest position.  */ 
    1040                     int xoffset = 0; 
    1041                     int yoffset = baseline; 
    1042                     int start = 0; 
     1045                    int x_offset = 0; 
    10431046 
    10441047                    if (default_ascent 
     
    10491052                        lowest = 0; 
    10501053                      } 
    1051                     /* TODO: per char metrics for Truetype and BDF 
    1052                        fonts.  */ 
     1054                    else 
    10531055                      { 
    1054                         highest = FONT_BASE (font) + 1; 
    1055                         lowest = - (FONT_HEIGHT (font) - FONT_BASE (font)); 
     1056                        /* Per char metrics not supported on w32 - use 
     1057                           font's metrics.  */ 
     1058                        highest = font->tm.tmAscent + 1; 
     1059                        lowest = - font->tm.tmDescent; 
    10561060                      } 
    10571061 
    10581062                    if (cmpcharp->cmp_rule) 
    1059                       xoffset = (int)(cmpcharp->col_offset[0] 
     1063                      x_offset = (int)(cmpcharp->col_offset[0] 
    10601064                                  * FONT_WIDTH (FRAME_FONT (f))); 
    10611065 
     
    10771081                        char_width = char_placement.abcA 
    10781082                          + char_placement.abcB + char_placement.abcC; 
    1079                         xoffset += FONT_WIDTH (font) - char_width; 
     1083                        x_offset += FONT_WIDTH (font) - char_width; 
    10801084                      } 
    10811085                    /* Don't let characters go beyond the glyph 
    10821086                       boundary whatever their over/underhangs. */ 
    1083                     if (xoffset > glyph_width - char_width) 
    1084                       xoffset = glyph_width - char_width; 
    1085  
    1086                     if (xoffset < 0) 
    1087                       xoffset = 0; 
    1088  
    1089                     /* Draw the first character at the normal 
    1090                        position.  */ 
    1091                     W32_TEXTOUT (start, 1); 
     1087                    if (x_offset > glyph_width - char_width) 
     1088                      x_offset = glyph_width - char_width; 
     1089 
     1090                    if (x_offset < 0) 
     1091                      x_offset = 0; 
     1092 
     1093                    /* Draw the first character at the normal position.  */ 
     1094                    if (print_via_unicode) 
     1095                      ExtTextOutW (hdc, left + x_offset, 
     1096                                   top /*+ baseline*/, 
     1097                                   fuOptions, clip_region, 
     1098                                   x_2byte_buffer, 1, NULL); 
     1099                    else if (CHARSET_DIMENSION (charset) > 1) 
     1100                      { 
     1101                        /* Keep character together */ 
     1102                        int n = CHARSET_DIMENSION (charset) ; 
     1103                        ExtTextOut (hdc, left + x_offset, 
     1104                                    top /*+ baseline*/, 
     1105                                    fuOptions, clip_region, 
     1106                                    x_1byte_buffer, n, NULL); 
     1107                        /* fiddle i.  */ 
     1108                        i += n - 1; 
     1109                      } 
     1110                    else 
     1111                      ExtTextOut (hdc, left + x_offset, 
     1112                                  top /*+ baseline*/, 
     1113                                  fuOptions, clip_region, 
     1114                                  x_1byte_buffer, 1, NULL); 
    10921115                    gidx++; 
    10931116                  } 
     
    10951118                  i = 0; 
    10961119 
    1097                 for (; i < n_chars; gidx++) 
     1120                for (; i < n_chars; i++, gidx++) 
    10981121                  { 
    1099                     int xoffset = 0, yoffset = FONT_BASE (font)
     1122                    int x_offset = 0, y_offset = 0
    11001123 
    11011124                    if (relative_compose) 
     
    11061129                                            make_number (cmpcharp->glyph[gidx])))) 
    11071130                          { 
    1108                             if (- (FONT_HEIGHT (font) - FONT_BASE (font)) 
    1109                                 >= relative_compose) 
     1131                            if (- font->tm.tmDescent >= relative_compose) 
    11101132                              { 
    11111133                                /* Draw above the current glyphs.  */ 
    1112                                 yoffset = highest + FONT_HEIGHT (font); 
    1113                                 highest += FONT_HEIGHT (font); 
     1134                                y_offset = highest + font->tm.tmDescent; 
     1135                                highest += font->tm.tmAscent 
     1136                                         + font->tm.tmDescent; 
    11141137                              } 
    1115                             else if (FONT_BASE (font) <= 0) 
     1138                            else if (font->tm.tmAscent <= 0) 
    11161139                              { 
    11171140                                /* Draw beneath the current glyphs.  */ 
    1118                                 yoffset = lowest; 
    1119                                 lowest -= FONT_HEIGHT (font); 
     1141                                y_offset = lowest - font->tm.tmAscent; 
     1142                                lowest -= font->tm.tmAscent 
     1143                                        + font->tm.tmDescent; 
    11201144                              } 
    11211145                          } 
     
    11251149                               it sticks out of HIGHEST or LOWEST, 
    11261150                               update them appropriately.  */ 
    1127                             if (FONT_BASE (font) > highest) 
    1128                               highest = FONT_BASE (font); 
    1129                             else if (- (FONT_HEIGHT (font) - FONT_BASE (font)) 
    1130                                      < lowest) 
    1131                               lowest = - (FONT_HEIGHT (font) - 
    1132                                           FONT_BASE (font)); 
     1151                            if (font->tm.tmAscent > highest) 
     1152                              highest = font->tm.tmAscent; 
     1153                            else if (- font->tm.tmDescent < lowest) 
     1154                              lowest = - font->tm.tmDescent; 
    11331155                          } 
    11341156                      } 
     
    11491171                                   : gref == 2 ? lowest 
    11501172                                   : (highest + lowest) / 2) 
    1151                           - (nref == 0 ? FONT_HEIGHT (font) 
    1152                            : nref == 1 ? (FONT_HEIGHT (font) - 
    1153                                           FONT_BASE (font)) 
     1173                                 - (nref == 0 ? font->tm.tmAscent 
     1174                                               + font->tm.tmDescent 
     1175                                     : nref == 1 ? font->tm.tmDescent 
    11541176                                     : nref == 2 ? 0 
    1155                            : (FONT_HEIGHT (font) / 2))); 
    1156                         top = bottom + FONT_HEIGHT (font); 
    1157  
     1177                                     : (font->tm.tmAscent + 
     1178                                        font->tm.tmDescent) / 2)); 
     1179                        top = bottom + (font->tm.tmAscent + 
     1180                                        font->tm.tmDescent); 
    11581181                        if (top > highest) 
    11591182                          highest = top; 
    11601183                        if (bottom < lowest) 
    11611184                          lowest = bottom; 
    1162                         yoffset = bottom + FONT_HEIGHT (font)
    1163                         xoffset = (int)(cmpcharp->col_offset[gidx] 
     1185                        y_offset = bottom + font->tm.tmDescent
     1186                        x_offset = (int)(cmpcharp->col_offset[gidx] 
    11641187                                    * FONT_WIDTH (FRAME_FONT(f))); 
    11651188                      } 
     
    11801203                        char_width = char_placement.abcA 
    11811204                          + char_placement.abcB + char_placement.abcC; 
    1182                         xoffset += FONT_WIDTH (font) - char_width; 
     1205                        x_offset += FONT_WIDTH (font) - char_width; 
    11831206                      } 
    11841207                    /* Don't let characters go beyond the glyph 
    11851208                       boundary whatever their over/underhangs. */ 
    1186                     if (xoffset > glyph_width - char_width) 
    1187                       xoffset = glyph_width - char_width; 
    1188  
    1189                     if (xoffset < 0) 
    1190                       xoffset = 0; 
    1191  
    1192                     W32_TEXTOUT (i, 1); 
     1209                    if (x_offset > glyph_width - char_width) 
     1210                      x_offset = glyph_width - char_width; 
     1211 
     1212                    if (x_offset < 0) 
     1213                      x_offset = 0; 
     1214 
     1215                    if (print_via_unicode) 
     1216                      ExtTextOutW (hdc, left + x_offset, 
     1217                                   top /*+ baseline - y_offset*/, 
     1218                                   fuOptions, clip_region, 
     1219                                   x_2byte_buffer + i, 1, NULL); 
     1220                    else if (CHARSET_DIMENSION (charset) > 1) 
     1221                      { 
     1222                        /* Keep character together */ 
     1223                        int n = CHARSET_DIMENSION (charset) ; 
     1224                        ExtTextOut (hdc, left + x_offset, 
     1225                                    top /*+ baseline - y_offset*/, 
     1226                                    fuOptions, clip_region, 
     1227                                    x_1byte_buffer + i, n, NULL); 
     1228                        /* fiddle i.  */ 
     1229                        i += n - 1; 
     1230                      } 
     1231                    else 
     1232                      ExtTextOut (hdc, left + x_offset, 
     1233                                  top /*+ baseline - y_offset*/, 
     1234                                  fuOptions, clip_region, 
     1235                                  x_1byte_buffer + i, 1, NULL); 
    11931236                  } 
    11941237              } 
     
    12241267          int underline_position = 1; 
    12251268 
    1226           if (FONT_HEIGHT (FRAME_FONT (f)) - FONT_BASE(FRAME_FONT (f)) 
    1227               <= underline_position) 
    1228             underline_position = (FONT_HEIGHT (FRAME_FONT (f)) - 
    1229                                   FONT_BASE(FRAME_FONT (f))) - 1; 
     1269          if (FRAME_FONT (f)->tm.tmDescent <= underline_position) 
     1270            underline_position = FRAME_FONT (f)->tm.tmDescent - 1; 
    12301271 
    12311272          if (face->underline) 
     
    19732014  result->modifiers = msg->dwModifiers; 
    19742015 
    1975   hdrop = (HDROP) msg->msg.wParam; 
    1976   DragQueryPoint (hdrop, &p); 
    1977  
    19782016  p.x = LOWORD (msg->msg.lParam); 
    19792017  p.y = HIWORD (msg->msg.lParam); 
     
    19822020  XSETINT (result->y, p.y); 
    19832021 
     2022  hdrop = (HDROP) msg->msg.wParam; 
     2023  DragQueryPoint (hdrop, &p); 
    19842024  num_files = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0); 
    19852025  files = Qnil; 
     
    41394179  FRAME_FONT (f) = (XFontStruct *) (fontp->font); 
    41404180  f->output_data.w32->font_baseline 
    4141     = FONT_BASE (FRAME_FONT (f)) + fontp->baseline_offset; 
     4181    = FRAME_FONT(f)->tm.tmAscent + fontp->baseline_offset; 
    41424182  FRAME_FONTSET (f) = -1; 
    41434183 
     
    51165156  w32_enable_unicode_output = 1; 
    51175157 
     5158  /* w32-charset-to-codepage-alist is initialized in w32-win.el.  */ 
    51185159  DEFVAR_LISP ("w32-charset-to-codepage-alist", 
    51195160               &Vw32_charset_to_codepage_alist, 
     
    51295170  XSETFASTINT (codepage, 949); 
    51305171  store_in_alist (&Vw32_charset_to_codepage_alist, 
    5131                   build_string ("ksc5601.1987"), codepage); 
    5132   XSETFASTINT (codepage, 1361); 
     5172                  build_string ("ksc5601"), codepage); 
     5173  XSETFASTINT (codepage, 932); 
     5174  /* SJIS only contains a subset of JISX0212, but list it anyway.  */ 
    51335175  store_in_alist (&Vw32_charset_to_codepage_alist, 
    5134                   build_string ("ksc5601.1992"), codepage); 
     5176                  build_string ("jisx0212-sjis"), codepage); 
    51355177  XSETFASTINT (codepage, 932); 
    51365178  store_in_alist (&Vw32_charset_to_codepage_alist, 
  • branches/GNU/src/w32term.h

    r1667 r1687  
    2929#define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255) 
    3030 
    31 #define FONT_WIDTH(f)       \ 
    32   ((f)->bdf ? (f)->bdf->width : (f)->tm.tmAveCharWidth) 
    33 #define FONT_HEIGHT(f)      \ 
    34    ((f)->bdf ? (f)->bdf->height : (f)->tm.tmHeight) 
    35 /* No idea why 5 seems to work in here, but it does */ 
    36 #define FONT_BASE(f)        \ 
    37   ((f)->bdf ? (f)->bdf->ury : (f)->tm.tmAscent) 
    38 #define FONT_MAX_WIDTH(f)   \ 
    39   ((f)->bdf ? (f)->bdf->width : (f)->tm.tmMaxCharWidth) 
     31#define FONT_WIDTH(f)   ((f)->tm.tmAveCharWidth) 
     32#define FONT_HEIGHT(f)  ((f)->tm.tmHeight) 
     33#define FONT_BASE(f)    ((f)->tm.tmAscent) 
     34#define FONT_MAX_WIDTH(f) ((f)->tm.tmMaxCharWidth) 
    4035 
    4136#define CHECK_W32_FRAME(f, frame)               \ 
  • branches/GNU/src/w32xfns.c

    r1663 r1687  
    239239  return (TRUE); 
    240240} 
    241  
    242 /* Process all messages in the current thread's queue.  */ 
    243 void 
    244 drain_message_queue () 
    245 { 
    246   MSG msg; 
    247   while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) 
    248     { 
    249       TranslateMessage (&msg); 
    250       DispatchMessage (&msg); 
    251     } 
    252 } 
    253  
    254241 
    255242/* 
  • branches/GNU/src/xdisp.c

    <
    r1667 r1687  
    20902090                            - (last_point_x + hscroll - !! hscroll)); 
    20912091 
    2092           pos = *compute_motion (last_point, last_point_y, last_point_x, 1
     2092          pos = *compute_motion (last_point, last_point_y, last_point_x, 0
    20932093                                 PT, height, 
    20942094                                 /* BUG FIX: See the comment of  
     
    28992899 
    29002900  val.bytepos = pos_byte; 
    2901   val.ovstring_chars_done = 0; 
    29022901 
    29032902  /* Redisplay the lines where the text was changed */ 
     
    34583457                      ovlen -= ovstr_done; 
    34593458 
    3460                       while (ovlen > 0 && p1 < endp
     3459                      while (ovlen > 0
    34613460                        { 
    34623461                          int charset, cols; 
     
    45584557   type of CODING_SYSTEM.  Return updated pointer into BUF.  */ 
    45594558 
    4560 static char invalid_eol_type[] = "(*invalid*)"; 
    4561  
    45624559static char * 
    45634560decode_mode_spec_coding (coding_system, buf, eol_flag) 
     
    45684565  Lisp_Object val; 
    45694566  int multibyte = !NILP (current_buffer->enable_multibyte_characters); 
    4570   unsigned char *eol_str; 
    4571   int eol_str_len; 
    4572   /* The EOL conversion we are using.  */ 
    4573   Lisp_Object eoltype; 
    45744567 
    45754568  val = coding_system; 
     
    45804573        *buf++ = '-'; 
    45814574      if (eol_flag) 
    4582         eoltype = eol_mnemonic_undecided; 
     4575        *buf++ = eol_mnemonic_undecided; 
    45834576      /* Don't mention EOL conversion if it isn't decided.  */ 
    45844577    } 
     
    46014594      if (eol_flag) 
    46024595        { 
     4596          /* The EOL conversion we are using.  */ 
     4597          int eoltype; 
    46034598          /* The EOL conversion that is normal on this system.  */