/[emacs]/emacs/src/xterm.c
ViewVC logotype

Diff of /emacs/src/xterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.721 by gerd, Fri Apr 12 09:33:52 2002 UTC revision 1.722 by monnier, Tue Apr 16 15:07:46 2002 UTC
# Line 394  Lisp_Object Vx_alt_keysym, Vx_hyper_keys Line 394  Lisp_Object Vx_alt_keysym, Vx_hyper_keys
394  static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;  static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;
395    
396  static Lisp_Object Qvendor_specific_keysyms;  static Lisp_Object Qvendor_specific_keysyms;
397    static Lisp_Object Qlatin_1, Qutf_8;
398    
399  extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));  extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
400  extern Lisp_Object x_icon_type P_ ((struct frame *));  extern Lisp_Object x_icon_type P_ ((struct frame *));
# Line 9935  XTread_socket (sd, bufp, numchars, expec Line 9936  XTread_socket (sd, bufp, numchars, expec
9936    
9937    ++handling_signal;    ++handling_signal;
9938        
   /* The input should be decoded if it is from XIM.  Currently the  
      locale of XIM is the same as that of the system.  So, we can use  
      Vlocale_coding_system which is initialized properly at Emacs  
      startup time.  */  
   setup_coding_system (Vlocale_coding_system, &coding);  
   coding.src_multibyte = 0;  
   coding.dst_multibyte = 1;  
   /* The input is converted to events, thus we can't handle  
      composition.  Anyway, there's no XIM that gives us composition  
      information.  */  
   coding.composing = COMPOSITION_DISABLED;  
   
