diff -r 6e739a7394ad x2x.c
|
a
|
b
|
|
| 219 | 219 | /* stuff on "from" display */ |
| 220 | 220 | Display *fromDpy; |
| 221 | 221 | Atom fromDpyUtf8String; |
| | 222 | Atom fromDpyTargets; |
| 222 | 223 | Window root; |
| 223 | 224 | Window trigger; |
| 224 | 225 | Window big; |
| … |
… |
|
| 258 | 259 | /* stuff on "to" display */ |
| 259 | 260 | Display *toDpy; |
| 260 | 261 | Atom toDpyUtf8String; |
| | 262 | Atom toDpyTargets; |
| 261 | 263 | Window selWin; |
| 262 | 264 | unsigned int inverseMap[N_BUTTONS + 1]; /* inverse of button mapping */ |
| 263 | 265 | |
| … |
… |
|
| 991 | 993 | if (fromDpy != fromWin) { |
| 992 | 994 | #endif |
| 993 | 995 | pDpyInfo->fromDpyUtf8String = XInternAtom(fromDpy, UTF8_STRING, False); |
| | 996 | pDpyInfo->fromDpyTargets = XInternAtom(fromDpy, "TARGETS", False); |
| 994 | 997 | #ifdef WIN_2_X |
| 995 | 998 | } |
| 996 | 999 | #endif |
| 997 | 1000 | pDpyInfo->toDpyUtf8String = XInternAtom(toDpy, UTF8_STRING, False); |
| | 1001 | pDpyInfo->toDpyTargets = XInternAtom(toDpy, "TARGETS", False); |
| 998 | 1002 | |
| 999 | 1003 | /* other dpyinfo values */ |
| 1000 | 1004 | pDpyInfo->mode = X2X_DISCONNECTED; |
| … |
… |
|
| 1934 | 1938 | PDPYXTRA pDpyXtra = GETDPYXTRA(dpy, pDpyInfo); |
| 1935 | 1939 | Display *otherDpy; |
| 1936 | 1940 | Atom utf8string; |
| | 1941 | Atom targets; |
| | 1942 | Atom data[10]; |
| | 1943 | int n = 0; |
| 1937 | 1944 | |
| 1938 | 1945 | if (dpy == pDpyInfo->fromDpy) { |
| 1939 | 1946 | utf8string = pDpyInfo->fromDpyUtf8String; |
| | 1947 | targets = pDpyInfo->fromDpyTargets; |
| 1940 | 1948 | } else { |
| 1941 | 1949 | utf8string = pDpyInfo->toDpyUtf8String; |
| | 1950 | targets = pDpyInfo->toDpyTargets; |
| 1942 | 1951 | } |
| 1943 | 1952 | |
| 1944 | | debug("selection request\n"); |
| | 1953 | debug("selection request\n"); |
| 1945 | 1954 | |
| 1946 | | /* bribe me to support more general selection requests, |
| 1947 | | or send me the code to do it. */ |
| 1948 | 1955 | if ((pDpyXtra->sState != SELSTATE_ON) || |
| 1949 | 1956 | (pEv->selection != XA_PRIMARY) || |
| 1950 | | (pEv->target > XA_LAST_PREDEFINED && pEv->target != utf8string)) { /* bad request, punt request */ |
| | 1957 | (pEv->target > XA_LAST_PREDEFINED && pEv->target != utf8string && pEv->target != targets)) { /* bad request, punt request */ |
| 1951 | 1958 | pEv->property = None; |
| 1952 | 1959 | SendSelectionNotify(pEv); /* blam! */ |
| | 1960 | } else if (pEv->target == targets) { |
| | 1961 | // send targets supported -> UTF8_STRING, STRING, TARGETS |
| | 1962 | n = 0; |
| | 1963 | data[n++] = utf8string; |
| | 1964 | data[n++] = XA_STRING; |
| | 1965 | data[n++] = targets; |
| | 1966 | XChangeProperty(dpy, pEv->requestor, pEv->property, XA_ATOM, 32, PropModeReplace, (unsigned char *) data, n); |
| | 1967 | SendSelectionNotify(pEv); |
| 1953 | 1968 | } else { |
| 1954 | 1969 | otherDpy = pDpyXtra->otherDpy; |
| 1955 | 1970 | SendPing(otherDpy, GETDPYXTRA(otherDpy, pDpyInfo)); /* get started */ |
| … |
… |
|
| 1958 | 1973 | pDpyInfo->sEv.property = None; |
| 1959 | 1974 | SendSelectionNotify(&(pDpyInfo->sEv)); /* blam! */ |
| 1960 | 1975 | } /* END if InProg */ |
| 1961 | | pDpyInfo->sDpy = otherDpy; |
| | 1976 | pDpyInfo->sDpy = otherDpy; |
| 1962 | 1977 | pDpyInfo->sEv = *pEv; |
| 1963 | 1978 | } /* END if relaySel */ |
| 1964 | 1979 | return False; |