2008-09-03 18:23:06 +02:00
|
|
|
/* x-selection.h -- proxies between NSPasteboard and X11 selections
|
|
|
|
|
2008-10-01 07:53:12 +02:00
|
|
|
Copyright (c) 2002, 2008 Apple Computer, Inc. All rights reserved.
|
2008-09-03 18:23:06 +02:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person
|
|
|
|
obtaining a copy of this software and associated documentation files
|
|
|
|
(the "Software"), to deal in the Software without restriction,
|
|
|
|
including without limitation the rights to use, copy, modify, merge,
|
|
|
|
publish, distribute, sublicense, and/or sell copies of the Software,
|
|
|
|
and to permit persons to whom the Software is furnished to do so,
|
|
|
|
subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be
|
|
|
|
included in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
|
|
|
|
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name(s) of the above
|
|
|
|
copyright holders shall not be used in advertising or otherwise to
|
|
|
|
promote the sale, use or other dealings in this Software without
|
2008-11-17 02:57:46 +01:00
|
|
|
prior written authorization.
|
|
|
|
*/
|
2008-09-03 18:23:06 +02:00
|
|
|
|
|
|
|
#ifndef X_SELECTION_H
|
|
|
|
#define X_SELECTION_H 1
|
|
|
|
|
|
|
|
#include "pbproxy.h"
|
2008-10-24 00:01:03 +02:00
|
|
|
|
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
|
2008-09-03 18:23:06 +02:00
|
|
|
#include <AppKit/NSPasteboard.h>
|
|
|
|
|
2008-09-14 18:23:17 +02:00
|
|
|
/* This stores image data or text. */
|
|
|
|
struct propdata {
|
|
|
|
unsigned char *data;
|
|
|
|
size_t length;
|
2009-09-05 23:03:19 +02:00
|
|
|
int format;
|
2008-09-14 18:23:17 +02:00
|
|
|
};
|
|
|
|
|
2008-09-21 01:49:16 +02:00
|
|
|
struct atom_list {
|
|
|
|
Atom primary, clipboard, text, utf8_string, string, targets, multiple,
|
|
|
|
cstring, image_png, image_jpeg, incr, atom, clipboard_manager,
|
|
|
|
compound_text, atom_pair;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-03 18:23:06 +02:00
|
|
|
@interface x_selection : NSObject
|
|
|
|
{
|
|
|
|
@private
|
|
|
|
|
|
|
|
/* The unmapped window we use for fetching selections. */
|
|
|
|
Window _selection_window;
|
|
|
|
|
2008-09-14 18:23:17 +02:00
|
|
|
Atom request_atom;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct propdata propdata;
|
|
|
|
Window requestor;
|
|
|
|
Atom selection;
|
|
|
|
} pending;
|
2008-09-19 22:29:37 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the number of times the user has requested a copy.
|
|
|
|
* Once the copy is completed, we --pending_copy, and if the
|
|
|
|
* pending_copy is > 0 we do it again.
|
|
|
|
*/
|
|
|
|
int pending_copy;
|
|
|
|
/*
|
|
|
|
* This is used for the same purpose as pending_copy, but for the
|
|
|
|
* CLIPBOARD. It also prevents a race with INCR transfers.
|
|
|
|
*/
|
|
|
|
int pending_clipboard;
|
2008-09-21 01:49:16 +02:00
|
|
|
|
|
|
|
struct atom_list atoms[1];
|
2008-09-03 18:23:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) x_active:(Time)timestamp;
|
|
|
|
- (void) x_inactive:(Time)timestamp;
|
|
|
|
|
|
|
|
- (void) x_copy:(Time)timestamp;
|
|
|
|
|
|
|
|
- (void) clear_event:(XSelectionClearEvent *)e;
|
|
|
|
- (void) request_event:(XSelectionRequestEvent *)e;
|
|
|
|
- (void) notify_event:(XSelectionEvent *)e;
|
2008-09-14 18:23:17 +02:00
|
|
|
- (void) property_event:(XPropertyEvent *)e;
|
2008-10-15 23:11:18 +02:00
|
|
|
- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e;
|
2008-09-14 18:23:17 +02:00
|
|
|
- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct propdata *)pdata;
|
2008-09-15 21:28:50 +02:00
|
|
|
- (void) claim_clipboard;
|
2008-10-05 03:54:15 +02:00
|
|
|
- (BOOL) set_clipboard_manager_status:(BOOL)value;
|
2008-09-16 23:21:18 +02:00
|
|
|
- (void) own_clipboard;
|
2008-09-19 22:29:37 +02:00
|
|
|
- (void) copy_completed:(Atom)selection;
|
2008-09-30 21:04:35 +02:00
|
|
|
|
|
|
|
- (void) reload_preferences;
|
2008-10-01 07:53:12 +02:00
|
|
|
- (BOOL) is_active;
|
2008-10-27 23:34:24 +01:00
|
|
|
- (void) send_none:(XSelectionRequestEvent *)e;
|
2008-09-03 18:23:06 +02:00
|
|
|
@end
|
|
|
|
|
2008-09-28 00:30:10 +02:00
|
|
|
/* main.m */
|
|
|
|
extern x_selection *_selection_object;
|
|
|
|
|
2008-09-03 18:23:06 +02:00
|
|
|
#endif /* X_SELECTION_H */
|