emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xselect.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/xselect.c
Date: Tue, 17 Jun 2003 06:51:11 -0400

Index: emacs/src/xselect.c
diff -c emacs/src/xselect.c:1.128 emacs/src/xselect.c:1.129
*** emacs/src/xselect.c:1.128   Sun Apr  6 16:35:06 2003
--- emacs/src/xselect.c Tue Jun 17 06:51:11 2003
***************
*** 29,38 ****
  #include "frame.h"    /* Need this to get the X window of selected_frame */
  #include "blockinput.h"
  #include "buffer.h"
- #include "charset.h"
- #include "coding.h"
  #include "process.h"
- #include "composite.h"
  
  struct prop_location;
  
--- 29,35 ----
***************
*** 114,119 ****
--- 111,118 ----
  /* Coding system for the next communicating with other X clients.  */
  static Lisp_Object Vnext_selection_coding_system;
  
+ static Lisp_Object Qforeign_selection;
+ 
  /* If this is a smaller number than the max-request-size of the display,
     emacs will use INCR selection transfer when the selection is larger
     than this.  The max-request-size is usually around 64k, so if you want
***************
*** 1605,1678 ****
    /* Convert any 8-bit data to a string, for compactness.  */
    else if (format == 8)
      {
!       Lisp_Object str;
!       int require_encoding = 0;
  
!       if (
! #if 1
!         1
! #else
!         ! NILP (buffer_defaults.enable_multibyte_characters)
! #endif
!         )
!       {
!         /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode
!            DATA to Emacs internal format because DATA may be encoded
!            in compound text format.  In addtion, if TYPE is `STRING'
!            and DATA contains any 8-bit Latin-1 code, we should also
!            decode it.  */
!         if (type == dpyinfo->Xatom_TEXT
!             || type == dpyinfo->Xatom_COMPOUND_TEXT)
!           require_encoding = 1;
!         else if (type == XA_STRING)
!           {
!             int i;
!             for (i = 0; i < size; i++)
!               {
!                 if (data[i] >= 0x80)
!                   {
!                     require_encoding = 1;
!                     break;
!                   }
!               }
!           }
!       }
!       if (!require_encoding)
!       {
!         str = make_unibyte_string ((char *) data, size);
!         Vlast_coding_system_used = Qraw_text;
!       }
        else
!       {
!         int bufsize;
!         unsigned char *buf;
!         struct coding_system coding;
! 
!         if (NILP (Vnext_selection_coding_system))
!           Vnext_selection_coding_system = Vselection_coding_system;
!         setup_coding_system
!           (Fcheck_coding_system(Vnext_selection_coding_system), &coding);
!         coding.src_multibyte = 0;
!         coding.dst_multibyte = 1;
!         Vnext_selection_coding_system = Qnil;
!           coding.mode |= CODING_MODE_LAST_BLOCK;
!         /* We explicitely disable composition handling because
!            selection data should not contain any composition
!            sequence.  */
!         coding.composing = COMPOSITION_DISABLED;
!         bufsize = decoding_buffer_size (&coding, size);
!         buf = (unsigned char *) xmalloc (bufsize);
!         decode_coding (&coding, data, buf, size, bufsize);
!         str = make_string_from_bytes ((char *) buf,
!                                       coding.produced_char, coding.produced);
!         xfree (buf);
! 
!         if (SYMBOLP (coding.post_read_conversion)
!             && !NILP (Ffboundp (coding.post_read_conversion)))
!           str = run_pre_post_conversion_on_str (str, &coding, 0);
!         Vlast_coding_system_used = coding.symbol;
!       }
!       compose_chars_in_text (0, SCHARS (str), str);
        return str;
      }
    /* Convert a single atom to a Lisp_Symbol.  Convert a set of atoms to
--- 1604,1624 ----
    /* Convert any 8-bit data to a string, for compactness.  */
    else if (format == 8)
      {
!       Lisp_Object str, lispy_type;
  
!       str = make_unibyte_string ((char *) data, size);
!       /* Indicate that this string is from foreign selection by a text
!        property `foreign-selection' so that the caller of
!        x-get-selection-internal (usually x-get-selection) can know
!        that the string must be decode.  */
!       if (type == dpyinfo->Xatom_COMPOUND_TEXT)
!       lispy_type = QCOMPOUND_TEXT;
!       else if (type == dpyinfo->Xatom_UTF8_STRING)
!       lispy_type = QUTF8_STRING;
        else
!       lispy_type = QSTRING;
!       Fput_text_property (make_number (0), make_number (size),
!                         Qforeign_selection, lispy_type, str);
        return str;
      }
    /* Convert a single atom to a Lisp_Symbol.  Convert a set of atoms to
***************
*** 2451,2454 ****
--- 2397,2402 ----
    QCUT_BUFFER7 = intern ("CUT_BUFFER7"); staticpro (&QCUT_BUFFER7);
  #endif
  
+   Qforeign_selection = intern ("foreign-selection");
+   staticpro (&Qforeign_selection);
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]