Changeset 1683

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

FSF GNU Emacs 20.3 98/8/21 Release.

Files:

Legend:

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

    r1679 r1683  
    7373static Lisp_Object Vselection_coding_system; 
    7474 
    75 /* Coding system for the next communicating with other Windows programs.  */ 
    76 static Lisp_Object Vnext_selection_coding_system; 
    77  
    7875/* The segment address and the size of the buffer in low 
    7976   memory used to move data between us and WinOldAp module.  */ 
     
    225222} 
    226223 
    227 /* Copy data into the clipboard, return zero if successfull.  */ 
     224/* Copy data into the clipboard, return non-zero if successfull.  */ 
    228225unsigned 
    229226set_clipboard_data (Format, Data, Size, Raw) 
     
    244241     standard CF_OEMTEXT clipboard format uses CRLF line endings, 
    245242     while Emacs uses just LF internally).  */ 
    246   truelen = Size + 1;          /* +1 for the terminating null */ 
     243  truelen = Size; 
    247244 
    248245  if (!Raw) 
     
    272269      while (Size--) 
    273270        { 
    274           /* Don't allow them to put binary data into the clipboard, since 
    275              it will cause yanked data to be truncated at the first null.  */ 
    276           if (*dp == '\0') 
    277             return 2; 
    278271          if (*dp == '\n') 
    279272            _farnspokeb (buf_offset++, '\r'); 
     
    281274        } 
    282275    } 
    283  
    284   /* Terminate with a null, otherwise Windows does strange things when 
    285      the text size is an integral multiple of 32 bytes. */ 
    286   _farnspokeb (buf_offset, *dp); 
    287276 
    288277  /* Calls Int 2Fh/AX=1703h with: 
     
    302291  free_xfer_buf (); 
    303292 
    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; 
    306294} 
    307295 
     
    336324{ 
    337325  __dpmi_regs regs; 
     326  unsigned datalen = 0; 
    338327  unsigned long xbuf_addr; 
    339328  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); 
    344329 
    345330  if (Format != CF_OEMTEXT) 
     
    377362              *dp++ = '\n'; 
    378363              xbuf_addr++; 
    379               last_block--;     /* adjust the beginning of the last 32 bytes */ 
    380364            } 
    381365          /* Windows reportedly rounds up the size of clipboard data 
    382366             (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            } 
    387373        } 
    388374    } 
     
    390376  free_xfer_buf (); 
    391377 
    392   return (unsigned) (dp - (unsigned char *)Data - 1)
     378  return datalen
    393379} 
    394380 
     
    427413static char no_mem_msg[] = 
    428414  "(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.)"; 
    431415 
    432416DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0, 
     
    435419    Lisp_Object string, frame; 
    436420{ 
    437   unsigned ok = 1, put_status = 0
     421  int ok = 1, ok1 = 1
    438422  int nbytes; 
    439423  unsigned char *src, *dst = NULL; 
     
    458442  /* Since we are now handling multilingual text, we must consider 
    459443     encoding text for the clipboard.  */ 
     444 
    460445  bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); 
    461446  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)) 
    464448         ? 0 
    465          : find_charset_in_str (src, nbytes, charsets, Qnil, 0, 1)); 
     449         : find_charset_in_str (src, nbytes, charsets, Qnil, 1)); 
    466450 
    467451  if (!num || (num == 1 && charsets[CHARSET_ASCII])) 
     
    479463      unsigned char *htext2; 
    480464 
    481       if (NILP (Vnext_selection_coding_system)) 
    482         Vnext_selection_coding_system = Vselection_coding_system; 
    483465      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); 
    486467      coding.mode |= CODING_MODE_LAST_BLOCK; 
    487468      Vlast_coding_system_used = coding.symbol; 
     
    496477   
    497478  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)); 
    501480 
    502481  if (!no_crlf_conversion) 
     
    520499     fail the function, people might wonder why their text sometimes 
    521500     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); 
    533504      sit_for (2, 0, 0, 1, 1); 
    534505    } 
     
    536507 done: 
    537508 
    538   return (ok && put_status == 0 ? string : Qnil); 
     509  return (ok ? string : Qnil); 
    539510} 
    540511 
     
    573544 
    574545  /* 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)) 
    582547    { 
    583548      /* If the clipboard data contains any 8-bit Latin-1 code, we 
     
    600565      struct coding_system coding; 
    601566 
    602       if (NILP (Vnext_selection_coding_system)) 
    603         Vnext_selection_coding_system = Vselection_coding_system; 
    604567      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); 
    607569      coding.mode |= CODING_MODE_LAST_BLOCK; 
    608570      truelen = get_clipboard_data (CF_OEMTEXT, htext, data_size, 1); 
     
    694656A default value is `iso-latin-1-dos'"); 
    695657  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); 
    704659 
    705660  QPRIMARY   = intern ("PRIMARY");      staticpro (&QPRIMARY); 
  • branches/GNU/src/w32.c

    r1679 r1683  
    504504  memcpy (o, full, len); 
    505505  o += len; 
    506   *o = '\0'; 
    507506  size -= len; 
    508507 
    509   while (p != NULL && *p) 
     508  do 
    510509    { 
    511510      q = p; 
     
    530529        return FALSE; 
    531530    } 
     531  while (p != NULL && *p); 
    532532 
    533533  return TRUE; 
     
    19611961      if (GetFileInformationByHandle (fh, &info)) 
    19621962        { 
     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            } 
    19631976          buf->st_nlink = info.nNumberOfLinks; 
    19641977          /* Might as well use file index to fake inode values, but this 
     
    19681981             (on NTFS, presumably less on FAT). */ 
    19691982          fake_inode = info.nFileIndexLow ^ info.nFileIndexHigh; 
     1983          CloseHandle (fh); 
    19701984        } 
    19711985      else 
    19721986        { 
    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        } 
    19911990    } 
    19921991  else 
     
    30263025     not exist in the expected place, tell the user.  */ 
    30273026 
    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 
    30623056      /* Use the low-level Emacs abort. */ 
    30633057#undef abort 
    3064           abort (); 
    3065         } 
    3066       else 
    3067         { 
    3068           close (fd); 
    3069         } 
    3070     } 
     3058      abort (); 
     3059    } 
     3060  } 
    30713061} 
    30723062 
     
    30783068  term_winsock (); 
    30793069#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 (); 
    30803076} 
    30813077 
     
    31773173    } 
    31783174  } 
    3179    
    3180   /* Check to see if Emacs has been installed correctly.  */ 
    3181   check_windows_init_file (); 
    31823175} 
    31833176 
  • branches/GNU/src/w32.h

    r1669 r1683  
    1 #ifndef EMACS_W32_H 
    2 #define EMACS_W32_H 
     1#ifndef _NT_H_ 
     2#define _NT_H_ 
    33 
    44/* Support routines for the NT version of Emacs. 
     
    2121the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    2222Boston, MA 02111-1307, USA.  */ 
    23  
    2423 
    2524/* File descriptor set emulation.  */ 
     
    105104/* ------------------------------------------------------------------------- */ 
    106105 
    107 /* Equivalent of strerror for W32 error codes.  */ 
    108 extern char * w32_strerror (int error_no); 
    109  
    110106/* Get long (aka "true") form of file name, if it exists.  */ 
    111107extern BOOL w32_get_long_filename (char * name, char * buf, int size); 
     
    125121extern void term_ntproc (); 
    126122 
    127 #endif /* EMACS_W32_H */ 
     123#endif /* _NT_H_ */ 
  • branches/GNU/src/w32console.c

    r1679 r1683  
    413413 
    414414static unsigned int sound_type = 0xFFFFFFFF; 
    415 #define MB_EMACS_SILENT (0xFFFFFFFF - 1) 
    416415 
    417416void 
     
    419418{ 
    420419  if (sound_type == 0xFFFFFFFF)  
    421     { 
    422420      Beep (666, 100); 
    423     } 
    424   else if (sound_type == MB_EMACS_SILENT) 
    425     { 
    426       /* Do nothing.  */ 
    427     } 
    428421  else 
    429     MessageBeep (sound_type); 
     422      MessageBeep (sound_type); 
    430423} 
    431424 
    432425DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, 
    433426       "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\ 
     427SOUND is 'asterisk, 'exclamation, 'hand, 'question, or 'ok\n\ 
     428to use the corresponding system sound for the bell.\n\ 
    437429SOUND is nil to use the normal beep.") 
    438430     (sound) 
     
    453445  else if (EQ (sound, intern ("ok")))  
    454446      sound_type = MB_OK; 
    455   else if (EQ (sound, intern ("silent"))) 
    456       sound_type = MB_EMACS_SILENT; 
    457447  else 
    458448      sound_type = 0xFFFFFFFF; 
     
    572562  char_attr_normal = char_attr; 
    573563  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 (); 
    581571} 
    582572 
  • branches/GNU/src/w32faces.c

    r1679 r1683  
    3434#include "window.h" 
    3535#include "intervals.h" 
    36 #include "charset.h" 
    37 #include "fontset.h" 
    3836 
    3937  
     
    5351           the face, 
    5452       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, 
    5654       BACKGROUND-PIXMAP is the name of an x bitmap filename, which we don't 
    5755           use right now, and 
     
    6563   global parameters for that face. 
    6664 
    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)]. 
    6866   PARAM_FACE is a struct face whose members are the Xlib analogues of 
    6967   the parameters in FACE-VECTOR.  If an element of FACE-VECTOR is 
     
    7169   These faces are called "parameter faces", because they're the ones 
    7270   lisp manipulates to control what gets displayed.  Elements 0 and 1 
    73    of FRAME->output_data.w32->param_faces are special - they describe the 
     71   of FRAME->display.x->param_faces are special - they describe the 
    7472   default and mode line faces.  None of the faces in param_faces have 
    7573   GC's.  (See src/dispextern.h for the definition of struct face. 
     
    8280   of their members are FACE_DEFAULT; they are completely specified. 
    8381   They then call intern_compute_face to search 
    84    FRAME->output_data.x->computed_faces for a matching face, add one if 
     82   FRAME->display.x->computed_faces for a matching face, add one if 
    8583   none is found, and return the index into 
    86    FRAME->output_data.x->computed_faces.  FRAME's glyph matrices use these 
     84   FRAME->display.x->computed_faces.  FRAME's glyph matrices use these 
    8785   indices to record the faces of the matrix characters, and the X 
    8886   display hooks consult compute_faces to decide how to display these 
     
    9896   This is done from time to time so that we don't hold on to 
    9997   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. 
    10398 
    10499   Constraints: 
     
    135130#define FACE_DEFAULT (~0) 
    136131 
    137 Lisp_Object Qface
     132Lisp_Object Qface, Qmouse_face
    138133Lisp_Object Qpixmap_spec_p; 
    139  
    140 extern Lisp_Object Qmouse_face;  /* In textprop.c.  */ 
    141134 
    142135int face_name_id_number ( /* FRAME_PTR, Lisp_Object name */ ); 
     
    160153  bzero (result, sizeof (struct face)); 
    161154  result->font = (XFontStruct *) FACE_DEFAULT; 
    162   result->fontset = -1; 
    163155  result->foreground = FACE_DEFAULT; 
    164156  result->background = FACE_DEFAULT; 
     
    175167 
    176168  result->font = face->font; 
    177   result->fontset = face->fontset; 
    178169  result->foreground = face->foreground; 
    179170  result->background = face->background; 
     
    191182{ 
    192183  return (   face1->font       == face2->font 
    193           && face1->fontset    == face2->fontset 
    194184          && face1->foreground == face2->foreground 
    195185          && face1->background == face2->background 
     
    234224     Lisp_Object name; 
    235225{ 
    236   struct font_info *fontinf; 
    237   XFontStruct *font = NULL; 
     226  XFontStruct *font; 
    238227 
    239228  if (NILP (name)) 
     
    242231  CHECK_STRING (name, 0); 
    243232  BLOCK_INPUT; 
    244   fontinf = w32_load_font (f, (char *) XSTRING (name)->data, 0); 
     233  font = w32_load_font (FRAME_W32_DISPLAY_INFO (f), (char *) XSTRING (name)->data); 
    245234  UNBLOCK_INPUT; 
    246   if (fontinf) 
    247     font = (XFontStruct *)fontinf->font; 
    248235 
    249236  if (! font) 
     
    295282 
    296283DEFUN ("pixmap-spec-p", Fpixmap_spec_p, Spixmap_spec_p, 1, 1, 0, 
    297   "Return t if OBJECT is 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
    300287{ 
    301288  Lisp_Object height, width; 
    302289 
    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) 
    311298               && XINT (width) > 0 
    312299               && XINT (height) > 0 
    313300               /* The string must have enough bits for width * height.  */ 
    314                && ((XSTRING (XCONS (XCONS (XCONS (object)->cdr)->cdr)->car)->size 
     301               && ((XSTRING (XCONS (XCONS (XCONS (arg)->cdr)->cdr)->car)->size 
    315302                    * (BITS_PER_INT / sizeof (int))) 
    316303                   >= XFASTINT (width) * XFASTINT (height)))) 
     
    436423      if (face) 
    437424        { 
    438           if (face->fontset < 0) 
    439425          unload_font (f, face->font); 
    440426          unload_color (f, face->foreground); 
     
    473459     struct face *new_face; 
    474460{ 
    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); 
    488462 
    489463  if (i >= FRAME_SIZE_COMPUTED_FACES (f)) 
     
    576550{ 
    577551  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) 
    586557      { 
    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); 
    592559        if (height > biggest) 
    593560          biggest = height; 
    594561      } 
    595562 
    596   if (biggest == FRAME_LINE_HEIGHT (f)
     563  if (biggest == f->output_data.w32->line_height
    597564    return 0; 
    598565 
    599   FRAME_LINE_HEIGHT (f) = biggest; 
     566  f->output_data.w32->line_height = biggest; 
    600567  return 1; 
    601568} 
     
    613580      && same_size_fonts (from->font, to->font)) 
    614581    to->font = from->font; 
    615   if (from->fontset != -1) 
    616     to->fontset = from->fontset; 
    617582  if (from->foreground != FACE_DEFAULT) 
    618583    to->foreground = from->foreground; 
     
    641606  face->background = FRAME_BACKGROUND_PIXEL (f); 
    642607  face->font = FRAME_FONT (f); 
    643   face->fontset = -1; 
    644608  face->stipple = 0; 
    645609  face->underline = 0; 
     
    964928    error ("Face id out of range"); 
    965929 
    966   if (! FRAME_WINDOW_P (f)) 
     930  if (! FRAME_W32_P (f)) 
    967931    return Qnil; 
    968932 
     
    972936  if (EQ (attr_name, intern ("font"))) 
    973937    { 
    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) 
    1001940        unload_font (f, face->font); 
    1002941      face->font = font; 
    1003       face->fontset = fontset; 
    1004942      if (frame_update_line_height (f)) 
    1005943        x_set_window_size (f, 0, f->width, f->height); 
  • branches/GNU/src/w32fns.c

    r1679 r1683  
    2929 
    3030#include "lisp.h" 
    31 #include "charset.h" 
    32 #include "fontset.h" 
    3331#include "w32term.h" 
    3432#include "frame.h" 
     
    4139#include "w32heap.h" 
    4240#include "termhooks.h" 
    43 #include "coding.h" 
    4441 
    4542#include <commdlg.h> 
     
    4946extern void free_frame_menubar (); 
    5047extern struct scroll_bar *x_window_to_scroll_bar (); 
    51 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state); 
    5248extern int quit_char; 
    53  
    54 extern char *lispy_function_keys[]; 
    5549 
    5650/* The colormap for converting color names to RGB values */ 
     
    6458Lisp_Object Vw32_alt_is_meta; 
    6559 
    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.  */ 
     62Lisp_Object Vw32_pass_optional_keys_to_system; 
    9863 
    9964/* Switch to control whether we inhibit requests for italicised fonts (which 
     
    13297/* Search path for bitmap files.  */ 
    13398Lisp_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; 
    14099 
    141100/* Evaluate this expression to rebuild the section of syms_of_w32fns 
     
    208167Lisp_Object Qdisplay; 
    209168 
    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  
    218169/* State variables for emulating a three button mouse. */ 
    219170#define LMOUSE 1 
     
    246197/* From w32term.c. */ 
    247198extern Lisp_Object Vw32_num_mouse_buttons; 
    248 extern Lisp_Object Vw32_recognize_altgr; 
    249199 
    250200  
     
    492442  fd = openp (Vx_bitmap_file_path, file, "", &found, 0); 
    493443  if (fd < 0) 
    494     return -1; 
    495   /* LoadLibraryEx won't handle special files handled by Emacs handler.  */ 
    496   if (fd == 0) 
    497444    return -1; 
    498445  close (fd); 
     
    13201267} 
    13211268 
    1322 COLORREF 
    1323 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  
    13541269COLORREF  
    13551270x_to_w32_color (colorname) 
     
    15161431     or TekHVC, since I don't know the algorithms for conversion to 
    15171432     RGB.  */ 
    1518  
    1519   /* If we fail to lookup the color name in w32_color_map, then check the 
    1520     colorname to see if it can be crudely approximated: If the X color  
    1521      ends in a number (e.g., "darkseagreen2"), strip the number and 
    1522      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) 
    15291444        { 
    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; 
    15381447        } 
     1448 
     1449      QUIT; 
    15391450    } 
    15401451   
    15411452  UNBLOCK_INPUT; 
     1453   
    15421454  return ret; 
    15431455} 
     
    21302042 
    21312043extern Lisp_Object x_new_font (); 
    2132 extern Lisp_Object x_new_fontset(); 
    21332044 
    21342045void 
     
    21382049{ 
    21392050  Lisp_Object result; 
    2140   Lisp_Object fontset_name; 
    21412051  Lisp_Object frame; 
    21422052 
    21432053  CHECK_STRING (arg, 1); 
    21442054 
    2145   fontset_name = Fquery_fontset (arg, Qnil); 
    2146  
    21472055  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); 
    21512057  UNBLOCK_INPUT; 
    21522058   
     
    29292835  wc.hIcon = LoadIcon (hinst, EMACS_CLASS); 
    29302836  wc.hCursor = LoadCursor (NULL, IDC_ARROW); 
    2931   wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH);  */ 
     2837  wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH); 
    29322838  wc.lpszMenuName = NULL; 
    29332839  wc.lpszClassName = EMACS_CLASS; 
     
    30012907} 
    30022908 
     2909/* Convert between the modifier bits W32 uses and the modifier bits 
     2910   Emacs uses.  */ 
     2911unsigned int 
     2912w32_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 
    30032920void  
    30042921my_post_msg (wmsg, hwnd, msg, wParam, lParam) 
     
    31053022  SHORT ctrl, alt; 
    31063023 
    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) 
    31083031    /* Emacs doesn't have keyboard focus.  Do nothing.  */ 
    31093032    return; 
    3110  
    3111   ctrl = GetAsyncKeyState (VK_CONTROL); 
    3112   alt = GetAsyncKeyState (VK_MENU); 
    31133033 
    31143034  if (!(ctrl & 0x08000)) 
     
    31203040    modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; 
    31213041 
    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.  */ 
    31433044} 
    31443045 
     
    31633064modifier_set (int vkey) 
    31643065{ 
    3165   if (vkey == VK_CAPITAL || vkey == VK_SCROLL
     3066  if (vkey == VK_CAPITAL
    31663067    return (GetKeyState (vkey) & 0x1); 
    31673068  if (!modifiers_recorded) 
     
    31783079    case VK_RMENU: 
    31793080      return modifiers[EMACS_RMENU]; 
     3081    default: 
     3082      break; 
    31803083    } 
    31813084  return (GetKeyState (vkey) & 0x8000); 
    3182 } 
    3183  
    3184 /* Convert between t