Mercurial > emacs
annotate src/macselect.c @ 94075:b31c348d0336
* doc-view.el (doc-view-dvipdf-program): New variable.
(doc-view-dvipdfm-program): Mention doc-view-dvipdf-program.
(doc-view-mode-p): Check for doc-view-dvipdf-program as
alternative for doc-view-dvipdfm-program.
(doc-view-dvi->pdf): Prefer dvipdf over dvipdfm.
author | Tassilo Horn <tassilo@member.fsf.org> |
---|---|
date | Mon, 14 Apr 2008 13:17:40 +0000 |
parents | 4e76a03232e5 |
children | 3af508d0bd74 |
rev | line source |
---|---|
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1 /* Selection processing for Emacs on Mac OS. |
79759 | 2 Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
3 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
4 This file is part of GNU Emacs. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
5 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
6 GNU Emacs is free software; you can redistribute it and/or modify |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
78260
922696f363b0
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76745
diff
changeset
|
8 the Free Software Foundation; either version 3, or (at your option) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
9 any later version. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
10 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
15 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
17 along with GNU Emacs; see the file COPYING. If not, write to |
64084 | 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 Boston, MA 02110-1301, USA. */ | |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
20 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
21 #include <config.h> |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
22 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
23 #include "lisp.h" |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
24 #include "macterm.h" |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
25 #include "blockinput.h" |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
26 #include "keymap.h" |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
27 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
28 #if TARGET_API_MAC_CARBON |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
29 typedef ScrapRef Selection; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
30 #else /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
31 #include <Scrap.h> |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
32 #include <Endian.h> |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
33 typedef int Selection; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
34 #endif /* !TARGET_API_MAC_CARBON */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
35 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
36 static OSStatus mac_get_selection_from_symbol P_ ((Lisp_Object, int, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
37 Selection *)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
38 static ScrapFlavorType get_flavor_type_from_symbol P_ ((Lisp_Object, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
39 Selection)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
40 static int mac_valid_selection_target_p P_ ((Lisp_Object)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
41 static OSStatus mac_clear_selection P_ ((Selection *)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
42 static Lisp_Object mac_get_selection_ownership_info P_ ((Selection)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
43 static int mac_valid_selection_value_p P_ ((Lisp_Object, Lisp_Object)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
44 static OSStatus mac_put_selection_value P_ ((Selection, Lisp_Object, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
45 Lisp_Object)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
46 static int mac_selection_has_target_p P_ ((Selection, Lisp_Object)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
47 static Lisp_Object mac_get_selection_value P_ ((Selection, Lisp_Object)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
48 static Lisp_Object mac_get_selection_target_list P_ ((Selection)); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
49 static void x_own_selection P_ ((Lisp_Object, Lisp_Object)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
50 static Lisp_Object x_get_local_selection P_ ((Lisp_Object, Lisp_Object, int)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
51 static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
52 Lisp_Object, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
53 Lisp_Object)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
54 EXFUN (Fx_selection_owner_p, 1); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
55 #ifdef MAC_OSX |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
56 static OSStatus mac_handle_service_event P_ ((EventHandlerCallRef, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
57 EventRef, void *)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
58 void init_service_handler P_ ((void)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
59 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
60 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
61 Lisp_Object QPRIMARY, QSECONDARY, QTIMESTAMP, QTARGETS; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
62 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
63 static Lisp_Object Vx_lost_selection_functions; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
64 /* Coding system for communicating with other programs via selections. */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
65 static Lisp_Object Vselection_coding_system; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
66 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
67 /* Coding system for the next communicating with other programs. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
68 static Lisp_Object Vnext_selection_coding_system; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
69 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
70 static Lisp_Object Qforeign_selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
71 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
72 /* The timestamp of the last input event Emacs received from the |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
73 window server. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
74 /* Defined in keyboard.c. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
75 extern unsigned long last_event_timestamp; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
76 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
77 /* This is an association list whose elements are of the form |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
78 ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME OWNERSHIP-INFO) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
79 SELECTION-NAME is a lisp symbol. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
80 SELECTION-VALUE is the value that emacs owns for that selection. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
81 It may be any kind of Lisp object. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
82 SELECTION-TIMESTAMP is the time at which emacs began owning this selection, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
83 as a cons of two 16-bit numbers (making a 32 bit time.) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
84 FRAME is the frame for which we made the selection. |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
85 OWNERSHIP-INFO is a value saved when emacs owns for that selection. |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
86 If another application takes the ownership of that selection |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
87 later, then newly examined ownership info value should be |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
88 different from the saved one. |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
89 If there is an entry in this alist, the current ownership info for |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
90 the selection coincides with OWNERSHIP-INFO, then it can be |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
91 assumed that Emacs owns that selection. |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
92 The only (eq) parts of this list that are visible from Lisp are the |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
93 selection-values. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
94 static Lisp_Object Vselection_alist; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
95 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
96 /* This is an alist whose CARs are selection-types and whose CDRs are |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
97 the names of Lisp functions to call to convert the given Emacs |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
98 selection value to a string representing the given selection type. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
99 This is for Lisp-level extension of the emacs selection |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
100 handling. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
101 static Lisp_Object Vselection_converter_alist; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
102 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
103 /* A selection name (represented as a Lisp symbol) can be associated |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
104 with a named scrap via `mac-scrap-name' property. Likewise for a |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
105 selection type with a scrap flavor type via `mac-ostype'. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
106 static Lisp_Object Qmac_scrap_name, Qmac_ostype; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
107 |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
108 #ifdef MAC_OSX |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
109 /* Selection name for communication via Services menu. */ |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
110 static Lisp_Object Vmac_service_selection; |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
111 #endif |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
112 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
113 /* Get a reference to the selection corresponding to the symbol SYM. |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
114 The reference is set to *SEL, and it becomes NULL if there's no |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
115 corresponding selection. Clear the selection if CLEAR_P is |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
116 non-zero. */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
117 |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
118 static OSStatus |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
119 mac_get_selection_from_symbol (sym, clear_p, sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
120 Lisp_Object sym; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
121 int clear_p; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
122 Selection *sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
123 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
124 OSStatus err = noErr; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
125 Lisp_Object str = Fget (sym, Qmac_scrap_name); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
126 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
127 if (!STRINGP (str)) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
128 *sel = NULL; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
129 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
130 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
131 #if TARGET_API_MAC_CARBON |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
132 #ifdef MAC_OSX |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
133 CFStringRef scrap_name = cfstring_create_with_string (str); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
134 OptionBits options = (clear_p ? kScrapClearNamedScrap |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
135 : kScrapGetNamedScrap); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
136 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
137 err = GetScrapByName (scrap_name, options, sel); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
138 CFRelease (scrap_name); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
139 #else /* !MAC_OSX */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
140 if (clear_p) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
141 err = ClearCurrentScrap (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
142 if (err == noErr) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
143 err = GetCurrentScrap (sel); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
144 #endif /* !MAC_OSX */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
145 #else /* !TARGET_API_MAC_CARBON */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
146 if (clear_p) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
147 err = ZeroScrap (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
148 if (err == noErr) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
149 *sel = 1; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
150 #endif /* !TARGET_API_MAC_CARBON */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
151 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
152 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
153 return err; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
154 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
155 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
156 /* Get a scrap flavor type from the symbol SYM. Return 0 if no |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
157 corresponding flavor type. If SEL is non-zero, the return value is |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
158 non-zero only when the SEL has the flavor type. */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
159 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
160 static ScrapFlavorType |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
161 get_flavor_type_from_symbol (sym, sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
162 Lisp_Object sym; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
163 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
164 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
165 Lisp_Object str = Fget (sym, Qmac_ostype); |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
166 ScrapFlavorType flavor_type; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
167 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
168 if (STRINGP (str) && SBYTES (str) == 4) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
169 flavor_type = EndianU32_BtoN (*((UInt32 *) SDATA (str))); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
170 else |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
171 flavor_type = 0; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
172 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
173 if (flavor_type && sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
174 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
175 #if TARGET_API_MAC_CARBON |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
176 OSStatus err; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
177 ScrapFlavorFlags flags; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
178 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
179 err = GetScrapFlavorFlags (sel, flavor_type, &flags); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
180 if (err != noErr) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
181 flavor_type = 0; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
182 #else /* !TARGET_API_MAC_CARBON */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
183 SInt32 size, offset; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
184 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
185 size = GetScrap (NULL, flavor_type, &offset); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
186 if (size < 0) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
187 flavor_type = 0; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
188 #endif /* !TARGET_API_MAC_CARBON */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
189 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
190 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
191 return flavor_type; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
192 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
193 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
194 /* Check if the symbol SYM has a corresponding selection target type. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
195 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
196 static int |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
197 mac_valid_selection_target_p (sym) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
198 Lisp_Object sym; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
199 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
200 return get_flavor_type_from_symbol (sym, 0) != 0; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
201 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
202 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
203 /* Clear the selection whose reference is *SEL. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
204 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
205 static OSStatus |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
206 mac_clear_selection (sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
207 Selection *sel; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
208 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
209 #if TARGET_API_MAC_CARBON |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
210 #ifdef MAC_OSX |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
211 return ClearScrap (sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
212 #else |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
213 OSStatus err; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
214 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
215 err = ClearCurrentScrap (); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
216 if (err == noErr) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
217 err = GetCurrentScrap (sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
218 return err; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
219 #endif |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
220 #else /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
221 return ZeroScrap (); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
222 #endif /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
223 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
224 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
225 /* Get ownership information for SEL. Emacs can detect a change of |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
226 the ownership by comparing saved and current values of the |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
227 ownership information. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
228 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
229 static Lisp_Object |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
230 mac_get_selection_ownership_info (sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
231 Selection sel; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
232 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
233 #if TARGET_API_MAC_CARBON |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
234 return long_to_cons ((unsigned long) sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
235 #else /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
236 ScrapStuffPtr scrap_info = InfoScrap (); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
237 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
238 return make_number (scrap_info->scrapCount); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
239 #endif /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
240 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
241 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
242 /* Return non-zero if VALUE is a valid selection value for TARGET. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
243 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
244 static int |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
245 mac_valid_selection_value_p (value, target) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
246 Lisp_Object value, target; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
247 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
248 return STRINGP (value); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
249 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
250 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
251 /* Put Lisp Object VALUE to the selection SEL. The target type is |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
252 specified by TARGET. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
253 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
254 static OSStatus |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
255 mac_put_selection_value (sel, target, value) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
256 Selection sel; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
257 Lisp_Object target, value; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
258 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
259 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, 0); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
260 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
261 if (flavor_type == 0 || !STRINGP (value)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
262 return noTypeErr; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
263 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
264 #if TARGET_API_MAC_CARBON |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
265 return PutScrapFlavor (sel, flavor_type, kScrapFlavorMaskNone, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
266 SBYTES (value), SDATA (value)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
267 #else /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
268 return PutScrap (SBYTES (value), flavor_type, SDATA (value)); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
269 #endif /* !TARGET_API_MAC_CARBON */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
270 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
271 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
272 /* Check if data for the target type TARGET is available in SEL. */ |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
273 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
274 static int |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
275 mac_selection_has_target_p (sel, target) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
276 Selection sel; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
277 Lisp_Object target; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
278 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
279 return get_flavor_type_from_symbol (target, sel) != 0; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
280 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
281 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
282 /* Get data for the target type TARGET from SEL and create a Lisp |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
283 string. Return nil if failed to get data. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
284 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
285 static Lisp_Object |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
286 mac_get_selection_value (sel, target) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
287 Selection sel; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
288 Lisp_Object target; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
289 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
290 OSStatus err; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
291 Lisp_Object result = Qnil; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
292 ScrapFlavorType flavor_type = get_flavor_type_from_symbol (target, sel); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
293 #if TARGET_API_MAC_CARBON |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
294 Size size; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
295 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
296 if (flavor_type) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
297 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
298 err = GetScrapFlavorSize (sel, flavor_type, &size); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
299 if (err == noErr) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
300 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
301 do |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
302 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
303 result = make_uninit_string (size); |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
304 err = GetScrapFlavorData (sel, flavor_type, |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
305 &size, SDATA (result)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
306 if (err != noErr) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
307 result = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
308 else if (size < SBYTES (result)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
309 result = make_unibyte_string (SDATA (result), size); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
310 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
311 while (STRINGP (result) && size > SBYTES (result)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
312 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
313 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
314 #else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
315 Handle handle; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
316 SInt32 size, offset; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
317 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
318 if (flavor_type) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
319 size = GetScrap (NULL, flavor_type, &offset); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
320 if (size >= 0) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
321 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
322 handle = NewHandle (size); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
323 HLock (handle); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
324 size = GetScrap (handle, flavor_type, &offset); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
325 if (size >= 0) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
326 result = make_unibyte_string (*handle, size); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
327 DisposeHandle (handle); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
328 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
329 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
330 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
331 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
332 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
333 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
334 /* Get the list of target types in SEL. The return value is a list of |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
335 target type symbols possibly followed by scrap flavor type |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
336 strings. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
337 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
338 static Lisp_Object |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
339 mac_get_selection_target_list (sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
340 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
341 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
342 Lisp_Object result = Qnil, rest, target; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
343 #if TARGET_API_MAC_CARBON |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
344 OSStatus err; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
345 UInt32 count, i, type; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
346 ScrapFlavorInfo *flavor_info = NULL; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
347 Lisp_Object strings = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
348 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
349 err = GetScrapFlavorCount (sel, &count); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
350 if (err == noErr) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
351 flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
352 err = GetScrapFlavorInfoList (sel, &count, flavor_info); |
70070
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
353 if (err != noErr) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
354 { |
70070
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
355 xfree (flavor_info); |
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
356 flavor_info = NULL; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
357 } |
64312
c528a5858404
(get_scrap_target_type_list): Avoid NULL pointer dereference.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
358 if (flavor_info == NULL) |
c528a5858404
(get_scrap_target_type_list): Avoid NULL pointer dereference.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64084
diff
changeset
|
359 count = 0; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
360 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
361 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
362 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
363 ScrapFlavorType flavor_type = 0; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
364 |
76745
f6a525134188
(get_scrap_target_type_list, x_own_selection): Move
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75376
diff
changeset
|
365 if (CONSP (XCAR (rest)) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
366 && (target = XCAR (XCAR (rest)), |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
367 SYMBOLP (target)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
368 && (flavor_type = get_flavor_type_from_symbol (target, sel))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
369 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
370 result = Fcons (target, result); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
371 #if TARGET_API_MAC_CARBON |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
372 for (i = 0; i < count; i++) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
373 if (flavor_info[i].flavorType == flavor_type) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
374 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
375 flavor_info[i].flavorType = 0; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
376 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
377 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
378 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
379 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
380 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
381 #if TARGET_API_MAC_CARBON |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
382 if (flavor_info) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
383 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
384 for (i = 0; i < count; i++) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
385 if (flavor_info[i].flavorType) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
386 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
387 type = EndianU32_NtoB (flavor_info[i].flavorType); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
388 strings = Fcons (make_unibyte_string ((char *) &type, 4), strings); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
389 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
390 result = nconc2 (result, strings); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
391 xfree (flavor_info); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
392 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
393 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
394 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
395 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
396 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
397 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
398 /* Do protocol to assert ourself as a selection owner. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
399 Update the Vselection_alist so that we can reply to later requests for |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
400 our selection. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
401 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
402 static void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
403 x_own_selection (selection_name, selection_value) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
404 Lisp_Object selection_name, selection_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
405 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
406 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
407 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
408 struct gcpro gcpro1, gcpro2; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
409 Lisp_Object rest, handler_fn, value, target_type; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
410 int count; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
411 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
412 CHECK_SYMBOL (selection_name); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
413 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
414 GCPRO2 (selection_name, selection_value); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
415 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
416 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
417 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
418 err = mac_get_selection_from_symbol (selection_name, 1, &sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
419 if (err == noErr && sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
420 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
421 /* Don't allow a quit within the converter. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
422 When the user types C-g, he would be surprised |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
423 if by luck it came during a converter. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
424 count = SPECPDL_INDEX (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
425 specbind (Qinhibit_quit, Qt); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
426 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
427 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
428 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
429 if (!(CONSP (XCAR (rest)) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
430 && (target_type = XCAR (XCAR (rest)), |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
431 SYMBOLP (target_type)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
432 && mac_valid_selection_target_p (target_type) |
76745
f6a525134188
(get_scrap_target_type_list, x_own_selection): Move
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75376
diff
changeset
|
433 && (handler_fn = XCDR (XCAR (rest)), |
f6a525134188
(get_scrap_target_type_list, x_own_selection): Move
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75376
diff
changeset
|
434 SYMBOLP (handler_fn)))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
435 continue; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
436 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
437 if (!NILP (handler_fn)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
438 value = call3 (handler_fn, selection_name, |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
439 target_type, selection_value); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
440 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
441 if (NILP (value)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
442 continue; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
443 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
444 if (mac_valid_selection_value_p (value, target_type)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
445 err = mac_put_selection_value (sel, target_type, value); |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
446 else if (CONSP (value) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
447 && EQ (XCAR (value), target_type) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
448 && mac_valid_selection_value_p (XCDR (value), target_type)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
449 err = mac_put_selection_value (sel, target_type, XCDR (value)); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
450 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
451 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
452 unbind_to (count, Qnil); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
453 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
454 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
455 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
456 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
457 UNGCPRO; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
458 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
459 if (sel && err != noErr) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
460 error ("Can't set selection"); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
461 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
462 /* Now update the local cache */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
463 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
464 Lisp_Object selection_time; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
465 Lisp_Object selection_data; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
466 Lisp_Object ownership_info; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
467 Lisp_Object prev_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
468 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
469 selection_time = long_to_cons (last_event_timestamp); |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
470 if (sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
471 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
472 BLOCK_INPUT; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
473 ownership_info = mac_get_selection_ownership_info (sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
474 UNBLOCK_INPUT; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
475 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
476 else |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
477 ownership_info = Qnil; /* dummy value for local-only selection */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
478 selection_data = Fcons (selection_name, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
479 Fcons (selection_value, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
480 Fcons (selection_time, |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
481 Fcons (selected_frame, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
482 Fcons (ownership_info, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
483 Qnil))))); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
484 prev_value = assq_no_quit (selection_name, Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
485 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
486 Vselection_alist = Fcons (selection_data, Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
487 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
488 /* If we already owned the selection, remove the old selection data. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
489 Perhaps we should destructively modify it instead. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
490 Don't use Fdelq as that may QUIT. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
491 if (!NILP (prev_value)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
492 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
493 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ |
85372
f7d19cfed7da
* xselect.c (x_own_selection, x_handle_selection_clear)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82290
diff
changeset
|
494 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
495 if (EQ (prev_value, Fcar (XCDR (rest)))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
496 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
497 XSETCDR (rest, Fcdr (XCDR (rest))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
498 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
499 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
500 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
501 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
502 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
503 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
504 /* Given a selection-name and desired type, look up our local copy of |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
505 the selection value and convert it to the type. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
506 The value is nil or a string. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
507 This function is used both for remote requests (LOCAL_REQUEST is zero) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
508 and for local x-get-selection-internal (LOCAL_REQUEST is nonzero). |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
509 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
510 This calls random Lisp code, and may signal or gc. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
511 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
512 static Lisp_Object |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
513 x_get_local_selection (selection_symbol, target_type, local_request) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
514 Lisp_Object selection_symbol, target_type; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
515 int local_request; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
516 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
517 Lisp_Object local_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
518 Lisp_Object handler_fn, value, type, check; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
519 int count; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
520 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
521 if (NILP (Fx_selection_owner_p (selection_symbol))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
522 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
523 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
524 local_value = assq_no_quit (selection_symbol, Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
525 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
526 /* TIMESTAMP is a special case 'cause that's easiest. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
527 if (EQ (target_type, QTIMESTAMP)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
528 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
529 handler_fn = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
530 value = XCAR (XCDR (XCDR (local_value))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
531 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
532 #if 0 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
533 else if (EQ (target_type, QDELETE)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
534 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
535 handler_fn = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
536 Fx_disown_selection_internal |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
537 (selection_symbol, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
538 XCAR (XCDR (XCDR (local_value)))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
539 value = QNULL; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
540 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
541 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
542 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
543 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
544 /* Don't allow a quit within the converter. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
545 When the user types C-g, he would be surprised |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
546 if by luck it came during a converter. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
547 count = SPECPDL_INDEX (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
548 specbind (Qinhibit_quit, Qt); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
549 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
550 CHECK_SYMBOL (target_type); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
551 handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
552 /* gcpro is not needed here since nothing but HANDLER_FN |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
553 is live, and that ought to be a symbol. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
554 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
555 if (!NILP (handler_fn)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
556 value = call3 (handler_fn, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
557 selection_symbol, (local_request ? Qnil : target_type), |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
558 XCAR (XCDR (local_value))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
559 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
560 value = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
561 unbind_to (count, Qnil); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
562 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
563 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
564 if (local_request) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
565 return value; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
566 |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
567 /* Make sure this value is of a type that we could transmit |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
568 to another application. */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
569 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
570 type = target_type; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
571 check = value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
572 if (CONSP (value) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
573 && SYMBOLP (XCAR (value))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
574 type = XCAR (value), |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
575 check = XCDR (value); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
576 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
577 if (NILP (value) || mac_valid_selection_value_p (check, type)) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
578 return value; |
71985
ae7908422c59
(x_get_local_selection): Use signal_error.
Kim F. Storm <storm@cua.dk>
parents:
70988
diff
changeset
|
579 |
ae7908422c59
(x_get_local_selection): Use signal_error.
Kim F. Storm <storm@cua.dk>
parents:
70988
diff
changeset
|
580 signal_error ("Invalid data returned by selection-conversion function", |
ae7908422c59
(x_get_local_selection): Use signal_error.
Kim F. Storm <storm@cua.dk>
parents:
70988
diff
changeset
|
581 list2 (handler_fn, value)); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
582 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
583 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
584 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
585 /* Clear all selections that were made from frame F. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
586 We do this when about to delete a frame. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
587 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
588 void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
589 x_clear_frame_selections (f) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
590 FRAME_PTR f; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
591 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
592 Lisp_Object frame; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
593 Lisp_Object rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
594 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
595 XSETFRAME (frame, f); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
596 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
597 /* Otherwise, we're really honest and truly being told to drop it. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
598 Don't use Fdelq as that may QUIT;. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
599 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
600 /* Delete elements from the beginning of Vselection_alist. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
601 while (!NILP (Vselection_alist) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
602 && EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (Vselection_alist))))))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
603 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
604 /* Let random Lisp code notice that the selection has been stolen. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
605 Lisp_Object hooks, selection_symbol; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
606 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
607 hooks = Vx_lost_selection_functions; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
608 selection_symbol = Fcar (Fcar (Vselection_alist)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
609 |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
610 if (!EQ (hooks, Qunbound) |
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
611 && !NILP (Fx_selection_owner_p (selection_symbol))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
612 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
613 for (; CONSP (hooks); hooks = Fcdr (hooks)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
614 call1 (Fcar (hooks), selection_symbol); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
615 #if 0 /* This can crash when deleting a frame |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
616 from x_connection_closed. Anyway, it seems unnecessary; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
617 something else should cause a redisplay. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
618 redisplay_preserve_echo_area (21); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
619 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
620 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
621 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
622 Vselection_alist = Fcdr (Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
623 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
624 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
625 /* Delete elements after the beginning of Vselection_alist. */ |
85372
f7d19cfed7da
* xselect.c (x_own_selection, x_handle_selection_clear)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82290
diff
changeset
|
626 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
627 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
628 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
629 /* Let random Lisp code notice that the selection has been stolen. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
630 Lisp_Object hooks, selection_symbol; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
631 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
632 hooks = Vx_lost_selection_functions; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
633 selection_symbol = Fcar (Fcar (XCDR (rest))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
634 |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
635 if (!EQ (hooks, Qunbound) |
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
636 && !NILP (Fx_selection_owner_p (selection_symbol))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
637 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
638 for (; CONSP (hooks); hooks = Fcdr (hooks)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
639 call1 (Fcar (hooks), selection_symbol); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
640 #if 0 /* See above */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
641 redisplay_preserve_echo_area (22); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
642 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
643 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
644 XSETCDR (rest, Fcdr (XCDR (rest))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
645 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
646 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
647 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
648 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
649 /* Do protocol to read selection-data from the server. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
650 Converts this to Lisp data and returns it. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
651 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
652 static Lisp_Object |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
653 x_get_foreign_selection (selection_symbol, target_type, time_stamp) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
654 Lisp_Object selection_symbol, target_type, time_stamp; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
655 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
656 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
657 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
658 Lisp_Object result = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
659 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
660 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
661 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
662 err = mac_get_selection_from_symbol (selection_symbol, 0, &sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
663 if (err == noErr && sel) |
69963
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
664 { |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
665 if (EQ (target_type, QTARGETS)) |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
666 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
667 result = mac_get_selection_target_list (sel); |
69963
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
668 result = Fvconcat (1, &result); |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
669 } |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
670 else |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
671 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
672 result = mac_get_selection_value (sel, target_type); |
69963
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
673 if (STRINGP (result)) |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
674 Fput_text_property (make_number (0), make_number (SBYTES (result)), |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
675 Qforeign_selection, target_type, result); |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
676 } |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
677 } |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
678 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
679 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
680 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
681 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
682 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
683 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
684 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
685 DEFUN ("x-own-selection-internal", Fx_own_selection_internal, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
686 Sx_own_selection_internal, 2, 2, 0, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
687 doc: /* Assert a selection of the given TYPE with the given VALUE. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
688 TYPE is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
689 VALUE is typically a string, or a cons of two markers, but may be |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
690 anything that the functions on `selection-converter-alist' know about. */) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
691 (selection_name, selection_value) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
692 Lisp_Object selection_name, selection_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
693 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
694 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
695 CHECK_SYMBOL (selection_name); |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
696 if (NILP (selection_value)) error ("SELECTION-VALUE may not be nil"); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
697 x_own_selection (selection_name, selection_value); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
698 return selection_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
699 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
700 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
701 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
702 /* Request the selection value from the owner. If we are the owner, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
703 simply return our selection value. If we are not the owner, this |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
704 will block until all of the data has arrived. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
705 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
706 DEFUN ("x-get-selection-internal", Fx_get_selection_internal, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
707 Sx_get_selection_internal, 2, 3, 0, |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
708 doc: /* Return text selected from some Mac application. |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
709 SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
710 TYPE is the type of data desired, typically `STRING'. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
711 TIME_STAMP is ignored on Mac. */) |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
712 (selection_symbol, target_type, time_stamp) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
713 Lisp_Object selection_symbol, target_type, time_stamp; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
714 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
715 Lisp_Object val = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
716 struct gcpro gcpro1, gcpro2; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
717 GCPRO2 (target_type, val); /* we store newly consed data into these */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
718 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
719 CHECK_SYMBOL (selection_symbol); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
720 CHECK_SYMBOL (target_type); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
721 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
722 val = x_get_local_selection (selection_symbol, target_type, 1); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
723 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
724 if (NILP (val)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
725 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
726 val = x_get_foreign_selection (selection_symbol, target_type, time_stamp); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
727 goto DONE; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
728 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
729 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
730 if (CONSP (val) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
731 && SYMBOLP (XCAR (val))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
732 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
733 val = XCDR (val); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
734 if (CONSP (val) && NILP (XCDR (val))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
735 val = XCAR (val); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
736 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
737 DONE: |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
738 UNGCPRO; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
739 return val; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
740 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
741 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
742 DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
743 Sx_disown_selection_internal, 1, 2, 0, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
744 doc: /* If we own the selection SELECTION, disown it. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
745 Disowning it means there is no such selection. */) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
746 (selection, time) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
747 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
748 Lisp_Object time; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
749 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
750 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
751 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
752 Lisp_Object local_selection_data; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
753 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
754 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
755 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
756 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
757 if (NILP (Fx_selection_owner_p (selection))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
758 return Qnil; /* Don't disown the selection when we're not the owner. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
759 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
760 local_selection_data = assq_no_quit (selection, Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
761 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
762 /* Don't use Fdelq as that may QUIT;. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
763 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
764 if (EQ (local_selection_data, Fcar (Vselection_alist))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
765 Vselection_alist = Fcdr (Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
766 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
767 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
768 Lisp_Object rest; |
85372
f7d19cfed7da
* xselect.c (x_own_selection, x_handle_selection_clear)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82290
diff
changeset
|
769 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
770 if (EQ (local_selection_data, Fcar (XCDR (rest)))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
771 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
772 XSETCDR (rest, Fcdr (XCDR (rest))); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
773 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
774 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
775 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
776 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
777 /* Let random lisp code notice that the selection has been stolen. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
778 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
779 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
780 Lisp_Object rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
781 rest = Vx_lost_selection_functions; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
782 if (!EQ (rest, Qunbound)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
783 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
784 for (; CONSP (rest); rest = Fcdr (rest)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
785 call1 (Fcar (rest), selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
786 prepare_menu_bars (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
787 redisplay_preserve_echo_area (20); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
788 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
789 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
790 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
791 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
792 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
793 err = mac_get_selection_from_symbol (selection, 0, &sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
794 if (err == noErr && sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
795 mac_clear_selection (&sel); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
796 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
797 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
798 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
799 return Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
800 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
801 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
802 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
803 DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
804 0, 1, 0, |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
805 doc: /* Whether the current Emacs process owns the given SELECTION. |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
806 The arg should be the name of the selection in question, typically one of |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
807 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
808 For convenience, the symbol nil is the same as `PRIMARY', |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
809 and t is the same as `SECONDARY'. */) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
810 (selection) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
811 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
812 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
813 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
814 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
815 Lisp_Object result = Qnil, local_selection_data; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
816 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
817 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
818 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
819 if (EQ (selection, Qnil)) selection = QPRIMARY; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
820 if (EQ (selection, Qt)) selection = QSECONDARY; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
821 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
822 local_selection_data = assq_no_quit (selection, Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
823 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
824 if (NILP (local_selection_data)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
825 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
826 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
827 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
828 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
829 err = mac_get_selection_from_symbol (selection, 0, &sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
830 if (err == noErr && sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
831 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
832 Lisp_Object ownership_info; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
833 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
834 ownership_info = XCAR (XCDR (XCDR (XCDR (XCDR (local_selection_data))))); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
835 if (!NILP (Fequal (ownership_info, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
836 mac_get_selection_ownership_info (sel)))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
837 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
838 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
839 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
840 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
841 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
842 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
843 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
844 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
845 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
846 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
847 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
848 0, 1, 0, |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
849 doc: /* Whether there is an owner for the given SELECTION. |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
850 The arg should be the name of the selection in question, typically one of |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
851 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
852 For convenience, the symbol nil is the same as `PRIMARY', |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
853 and t is the same as `SECONDARY'. */) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
854 (selection) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
855 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
856 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
857 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
858 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
859 Lisp_Object result = Qnil, rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
860 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
861 /* It should be safe to call this before we have an Mac frame. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
862 if (! FRAME_MAC_P (SELECTED_FRAME ())) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
863 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
864 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
865 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
866 if (!NILP (Fx_selection_owner_p (selection))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
867 return Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
868 if (EQ (selection, Qnil)) selection = QPRIMARY; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
869 if (EQ (selection, Qt)) selection = QSECONDARY; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
870 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
871 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
872 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
873 err = mac_get_selection_from_symbol (selection, 0, &sel); |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
874 if (err == noErr && sel) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
875 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
876 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
877 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
878 && mac_selection_has_target_p (sel, XCAR (XCAR (rest)))) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
879 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
880 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
881 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
882 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
883 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
884 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
885 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
886 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
887 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
888 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
889 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
890 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
891 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
892 Apple event support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
893 ***********************************************************************/ |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
894 int mac_ready_for_apple_events = 0; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
895 static Lisp_Object Vmac_apple_event_map; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
896 static Lisp_Object Qmac_apple_event_class, Qmac_apple_event_id; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
897 static Lisp_Object Qemacs_suspension_id; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
898 extern Lisp_Object Qundefined; |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
899 extern void mac_store_apple_event P_ ((Lisp_Object, Lisp_Object, |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
900 const AEDesc *)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
901 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
902 struct apple_event_binding |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
903 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
904 UInt32 code; /* Apple event class or ID. */ |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
905 Lisp_Object key, binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
906 }; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
907 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
908 struct suspended_ae_info |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
909 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
910 UInt32 expiration_tick, suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
911 AppleEvent apple_event, reply; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
912 struct suspended_ae_info *next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
913 }; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
914 |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
915 /* List of apple events deferred at the startup time. */ |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
916 static struct suspended_ae_info *deferred_apple_events = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
917 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
918 /* List of suspended apple events, in order of expiration_tick. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
919 static struct suspended_ae_info *suspended_apple_events = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
920 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
921 static void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
922 find_event_binding_fun (key, binding, args, data) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
923 Lisp_Object key, binding, args; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
924 void *data; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
925 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
926 struct apple_event_binding *event_binding = |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
927 (struct apple_event_binding *)data; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
928 Lisp_Object code_string; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
929 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
930 if (!SYMBOLP (key)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
931 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
932 code_string = Fget (key, args); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
933 if (STRINGP (code_string) && SBYTES (code_string) == 4 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
934 && (EndianU32_BtoN (*((UInt32 *) SDATA (code_string))) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
935 == event_binding->code)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
936 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
937 event_binding->key = key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
938 event_binding->binding = binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
939 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
940 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
941 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
942 static void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
943 find_event_binding (keymap, event_binding, class_p) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
944 Lisp_Object keymap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
945 struct apple_event_binding *event_binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
946 int class_p; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
947 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
948 if (event_binding->code == 0) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
949 event_binding->binding = |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
950 access_keymap (keymap, event_binding->key, 0, 1, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
951 else |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
952 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
953 event_binding->binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
954 map_keymap (keymap, find_event_binding_fun, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
955 class_p ? Qmac_apple_event_class : Qmac_apple_event_id, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
956 event_binding, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
957 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
958 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
959 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
960 void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
961 mac_find_apple_event_spec (class, id, class_key, id_key, binding) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
962 AEEventClass class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
963 AEEventID id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
964 Lisp_Object *class_key, *id_key, *binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
965 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
966 struct apple_event_binding event_binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
967 Lisp_Object keymap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
968 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
969 *binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
970 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
971 keymap = get_keymap (Vmac_apple_event_map, 0, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
972 if (NILP (keymap)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
973 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
974 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
975 event_binding.code = class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
976 event_binding.key = *class_key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
977 event_binding.binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
978 find_event_binding (keymap, &event_binding, 1); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
979 *class_key = event_binding.key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
980 keymap = get_keymap (event_binding.binding, 0, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
981 if (NILP (keymap)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
982 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
983 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
984 event_binding.code = id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
985 event_binding.key = *id_key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
986 event_binding.binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
987 find_event_binding (keymap, &event_binding, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
988 *id_key = event_binding.key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
989 *binding = event_binding.binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
990 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
991 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
992 static OSErr |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
993 defer_apple_events (apple_event, reply) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
994 const AppleEvent *apple_event, *reply; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
995 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
996 OSErr err; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
997 struct suspended_ae_info *new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
998 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
999 new = xmalloc (sizeof (struct suspended_ae_info)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1000 bzero (new, sizeof (struct suspended_ae_info)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1001 new->apple_event.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1002 new->reply.descriptorType = typeNull; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1003 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1004 err = AESuspendTheCurrentEvent (apple_event); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1005 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1006 /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1007 copies of the Apple event and the reply, but Mac OS 10.4 Xcode |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1008 manual says it doesn't. Anyway we create copies of them and save |
69963
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1009 them in `deferred_apple_events'. */ |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1010 if (err == noErr) |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1011 err = AEDuplicateDesc (apple_event, &new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1012 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1013 err = AEDuplicateDesc (reply, &new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1014 if (err == noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1015 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1016 new->next = deferred_apple_events; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1017 deferred_apple_events = new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1018 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1019 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1020 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1021 AEDisposeDesc (&new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1022 AEDisposeDesc (&new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1023 xfree (new); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1024 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1025 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1026 return err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1027 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1028 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1029 static OSErr |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1030 mac_handle_apple_event_1 (class, id, apple_event, reply) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1031 Lisp_Object class, id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1032 const AppleEvent *apple_event; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1033 AppleEvent *reply; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1034 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1035 OSErr err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1036 static UInt32 suspension_id = 0; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1037 struct suspended_ae_info *new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1038 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1039 new = xmalloc (sizeof (struct suspended_ae_info)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1040 bzero (new, sizeof (struct suspended_ae_info)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1041 new->apple_event.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1042 new->reply.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1043 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1044 err = AESuspendTheCurrentEvent (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1045 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1046 err = AEDuplicateDesc (apple_event, &new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1047 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1048 err = AEDuplicateDesc (reply, &new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1049 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1050 err = AEPutAttributePtr (&new->apple_event, KEY_EMACS_SUSPENSION_ID_ATTR, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1051 typeUInt32, &suspension_id, sizeof (UInt32)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1052 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1053 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1054 OSErr err1; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1055 SInt32 reply_requested; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1056 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1057 err1 = AEGetAttributePtr (&new->apple_event, keyReplyRequestedAttr, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1058 typeSInt32, NULL, &reply_requested, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1059 sizeof (SInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1060 if (err1 != noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1061 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1062 /* Emulate keyReplyRequestedAttr in older versions. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1063 reply_requested = reply->descriptorType != typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1064 err = AEPutAttributePtr (&new->apple_event, keyReplyRequestedAttr, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1065 typeSInt32, &reply_requested, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1066 sizeof (SInt32)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1067 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1068 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1069 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1070 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1071 SInt32 timeout = 0; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1072 struct suspended_ae_info **p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1073 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1074 new->suspension_id = suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1075 suspension_id++; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1076 err = AEGetAttributePtr (apple_event, keyTimeoutAttr, typeSInt32, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1077 NULL, &timeout, sizeof (SInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1078 new->expiration_tick = TickCount () + timeout; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1079 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1080 for (p = &suspended_apple_events; *p; p = &(*p)->next) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1081 if ((*p)->expiration_tick >= new->expiration_tick) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1082 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1083 new->next = *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1084 *p = new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1085 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1086 mac_store_apple_event (class, id, &new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1087 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1088 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1089 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1090 AEDisposeDesc (&new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1091 AEDisposeDesc (&new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1092 xfree (new); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1093 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1094 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1095 return err; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1096 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1097 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1098 static pascal OSErr |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1099 mac_handle_apple_event (apple_event, reply, refcon) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1100 const AppleEvent *apple_event; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1101 AppleEvent *reply; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1102 SInt32 refcon; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1103 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1104 OSErr err; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1105 UInt32 suspension_id; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1106 AEEventClass event_class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1107 AEEventID event_id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1108 Lisp_Object class_key, id_key, binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1109 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1110 if (!mac_ready_for_apple_events) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1111 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1112 err = defer_apple_events (apple_event, reply); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1113 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1114 return errAEEventNotHandled; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1115 return noErr; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1116 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1117 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1118 err = AEGetAttributePtr (apple_event, KEY_EMACS_SUSPENSION_ID_ATTR, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1119 typeUInt32, NULL, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1120 &suspension_id, sizeof (UInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1121 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1122 /* Previously suspended event. Pass it to the next handler. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1123 return errAEEventNotHandled; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1124 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1125 err = AEGetAttributePtr (apple_event, keyEventClassAttr, typeType, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1126 &event_class, sizeof (AEEventClass), NULL); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1127 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1128 err = AEGetAttributePtr (apple_event, keyEventIDAttr, typeType, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1129 &event_id, sizeof (AEEventID), NULL); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1130 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1131 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1132 mac_find_apple_event_spec (event_class, event_id, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1133 &class_key, &id_key, &binding); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1134 if (!NILP (binding) && !EQ (binding, Qundefined)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1135 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1136 if (INTEGERP (binding)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1137 return XINT (binding); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1138 err = mac_handle_apple_event_1 (class_key, id_key, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1139 apple_event, reply); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1140 } |
70988
5605e49b641f
(mac_handle_apple_event): Return
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70873
diff
changeset
|
1141 else |
5605e49b641f
(mac_handle_apple_event): Return
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70873
diff
changeset
|
1142 err = errAEEventNotHandled; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1143 } |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1144 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1145 return noErr; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1146 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1147 return errAEEventNotHandled; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1148 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1149 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1150 static int |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1151 cleanup_suspended_apple_events (head, all_p) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1152 struct suspended_ae_info **head; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1153 int all_p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1154 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1155 UInt32 current_tick = TickCount (), nresumed = 0; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1156 struct suspended_ae_info *p, *next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1157 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1158 for (p = *head; p; p = next) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1159 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1160 if (!all_p && p->expiration_tick > current_tick) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1161 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1162 AESetTheCurrentEvent (&p->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1163 AEResumeTheCurrentEvent (&p->apple_event, &p->reply, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1164 (AEEventHandlerUPP) kAENoDispatch, 0); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1165 AEDisposeDesc (&p->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1166 AEDisposeDesc (&p->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1167 nresumed++; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1168 next = p->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1169 xfree (p); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1170 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1171 *head = p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1172 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1173 return nresumed; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1174 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1175 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1176 static void |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1177 cleanup_all_suspended_apple_events () |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1178 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1179 cleanup_suspended_apple_events (&deferred_apple_events, 1); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1180 cleanup_suspended_apple_events (&suspended_apple_events, 1); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1181 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1182 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1183 void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1184 init_apple_event_handler () |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1185 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1186 OSErr err; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1187 long result; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1188 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1189 /* Make sure we have Apple events before starting. */ |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1190 err = Gestalt (gestaltAppleEventsAttr, &result); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1191 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1192 abort (); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1193 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1194 if (!(result & (1 << gestaltAppleEventsPresent))) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1195 abort (); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1196 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1197 err = AEInstallEventHandler (typeWildCard, typeWildCard, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1198 #if TARGET_API_MAC_CARBON |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1199 NewAEEventHandlerUPP (mac_handle_apple_event), |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1200 #else |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1201 NewAEEventHandlerProc (mac_handle_apple_event), |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1202 #endif |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1203 0L, false); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1204 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1205 abort (); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1206 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1207 atexit (cleanup_all_suspended_apple_events); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1208 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1209 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1210 static UInt32 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1211 get_suspension_id (apple_event) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1212 Lisp_Object apple_event; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1213 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1214 Lisp_Object tem; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1215 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1216 CHECK_CONS (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1217 CHECK_STRING_CAR (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1218 if (SBYTES (XCAR (apple_event)) != 4 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1219 || strcmp (SDATA (XCAR (apple_event)), "aevt") != 0) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1220 error ("Not an apple event"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1221 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1222 tem = assq_no_quit (Qemacs_suspension_id, XCDR (apple_event)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1223 if (NILP (tem)) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1224 error ("Suspension ID not available"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1225 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1226 tem = XCDR (tem); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1227 if (!(CONSP (tem) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1228 && STRINGP (XCAR (tem)) && SBYTES (XCAR (tem)) == 4 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1229 && strcmp (SDATA (XCAR (tem)), "magn") == 0 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1230 && STRINGP (XCDR (tem)) && SBYTES (XCDR (tem)) == 4)) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1231 error ("Bad suspension ID format"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1232 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1233 return *((UInt32 *) SDATA (XCDR (tem))); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1234 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1235 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1236 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1237 DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, Smac_process_deferred_apple_events, 0, 0, 0, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1238 doc: /* Process Apple events that are deferred at the startup time. */) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1239 () |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1240 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1241 if (mac_ready_for_apple_events) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1242 return Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1243 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1244 BLOCK_INPUT; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1245 mac_ready_for_apple_events = 1; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1246 if (deferred_apple_events) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1247 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1248 struct suspended_ae_info *prev, *tail, *next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1249 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1250 /* `nreverse' deferred_apple_events. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1251 prev = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1252 for (tail = deferred_apple_events; tail; tail = next) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1253 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1254 next = tail->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1255 tail->next = prev; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1256 prev = tail; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1257 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1258 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1259 /* Now `prev' points to the first cell. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1260 for (tail = prev; tail; tail = next) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1261 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1262 next = tail->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1263 AEResumeTheCurrentEvent (&tail->apple_event, &tail->reply, |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1264 ((AEEventHandlerUPP) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1265 kAEUseStandardDispatch), 0); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1266 AEDisposeDesc (&tail->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1267 AEDisposeDesc (&tail->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1268 xfree (tail); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1269 } |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1270 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1271 deferred_apple_events = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1272 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1273 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1274 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1275 return Qt; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1276 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1277 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1278 DEFUN ("mac-cleanup-expired-apple-events", Fmac_cleanup_expired_apple_events, Smac_cleanup_expired_apple_events, 0, 0, 0, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1279 doc: /* Clean up expired Apple events. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1280 Return the number of expired events. */) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1281 () |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1282 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1283 int nexpired; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1284 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1285 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1286 nexpired = cleanup_suspended_apple_events (&suspended_apple_events, 0); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1287 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1288 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1289 return make_number (nexpired); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1290 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1291 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1292 DEFUN ("mac-ae-set-reply-parameter", Fmac_ae_set_reply_parameter, Smac_ae_set_reply_parameter, 3, 3, 0, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1293 doc: /* Set parameter KEYWORD to DESCRIPTOR on reply of APPLE-EVENT. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1294 KEYWORD is a 4-byte string. DESCRIPTOR is a Lisp representation of an |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1295 Apple event descriptor. It has the form of (TYPE . DATA), where TYPE |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1296 is a 4-byte string. Valid format of DATA is as follows: |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1297 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1298 * If TYPE is "null", then DATA is nil. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1299 * If TYPE is "list", then DATA is a list (DESCRIPTOR1 ... DESCRIPTORn). |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1300 * If TYPE is "reco", then DATA is a list ((KEYWORD1 . DESCRIPTOR1) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1301 ... (KEYWORDn . DESCRIPTORn)). |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1302 * If TYPE is "aevt", then DATA is ignored and the descriptor is |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1303 treated as null. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1304 * Otherwise, DATA is a string. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1305 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1306 If a (sub-)descriptor is in an invalid format, it is silently treated |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1307 as null. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1308 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1309 Return t if the parameter is successfully set. Otherwise return nil. */) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1310 (apple_event, keyword, descriptor) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1311 Lisp_Object apple_event, keyword, descriptor; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1312 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1313 Lisp_Object result = Qnil; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1314 UInt32 suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1315 struct suspended_ae_info *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1316 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1317 suspension_id = get_suspension_id (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1318 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1319 CHECK_STRING (keyword); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1320 if (SBYTES (keyword) != 4) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1321 error ("Apple event keyword must be a 4-byte string: %s", |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1322 SDATA (keyword)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1323 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1324 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1325 for (p = suspended_apple_events; p; p = p->next) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1326 if (p->suspension_id == suspension_id) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1327 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1328 if (p && p->reply.descriptorType != typeNull) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1329 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1330 OSErr err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1331 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1332 err = mac_ae_put_lisp (&p->reply, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1333 EndianU32_BtoN (*((UInt32 *) SDATA (keyword))), |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1334 descriptor); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1335 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1336 result = Qt; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1337 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1338 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1339 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1340 return result; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1341 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1342 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1343 DEFUN ("mac-resume-apple-event", Fmac_resume_apple_event, Smac_resume_apple_event, 1, 2, 0, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1344 doc: /* Resume handling of APPLE-EVENT. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1345 Every Apple event handled by the Lisp interpreter is suspended first. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1346 This function resumes such a suspended event either to complete Apple |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1347 event handling to give a reply, or to redispatch it to other handlers. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1348 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1349 If optional ERROR-CODE is an integer, it specifies the error number |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1350 that is set in the reply. If ERROR-CODE is t, the resumed event is |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1351 handled with the standard dispatching mechanism, but it is not handled |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1352 by Emacs again, thus it is redispatched to other handlers. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1353 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1354 Return t if APPLE-EVENT is successfully resumed. Otherwise return |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1355 nil, which means the event is already resumed or expired. */) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1356 (apple_event, error_code) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1357 Lisp_Object apple_event, error_code; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1358 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1359 Lisp_Object result = Qnil; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1360 UInt32 suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1361 struct suspended_ae_info **p, *ae; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1362 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1363 suspension_id = get_suspension_id (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1364 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1365 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1366 for (p = &suspended_apple_events; *p; p = &(*p)->next) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1367 if ((*p)->suspension_id == suspension_id) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1368 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1369 if (*p) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1370 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1371 ae = *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1372 *p = (*p)->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1373 if (INTEGERP (error_code) |
75240
ffa0f75caa03
(Fmac_resume_apple_event): Set error number when
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74628
diff
changeset
|
1374 && ae->reply.descriptorType != typeNull) |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1375 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1376 SInt32 errn = XINT (error_code); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1377 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1378 AEPutParamPtr (&ae->reply, keyErrorNumber, typeSInt32, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1379 &errn, sizeof (SInt32)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1380 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1381 AESetTheCurrentEvent (&ae->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1382 AEResumeTheCurrentEvent (&ae->apple_event, &ae->reply, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1383 ((AEEventHandlerUPP) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1384 (EQ (error_code, Qt) ? |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1385 kAEUseStandardDispatch : kAENoDispatch)), |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1386 0); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1387 AEDisposeDesc (&ae->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1388 AEDisposeDesc (&ae->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1389 xfree (ae); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1390 result = Qt; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1391 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1392 UNBLOCK_INPUT; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1393 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1394 return result; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1395 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1396 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1397 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1398 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1399 Drag and drop support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1400 ***********************************************************************/ |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1401 #if TARGET_API_MAC_CARBON |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1402 static Lisp_Object Vmac_dnd_known_types; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1403 static pascal OSErr mac_do_track_drag P_ ((DragTrackingMessage, WindowRef, |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1404 void *, DragRef)); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1405 static pascal OSErr mac_do_receive_drag P_ ((WindowRef, void *, DragRef)); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1406 static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1407 static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1408 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1409 extern void mac_store_drag_event P_ ((WindowRef, Point, SInt16, |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1410 const AEDesc *)); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1411 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1412 static pascal OSErr |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1413 mac_do_track_drag (message, window, refcon, drag) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1414 DragTrackingMessage message; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1415 WindowRef window; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1416 void *refcon; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1417 DragRef drag; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1418 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1419 OSErr err = noErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1420 static int can_accept; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1421 UInt16 num_items, index; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1422 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1423 if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1424 return dragNotAcceptedErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1425 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1426 switch (message) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1427 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1428 case kDragTrackingEnterHandler: |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1429 err = CountDragItems (drag, &num_items); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1430 if (err != noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1431 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1432 can_accept = 0; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1433 for (index = 1; index <= num_items; index++) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1434 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1435 ItemReference item; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1436 FlavorFlags flags; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1437 Lisp_Object rest; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1438 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1439 err = GetDragItemReferenceNumber (drag, index, &item); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1440 if (err != noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1441 continue; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1442 for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1443 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1444 Lisp_Object str; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1445 FlavorType type; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1446 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1447 str = XCAR (rest); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1448 if (!(STRINGP (str) && SBYTES (str) == 4)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1449 continue; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1450 type = EndianU32_BtoN (*((UInt32 *) SDATA (str))); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1451 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1452 err = GetFlavorFlags (drag, item, type, &flags); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1453 if (err == noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1454 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1455 can_accept = 1; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1456 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1457 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1458 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1459 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1460 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1461 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1462 case kDragTrackingEnterWindow: |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1463 if (can_accept) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1464 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1465 RgnHandle hilite_rgn = NewRgn (); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1466 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1467 if (hilite_rgn) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1468 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1469 Rect r; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1470 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1471 GetWindowPortBounds (window, &r); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1472 OffsetRect (&r, -r.left, -r.top); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1473 RectRgn (hilite_rgn, &r); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1474 ShowDragHilite (drag, hilite_rgn, true); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1475 DisposeRgn (hilite_rgn); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1476 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1477 SetThemeCursor (kThemeCopyArrowCursor); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1478 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1479 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1480 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1481 case kDragTrackingInWindow: |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1482 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1483 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1484 case kDragTrackingLeaveWindow: |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1485 if (can_accept) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1486 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1487 HideDragHilite (drag); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1488 SetThemeCursor (kThemeArrowCursor); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1489 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1490 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1491 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1492 case kDragTrackingLeaveHandler: |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1493 break; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1494 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1495 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1496 if (err != noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1497 return dragNotAcceptedErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1498 return noErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1499 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1500 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1501 static pascal OSErr |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1502 mac_do_receive_drag (window, refcon, drag) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1503 WindowRef window; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1504 void *refcon; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1505 DragRef drag; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1506 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1507 OSErr err; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1508 int num_types, i; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1509 Lisp_Object rest, str; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1510 FlavorType *types; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1511 AppleEvent apple_event; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1512 Point mouse_pos; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1513 SInt16 modifiers; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1514 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1515 if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1516 return dragNotAcceptedErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1517 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1518 num_types = 0; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1519 for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1520 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1521 str = XCAR (rest); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1522 if (STRINGP (str) && SBYTES (str) == 4) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1523 num_types++; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1524 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1525 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1526 types = xmalloc (sizeof (FlavorType) * num_types); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1527 i = 0; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1528 for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1529 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1530 str = XCAR (rest); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1531 if (STRINGP (str) && SBYTES (str) == 4) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1532 types[i++] = EndianU32_BtoN (*((UInt32 *) SDATA (str))); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1533 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1534 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1535 err = create_apple_event_from_drag_ref (drag, num_types, types, |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1536 &apple_event); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1537 xfree (types); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1538 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1539 if (err == noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1540 err = GetDragMouse (drag, &mouse_pos, NULL); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1541 if (err == noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1542 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1543 GlobalToLocal (&mouse_pos); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1544 err = GetDragModifiers (drag, NULL, NULL, &modifiers); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1545 } |
75376
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1546 if (err == noErr) |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1547 { |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1548 UInt32 key_modifiers = modifiers; |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1549 |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1550 err = AEPutParamPtr (&apple_event, kEventParamKeyModifiers, |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1551 typeUInt32, &key_modifiers, sizeof (UInt32)); |
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1552 } |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1553 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1554 if (err == noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1555 { |
75376
7b70538ea11c
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75348
diff
changeset
|
1556 mac_store_drag_event (window, mouse_pos, 0, &apple_event); |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1557 AEDisposeDesc (&apple_event); |
74628
6f17f4d8d9d6
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Use
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
73574
diff
changeset
|
1558 mac_wakeup_from_rne (); |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1559 return noErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1560 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1561 else |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1562 return dragNotAcceptedErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1563 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1564 #endif /* TARGET_API_MAC_CARBON */ |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1565 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1566 OSErr |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1567 install_drag_handler (window) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1568 WindowRef window; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1569 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1570 OSErr err = noErr; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1571 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1572 #if TARGET_API_MAC_CARBON |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1573 if (mac_do_track_dragUPP == NULL) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1574 mac_do_track_dragUPP = NewDragTrackingHandlerUPP (mac_do_track_drag); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1575 if (mac_do_receive_dragUPP == NULL) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1576 mac_do_receive_dragUPP = NewDragReceiveHandlerUPP (mac_do_receive_drag); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1577 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1578 err = InstallTrackingHandler (mac_do_track_dragUPP, window, NULL); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1579 if (err == noErr) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1580 err = InstallReceiveHandler (mac_do_receive_dragUPP, window, NULL); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1581 #endif |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1582 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1583 return err; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1584 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1585 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1586 void |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1587 remove_drag_handler (window) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1588 WindowRef window; |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1589 { |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1590 #if TARGET_API_MAC_CARBON |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1591 if (mac_do_track_dragUPP) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1592 RemoveTrackingHandler (mac_do_track_dragUPP, window); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1593 if (mac_do_receive_dragUPP) |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1594 RemoveReceiveHandler (mac_do_receive_dragUPP, window); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1595 #endif |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1596 } |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1597 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1598 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1599 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1600 Services menu support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1601 ***********************************************************************/ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1602 #ifdef MAC_OSX |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1603 OSStatus |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1604 install_service_handler () |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1605 { |
73574
848513456fe7
(init_service_handler): Make variable `specs' static
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72544
diff
changeset
|
1606 static const EventTypeSpec specs[] = |
848513456fe7
(init_service_handler): Make variable `specs' static
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72544
diff
changeset
|
1607 {{kEventClassService, kEventServiceGetTypes}, |
848513456fe7
(init_service_handler): Make variable `specs' static
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72544
diff
changeset
|
1608 {kEventClassService, kEventServiceCopy}, |
848513456fe7
(init_service_handler): Make variable `specs' static
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72544
diff
changeset
|
1609 {kEventClassService, kEventServicePaste}, |
848513456fe7
(init_service_handler): Make variable `specs' static
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
72544
diff
changeset
|
1610 {kEventClassService, kEventServicePerform}}; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1611 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1612 return InstallApplicationEventHandler (NewEventHandlerUPP |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1613 (mac_handle_service_event), |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1614 GetEventTypeCount (specs), |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1615 specs, NULL, NULL); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1616 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1617 |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1618 extern OSStatus mac_store_service_event P_ ((EventRef)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1619 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1620 static OSStatus |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1621 copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1622 ScrapRef from_scrap, to_scrap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1623 ScrapFlavorType flavor_type; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1624 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1625 OSStatus err; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1626 Size size, size_allocated; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1627 char *buf = NULL; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1628 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1629 err = GetScrapFlavorSize (from_scrap, flavor_type, &size); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1630 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1631 buf = xmalloc (size); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1632 while (buf) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1633 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1634 size_allocated = size; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1635 err = GetScrapFlavorData (from_scrap, flavor_type, &size, buf); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1636 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1637 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1638 xfree (buf); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1639 buf = NULL; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1640 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1641 else if (size_allocated < size) |
70070
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
1642 buf = xrealloc (buf, size); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1643 else |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1644 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1645 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1646 if (err == noErr) |
69963
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1647 { |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1648 if (buf == NULL) |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1649 err = memFullErr; |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1650 else |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1651 { |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1652 err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone, |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1653 size, buf); |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1654 xfree (buf); |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1655 } |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
1656 } |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1657 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1658 return err; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1659 } |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1660 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1661 static OSStatus |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1662 mac_handle_service_event (call_ref, event, data) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1663 EventHandlerCallRef call_ref; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1664 EventRef event; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1665 void *data; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1666 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1667 OSStatus err = noErr; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1668 ScrapRef cur_scrap, specific_scrap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1669 UInt32 event_kind = GetEventKind (event); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1670 CFMutableArrayRef copy_types, paste_types; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1671 CFStringRef type; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1672 Lisp_Object rest; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1673 ScrapFlavorType flavor_type; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1674 |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1675 /* Check if Vmac_service_selection is a valid selection that has a |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1676 corresponding scrap. */ |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1677 if (!SYMBOLP (Vmac_service_selection)) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1678 err = eventNotHandledErr; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1679 else |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1680 err = mac_get_selection_from_symbol (Vmac_service_selection, 0, &cur_scrap); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1681 if (!(err == noErr && cur_scrap)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1682 return eventNotHandledErr; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1683 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1684 switch (event_kind) |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1685 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1686 case kEventServiceGetTypes: |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1687 /* Set paste types. */ |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1688 err = GetEventParameter (event, kEventParamServicePasteTypes, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1689 typeCFMutableArrayRef, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1690 sizeof (CFMutableArrayRef), NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1691 &paste_types); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1692 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1693 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1694 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1695 for (rest = Vselection_converter_alist; CONSP (rest); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1696 rest = XCDR (rest)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1697 if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1698 && (flavor_type = |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1699 get_flavor_type_from_symbol (XCAR (XCAR (rest)), 0))) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1700 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1701 type = CreateTypeStringWithOSType (flavor_type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1702 if (type) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1703 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1704 CFArrayAppendValue (paste_types, type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1705 CFRelease (type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1706 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1707 } |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1708 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1709 /* Set copy types. */ |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1710 err = GetEventParameter (event, kEventParamServiceCopyTypes, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1711 typeCFMutableArrayRef, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1712 sizeof (CFMutableArrayRef), NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1713 ©_types); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1714 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1715 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1716 |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1717 if (NILP (Fx_selection_owner_p (Vmac_service_selection))) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1718 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1719 else |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1720 goto copy_all_flavors; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1721 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1722 case kEventServiceCopy: |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1723 err = GetEventParameter (event, kEventParamScrapRef, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1724 typeScrapRef, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1725 sizeof (ScrapRef), NULL, &specific_scrap); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1726 if (err != noErr |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1727 || NILP (Fx_selection_owner_p (Vmac_service_selection))) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1728 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1729 err = eventNotHandledErr; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1730 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1731 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1732 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1733 copy_all_flavors: |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1734 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1735 UInt32 count, i; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1736 ScrapFlavorInfo *flavor_info = NULL; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1737 ScrapFlavorFlags flags; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1738 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1739 err = GetScrapFlavorCount (cur_scrap, &count); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1740 if (err == noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1741 flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count); |
70070
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
1742 err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info); |
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
1743 if (err != noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1744 { |
70070
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
1745 xfree (flavor_info); |
9559d7f62131
(get_scrap_target_type_list, defer_apple_events)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
69963
diff
changeset
|
1746 flavor_info = NULL; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1747 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1748 if (flavor_info == NULL) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1749 break; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1750 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1751 for (i = 0; i < count; i++) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1752 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1753 flavor_type = flavor_info[i].flavorType; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1754 err = GetScrapFlavorFlags (cur_scrap, flavor_type, &flags); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1755 if (err == noErr && !(flags & kScrapFlavorMaskSenderOnly)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1756 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1757 if (event_kind == kEventServiceCopy) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1758 err = copy_scrap_flavor_data (cur_scrap, specific_scrap, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1759 flavor_type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1760 else /* event_kind == kEventServiceGetTypes */ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1761 { |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1762 type = CreateTypeStringWithOSType (flavor_type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1763 if (type) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1764 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1765 CFArrayAppendValue (copy_types, type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1766 CFRelease (type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1767 } |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1768 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1769 } |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1770 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1771 xfree (flavor_info); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1772 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1773 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1774 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1775 case kEventServicePaste: |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1776 case kEventServicePerform: |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1777 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1778 int data_exists_p = 0; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1779 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1780 err = GetEventParameter (event, kEventParamScrapRef, typeScrapRef, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1781 NULL, sizeof (ScrapRef), NULL, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1782 &specific_scrap); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1783 if (err == noErr) |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1784 err = mac_clear_selection (&cur_scrap); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1785 if (err == noErr) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1786 for (rest = Vselection_converter_alist; CONSP (rest); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1787 rest = XCDR (rest)) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1788 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1789 if (! (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest))))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1790 continue; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1791 flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest)), |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
1792 specific_scrap); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1793 if (flavor_type == 0) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1794 continue; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1795 err = copy_scrap_flavor_data (specific_scrap, cur_scrap, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1796 flavor_type); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1797 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1798 data_exists_p = 1; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1799 } |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1800 if (!data_exists_p) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1801 err = eventNotHandledErr; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1802 else |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1803 err = mac_store_service_event (event); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1804 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1805 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1806 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1807 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1808 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1809 err = eventNotHandledErr; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1810 return err; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1811 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1812 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1813 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1814 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1815 void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1816 syms_of_macselect () |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1817 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1818 defsubr (&Sx_get_selection_internal); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1819 defsubr (&Sx_own_selection_internal); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1820 defsubr (&Sx_disown_selection_internal); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1821 defsubr (&Sx_selection_owner_p); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1822 defsubr (&Sx_selection_exists_p); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1823 defsubr (&Smac_process_deferred_apple_events); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1824 defsubr (&Smac_cleanup_expired_apple_events); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1825 defsubr (&Smac_resume_apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1826 defsubr (&Smac_ae_set_reply_parameter); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1827 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1828 Vselection_alist = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1829 staticpro (&Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1830 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1831 DEFVAR_LISP ("selection-converter-alist", &Vselection_converter_alist, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1832 doc: /* An alist associating selection-types with functions. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1833 These functions are called to convert the selection, with three args: |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1834 the name of the selection (typically `PRIMARY', `SECONDARY', or `CLIPBOARD'); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1835 a desired type to which the selection should be converted; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1836 and the local selection value (whatever was given to `x-own-selection'). |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1837 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1838 The function should return the value to send to the Scrap Manager |
64607
fefea1491def
(Fx_own_selection_internal): Follow error conventions.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64312
diff
changeset
|
1839 \(must be a string). A return value of nil |
76745
f6a525134188
(get_scrap_target_type_list, x_own_selection): Move
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
75376
diff
changeset
|
1840 means that the conversion could not be done. */); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1841 Vselection_converter_alist = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1842 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1843 DEFVAR_LISP ("x-lost-selection-functions", &Vx_lost_selection_functions, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1844 doc: /* A list of functions to be called when Emacs loses a selection. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1845 \(This happens when a Lisp program explicitly clears the selection.) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1846 The functions are called with one argument, the selection type |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1847 \(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'). */); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1848 Vx_lost_selection_functions = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1849 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1850 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1851 doc: /* Coding system for communicating with other programs. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1852 When sending or receiving text via cut_buffer, selection, and clipboard, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1853 the text is encoded or decoded by this coding system. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1854 The default value is determined by the system script code. */); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1855 Vselection_coding_system = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1856 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1857 DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1858 doc: /* Coding system for the next communication with other programs. |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1859 Usually, `selection-coding-system' is used for communicating with |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1860 other programs. But, if this variable is set, it is used for the |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1861 next communication only. After the communication, this variable is |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1862 set to nil. */); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1863 Vnext_selection_coding_system = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1864 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1865 DEFVAR_LISP ("mac-apple-event-map", &Vmac_apple_event_map, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1866 doc: /* Keymap for Apple events handled by Emacs. */); |
67489
e9ee2ee1d26e
(syms_of_macselect) <mac-apple-event-map>:
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67457
diff
changeset
|
1867 Vmac_apple_event_map = Qnil; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1868 |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1869 #if TARGET_API_MAC_CARBON |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1870 DEFVAR_LISP ("mac-dnd-known-types", &Vmac_dnd_known_types, |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1871 doc: /* The types accepted by default for dropped data. |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1872 The types are chosen in the order they appear in the list. */); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1873 Vmac_dnd_known_types = list4 (build_string ("hfs "), build_string ("utxt"), |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1874 build_string ("TEXT"), build_string ("TIFF")); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1875 #ifdef MAC_OSX |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1876 Vmac_dnd_known_types = Fcons (build_string ("furl"), Vmac_dnd_known_types); |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1877 #endif |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1878 #endif |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1879 |
62271
6cae229f309b
(syms_of_macselect) [MAC_OSX]: Apply a change that was previously
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
62102
diff
changeset
|
1880 #ifdef MAC_OSX |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1881 DEFVAR_LISP ("mac-service-selection", &Vmac_service_selection, |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1882 doc: /* Selection name for communication via Services menu. */); |
70562
e2bd086e6902
(Vmac_service_selection) [MAC_OSX]: Rename from
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70495
diff
changeset
|
1883 Vmac_service_selection = intern ("PRIMARY"); |
62271
6cae229f309b
(syms_of_macselect) [MAC_OSX]: Apply a change that was previously
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
62102
diff
changeset
|
1884 #endif |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1885 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1886 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1887 QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1888 QTIMESTAMP = intern ("TIMESTAMP"); staticpro (&QTIMESTAMP); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1889 QTARGETS = intern ("TARGETS"); staticpro (&QTARGETS); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1890 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1891 Qforeign_selection = intern ("foreign-selection"); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1892 staticpro (&Qforeign_selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1893 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1894 Qmac_scrap_name = intern ("mac-scrap-name"); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1895 staticpro (&Qmac_scrap_name); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1896 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1897 Qmac_ostype = intern ("mac-ostype"); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1898 staticpro (&Qmac_ostype); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1899 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1900 Qmac_apple_event_class = intern ("mac-apple-event-class"); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1901 staticpro (&Qmac_apple_event_class); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1902 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1903 Qmac_apple_event_id = intern ("mac-apple-event-id"); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1904 staticpro (&Qmac_apple_event_id); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1905 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1906 Qemacs_suspension_id = intern ("emacs-suspension-id"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1907 staticpro (&Qemacs_suspension_id); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1908 } |
61819 | 1909 |
1910 /* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732 | |
1911 (do not change this comment) */ |