Changeset 1683
- Timestamp:
- 02/17/98 01:45:18 (11 years ago)
- Files:
-
- branches/GNU/src/w16select.c (modified) (19 diffs)
- branches/GNU/src/w32.c (modified) (7 diffs)
- branches/GNU/src/w32.h (modified) (4 diffs)
- branches/GNU/src/w32console.c (modified) (4 diffs)
- branches/GNU/src/w32faces.c (modified) (20 diffs)
- branches/GNU/src/w32fns.c (modified) (60 diffs)
- branches/GNU/src/w32gui.h (modified) (1 diff)
- branches/GNU/src/w32heap.c (modified) (10 diffs)
- branches/GNU/src/w32heap.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/GNU/src/w16select.c
r1679 r1683 73 73 static Lisp_Object Vselection_coding_system; 74 74 75 /* Coding system for the next communicating with other Windows programs. */76 static Lisp_Object Vnext_selection_coding_system;77 78 75 /* The segment address and the size of the buffer in low 79 76 memory used to move data between us and WinOldAp module. */ … … 225 222 } 226 223 227 /* Copy data into the clipboard, return zero if successfull. */224 /* Copy data into the clipboard, return non-zero if successfull. */ 228 225 unsigned 229 226 set_clipboard_data (Format, Data, Size, Raw) … … 244 241 standard CF_OEMTEXT clipboard format uses CRLF line endings, 245 242 while Emacs uses just LF internally). */ 246 truelen = Size + 1; /* +1 for the terminating null */243 truelen = Size; 247 244 248 245 if (!Raw) … … 272 269 while (Size--) 273 270 { 274 /* Don't allow them to put binary data into the clipboard, since275 it will cause yanked data to be truncated at the first null. */276 if (*dp == '\0')277 return 2;278 271 if (*dp == '\n') 279 272 _farnspokeb (buf_offset++, '\r'); … … 281 274 } 282 275 } 283 284 /* Terminate with a null, otherwise Windows does strange things when285 the text size is an integral multiple of 32 bytes. */286 _farnspokeb (buf_offset, *dp);287 276 288 277 /* Calls Int 2Fh/AX=1703h with: … … 302 291 free_xfer_buf (); 303 292 304 /* Zero means success, otherwise (1 or 2) it's an error. */ 305 return regs.x.ax > 0 ? 0 : 1; 293 return regs.x.ax; 306 294 } 307 295 … … 336 324 { 337 325 __dpmi_regs regs; 326 unsigned datalen = 0; 338 327 unsigned long xbuf_addr; 339 328 unsigned char *dp = Data; 340 /* The last 32-byte aligned block of data. See commentary below. */341 unsigned char *last_block = dp + ((Size & 0x1f)342 ? (Size & 0x20)343 : Size - 0x20);344 329 345 330 if (Format != CF_OEMTEXT) … … 377 362 *dp++ = '\n'; 378 363 xbuf_addr++; 379 last_block--; /* adjust the beginning of the last 32 bytes */380 364 } 381 365 /* Windows reportedly rounds up the size of clipboard data 382 366 (passed in SIZE) to a multiple of 32. We therefore bail 383 out when we see the first null character in the last 32-byte 384 block. */ 385 else if (c == '\0' && dp > last_block) 386 break; 367 out when we see the first null character. */ 368 else if (c == '\0') 369 { 370 datalen = dp - (unsigned char *)Data - 1; 371 break; 372 } 387 373 } 388 374 } … … 390 376 free_xfer_buf (); 391 377 392 return (unsigned) (dp - (unsigned char *)Data - 1);378 return datalen; 393 379 } 394 380 … … 427 413 static char no_mem_msg[] = 428 414 "(Not enough DOS memory to put saved text into clipboard.)"; 429 static char binary_msg[] =430 "(Binary characters in saved text; clipboard data not set.)";431 415 432 416 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0, … … 435 419 Lisp_Object string, frame; 436 420 { 437 unsigned ok = 1, put_status = 0;421 int ok = 1, ok1 = 1; 438 422 int nbytes; 439 423 unsigned char *src, *dst = NULL; … … 458 442 /* Since we are now handling multilingual text, we must consider 459 443 encoding text for the clipboard. */ 444 460 445 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); 461 446 num = ((nbytes <= 1 /* Check the possibility of short cut. */ 462 || !STRING_MULTIBYTE (string) 463 || nbytes == XSTRING (string)->size) 447 || NILP (buffer_defaults.enable_multibyte_characters)) 464 448 ? 0 465 : find_charset_in_str (src, nbytes, charsets, Qnil, 0,1));449 : find_charset_in_str (src, nbytes, charsets, Qnil, 1)); 466 450 467 451 if (!num || (num == 1 && charsets[CHARSET_ASCII])) … … 479 463 unsigned char *htext2; 480 464 481 if (NILP (Vnext_selection_coding_system))482 Vnext_selection_coding_system = Vselection_coding_system;483 465 setup_coding_system 484 (Fcheck_coding_system (Vnext_selection_coding_system), &coding); 485 Vnext_selection_coding_system = Qnil; 466 (Fcheck_coding_system (Vselection_coding_system), &coding); 486 467 coding.mode |= CODING_MODE_LAST_BLOCK; 487 468 Vlast_coding_system_used = coding.symbol; … … 496 477 497 478 ok = empty_clipboard () 498 && ((put_status 499 = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)) 500 == 0); 479 && (ok1 = set_clipboard_data (CF_OEMTEXT, src, nbytes, no_crlf_conversion)); 501 480 502 481 if (!no_crlf_conversion) … … 520 499 fail the function, people might wonder why their text sometimes 521 500 doesn't make it to the clipboard. */ 522 if (put_status) 523 { 524 switch (put_status) 525 { 526 case 1: 527 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); 528 break; 529 case 2: 530 message2 (binary_msg, sizeof (binary_msg) - 1, 0); 531 break; 532 } 501 if (ok1 == 0) 502 { 503 message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0); 533 504 sit_for (2, 0, 0, 1, 1); 534 505 } … … 536 507 done: 537 508 538 return (ok && put_status == 0? string : Qnil);509 return (ok ? string : Qnil); 539 510 } 540 511 … … 573 544 574 545 /* Do we need to decode it? */ 575 if ( 576 #if 1 577 1 578 #else 579 ! NILP (buffer_defaults.enable_multibyte_characters) 580 #endif 581 ) 546 if (! NILP (buffer_defaults.enable_multibyte_characters)) 582 547 { 583 548 /* If the clipboard data contains any 8-bit Latin-1 code, we … … 600 565 struct coding_system coding; 601 566 602 if (NILP (Vnext_selection_coding_system))603 Vnext_selection_coding_system = Vselection_coding_system;604 567 setup_coding_system 605 (Fcheck_coding_system (Vnext_selection_coding_system), &coding); 606 Vnext_selection_coding_system = Qnil; 568 (Fcheck_coding_system (Vselection_coding_system), &coding); 607 569 coding.mode |= CODING_MODE_LAST_BLOCK; 608 570 truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1); … … 694 656 A default value is `iso-latin-1-dos'"); 695 657 Vselection_coding_system=intern ("iso-latin-1-dos"); 696 697 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, 698 "Coding system for the next communication with other X clients.\n\ 699 Usually, `selection-coding-system' is used for communicating with\n\ 700 other X clients. But, if this variable is set, it is used for the\n\ 701 next communication only. After the communication, this variable is\n\ 702 set to nil."); 703 Vnext_selection_coding_system = Qnil; 658 staticpro(&Vselection_coding_system); 704 659 705 660 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); branches/GNU/src/w32.c
r1679 r1683 504 504 memcpy (o, full, len); 505 505 o += len; 506 *o = '\0';507 506 size -= len; 508 507 509 while (p != NULL && *p)508 do 510 509 { 511 510 q = p; … … 530 529 return FALSE; 531 530 } 531 while (p != NULL && *p); 532 532 533 533 return TRUE; … … 1961 1961 if (GetFileInformationByHandle (fh, &info)) 1962 1962 { 1963 switch (GetFileType (fh)) 1964 { 1965 case FILE_TYPE_DISK: 1966 buf->st_mode = _S_IFREG; 1967 break; 1968 case FILE_TYPE_PIPE: 1969 buf->st_mode = _S_IFIFO; 1970 break; 1971 case FILE_TYPE_CHAR: 1972 case FILE_TYPE_UNKNOWN: 1973 default: 1974 buf->st_mode = _S_IFCHR; 1975 } 1963 1976 buf->st_nlink = info.nNumberOfLinks; 1964 1977 /* Might as well use file index to fake inode values, but this … … 1968 1981 (on NTFS, presumably less on FAT). */ 1969 1982 fake_inode = info.nFileIndexLow ^ info.nFileIndexHigh; 1983 CloseHandle (fh); 1970 1984 } 1971 1985 else 1972 1986 { 1973 buf->st_nlink = 1; 1974 fake_inode = 0; 1975 } 1976 1977 switch (GetFileType (fh)) 1978 { 1979 case FILE_TYPE_DISK: 1980 buf->st_mode = _S_IFREG; 1981 break; 1982 case FILE_TYPE_PIPE: 1983 buf->st_mode = _S_IFIFO; 1984 break; 1985 case FILE_TYPE_CHAR: 1986 case FILE_TYPE_UNKNOWN: 1987 default: 1988 buf->st_mode = _S_IFCHR; 1989 } 1990 CloseHandle (fh); 1987 errno = EACCES; 1988 return -1; 1989 } 1991 1990 } 1992 1991 else … … 3026 3025 not exist in the expected place, tell the user. */ 3027 3026 3028 if (!noninteractive && !inhibit_window_system) 3029 { 3030 extern Lisp_Object Vwindow_system, Vload_path, Qfile_exists_p; 3031 Lisp_Object objs[2]; 3032 Lisp_Object full_load_path; 3033 Lisp_Object init_file; 3034 int fd; 3035 3036 objs[0] = Vload_path; 3037 objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH"))); 3038 full_load_path = Fappend (2, objs); 3039 init_file = build_string ("term/w32-win"); 3040 fd = openp (full_load_path, init_file, ".el:.elc", NULL, 0); 3041 if (fd < 0) 3042 { 3043 Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil); 3044 char *init_file_name = XSTRING (init_file)->data; 3045 char *load_path = XSTRING (load_path_print)->data; 3046 char *buffer = alloca (1024); 3047 3048 sprintf (buffer, 3049 "The Emacs Windows initialization file \"%s.el\" " 3050 "could not be found in your Emacs installation. " 3051 "Emacs checked the following directories for this file:\n" 3052 "\n%s\n\n" 3053 "When Emacs cannot find this file, it usually means that it " 3054 "was not installed properly, or its distribution file was " 3055 "not unpacked properly.\nSee the README.W32 file in the " 3056 "top-level Emacs directory for more information.", 3057 init_file_name, load_path); 3058 MessageBox (NULL, 3059 buffer, 3060 "Emacs Abort Dialog", 3061 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); 3027 if (!noninteractive && !inhibit_window_system) { 3028 extern Lisp_Object Vwindow_system, Vload_path; 3029 Lisp_Object init_file; 3030 int fd; 3031 3032 init_file = build_string ("term/w32-win"); 3033 fd = openp (Vload_path, init_file, ".el:.elc", NULL, 0); 3034 if (fd < 0) { 3035 Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil); 3036 char *init_file_name = XSTRING (init_file)->data; 3037 char *load_path = XSTRING (load_path_print)->data; 3038 char *buffer = alloca (1024); 3039 3040 sprintf (buffer, 3041 "The Emacs Windows initialization file \"%s.el\" " 3042 "could not be found in your Emacs installation. " 3043 "Emacs checked the following directories for this file:\n" 3044 "\n%s\n\n" 3045 "When Emacs cannot find this file, it usually means that it " 3046 "was not installed properly, or its distribution file was " 3047 "not unpacked properly.\nSee the README.W32 file in the " 3048 "top-level Emacs directory for more information.", 3049 init_file_name, load_path); 3050 MessageBox (NULL, 3051 buffer, 3052 "Emacs Abort Dialog", 3053 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); 3054 close (fd); 3055 3062 3056 /* Use the low-level Emacs abort. */ 3063 3057 #undef abort 3064 abort (); 3065 } 3066 else 3067 { 3068 close (fd); 3069 } 3070 } 3058 abort (); 3059 } 3060 } 3071 3061 } 3072 3062 … … 3078 3068 term_winsock (); 3079 3069 #endif 3070 3071 /* Check whether we are shutting down because we cannot find the 3072 Windows initialization file. Do this during shutdown so that 3073 Emacs is initialized as possible, and so that it is out of the 3074 critical startup path. */ 3075 check_windows_init_file (); 3080 3076 } 3081 3077 … … 3177 3173 } 3178 3174 } 3179 3180 /* Check to see if Emacs has been installed correctly. */3181 check_windows_init_file ();3182 3175 } 3183 3176 branches/GNU/src/w32.h
r1669 r1683 1 #ifndef EMACS_W32_H2 #define EMACS_W32_H1 #ifndef _NT_H_ 2 #define _NT_H_ 3 3 4 4 /* Support routines for the NT version of Emacs. … … 21 21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 22 Boston, MA 02111-1307, USA. */ 23 24 23 25 24 /* File descriptor set emulation. */ … … 105 104 /* ------------------------------------------------------------------------- */ 106 105 107 /* Equivalent of strerror for W32 error codes. */108 extern char * w32_strerror (int error_no);109 110 106 /* Get long (aka "true") form of file name, if it exists. */ 111 107 extern BOOL w32_get_long_filename (char * name, char * buf, int size); … … 125 121 extern void term_ntproc (); 126 122 127 #endif /* EMACS_W32_H*/123 #endif /* _NT_H_ */ branches/GNU/src/w32console.c
r1679 r1683 413 413 414 414 static unsigned int sound_type = 0xFFFFFFFF; 415 #define MB_EMACS_SILENT (0xFFFFFFFF - 1)416 415 417 416 void … … 419 418 { 420 419 if (sound_type == 0xFFFFFFFF) 421 {422 420 Beep (666, 100); 423 }424 else if (sound_type == MB_EMACS_SILENT)425 {426 /* Do nothing. */427 }428 421 else 429 MessageBeep (sound_type);422 MessageBeep (sound_type); 430 423 } 431 424 432 425 DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, 433 426 "Set the sound generated when the bell is rung.\n\ 434 SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent\n\ 435 to use the corresponding system sound for the bell. The 'silent sound\n\ 436 prevents Emacs from making any sound at all.\n\ 427 SOUND is 'asterisk, 'exclamation, 'hand, 'question, or 'ok\n\ 428 to use the corresponding system sound for the bell.\n\ 437 429 SOUND is nil to use the normal beep.") 438 430 (sound) … … 453 445 else if (EQ (sound, intern ("ok"))) 454 446 sound_type = MB_OK; 455 else if (EQ (sound, intern ("silent")))456 sound_type = MB_EMACS_SILENT;457 447 else 458 448 sound_type = 0xFFFFFFFF; … … 572 562 char_attr_normal = char_attr; 573 563 char_attr_reverse = ((char_attr & 0xf) << 4) + ((char_attr & 0xf0) >> 4); 574 575 /* Lines per page. Use buffer coords instead of buffer size.*/576 FRAME_HEIGHT (selected_frame) = 1 + info.srWindow.Bottom -577 info.srWindow.Top;578 /* Characters per line. Use buffer coords instead of buffer size. */ 579 SET_FRAME_WIDTH (selected_frame, 1 + info.srWindow.Right -580 info.srWindow.Left);564 565 FRAME_HEIGHT (selected_frame) = info.dwSize.Y; /* lines per page */ 566 SET_FRAME_WIDTH (selected_frame, info.dwSize.X); /* characters per line */ 567 568 // move_cursor (0, 0); 569 570 // clear_frame (); 581 571 } 582 572 branches/GNU/src/w32faces.c
r1679 r1683 34 34 #include "window.h" 35 35 #include "intervals.h" 36 #include "charset.h"37 #include "fontset.h"38 36 39 37 … … 53 51 the face, 54 52 FONT, FOREGROUND, and BACKGROUND are strings naming the fonts and colors 55 to use with the face, FONT may name fontsets,53 to use with the face, 56 54 BACKGROUND-PIXMAP is the name of an x bitmap filename, which we don't 57 55 use right now, and … … 65 63 global parameters for that face. 66 64 67 Let PARAM-FACE be FRAME-> output_data.w32->param_faces[Faref(FACE-VECTOR,2)].65 Let PARAM-FACE be FRAME->display.x->param_faces[Faref (FACE-VECTOR, 2)]. 68 66 PARAM_FACE is a struct face whose members are the Xlib analogues of 69 67 the parameters in FACE-VECTOR. If an element of FACE-VECTOR is … … 71 69 These faces are called "parameter faces", because they're the ones 72 70 lisp manipulates to control what gets displayed. Elements 0 and 1 73 of FRAME-> output_data.w32->param_faces are special - they describe the71 of FRAME->display.x->param_faces are special - they describe the 74 72 default and mode line faces. None of the faces in param_faces have 75 73 GC's. (See src/dispextern.h for the definition of struct face. … … 82 80 of their members are FACE_DEFAULT; they are completely specified. 83 81 They then call intern_compute_face to search 84 FRAME-> output_data.x->computed_faces for a matching face, add one if82 FRAME->display.x->computed_faces for a matching face, add one if 85 83 none is found, and return the index into 86 FRAME-> output_data.x->computed_faces. FRAME's glyph matrices use these84 FRAME->display.x->computed_faces. FRAME's glyph matrices use these 87 85 indices to record the faces of the matrix characters, and the X 88 86 display hooks consult compute_faces to decide how to display these … … 98 96 This is done from time to time so that we don't hold on to 99 97 lots of GCs that are no longer needed. 100 101 If a computed face has 0 as its font,102 it is unused, and can be reused by new_computed_face.103 98 104 99 Constraints: … … 135 130 #define FACE_DEFAULT (~0) 136 131 137 Lisp_Object Qface ;132 Lisp_Object Qface, Qmouse_face; 138 133 Lisp_Object Qpixmap_spec_p; 139 140 extern Lisp_Object Qmouse_face; /* In textprop.c. */141 134 142 135 int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ ); … … 160 153 bzero (result, sizeof (struct face)); 161 154 result->font = (XFontStruct *) FACE_DEFAULT; 162 result->fontset = -1;163 155 result->foreground = FACE_DEFAULT; 164 156 result->background = FACE_DEFAULT; … … 175 167 176 168 result->font = face->font; 177 result->fontset = face->fontset;178 169 result->foreground = face->foreground; 179 170 result->background = face->background; … … 191 182 { 192 183 return ( face1->font == face2->font 193 && face1->fontset == face2->fontset194 184 && face1->foreground == face2->foreground 195 185 && face1->background == face2->background … … 234 224 Lisp_Object name; 235 225 { 236 struct font_info *fontinf; 237 XFontStruct *font = NULL; 226 XFontStruct *font; 238 227 239 228 if (NILP (name)) … … 242 231 CHECK_STRING (name, 0); 243 232 BLOCK_INPUT; 244 font inf = w32_load_font (f, (char *) XSTRING (name)->data, 0);233 font = w32_load_font (FRAME_W32_DISPLAY_INFO (f), (char *) XSTRING (name)->data); 245 234 UNBLOCK_INPUT; 246 if (fontinf)247 font = (XFontStruct *)fontinf->font;248 235 249 236 if (! font) … … 295 282 296 283 DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0, 297 "Return t if OBJECTis a valid pixmap specification.")298 ( object)299 Lisp_Object object;284 "Return t if ARG is a valid pixmap specification.") 285 (arg) 286 Lisp_Object arg; 300 287 { 301 288 Lisp_Object height, width; 302 289 303 return ((STRINGP ( object)304 || (CONSP ( object)305 && CONSP (XCONS ( object)->cdr)306 && CONSP (XCONS (XCONS ( object)->cdr)->cdr)307 && NILP (XCONS (XCONS (XCONS ( object)->cdr)->cdr)->cdr)308 && (width = XCONS ( object)->car, INTEGERP (width))309 && (height = XCONS (XCONS ( object)->cdr)->car, INTEGERP (height))310 && STRINGP (XCONS (XCONS (XCONS ( object)->cdr)->cdr)->car)290 return ((STRINGP (arg) 291 || (CONSP (arg) 292 && CONSP (XCONS (arg)->cdr) 293 && CONSP (XCONS (XCONS (arg)->cdr)->cdr) 294 && NILP (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->cdr) 295 && (width = XCONS (arg)->car, INTEGERP (width)) 296 && (height = XCONS (XCONS (arg)->cdr)->car, INTEGERP (height)) 297 && STRINGP (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car) 311 298 && XINT (width) > 0 312 299 && XINT (height) > 0 313 300 /* The string must have enough bits for width * height. */ 314 && ((XSTRING (XCONS (XCONS (XCONS ( object)->cdr)->cdr)->car)->size301 && ((XSTRING (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car)->size 315 302 * (BITS_PER_INT / sizeof (int))) 316 303 >= XFASTINT (width) * XFASTINT (height)))) … … 436 423 if (face) 437 424 { 438 if (face->fontset < 0)439 425 unload_font (f, face->font); 440 426 unload_color (f, face->foreground); … … 473 459 struct face *new_face; 474 460 { 475 int len = FRAME_N_COMPUTED_FACES (f); 476 int i; 477 478 /* Search for an unused computed face in the middle of the table. */ 479 for (i = 0; i < len; i++) 480 { 481 struct face *face = FRAME_COMPUTED_FACES (f)[i]; 482 if (face->font == 0) 483 { 484 FRAME_COMPUTED_FACES (f)[i] = copy_face (new_face); 485 return i; 486 } 487 } 461 int i = FRAME_N_COMPUTED_FACES (f); 488 462 489 463 if (i >= FRAME_SIZE_COMPUTED_FACES (f)) … … 576 550 { 577 551 int i; 578 int fontset = FRAME_FONTSET (f); 579 int biggest = (fontset > 0 580 ? FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height 581 : FONT_HEIGHT (FRAME_FONT (f))); 582 583 for (i = 0; i < FRAME_N_PARAM_FACES (f); i++) 584 if (FRAME_PARAM_FACES (f)[i] != 0 585 && FRAME_PARAM_FACES (f)[i]->font != (XFontStruct *) FACE_DEFAULT) 552 int biggest = FONT_HEIGHT (f->output_data.w32->font); 553 554 for (i = 0; i < f->output_data.w32->n_param_faces; i++) 555 if (f->output_data.w32->param_faces[i] != 0 556 && f->output_data.w32->param_faces[i]->font != (XFontStruct *) FACE_DEFAULT) 586 557 { 587 int height = ((fontset = 588 FRAME_PARAM_FACES (f)[i]->fontset) > 0 589 ? FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height 590 : FONT_HEIGHT 591 (FRAME_PARAM_FACES (f)[i]->font)); 558 int height = FONT_HEIGHT (f->output_data.w32->param_faces[i]->font); 592 559 if (height > biggest) 593 560 biggest = height; 594 561 } 595 562 596 if (biggest == FRAME_LINE_HEIGHT (f))563 if (biggest == f->output_data.w32->line_height) 597 564 return 0; 598 565 599 FRAME_LINE_HEIGHT (f)= biggest;566 f->output_data.w32->line_height = biggest; 600 567 return 1; 601 568 } … … 613 580 && same_size_fonts (from->font, to->font)) 614 581 to->font = from->font; 615 if (from->fontset != -1)616 to->fontset = from->fontset;617 582 if (from->foreground != FACE_DEFAULT) 618 583 to->foreground = from->foreground; … … 641 606 face->background = FRAME_BACKGROUND_PIXEL (f); 642 607 face->font = FRAME_FONT (f); 643 face->fontset = -1;644 608 face->stipple = 0; 645 609 face->underline = 0; … … 964 928 error ("Face id out of range"); 965 929 966 if (! FRAME_W INDOW_P (f))930 if (! FRAME_W32_P (f)) 967 931 return Qnil; 968 932 … … 972 936 if (EQ (attr_name, intern ("font"))) 973 937 { 974 XFontStruct *font = NULL; 975 int fontset; 976 977 if (NILP (attr_value)) 978 { 979 font = (XFontStruct *) FACE_DEFAULT; 980 fontset = -1; 981 } 982 else 983 { 984 CHECK_STRING (attr_value, 0); 985 fontset = fs_query_fontset (f, XSTRING (attr_value)->data); 986 if (fontset >= 0) 987 { 988 struct font_info *fontp; 989 990 if (!(fontp = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), 991 CHARSET_ASCII, NULL, fontset))) 992 Fsignal (Qerror, 993 Fcons (build_string ("ASCII font can't be loaded"), 994 Fcons (attr_value, Qnil))); 995 font = (XFontStruct *) (fontp->font); 996 } 997 else 998 font = load_font (f, attr_value); 999 } 1000 if (face->fontset == -1 && face->font != f->output_data.w32->font) 938 XFontStruct *font = load_font (f, attr_value); 939 if (face->font != f->output_data.w32->font) 1001 940 unload_font (f, face->font); 1002 941 face->font = font; 1003 face->fontset = fontset;1004 942 if (frame_update_line_height (f)) 1005 943 x_set_window_size (f, 0, f->width, f->height); branches/GNU/src/w32fns.c
r1679 r1683 29 29 30 30 #include "lisp.h" 31 #include "charset.h"32 #include "fontset.h"33 31 #include "w32term.h" 34 32 #include "frame.h" … … 41 39 #include "w32heap.h" 42 40 #include "termhooks.h" 43 #include "coding.h"44 41 45 42 #include <commdlg.h> … … 49 46 extern void free_frame_menubar (); 50 47 extern struct scroll_bar *x_window_to_scroll_bar (); 51 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);52 48 extern int quit_char; 53 54 extern char *lispy_function_keys[];55 49 56 50 /* The colormap for converting color names to RGB values */ … … 64 58 Lisp_Object Vw32_alt_is_meta; 65 59 66 /* Non nil if left window key events are passed on to Windows (this only 67 affects whether "tapping" the key opens the Start menu). */ 68 Lisp_Object Vw32_pass_lwindow_to_system; 69 70 /* Non nil if right window key events are passed on to Windows (this 71 only affects whether "tapping" the key opens the Start menu). */ 72 Lisp_Object Vw32_pass_rwindow_to_system; 73 74 /* Virtual key code used to generate "phantom" key presses in order 75 to stop system from acting on Windows key events. */ 76 Lisp_Object Vw32_phantom_key_code; 77 78 /* Modifier associated with the left "Windows" key, or nil to act as a 79 normal key. */ 80 Lisp_Object Vw32_lwindow_modifier; 81 82 /* Modifier associated with the right "Windows" key, or nil to act as a 83 normal key. */ 84 Lisp_Object Vw32_rwindow_modifier; 85 86 /* Modifier associated with the "Apps" key, or nil to act as a normal 87 key. */ 88 Lisp_Object Vw32_apps_modifier; 89 90 /* Value is nil if Num Lock acts as a function key. */ 91 Lisp_Object Vw32_enable_num_lock; 92 93 /* Value is nil if Caps Lock acts as a function key. */ 94 Lisp_Object Vw32_enable_caps_lock; 95 96 /* Modifier associated with Scroll Lock, or nil to act as a normal key. */ 97 Lisp_Object Vw32_scroll_lock_modifier; 60 /* Non nil if left window, right window, and application key events 61 are passed on to Windows. */ 62 Lisp_Object Vw32_pass_optional_keys_to_system; 98 63 99 64 /* Switch to control whether we inhibit requests for italicised fonts (which … … 132 97 /* Search path for bitmap files. */ 133 98 Lisp_Object Vx_bitmap_file_path; 134 135 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */136 Lisp_Object Vx_pixel_size_width_font_regexp;137 138 /* A flag to control how to display unibyte 8-bit character. */139 int unibyte_display_via_language_environment;140 99 141 100 /* Evaluate this expression to rebuild the section of syms_of_w32fns … … 208 167 Lisp_Object Qdisplay; 209 168 210 Lisp_Object Qhyper;211 Lisp_Object Qsuper;212 Lisp_Object Qmeta;213 Lisp_Object Qalt;214 Lisp_Object Qctrl;215 Lisp_Object Qcontrol;216 Lisp_Object Qshift;217 218 169 /* State variables for emulating a three button mouse. */ 219 170 #define LMOUSE 1 … … 246 197 /* From w32term.c. */ 247 198 extern Lisp_Object Vw32_num_mouse_buttons; 248 extern Lisp_Object Vw32_recognize_altgr;249 199 250 200 … … 492 442 fd = openp (Vx_bitmap_file_path, file, "", &found, 0); 493 443 if (fd < 0) 494 return -1;495 /* LoadLibraryEx won't handle special files handled by Emacs handler. */496 if (fd == 0)497 444 return -1; 498 445 close (fd); … … 1320 1267 } 1321 1268 1322 COLORREF1323 w32_color_map_lookup (colorname)1324 char *colorname;1325 {1326 Lisp_Object tail, ret = Qnil;1327 1328 BLOCK_INPUT;1329 1330 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail))1331 {1332 register Lisp_Object elt, tem;1333 1334 elt = Fcar (tail);1335 if (!CONSP (elt)) continue;1336 1337 tem = Fcar (elt);1338 1339 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)1340 {1341 ret = XUINT (Fcdr (elt));1342 break;1343 }1344 1345 QUIT;1346 }1347 1348 1349 UNBLOCK_INPUT;1350 1351 return ret;1352 }1353 1354 1269 COLORREF 1355 1270 x_to_w32_color (colorname) … … 1516 1431 or TekHVC, since I don't know the algorithms for conversion to 1517 1432 RGB. */ 1518 1519 /* If we fail to lookup the color name in w32_color_map, then check the1520 colorname to see if it can be crudely approximated: If the X color1521 ends in a number (e.g., "darkseagreen2"), strip the number and1522 return the result of looking up the base color name. */ 1523 ret = w32_color_map_lookup (colorname);1524 if (NILP (ret))1525 { 1526 int len = strlen (colorname);1527 1528 if ( isdigit (colorname[len - 1]))1433 1434 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) 1435 { 1436 register Lisp_Object elt, tem; 1437 1438 elt = Fcar (tail); 1439 if (!CONSP (elt)) continue; 1440 1441 tem = Fcar (elt); 1442 1443 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) 1529 1444 { 1530 char *ptr, *approx = alloca (len); 1531 1532 strcpy (approx, colorname); 1533 ptr = &approx[len - 1]; 1534 while (ptr > approx && isdigit (*ptr)) 1535 *ptr-- = '\0'; 1536 1537 ret = w32_color_map_lookup (approx); 1445 ret = XUINT(Fcdr (elt)); 1446 break; 1538 1447 } 1448 1449 QUIT; 1539 1450 } 1540 1451 1541 1452 UNBLOCK_INPUT; 1453 1542 1454 return ret; 1543 1455 } … … 2130 2042 2131 2043 extern Lisp_Object x_new_font (); 2132 extern Lisp_Object x_new_fontset();2133 2044 2134 2045 void … … 2138 2049 { 2139 2050 Lisp_Object result; 2140 Lisp_Object fontset_name;2141 2051 Lisp_Object frame; 2142 2052 2143 2053 CHECK_STRING (arg, 1); 2144 2054 2145 fontset_name = Fquery_fontset (arg, Qnil);2146 2147 2055 BLOCK_INPUT; 2148 result = (STRINGP (fontset_name) 2149 ? x_new_fontset (f, XSTRING (fontset_name)->data) 2150 : x_new_font (f, XSTRING (arg)->data)); 2056 result = x_new_font (f, XSTRING (arg)->data); 2151 2057 UNBLOCK_INPUT; 2152 2058 … … 2929 2835 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); 2930 2836 wc.hCursor = LoadCursor (NULL, IDC_ARROW); 2931 wc.hbrBackground = NULL; / * GetStockObject (WHITE_BRUSH); */2837 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH); 2932 2838 wc.lpszMenuName = NULL; 2933 2839 wc.lpszClassName = EMACS_CLASS; … … 3001 2907 } 3002 2908 2909 /* Convert between the modifier bits W32 uses and the modifier bits 2910 Emacs uses. */ 2911 unsigned int 2912 w32_get_modifiers () 2913 { 2914 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) | 2915 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) | 2916 ((GetKeyState (VK_MENU)&0x8000) ? 2917 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0)); 2918 } 2919 3003 2920 void 3004 2921 my_post_msg (wmsg, hwnd, msg, wParam, lParam) … … 3105 3022 SHORT ctrl, alt; 3106 3023 3107 if (GetFocus () == NULL) 3024 if (!modifiers_recorded) 3025 return; 3026 3027 ctrl = GetAsyncKeyState (VK_CONTROL); 3028 alt = GetAsyncKeyState (VK_MENU); 3029 3030 if (ctrl == 0 || alt == 0) 3108 3031 /* Emacs doesn't have keyboard focus. Do nothing. */ 3109 3032 return; 3110 3111 ctrl = GetAsyncKeyState (VK_CONTROL);3112 alt = GetAsyncKeyState (VK_MENU);3113 3033 3114 3034 if (!(ctrl & 0x08000)) … … 3120 3040 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; 3121 3041 3122 /* Update the state of all modifier keys, because modifiers used in 3123 hot-key combinations can get stuck on if Emacs loses focus as a 3124 result of a hot-key being pressed. */ 3125 { 3126 BYTE keystate[256]; 3127 3128 #define CURRENT_STATE(key) ((GetAsyncKeyState (key) & 0x8000) >> 8) 3129 3130 GetKeyboardState (keystate); 3131 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT); 3132 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL); 3133 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL); 3134 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL); 3135 keystate[VK_MENU] = CURRENT_STATE (VK_MENU); 3136 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU); 3137 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU); 3138 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN); 3139 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN); 3140 keystate[VK_APPS] = CURRENT_STATE (VK_APPS); 3141 SetKeyboardState (keystate); 3142 } 3042 /* Otherwise, leave the modifier state as it was when Emacs lost 3043 keyboard focus. */ 3143 3044 } 3144 3045 … … 3163 3064 modifier_set (int vkey) 3164 3065 { 3165 if (vkey == VK_CAPITAL || vkey == VK_SCROLL)3066 if (vkey == VK_CAPITAL) 3166 3067 return (GetKeyState (vkey) & 0x1); 3167 3068 if (!modifiers_recorded) … … 3178 3079 case VK_RMENU: 3179 3080 return modifiers[EMACS_RMENU]; 3081 default: 3082 break; 3180 3083 } 3181 3084 return (GetKeyState (vkey) & 0x8000); 3182 }3183 3184 /* Convert between t
