53 |
extern Display *g_display; |
extern Display *g_display; |
54 |
extern Window g_wnd; |
extern Window g_wnd; |
55 |
extern Time g_last_gesturetime; |
extern Time g_last_gesturetime; |
56 |
|
extern BOOL g_rdpclip; |
57 |
|
|
58 |
|
/* Mode of operation. |
59 |
|
- Auto: Look at both PRIMARY and CLIPBOARD and use the most recent. |
60 |
|
- Non-auto: Look at just CLIPBOARD. */ |
61 |
|
static BOOL auto_mode = True; |
62 |
/* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */ |
/* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */ |
63 |
static Atom clipboard_atom, primary_atom; |
static Atom clipboard_atom, primary_atom; |
64 |
/* Atom of the TARGETS clipboard target */ |
/* Atom of the TARGETS clipboard target */ |
907 |
return; |
return; |
908 |
} |
} |
909 |
|
|
910 |
primary_owner = XGetSelectionOwner(g_display, primary_atom); |
if (auto_mode) |
911 |
|
primary_owner = XGetSelectionOwner(g_display, primary_atom); |
912 |
|
else |
913 |
|
primary_owner = None; |
914 |
|
|
915 |
clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom); |
clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom); |
916 |
|
|
917 |
/* Both available */ |
/* Both available */ |
952 |
cliprdr_send_simple_native_format_announce(RDP_CF_TEXT); |
cliprdr_send_simple_native_format_announce(RDP_CF_TEXT); |
953 |
} |
} |
954 |
|
|
955 |
|
void |
956 |
|
ui_clip_set_mode(const char *optarg) |
957 |
|
{ |
958 |
|
g_rdpclip = True; |
959 |
|
|
960 |
|
if (str_startswith(optarg, "auto") || str_startswith(optarg, "on") |
961 |
|
|| str_startswith(optarg, "PRIMARYCLIPBOARD")) |
962 |
|
auto_mode = True; |
963 |
|
else if (str_startswith(optarg, "CLIPBOARD")) |
964 |
|
auto_mode = False; |
965 |
|
else |
966 |
|
{ |
967 |
|
warning("Invalid clipboard mode '%s'.\n", optarg); |
968 |
|
g_rdpclip = False; |
969 |
|
} |
970 |
|
} |
971 |
|
|
972 |
void |
void |
973 |
xclip_init(void) |
xclip_init(void) |
974 |
{ |
{ |
975 |
|
if (!g_rdpclip) |
976 |
|
return; |
977 |
|
|
978 |
if (!cliprdr_init()) |
if (!cliprdr_init()) |
979 |
return; |
return; |
980 |
|
|