Mercurial > hg > xemacs-beta
comparison src/xselect.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
1051 } | 1051 } |
1052 | 1052 |
1053 static Lisp_Object Qx_selection_reply_timeout_internal; | 1053 static Lisp_Object Qx_selection_reply_timeout_internal; |
1054 | 1054 |
1055 DEFUN ("x-selection-reply-timeout-internal", | 1055 DEFUN ("x-selection-reply-timeout-internal", |
1056 Fx_selection_reply_timeout_internal, | 1056 Fx_selection_reply_timeout_internal, 1, 1, 0, /* |
1057 Sx_selection_reply_timeout_internal, 1, 1, 0 /* | 1057 |
1058 | 1058 */ |
1059 */ ) | 1059 (arg)) |
1060 (arg) | |
1061 Lisp_Object arg; | |
1062 { | 1060 { |
1063 selection_reply_timed_out = 1; | 1061 selection_reply_timed_out = 1; |
1064 reading_selection_reply = 0; | 1062 reading_selection_reply = 0; |
1065 return Qnil; | 1063 return Qnil; |
1066 } | 1064 } |
1650 | 1648 |
1651 reading_selection_reply = 0; /* we're done now. */ | 1649 reading_selection_reply = 0; /* we're done now. */ |
1652 } | 1650 } |
1653 | 1651 |
1654 | 1652 |
1655 DEFUN ("x-own-selection-internal", | 1653 DEFUN ("x-own-selection-internal", Fx_own_selection_internal, 2, 2, 0, /* |
1656 Fx_own_selection_internal, Sx_own_selection_internal, | |
1657 2, 2, 0 /* | |
1658 Assert an X selection of the given TYPE with the given VALUE. | 1654 Assert an X selection of the given TYPE with the given VALUE. |
1659 TYPE is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. | 1655 TYPE is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. |
1660 VALUE is typically a string, or a cons of two markers, but may be | 1656 VALUE is typically a string, or a cons of two markers, but may be |
1661 anything that the functions on selection-converter-alist know about. | 1657 anything that the functions on selection-converter-alist know about. |
1662 */ ) | 1658 */ |
1663 (selection_name, selection_value) | 1659 (selection_name, selection_value)) |
1664 Lisp_Object selection_name, selection_value; | |
1665 { | 1660 { |
1666 CHECK_SYMBOL (selection_name); | 1661 CHECK_SYMBOL (selection_name); |
1667 if (NILP (selection_value)) error ("selection-value may not be nil."); | 1662 if (NILP (selection_value)) error ("selection-value may not be nil."); |
1668 x_own_selection (selection_name, selection_value); | 1663 x_own_selection (selection_name, selection_value); |
1669 return selection_value; | 1664 return selection_value; |
1672 | 1667 |
1673 /* Request the selection value from the owner. If we are the owner, | 1668 /* Request the selection value from the owner. If we are the owner, |
1674 simply return our selection value. If we are not the owner, this | 1669 simply return our selection value. If we are not the owner, this |
1675 will block until all of the data has arrived. | 1670 will block until all of the data has arrived. |
1676 */ | 1671 */ |
1677 DEFUN ("x-get-selection-internal", | 1672 DEFUN ("x-get-selection-internal", Fx_get_selection_internal, 2, 2, 0, /* |
1678 Fx_get_selection_internal, Sx_get_selection_internal, 2, 2, 0 /* | |
1679 Return text selected from some X window. | 1673 Return text selected from some X window. |
1680 SELECTION is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. | 1674 SELECTION is a symbol, typically PRIMARY, SECONDARY, or CLIPBOARD. |
1681 TYPE is the type of data desired, typically STRING. | 1675 TYPE is the type of data desired, typically STRING. |
1682 */ ) | 1676 */ |
1683 (selection_symbol, target_type) | 1677 (selection_symbol, target_type)) |
1684 Lisp_Object selection_symbol, target_type; | |
1685 { | 1678 { |
1686 /* This function can GC */ | 1679 /* This function can GC */ |
1687 Lisp_Object val = Qnil; | 1680 Lisp_Object val = Qnil; |
1688 struct gcpro gcpro1, gcpro2; | 1681 struct gcpro gcpro1, gcpro2; |
1689 GCPRO2 (target_type, val); /* we store newly consed data into these */ | 1682 GCPRO2 (target_type, val); /* we store newly consed data into these */ |
1721 DONE_LABEL: | 1714 DONE_LABEL: |
1722 UNGCPRO; | 1715 UNGCPRO; |
1723 return val; | 1716 return val; |
1724 } | 1717 } |
1725 | 1718 |
1726 DEFUN ("x-disown-selection-internal", | 1719 DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, 1, 2, 0, /* |
1727 Fx_disown_selection_internal, Sx_disown_selection_internal, 1, 2, 0 /* | |
1728 If we own the named selection, then disown it (make there be no selection). | 1720 If we own the named selection, then disown it (make there be no selection). |
1729 */ ) | 1721 */ |
1730 (selection, timeval) | 1722 (selection, timeval)) |
1731 Lisp_Object selection; | |
1732 Lisp_Object timeval; | |
1733 { | 1723 { |
1734 struct device *d = decode_x_device (Qnil); | 1724 struct device *d = decode_x_device (Qnil); |
1735 Display *display = DEVICE_X_DISPLAY (d); | 1725 Display *display = DEVICE_X_DISPLAY (d); |
1736 Time timestamp; | 1726 Time timestamp; |
1737 Atom selection_atom; | 1727 Atom selection_atom; |
1771 | 1761 |
1772 return Qt; | 1762 return Qt; |
1773 } | 1763 } |
1774 | 1764 |
1775 | 1765 |
1776 DEFUN ("x-selection-owner-p", | 1766 DEFUN ("x-selection-owner-p", Fx_selection_owner_p, 0, 1, 0, /* |
1777 Fx_selection_owner_p, Sx_selection_owner_p, 0, 1, 0 /* | |
1778 Whether the current emacs process owns the given X Selection. | 1767 Whether the current emacs process owns the given X Selection. |
1779 The arg should be the name of the selection in question, typically one of | 1768 The arg should be the name of the selection in question, typically one of |
1780 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol | 1769 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol |
1781 nil is the same as PRIMARY, and t is the same as SECONDARY.) | 1770 nil is the same as PRIMARY, and t is the same as SECONDARY.) |
1782 */ ) | 1771 */ |
1783 (selection) | 1772 (selection)) |
1784 Lisp_Object selection; | |
1785 { | 1773 { |
1786 CHECK_SYMBOL (selection); | 1774 CHECK_SYMBOL (selection); |
1787 if (EQ (selection, Qnil)) selection = QPRIMARY; | 1775 if (EQ (selection, Qnil)) selection = QPRIMARY; |
1788 if (EQ (selection, Qt)) selection = QSECONDARY; | 1776 if (EQ (selection, Qt)) selection = QSECONDARY; |
1789 | 1777 |
1790 if (NILP (Fassq (selection, Vselection_alist))) | 1778 if (NILP (Fassq (selection, Vselection_alist))) |
1791 return Qnil; | 1779 return Qnil; |
1792 return Qt; | 1780 return Qt; |
1793 } | 1781 } |
1794 | 1782 |
1795 DEFUN ("x-selection-exists-p", | 1783 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, 0, 1, 0, /* |
1796 Fx_selection_exists_p, Sx_selection_exists_p, 0, 1, 0 /* | |
1797 Whether there is an owner for the given X Selection. | 1784 Whether there is an owner for the given X Selection. |
1798 The arg should be the name of the selection in question, typically one of | 1785 The arg should be the name of the selection in question, typically one of |
1799 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol | 1786 the symbols PRIMARY, SECONDARY, or CLIPBOARD. (For convenience, the symbol |
1800 nil is the same as PRIMARY, and t is the same as SECONDARY.) | 1787 nil is the same as PRIMARY, and t is the same as SECONDARY.) |
1801 */ ) | 1788 */ |
1802 (selection) | 1789 (selection)) |
1803 Lisp_Object selection; | |
1804 { | 1790 { |
1805 Window owner; | 1791 Window owner; |
1806 struct device *d = decode_x_device (Qnil); | 1792 struct device *d = decode_x_device (Qnil); |
1807 Display *dpy = DEVICE_X_DISPLAY (d); | 1793 Display *dpy = DEVICE_X_DISPLAY (d); |
1808 CHECK_SYMBOL (selection); | 1794 CHECK_SYMBOL (selection); |
1844 !EQ((symbol),QCUT_BUFFER6) && !EQ((symbol),QCUT_BUFFER7)) \ | 1830 !EQ((symbol),QCUT_BUFFER6) && !EQ((symbol),QCUT_BUFFER7)) \ |
1845 signal_error (Qerror, list2 (build_string ("Doesn't name a cutbuffer"), \ | 1831 signal_error (Qerror, list2 (build_string ("Doesn't name a cutbuffer"), \ |
1846 (symbol))); \ | 1832 (symbol))); \ |
1847 } | 1833 } |
1848 | 1834 |
1849 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, | 1835 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, 1, 1, 0, /* |
1850 Sx_get_cutbuffer_internal, 1, 1, 0 /* | |
1851 Return the value of the named CUTBUFFER (typically CUT_BUFFER0). | 1836 Return the value of the named CUTBUFFER (typically CUT_BUFFER0). |
1852 */ ) | 1837 */ |
1853 (cutbuffer) | 1838 (cutbuffer)) |
1854 Lisp_Object cutbuffer; | |
1855 { | 1839 { |
1856 struct device *d = decode_x_device (Qnil); | 1840 struct device *d = decode_x_device (Qnil); |
1857 Display *display = DEVICE_X_DISPLAY (d); | 1841 Display *display = DEVICE_X_DISPLAY (d); |
1858 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ | 1842 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ |
1859 Atom cut_buffer_atom; | 1843 Atom cut_buffer_atom; |
1883 xfree (data); | 1867 xfree (data); |
1884 return ret; | 1868 return ret; |
1885 } | 1869 } |
1886 | 1870 |
1887 | 1871 |
1888 DEFUN ("x-store-cutbuffer-internal", Fx_store_cutbuffer_internal, | 1872 DEFUN ("x-store-cutbuffer-internal", Fx_store_cutbuffer_internal, 2, 2, 0, /* |
1889 Sx_store_cutbuffer_internal, 2, 2, 0 /* | |
1890 Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING. | 1873 Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING. |
1891 */ ) | 1874 */ |
1892 (cutbuffer, string) | 1875 (cutbuffer, string)) |
1893 Lisp_Object cutbuffer, string; | |
1894 { | 1876 { |
1895 struct device *d = decode_x_device (Qnil); | 1877 struct device *d = decode_x_device (Qnil); |
1896 Display *display = DEVICE_X_DISPLAY (d); | 1878 Display *display = DEVICE_X_DISPLAY (d); |
1897 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ | 1879 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ |
1898 Atom cut_buffer_atom; | 1880 Atom cut_buffer_atom; |
1925 } | 1907 } |
1926 return string; | 1908 return string; |
1927 } | 1909 } |
1928 | 1910 |
1929 | 1911 |
1930 DEFUN ("x-rotate-cutbuffers-internal", Fx_rotate_cutbuffers_internal, | 1912 DEFUN ("x-rotate-cutbuffers-internal", Fx_rotate_cutbuffers_internal, 1, 1, 0, /* |
1931 Sx_rotate_cutbuffers_internal, 1, 1, 0 /* | |
1932 Rotate the values of the cutbuffers by the given number of steps; | 1913 Rotate the values of the cutbuffers by the given number of steps; |
1933 positive means move values forward, negative means backward. | 1914 positive means move values forward, negative means backward. |
1934 */ ) | 1915 */ |
1935 (n) | 1916 (n)) |
1936 Lisp_Object n; | |
1937 { | 1917 { |
1938 struct device *d = decode_x_device (Qnil); | 1918 struct device *d = decode_x_device (Qnil); |
1939 Display *display = DEVICE_X_DISPLAY (d); | 1919 Display *display = DEVICE_X_DISPLAY (d); |
1940 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ | 1920 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */ |
1941 Atom props [8]; | 1921 Atom props [8]; |
1965 /************************************************************************/ | 1945 /************************************************************************/ |
1966 | 1946 |
1967 void | 1947 void |
1968 syms_of_xselect (void) | 1948 syms_of_xselect (void) |
1969 { | 1949 { |
1970 defsubr (&Sx_get_selection_internal); | 1950 DEFSUBR (Fx_get_selection_internal); |
1971 defsubr (&Sx_own_selection_internal); | 1951 DEFSUBR (Fx_own_selection_internal); |
1972 defsubr (&Sx_disown_selection_internal); | 1952 DEFSUBR (Fx_disown_selection_internal); |
1973 defsubr (&Sx_selection_owner_p); | 1953 DEFSUBR (Fx_selection_owner_p); |
1974 defsubr (&Sx_selection_exists_p); | 1954 DEFSUBR (Fx_selection_exists_p); |
1975 | 1955 |
1976 #ifdef CUT_BUFFER_SUPPORT | 1956 #ifdef CUT_BUFFER_SUPPORT |
1977 defsubr (&Sx_get_cutbuffer_internal); | 1957 DEFSUBR (Fx_get_cutbuffer_internal); |
1978 defsubr (&Sx_store_cutbuffer_internal); | 1958 DEFSUBR (Fx_store_cutbuffer_internal); |
1979 defsubr (&Sx_rotate_cutbuffers_internal); | 1959 DEFSUBR (Fx_rotate_cutbuffers_internal); |
1980 #endif /* CUT_BUFFER_SUPPORT */ | 1960 #endif /* CUT_BUFFER_SUPPORT */ |
1981 | 1961 |
1982 /* Unfortunately, timeout handlers must be lisp functions. */ | 1962 /* Unfortunately, timeout handlers must be lisp functions. */ |
1983 defsymbol (&Qx_selection_reply_timeout_internal, | 1963 defsymbol (&Qx_selection_reply_timeout_internal, |
1984 "x-selection-reply-timeout-internal"); | 1964 "x-selection-reply-timeout-internal"); |
1985 defsubr (&Sx_selection_reply_timeout_internal); | 1965 DEFSUBR (Fx_selection_reply_timeout_internal); |
1986 | 1966 |
1987 defsymbol (&QPRIMARY, "PRIMARY"); | 1967 defsymbol (&QPRIMARY, "PRIMARY"); |
1988 defsymbol (&QSECONDARY, "SECONDARY"); | 1968 defsymbol (&QSECONDARY, "SECONDARY"); |
1989 defsymbol (&QSTRING, "STRING"); | 1969 defsymbol (&QSTRING, "STRING"); |
1990 defsymbol (&QINTEGER, "INTEGER"); | 1970 defsymbol (&QINTEGER, "INTEGER"); |