b5aded67de3d2f7347c787346c835e45358fc799
[sxemacs] / lisp / gtk-select.el
1 ;;; gtk-select.el --- Lisp interface to GTK selections.
2
3 ;; Copyright (C) 1990, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Sun Microsystems.
5 ;; Copyright (C) 2000 Free Software Foundation
6
7 ;; Maintainer: William Perry <wmperry@gnu.org>
8 ;; Keywords: extensions, dumped
9
10 ;; This file is part of SXEmacs.
11
12 ;; SXEmacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; SXEmacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Synched up with: Not in FSF
26
27 ;;; Commentary:
28
29 ;; This file is dumped with SXEmacs (when GTK support is compiled in).
30 ;; #### Only copes with copying/pasting text
31
32 ;;; Code:
33
34 (defun gtk-get-secondary-selection ()
35   "Return text selected from some GTK window."
36   (get-selection 'SECONDARY))
37
38 (defun gtk-own-secondary-selection (selection &optional type)
39   "Make a secondary GTK Selection of the given argument.  The argument may be a
40 string or a cons of two markers (in which case the selection is considered to
41 be the text between those markers)."
42   (interactive (if (not current-prefix-arg)
43                    (list (read-string "Store text for pasting: "))
44                  (list (cons ;; these need not be ordered.
45                         (copy-marker (point-marker))
46                         (copy-marker (mark-marker))))))
47   (own-selection selection 'SECONDARY))
48
49 (defun gtk-notice-selection-requests (selection type successful)
50   "for possible use as the value of `gtk-sent-selection-hooks'."
51   (if (not successful)
52       (message "Selection request failed to convert %s to %s"
53                selection type)
54     (message "Sent selection %s as %s" selection type)))
55
56 (defun gtk-notice-selection-failures (selection type successful)
57   "for possible use as the value of `gtk-sent-selection-hooks'."
58   (or successful
59       (message "Selection request failed to convert %s to %s"
60                selection type)))
61
62 ;(setq gtk-sent-selection-hooks 'gtk-notice-selection-requests)
63 ;(setq gtk-sent-selection-hooks 'gtk-notice-selection-failures)