1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*--------------------------------*-C-*--------------------------------------* |
2 | * File: screen.c |
2 | * File: screen.c |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
5 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
|
|
6 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
6 | * |
7 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * (at your option) any later version. |
… | |
… | |
16 | * |
17 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | *--------------------------------------------------------------------------*/ |
21 | *--------------------------------------------------------------------------*/ |
|
|
22 | |
21 | /* |
23 | /* |
22 | * We handle _all_ screen updates and selections |
24 | * This file handles _all_ screen updates and selections |
23 | */ |
25 | */ |
24 | |
26 | |
25 | #include "../config.h" /* NECESSARY */ |
27 | #include "../config.h" /* NECESSARY */ |
26 | #define INTERN_SCREEN |
28 | #define INTERN_SCREEN |
27 | #include "rxvt.h" /* NECESSARY */ |
29 | #include "rxvt.h" /* NECESSARY */ |
… | |
… | |
30 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
32 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
31 | |
33 | |
32 | #include <stdint.h> |
34 | #include <stdint.h> |
33 | #include <wchar.h> |
35 | #include <wchar.h> |
34 | |
36 | |
35 | #include "salloc.C" // HACK!! |
37 | #include "salloc.C" // HACK, should be a seperate compile! |
36 | |
38 | |
37 | inline void fill_text (text_t *start, text_t value, int len) |
39 | inline void fill_text (text_t *start, text_t value, int len) |
38 | { |
40 | { |
39 | while (len--) |
41 | while (len--) |
40 | *start++ = value; |
42 | *start++ = value; |
… | |
… | |
2488 | } |
2490 | } |
2489 | |
2491 | |
2490 | for (;;) |
2492 | for (;;) |
2491 | { |
2493 | { |
2492 | if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), |
2494 | if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), |
2493 | (long) (PROP_SIZE / 4), delete_prop, |
2495 | (long) (PROP_SIZE / 4), delete_prop, |
2494 | AnyPropertyType, &ct.encoding, &ct.format, |
2496 | AnyPropertyType, &ct.encoding, &ct.format, |
2495 | &ct.nitems, &bytes_after, |
2497 | &ct.nitems, &bytes_after, |
2496 | &ct.value) != Success) |
2498 | &ct.value) != Success) |
2497 | break; |
2499 | break; |
2498 | |
2500 | |
2499 | if (ct.encoding == 0) |
2501 | if (ct.encoding == 0) |
2500 | { |
2502 | { |
2501 | D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); |
2503 | D_SELECT ((stderr, "rxvt_selection_paste: property didn't exist!")); |
… | |
… | |
2509 | } |
2511 | } |
2510 | |
2512 | |
2511 | if (ct.nitems == 0) |
2513 | if (ct.nitems == 0) |
2512 | { |
2514 | { |
2513 | D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); |
2515 | D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); |
2514 | if (selection_wait == Sel_normal && nread == 0) |
2516 | if (selection_wait == Sel_normal && nread == 0 |
|
|
2517 | && (win != display->root || prop != XA_CUT_BUFFER0)) // avoid recursion |
2515 | { |
2518 | { |
2516 | /* |
2519 | /* |
2517 | * pass through again trying CUT_BUFFER0 if we've come from |
2520 | * pass through again trying CUT_BUFFER0 if we've come from |
2518 | * XConvertSelection () but nothing was presented |
2521 | * XConvertSelection () but nothing was presented |
2519 | */ |
2522 | */ |