comparison src/w32term.c @ 83331:efa9e4606e7e

Merged from miles@gnu.org--gnu-2005 (patch 83-87, 449-468) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-449 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-450 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-451 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-452 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-453 Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-454 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-455 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-456 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-457 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-459 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-460 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-461 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-462 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-463 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-464 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-465 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-466 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-467 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-468 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-83 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-84 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-85 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-86 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-87 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-371
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 05 Jul 2005 22:12:55 +0000
parents e58cb448e07c 12f374b6c866
children 6c13700d1c13
comparison
equal deleted inserted replaced
83330:233c9974025b 83331:efa9e4606e7e
135 135
136 /* Flag to enable Unicode output in case users wish to use programs 136 /* Flag to enable Unicode output in case users wish to use programs
137 like Twinbridge on '95 rather than installed system level support 137 like Twinbridge on '95 rather than installed system level support
138 for Far East languages. */ 138 for Far East languages. */
139 int w32_enable_unicode_output; 139 int w32_enable_unicode_output;
140
141 /* Flag to enable Cleartype hack for font metrics. */
142 static int cleartype_active;
140 143
141 DWORD dwWindowsThreadId = 0; 144 DWORD dwWindowsThreadId = 0;
142 HANDLE hWindowsThread = NULL; 145 HANDLE hWindowsThread = NULL;
143 DWORD dwMainThreadId = 0; 146 DWORD dwMainThreadId = 0;
144 HANDLE hMainThread = NULL; 147 HANDLE hMainThread = NULL;
505 int x, y0, y1; 508 int x, y0, y1;
506 { 509 {
507 struct frame *f = XFRAME (WINDOW_FRAME (w)); 510 struct frame *f = XFRAME (WINDOW_FRAME (w));
508 RECT r; 511 RECT r;
509 HDC hdc; 512 HDC hdc;
513 struct face *face;
510 514
511 r.left = x; 515 r.left = x;
512 r.right = x + 1; 516 r.right = x + 1;
513 r.top = y0; 517 r.top = y0;
514 r.bottom = y1; 518 r.bottom = y1;
515 519
516 hdc = get_frame_dc (f); 520 hdc = get_frame_dc (f);
517 w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); 521 face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
522 if (face)
523 w32_fill_rect (f, hdc, face->foreground, &r);
524 else
525 w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r);
526
518 release_frame_dc (f, hdc); 527 release_frame_dc (f, hdc);
519 } 528 }
520 529
521 530
522 /* End update of window W (which is equal to updated_window). 531 /* End update of window W (which is equal to updated_window).
905 /* Don't trust the ABC widths. For synthesized fonts they are 914 /* Don't trust the ABC widths. For synthesized fonts they are
906 wrong, and so is the result of GetCharWidth()! */ 915 wrong, and so is the result of GetCharWidth()! */
907 int real_width; 916 int real_width;
908 GetCharWidth (hdc, *char2b, *char2b, &real_width); 917 GetCharWidth (hdc, *char2b, *char2b, &real_width);
909 #endif 918 #endif
919 if (cleartype_active)
920 {
921 /* Cleartype antialiasing causes characters to overhang
922 by a pixel on each side compared with what GetCharABCWidths
923 reports. */
924 char_widths.abcA -= 1;
925 char_widths.abcC -= 1;
926 char_widths.abcB += 2;
927 }
928
910 pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC; 929 pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC;
911 #if 0 930 #if 0
912 /* As far as I can tell, this is the best way to determine what 931 /* As far as I can tell, this is the best way to determine what
913 ExtTextOut will do with the broken font. */ 932 ExtTextOut will do with the broken font. */
914 if (pcm->width != real_width) 933 if (pcm->width != real_width)
6402 w32_system_caret_hwnd = NULL; 6421 w32_system_caret_hwnd = NULL;
6403 w32_system_caret_height = 0; 6422 w32_system_caret_height = 0;
6404 w32_system_caret_x = 0; 6423 w32_system_caret_x = 0;
6405 w32_system_caret_y = 0; 6424 w32_system_caret_y = 0;
6406 6425
6426 /* Initialize w32_use_visible_system_caret based on whether a screen
6427 reader is in use. */
6428 if (!SystemParametersInfo (SPI_GETSCREENREADER, 0,
6429 &w32_use_visible_system_caret, 0))
6430 w32_use_visible_system_caret = 0;
6431
6407 last_tool_bar_item = -1; 6432 last_tool_bar_item = -1;
6408 any_help_event_p = 0; 6433 any_help_event_p = 0;
6409 6434
6410 /* Initialize input mode: interrupt_input off, no flow control, allow 6435 /* Initialize input mode: interrupt_input off, no flow control, allow
6411 8 bit character input, standard quit char. */ 6436 8 bit character input, standard quit char. */
6446 #endif 6471 #endif
6447 6472
6448 /* Dynamically link to optional system components. */ 6473 /* Dynamically link to optional system components. */
6449 { 6474 {
6450 HANDLE user_lib = LoadLibrary ("user32.dll"); 6475 HANDLE user_lib = LoadLibrary ("user32.dll");
6476 UINT smoothing_type;
6477 BOOL smoothing_enabled;
6451 6478
6452 #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) 6479 #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn)
6453 6480
6454 /* New proportional scroll bar functions. */ 6481 /* New proportional scroll bar functions. */
6455 LOAD_PROC (SetScrollInfo); 6482 LOAD_PROC (SetScrollInfo);
6466 6493
6467 /* For either kind of scroll bar, take account of the arrows; these 6494 /* For either kind of scroll bar, take account of the arrows; these
6468 effectively form the border of the main scroll bar range. */ 6495 effectively form the border of the main scroll bar range. */
6469 vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border 6496 vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border
6470 = GetSystemMetrics (SM_CYVSCROLL); 6497 = GetSystemMetrics (SM_CYVSCROLL);
6498
6499 /* Constants that are not always defined by the system headers
6500 since they only exist on certain versions of Windows. */
6501 #ifndef SPI_GETFONTSMOOTHING
6502 #define SPI_GETFONTSMOOTHING 0x4A
6503 #endif
6504 #ifndef SPI_GETFONTSMOOTHINGTYPE
6505 #define SPI_GETFONTSMOOTHINGTYPE 0x0200A
6506 #endif
6507 #ifndef FE_FONTSMOOTHINGCLEARTYPE
6508 #define FE_FONTSMOOTHINGCLEARTYPE 0x2
6509 #endif
6510
6511 /* Determine if Cleartype is in use. Used to enable a hack in
6512 the char metric calculations which adds extra pixels to
6513 compensate for the "sub-pixels" that are not counted by the
6514 system APIs. */
6515 cleartype_active =
6516 SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0)
6517 && smoothing_enabled
6518 && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0)
6519 && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE;
6471 } 6520 }
6472 } 6521 }
6473 6522
6474 void 6523 void
6475 syms_of_w32term () 6524 syms_of_w32term ()
6535 software is running as it starts up. 6584 software is running as it starts up.
6536 6585
6537 When this variable is set, other variables affecting the appearance of 6586 When this variable is set, other variables affecting the appearance of
6538 the cursor have no effect. */); 6587 the cursor have no effect. */);
6539 6588
6540 /* Initialize w32_use_visible_system_caret based on whether a screen 6589 w32_use_visible_system_caret = 0;
6541 reader is in use. */
6542 if (!SystemParametersInfo (SPI_GETSCREENREADER, 0,
6543 &w32_use_visible_system_caret, 0))
6544 w32_use_visible_system_caret = 0;
6545 6590
6546 /* We don't yet support this, but defining this here avoids whining 6591 /* We don't yet support this, but defining this here avoids whining
6547 from cus-start.el and other places, like "M-x set-variable". */ 6592 from cus-start.el and other places, like "M-x set-variable". */
6548 DEFVAR_BOOL ("x-use-underline-position-properties", 6593 DEFVAR_BOOL ("x-use-underline-position-properties",
6549 &x_use_underline_position_properties, 6594 &x_use_underline_position_properties,