Mercurial > emacs
annotate src/macselect.c @ 80454:98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
(Selection): Move typedef to macgui.h.
(Vselection_converter_alist, Qmac_scrap_name, Qmac_ostype)
(Vmac_apple_event_map, Qmac_apple_event_class, Qmac_apple_event_id):
Make variables non-static.
(Vmac_dnd_known_types) [TARGET_API_MAC_CARBON]: Likewise.
(mac_handle_apple_event, cleanup_all_suspended_apple_events):
Make functions non-static.
(Vmac_service_selection) [MAC_OSX]: Likewise.
(mac_get_selection_from_symbol, get_flavor_type_from_symbol)
(mac_valid_selection_target_p, mac_clear_selection)
(mac_get_selection_ownership_info, mac_valid_selection_value_p)
(mac_put_selection_value, mac_selection_has_target_p)
(mac_get_selection_value, mac_get_selection_target_list)
(init_apple_event_handler, install_drag_handler, remove_drag_handler):
Move functions to mactoolbox.c.
(mac_do_track_drag, mac_do_receive_drag) [TARGET_API_MAC_CARBON]:
Likewise.
(copy_scrap_flavor_data, mac_handle_service_event)
(install_service_handler) [MAC_OSX]: Likewise.
(syms_of_macselect) <Vmac_dnd_known_types>:
Use mac_dnd_default_known_types.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Sun, 06 Apr 2008 01:58:39 +0000 |
parents | 1d3df1b9547b |
children | aee651d7cdc7 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 |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
28 #if !TARGET_API_MAC_CARBON |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
29 #include <Endian.h> |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
30 #endif |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
31 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 Lisp_Object, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
36 Lisp_Object)); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
37 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
38 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
|
39 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
40 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
|
41 /* 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
|
42 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
|
43 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
44 /* 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
|
45 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
|
46 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
47 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
|
48 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
49 /* 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
|
50 window server. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
51 /* 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
|
52 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
|
53 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
54 /* 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
|
55 ( 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 selection-values. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
71 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
|
72 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
73 /* 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
|
74 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
|
75 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
|
76 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
|
77 handling. */ |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
78 Lisp_Object Vselection_converter_alist; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
79 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
80 /* 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
|
81 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
|
82 selection type with a scrap flavor type via `mac-ostype'. */ |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
83 Lisp_Object Qmac_scrap_name, Qmac_ostype; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
84 |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
85 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
86 /* 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
|
87 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
|
88 our selection. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
89 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
90 static void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
91 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
|
92 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
|
93 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
94 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
95 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
96 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
|
97 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
|
98 int count; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
99 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
100 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
|
101 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
102 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
|
103 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
104 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
105 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
106 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
|
107 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
|
108 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
109 /* 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
|
110 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
|
111 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
|
112 count = SPECPDL_INDEX (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
113 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
|
114 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
115 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
|
116 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
117 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
|
118 && (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
|
119 SYMBOLP (target_type)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
120 && 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
|
121 && (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
|
122 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
|
123 continue; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
124 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
129 if (NILP (value)) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
130 continue; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
131 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 && 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
|
136 && 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
|
137 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
|
138 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
139 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
140 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
|
141 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
142 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
143 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
144 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
145 UNGCPRO; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
146 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
147 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
|
148 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
|
149 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
150 /* 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
|
151 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 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
|
156 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
157 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
|
158 if (sel) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
159 { |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
160 BLOCK_INPUT; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
161 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
|
162 UNBLOCK_INPUT; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
163 } |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
164 else |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
165 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
|
166 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
|
167 Fcons (selection_value, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
168 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
|
169 Fcons (selected_frame, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
170 Fcons (ownership_info, |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
171 Qnil))))); |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
172 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
|
173 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
174 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
|
175 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
176 /* 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
|
177 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
|
178 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
|
179 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
|
180 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
181 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
182 for (rest = Vselection_alist; !NILP (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
|
183 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
|
184 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
185 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
|
186 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
187 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
188 } |
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 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
192 /* 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
198 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
|
199 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
200 static Lisp_Object |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
201 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
|
202 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
|
203 int local_request; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
204 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
205 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
|
206 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
|
207 int count; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
208 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
209 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
|
210 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
211 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
212 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
|
213 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
214 /* 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
|
215 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
|
216 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
217 handler_fn = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
218 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
|
219 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
220 #if 0 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
221 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
|
222 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
223 handler_fn = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
224 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
|
225 (selection_symbol, |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
226 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
|
227 value = QNULL; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
228 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
229 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
230 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
231 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
232 /* 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
|
233 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
|
234 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
|
235 count = SPECPDL_INDEX (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
236 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
|
237 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
238 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
|
239 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
|
240 /* 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
|
241 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
|
242 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 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
|
247 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
248 value = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
249 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
|
250 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
251 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
252 if (local_request) |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
253 return value; |
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
254 |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
255 /* 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
|
256 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
|
257 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
258 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
|
259 check = value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
260 if (CONSP (value) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
261 && SYMBOLP (XCAR (value))) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
262 type = XCAR (value), |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
263 check = XCDR (value); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
264 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
265 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
|
266 return value; |
71985
ae7908422c59
(x_get_local_selection): Use signal_error.
Kim F. Storm <storm@cua.dk>
parents:
70988
diff
changeset
|
267 |
ae7908422c59
(x_get_local_selection): Use signal_error.
Kim F. Storm <storm@cua.dk>
parents:
70988
diff
changeset
|
268 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
|
269 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
|
270 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
271 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
272 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
273 /* 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
|
274 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
|
275 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
276 void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
277 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
|
278 FRAME_PTR f; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
279 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
280 Lisp_Object frame; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
281 Lisp_Object rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
282 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
283 XSETFRAME (frame, f); |
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 /* 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
|
286 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
|
287 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
288 /* 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
|
289 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
|
290 && 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
|
291 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
292 /* 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
|
293 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
|
294 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
295 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
|
296 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
|
297 |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
298 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
|
299 && !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
|
300 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
301 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
|
302 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
|
303 #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
|
304 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
|
305 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
|
306 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
|
307 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
308 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
309 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
310 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
|
311 } |
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 /* Delete elements after 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
|
314 for (rest = Vselection_alist; !NILP (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
|
315 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
|
316 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
317 /* 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
|
318 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
|
319 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
320 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
|
321 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
|
322 |
62102
b710f3bc2da3
(x_own_selection): Accept Lisp string as result of
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
61819
diff
changeset
|
323 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
|
324 && !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
|
325 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
326 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
|
327 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
|
328 #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
|
329 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
|
330 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
331 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
332 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
|
333 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
334 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
335 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
336 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
337 /* 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
|
338 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
|
339 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
340 static Lisp_Object |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
341 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
|
342 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
|
343 { |
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; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
345 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
346 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
|
347 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
348 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
349 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
350 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
|
351 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
|
352 { |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
353 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
|
354 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
355 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
|
356 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
|
357 } |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
358 else |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
359 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
360 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
|
361 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
|
362 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
|
363 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
|
364 } |
b25e279aa874
(get_flavor_type_from_symbol): Remove unused variable `val'.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
67489
diff
changeset
|
365 } |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
366 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
367 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
368 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
369 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
370 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
371 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
372 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 (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
|
380 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
|
381 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
382 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 return selection_value; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
387 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
388 |
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 /* 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
|
391 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
|
392 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
|
393 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
394 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
|
395 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
|
396 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
|
397 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
|
398 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
|
399 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
|
400 (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
|
401 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
|
402 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
403 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
|
404 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
|
405 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
|
406 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
407 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
|
408 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
|
409 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
410 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
|
411 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
412 if (NILP (val)) |
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 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
|
415 goto DONE; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
416 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
417 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
418 if (CONSP (val) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
419 && SYMBOLP (XCAR (val))) |
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 val = XCDR (val); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
422 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
|
423 val = XCAR (val); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
424 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
425 DONE: |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
426 UNGCPRO; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
427 return val; |
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 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
430 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
|
431 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
|
432 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
|
433 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
|
434 (selection, time) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
435 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
436 Lisp_Object time; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
437 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
438 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
439 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
440 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
|
441 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
442 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
443 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
444 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
445 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
|
446 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
|
447 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
448 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
|
449 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
450 /* 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
|
451 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
452 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
|
453 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
|
454 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
455 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
456 Lisp_Object rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
457 for (rest = Vselection_alist; !NILP (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
|
458 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
|
459 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
460 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
|
461 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
462 } |
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 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
465 /* 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
|
466 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
467 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
468 Lisp_Object rest; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
469 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
|
470 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
|
471 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
472 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
|
473 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
|
474 prepare_menu_bars (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
475 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
|
476 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
477 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
478 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
479 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
480 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
481 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
|
482 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
|
483 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
|
484 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
485 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
486 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
487 return Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
488 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
489 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
490 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
491 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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 (selection) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
499 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
500 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
501 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
502 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
503 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
|
504 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
505 check_mac (); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
506 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
507 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
|
508 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
|
509 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
510 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
|
511 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
512 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
|
513 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
514 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
515 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
516 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
517 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
|
518 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
|
519 { |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
520 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
|
521 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
522 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
|
523 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
|
524 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
|
525 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
526 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
527 else |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
528 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
529 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
530 UNBLOCK_INPUT; |
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 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
533 } |
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 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 (selection) |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
543 Lisp_Object selection; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
544 { |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
545 OSStatus err; |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
546 Selection sel; |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
547 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
|
548 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
549 /* 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
|
550 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
|
551 return Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
552 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
553 CHECK_SYMBOL (selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
554 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
|
555 return Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
556 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
|
557 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
|
558 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
559 BLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
560 |
80391
1d3df1b9547b
[!TARGET_API_MAC_CARBON] Include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
79759
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
565 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
|
566 && 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
|
567 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
568 result = Qt; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
569 break; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
570 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
571 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
572 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
573 UNBLOCK_INPUT; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
574 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
575 return result; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
576 } |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
577 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
578 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
579 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
580 Apple event support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
581 ***********************************************************************/ |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
582 int mac_ready_for_apple_events = 0; |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
583 Lisp_Object Vmac_apple_event_map; |
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
584 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
|
585 static Lisp_Object Qemacs_suspension_id; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
586 extern Lisp_Object Qundefined; |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
587 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
|
588 const AEDesc *)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
589 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
590 struct apple_event_binding |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
591 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
592 UInt32 code; /* Apple event class or ID. */ |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
593 Lisp_Object key, binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
594 }; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
595 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
596 struct suspended_ae_info |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
597 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
598 UInt32 expiration_tick, suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
599 AppleEvent apple_event, reply; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
600 struct suspended_ae_info *next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
601 }; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
602 |
72544
f8ade754466c
(get_scrap_from_symbol, clear_scrap, put_scrap_string)
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
71985
diff
changeset
|
603 /* 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
|
604 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
|
605 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
606 /* 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
|
607 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
|
608 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
609 static void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
610 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
|
611 Lisp_Object key, binding, args; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
612 void *data; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
613 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
614 struct apple_event_binding *event_binding = |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
615 (struct apple_event_binding *)data; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
616 Lisp_Object code_string; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
617 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
618 if (!SYMBOLP (key)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
619 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
620 code_string = Fget (key, args); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
621 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
|
622 && (EndianU32_BtoN (*((UInt32 *) SDATA (code_string))) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
623 == event_binding->code)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
624 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
625 event_binding->key = key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
626 event_binding->binding = binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
627 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
628 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
629 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
630 static void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
631 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
|
632 Lisp_Object keymap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
633 struct apple_event_binding *event_binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
634 int class_p; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
635 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
636 if (event_binding->code == 0) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
637 event_binding->binding = |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
638 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
|
639 else |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
640 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
641 event_binding->binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
642 map_keymap (keymap, find_event_binding_fun, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
643 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
|
644 event_binding, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
645 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
646 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
647 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
648 void |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
649 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
|
650 AEEventClass class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
651 AEEventID id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
652 Lisp_Object *class_key, *id_key, *binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
653 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
654 struct apple_event_binding event_binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
655 Lisp_Object keymap; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
656 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
657 *binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
658 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
659 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
|
660 if (NILP (keymap)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
661 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
662 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
663 event_binding.code = class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
664 event_binding.key = *class_key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
665 event_binding.binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
666 find_event_binding (keymap, &event_binding, 1); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
667 *class_key = event_binding.key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
668 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
|
669 if (NILP (keymap)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
670 return; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
671 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
672 event_binding.code = id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
673 event_binding.key = *id_key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
674 event_binding.binding = Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
675 find_event_binding (keymap, &event_binding, 0); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
676 *id_key = event_binding.key; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
677 *binding = event_binding.binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
678 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
679 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
680 static OSErr |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
681 defer_apple_events (apple_event, reply) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
682 const AppleEvent *apple_event, *reply; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
683 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
684 OSErr err; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
685 struct suspended_ae_info *new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
686 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
687 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
|
688 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
|
689 new->apple_event.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
690 new->reply.descriptorType = typeNull; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
691 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
692 err = AESuspendTheCurrentEvent (apple_event); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
693 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
694 /* 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
|
695 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
|
696 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
|
697 them in `deferred_apple_events'. */ |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
698 if (err == noErr) |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
699 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
|
700 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
701 err = AEDuplicateDesc (reply, &new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
702 if (err == noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
703 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
704 new->next = deferred_apple_events; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
705 deferred_apple_events = new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
706 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
707 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
708 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
709 AEDisposeDesc (&new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
710 AEDisposeDesc (&new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
711 xfree (new); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
712 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
713 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
714 return err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
715 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
716 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
717 static OSErr |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
718 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
|
719 Lisp_Object class, id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
720 const AppleEvent *apple_event; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
721 AppleEvent *reply; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
722 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
723 OSErr err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
724 static UInt32 suspension_id = 0; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
725 struct suspended_ae_info *new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
726 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
727 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
|
728 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
|
729 new->apple_event.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
730 new->reply.descriptorType = typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
731 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
732 err = AESuspendTheCurrentEvent (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
733 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
734 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
|
735 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
736 err = AEDuplicateDesc (reply, &new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
737 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
738 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
|
739 typeUInt32, &suspension_id, sizeof (UInt32)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
740 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
741 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
742 OSErr err1; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
743 SInt32 reply_requested; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
744 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
745 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
|
746 typeSInt32, NULL, &reply_requested, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
747 sizeof (SInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
748 if (err1 != noErr) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
749 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
750 /* Emulate keyReplyRequestedAttr in older versions. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
751 reply_requested = reply->descriptorType != typeNull; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
752 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
|
753 typeSInt32, &reply_requested, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
754 sizeof (SInt32)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
755 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
756 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
757 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
758 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
759 SInt32 timeout = 0; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
760 struct suspended_ae_info **p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
761 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
762 new->suspension_id = suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
763 suspension_id++; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
764 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
|
765 NULL, &timeout, sizeof (SInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
766 new->expiration_tick = TickCount () + timeout; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
767 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
768 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
|
769 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
|
770 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
771 new->next = *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
772 *p = new; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
773 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
774 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
|
775 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
776 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
777 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
778 AEDisposeDesc (&new->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
779 AEDisposeDesc (&new->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
780 xfree (new); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
781 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
782 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
783 return err; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
784 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
785 |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
786 pascal OSErr |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
787 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
|
788 const AppleEvent *apple_event; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
789 AppleEvent *reply; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
790 SInt32 refcon; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
791 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
792 OSErr err; |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
793 UInt32 suspension_id; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
794 AEEventClass event_class; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
795 AEEventID event_id; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
796 Lisp_Object class_key, id_key, binding; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
797 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
798 if (!mac_ready_for_apple_events) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
799 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
800 err = defer_apple_events (apple_event, reply); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
801 if (err != noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
802 return errAEEventNotHandled; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
803 return noErr; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
804 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
805 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
806 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
|
807 typeUInt32, NULL, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
808 &suspension_id, sizeof (UInt32), NULL); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
809 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
810 /* 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
|
811 return errAEEventNotHandled; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
812 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
813 err = AEGetAttributePtr (apple_event, keyEventClassAttr, typeType, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
814 &event_class, sizeof (AEEventClass), NULL); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
815 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
816 err = AEGetAttributePtr (apple_event, keyEventIDAttr, typeType, NULL, |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
817 &event_id, sizeof (AEEventID), NULL); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
818 if (err == noErr) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
819 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
820 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
|
821 &class_key, &id_key, &binding); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
822 if (!NILP (binding) && !EQ (binding, Qundefined)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
823 { |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
824 if (INTEGERP (binding)) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
825 return XINT (binding); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
826 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
|
827 apple_event, reply); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
828 } |
70988
5605e49b641f
(mac_handle_apple_event): Return
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70873
diff
changeset
|
829 else |
5605e49b641f
(mac_handle_apple_event): Return
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70873
diff
changeset
|
830 err = errAEEventNotHandled; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
831 } |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
832 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
833 return noErr; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
834 else |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
835 return errAEEventNotHandled; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
836 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
837 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
838 static int |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
839 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
|
840 struct suspended_ae_info **head; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
841 int all_p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
842 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
843 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
|
844 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
|
845 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
846 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
|
847 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
848 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
|
849 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
850 AESetTheCurrentEvent (&p->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
851 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
|
852 (AEEventHandlerUPP) kAENoDispatch, 0); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
853 AEDisposeDesc (&p->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
854 AEDisposeDesc (&p->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
855 nresumed++; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
856 next = p->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
857 xfree (p); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
858 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
859 *head = p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
860 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
861 return nresumed; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
862 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
863 |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
864 void |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
865 cleanup_all_suspended_apple_events () |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
866 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
867 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
|
868 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
|
869 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
870 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
871 static UInt32 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
872 get_suspension_id (apple_event) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
873 Lisp_Object apple_event; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
874 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
875 Lisp_Object tem; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
876 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
877 CHECK_CONS (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
878 CHECK_STRING_CAR (apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
879 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
|
880 || 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
|
881 error ("Not an apple event"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
882 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
883 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
|
884 if (NILP (tem)) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
885 error ("Suspension ID not available"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
886 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
887 tem = XCDR (tem); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
888 if (!(CONSP (tem) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
889 && 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
|
890 && 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
|
891 && 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
|
892 error ("Bad suspension ID format"); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
893 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
894 return *((UInt32 *) SDATA (XCDR (tem))); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
895 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
896 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
897 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
898 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
|
899 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
|
900 () |
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 if (mac_ready_for_apple_events) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
903 return Qnil; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
904 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
905 BLOCK_INPUT; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
906 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
|
907 if (deferred_apple_events) |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
908 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
909 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
|
910 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
911 /* `nreverse' deferred_apple_events. */ |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
912 prev = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
913 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
|
914 { |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
915 next = tail->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
916 tail->next = prev; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
917 prev = tail; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
918 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
919 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
920 /* 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
|
921 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
|
922 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
923 next = tail->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
924 AEResumeTheCurrentEvent (&tail->apple_event, &tail->reply, |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
925 ((AEEventHandlerUPP) |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
926 kAEUseStandardDispatch), 0); |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
927 AEDisposeDesc (&tail->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
928 AEDisposeDesc (&tail->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
929 xfree (tail); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
930 } |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
931 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
932 deferred_apple_events = NULL; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
933 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
934 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
935 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
936 return Qt; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
937 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
938 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
939 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
|
940 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
|
941 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
|
942 () |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
943 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
944 int nexpired; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
945 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
946 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
947 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
|
948 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
949 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
950 return make_number (nexpired); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
951 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
952 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
953 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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
959 * 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
|
960 * 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
|
961 * 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
|
962 ... (KEYWORDn . DESCRIPTORn)). |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
963 * 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
|
964 treated as null. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
965 * Otherwise, DATA is a string. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
966 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
967 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
|
968 as null. |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
969 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
970 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
|
971 (apple_event, keyword, descriptor) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
972 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
|
973 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
974 Lisp_Object result = Qnil; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
975 UInt32 suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
976 struct suspended_ae_info *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
977 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
978 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
|
979 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
980 CHECK_STRING (keyword); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
981 if (SBYTES (keyword) != 4) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
982 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
|
983 SDATA (keyword)); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
984 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
985 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
986 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
|
987 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
|
988 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
989 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
|
990 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
991 OSErr err; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
992 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
993 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
|
994 EndianU32_BtoN (*((UInt32 *) SDATA (keyword))), |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
995 descriptor); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
996 if (err == noErr) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
997 result = Qt; |
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 UNBLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1000 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1001 return result; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1002 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1003 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1004 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
|
1005 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
|
1006 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
|
1007 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
|
1008 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
|
1009 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1010 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
|
1011 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
|
1012 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
|
1013 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
|
1014 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1015 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
|
1016 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
|
1017 (apple_event, error_code) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1018 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
|
1019 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1020 Lisp_Object result = Qnil; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1021 UInt32 suspension_id; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1022 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
|
1023 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1024 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
|
1025 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1026 BLOCK_INPUT; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1027 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
|
1028 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
|
1029 break; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1030 if (*p) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1031 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1032 ae = *p; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1033 *p = (*p)->next; |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1034 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
|
1035 && ae->reply.descriptorType != typeNull) |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1036 { |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1037 SInt32 errn = XINT (error_code); |
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 AEPutParamPtr (&ae->reply, keyErrorNumber, typeSInt32, |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1040 &errn, sizeof (SInt32)); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1041 } |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1042 AESetTheCurrentEvent (&ae->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1043 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
|
1044 ((AEEventHandlerUPP) |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1045 (EQ (error_code, Qt) ? |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1046 kAEUseStandardDispatch : kAENoDispatch)), |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1047 0); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1048 AEDisposeDesc (&ae->reply); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1049 AEDisposeDesc (&ae->apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1050 xfree (ae); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1051 result = Qt; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1052 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1053 UNBLOCK_INPUT; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1054 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1055 return result; |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1056 } |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1057 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1058 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1059 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1060 Drag and drop support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1061 ***********************************************************************/ |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1062 #if TARGET_API_MAC_CARBON |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
1063 Lisp_Object Vmac_dnd_known_types; |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1064 #endif /* TARGET_API_MAC_CARBON */ |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1065 |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1066 |
70873
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1067 /*********************************************************************** |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1068 Services menu support |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1069 ***********************************************************************/ |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1070 #ifdef MAC_OSX |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
1071 /* Selection name for communication via Services menu. */ |
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
1072 Lisp_Object 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
|
1073 #endif |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1074 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1075 void |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1076 syms_of_macselect () |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1077 { |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1078 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
|
1079 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
|
1080 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
|
1081 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
|
1082 defsubr (&Sx_selection_exists_p); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1083 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
|
1084 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
|
1085 defsubr (&Smac_resume_apple_event); |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1086 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
|
1087 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1088 Vselection_alist = Qnil; |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1089 staticpro (&Vselection_alist); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1090 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1091 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
|
1092 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
|
1093 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
|
1094 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
|
1095 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
|
1096 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
|
1097 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1098 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
|
1099 \(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
|
1100 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
|
1101 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
|
1102 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1103 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
|
1104 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
|
1105 \(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
|
1106 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
|
1107 \(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
|
1108 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
|
1109 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1110 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
|
1111 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
|
1112 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
|
1113 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
|
1114 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
|
1115 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
|
1116 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1117 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
|
1118 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
|
1119 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
|
1120 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
|
1121 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
|
1122 set to nil. */); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1123 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
|
1124 |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1125 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
|
1126 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
|
1127 Vmac_apple_event_map = Qnil; |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1128 |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1129 #if TARGET_API_MAC_CARBON |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1130 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
|
1131 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
|
1132 The types are chosen in the order they appear in the list. */); |
80454
98811b17d3b9
[!TARGET_API_MAC_CARBON]: Don't include Scrap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
80391
diff
changeset
|
1133 Vmac_dnd_known_types = mac_dnd_default_known_types (); |
70383
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1134 #endif |
84a220b0dd72
Update copyright year.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70070
diff
changeset
|
1135 |
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
|
1136 #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
|
1137 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
|
1138 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
|
1139 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
|
1140 #endif |
61777
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1141 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1142 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
|
1143 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
|
1144 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
|
1145 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
|
1146 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1147 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
|
1148 staticpro (&Qforeign_selection); |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1149 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1150 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
|
1151 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
|
1152 |
c323711ae68f
New file for selection processing on Mac OS.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
diff
changeset
|
1153 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
|
1154 staticpro (&Qmac_ostype); |
67457
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1155 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1156 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
|
1157 staticpro (&Qmac_apple_event_class); |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1158 |
819dc1a5c256
Include keymap.h.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
64607
diff
changeset
|
1159 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
|
1160 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
|
1161 |
523dd2f40cc1
(Qemacs_suspension_id): New variable.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
70562
diff
changeset
|
1162 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
|
1163 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
|
1164 } |
61819 | 1165 |
1166 /* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732 | |
1167 (do not change this comment) */ |