75 |
|
// Do we replace GetScrap()? |
76 |
|
#define REPLACE_GETSCRAP 1 |
77 |
|
|
78 |
– |
// Do we want PutScrap() to ignore requests from klipper? |
79 |
– |
#define PUTSCRAP_IGNORES_KLIPPER 0 |
80 |
– |
|
78 |
|
// Do we want GetScrap() to check for TIMESTAMP and optimize out clipboard syncs? |
79 |
|
#define GETSCRAP_REQUESTS_TIMESTAMP 0 |
80 |
|
|
267 |
|
|
268 |
|
|
269 |
|
/* |
273 |
– |
* Check for a "klipper" window which, in older versions (3.1), was |
274 |
– |
* polling and retrieving clipboard data several times per second. |
275 |
– |
*/ |
276 |
– |
|
277 |
– |
static bool is_klipper_window_probe(Window w); |
278 |
– |
static bool is_klipper_window_check(Window w); |
279 |
– |
static bool (*is_klipper_window)(Window w) = is_klipper_window_probe; |
280 |
– |
static Window klipper_win = None; |
281 |
– |
|
282 |
– |
static bool is_klipper_window_probe(Window w) |
283 |
– |
{ |
284 |
– |
// We expect "klipper" to be within the first clients to request |
285 |
– |
// data from our clipboard |
286 |
– |
static int clients_countdown = 2; |
287 |
– |
|
288 |
– |
bool found = false; |
289 |
– |
char *window_name; |
290 |
– |
if (XFetchName(x_display, w, &window_name) && !strcmp(window_name, "klipper")) { |
291 |
– |
D(bug(" found and ignore clipboard requests from klipper window id: 0x%08x\n", w)); |
292 |
– |
klipper_win = w; |
293 |
– |
found = true; |
294 |
– |
} |
295 |
– |
|
296 |
– |
if (found || --clients_countdown <= 0) |
297 |
– |
is_klipper_window = is_klipper_window_check; |
298 |
– |
} |
299 |
– |
|
300 |
– |
static bool is_klipper_window_check(Window w) |
301 |
– |
{ |
302 |
– |
return w == klipper_win; |
303 |
– |
} |
304 |
– |
|
305 |
– |
|
306 |
– |
/* |
270 |
|
* Initialization |
271 |
|
*/ |
272 |
|
|
640 |
|
if (req->requestor == clip_win || req->selection != xa_clipboard) |
641 |
|
return; |
642 |
|
|
680 |
– |
#if PUTSCRAP_IGNORES_KLIPPER |
681 |
– |
if (is_klipper_window(req->requestor)) |
682 |
– |
return; |
683 |
– |
#endif |
684 |
– |
|
643 |
|
D(bug("Selection requested from 0x%lx to 0x%lx (%s) 0x%lx (%s)\n", |
644 |
|
req->requestor, |
645 |
|
req->selection, |