9939    /* Find the display we are supposed to read input for.    /* Find the display we are supposed to read input for.
9940       It's the one communicating on descriptor SD.  */       It's the one communicating on descriptor SD.  */
9941    for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)    for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
# Line 10457  XTread_socket (sd, bufp, numchars, expec Line 10446  XTread_socket (sd, bufp, numchars, expec
10446                    unsigned char *copy_bufptr = copy_buffer;                    unsigned char *copy_bufptr = copy_buffer;
10447                    int copy_bufsiz = sizeof (copy_buffer);                    int copy_bufsiz = sizeof (copy_buffer);
10448                    int modifiers;                    int modifiers;
10449                      Lisp_Object coding_system = Qlatin_1;
10450    
10451                    event.xkey.state                    event.xkey.state
10452                      |= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f),                      |= x_emacs_to_x_modifiers (FRAME_X_DISPLAY_INFO (f),
# Line 10486  XTread_socket (sd, bufp, numchars, expec Line 10476  XTread_socket (sd, bufp, numchars, expec
10476                      {                      {
10477                        Status status_return;                        Status status_return;
10478    
10479                          coding_system = Vlocale_coding_system;
10480                        nbytes = XmbLookupString (FRAME_XIC (f),                        nbytes = XmbLookupString (FRAME_XIC (f),
10481                                                  &event.xkey, copy_bufptr,                                                  &event.xkey, copy_bufptr,
10482                                                  copy_bufsiz, &keysym,                                                  copy_bufsiz, &keysym,
# Line 10499  XTread_socket (sd, bufp, numchars, expec Line 10490  XTread_socket (sd, bufp, numchars, expec
10490                                                      copy_bufsiz, &keysym,                                                      copy_bufsiz, &keysym,
10491                                                      &status_return);                                                      &status_return);
10492                          }                          }
10493    #ifdef X_HAVE_UTF8_STRING
10494                          else if (status_return == XLookupKeySym)
10495                            {  /* Try again but with utf-8.  */
10496                              coding_system = Qutf_8;
10497                              nbytes = Xutf8LookupString (FRAME_XIC (f),
10498                                                          &event.xkey, copy_bufptr,
10499                                                          copy_bufsiz, &keysym,
10500                                                          &status_return);
10501                              if (status_return == XBufferOverflow)
10502                                {
10503                                  copy_bufsiz = nbytes + 1;
10504                                  copy_bufptr = (char *) alloca (copy_bufsiz);
10505                                  nbytes = Xutf8LookupString (FRAME_XIC (f),
10506                                                              &event.xkey,
10507                                                              copy_bufptr,
10508                                                              copy_bufsiz, &keysym,
10509                                                              &status_return);
10510                                }
10511                            }
10512    #endif
10513    
10514                        if (status_return == XLookupNone)                        if (status_return == XLookupNone)
10515                          break;                          break;
# Line 10625  XTread_socket (sd, bufp, numchars, expec Line 10636  XTread_socket (sd, bufp, numchars, expec
10636                            register int c;                            register int c;
10637                            int nchars, len;                            int nchars, len;
10638    
10639                              /* The input should be decoded with `coding_system'
10640                                 which depends on which X*LookupString function
10641                                 we used just above and the locale.  */
10642                              setup_coding_system (coding_system, &coding);
10643                              coding.src_multibyte = 0;
10644                              coding.dst_multibyte = 1;
10645                              /* The input is converted to events, thus we can't
10646                                 handle composition.  Anyway, there's no XIM that
10647                                 gives us composition information.  */
10648                              coding.composing = COMPOSITION_DISABLED;
10649    
10650                            for (i = 0; i < nbytes; i++)                            for (i = 0; i < nbytes; i++)
10651                              {                              {
10652                                if (temp_index == (sizeof temp_buffer                                if (temp_index == (sizeof temp_buffer
# Line 10633  XTread_socket (sd, bufp, numchars, expec Line 10655  XTread_socket (sd, bufp, numchars, expec
10655                                temp_buffer[temp_index++] = copy_bufptr[i];                                temp_buffer[temp_index++] = copy_bufptr[i];
10656                              }                              }
10657    
10658                            if (/* If the event is not from XIM, */                            {
10659                                event.xkey.keycode != 0                              /* Decode the input data.  */
10660                                /* or the current locale doesn't request                              int require;
10661                                   decoding of the intup data, ... */                              unsigned char *p;
10662                                || coding.type == coding_type_raw_text  
10663                                || coding.type == coding_type_no_conversion)                              require = decoding_buffer_size (&coding, nbytes);
10664                              {                              p = (unsigned char *) alloca (require);
10665                                /* ... we can use the input data as is.  */                              coding.mode |= CODING_MODE_LAST_BLOCK;
10666                                nchars = nbytes;                              decode_coding (&coding, copy_bufptr, p,
10667                              }                                             nbytes, require);
10668                            else                              nbytes = coding.produced;
10669                              {                              nchars = coding.produced_char;
10670                                /* We have to decode the input data.  */                              copy_bufptr = p;
10671                                int require;                            }
                               unsigned char *p;  
   
                               require = decoding_buffer_size (&coding, nbytes);  
                               p = (unsigned char *) alloca (require);  
                               coding.mode |= CODING_MODE_LAST_BLOCK;  
                               decode_coding (&coding, copy_bufptr, p,  
                                              nbytes, require);  
                               nbytes = coding.produced;  
                               nchars = coding.produced_char;  
                               copy_bufptr = p;  
                             }  
10672    
10673                            /* Convert the input data to a sequence of                            /* Convert the input data to a sequence of
10674                               character events.  */                               character events.  */
# Line 15080  syms_of_xterm () Line 15091  syms_of_xterm ()
15091    staticpro (&Qvendor_specific_keysyms);    staticpro (&Qvendor_specific_keysyms);
15092    Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");    Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
15093    
15094      staticpro (&Qutf_8);
15095      Qutf_8 = intern ("utf-8");
15096      staticpro (&Qlatin_1);
15097      Qlatin_1 = intern ("latin-1");
15098    
15099    staticpro (&last_mouse_press_frame);    staticpro (&last_mouse_press_frame);
15100    last_mouse_press_frame = Qnil;    last_mouse_press_frame = Qnil;
15101    

Legend:
Removed from v.1.721  
changed lines
  Added in v.1.722

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26