1 /* x-selection.h -- proxies between NSPasteboard and X11 selections
3 * Copyright (c) 2002-2012 Apple Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation files
7 * (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
20 * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Except as contained in this notice, the name(s) of the above
26 * copyright holders shall not be used in advertising or otherwise to
27 * promote the sale, use or other dealings in this Software without
28 * prior written authorization.
32 #define X_SELECTION_H 1
36 #define Cursor X_Cursor
37 #include <X11/extensions/Xfixes.h>
40 #include <AppKit/NSPasteboard.h>
42 /* This stores image data or text. */
50 Atom primary
, clipboard
, text
, utf8_string
, string
, targets
, multiple
,
51 cstring
, image_png
, image_jpeg
, incr
, atom
, clipboard_manager
,
52 compound_text
, atom_pair
;
55 @interface x_selection
: NSObject
59 /* The unmapped window we use for fetching selections. */
60 Window _selection_window
;
65 struct propdata propdata
;
71 * This is the number of times the user has requested a copy.
72 * Once the copy is completed, we --pending_copy, and if the
73 * pending_copy is > 0 we do it again.
77 * This is used for the same purpose as pending_copy, but for the
78 * CLIPBOARD. It also prevents a race with INCR transfers.
80 int pending_clipboard
;
82 struct atom_list atoms
[1];
85 - (void)x_active
:(Time
)timestamp
;
86 - (void)x_inactive
:(Time
)timestamp
;
88 - (void)x_copy
:(Time
)timestamp
;
90 - (void)clear_event
:(XSelectionClearEvent
*)e
;
91 - (void)request_event
:(XSelectionRequestEvent
*)e
;
92 - (void)notify_event
:(XSelectionEvent
*)e
;
93 - (void)property_event
:(XPropertyEvent
*)e
;
94 - (void)xfixes_selection_notify
:(XFixesSelectionNotifyEvent
*)e
;
95 - (void)handle_selection
:(Atom
) selection type
:(Atom
) type propdata
:(struct
98 - (void)claim_clipboard
;
99 - (BOOL
)set_clipboard_manager_status
:(BOOL
)value
;
100 - (void)own_clipboard
;
101 - (void)copy_completed
:(Atom
)selection
;
103 - (void)reload_preferences
;
105 - (void)send_none
:(XSelectionRequestEvent
*)e
;
109 extern x_selection
* _selection_object
;
111 #endif /* X_SELECTION_H */