Ticket #7: qt-fix.diff

File qt-fix.diff, 2.7 kB (added by vanto, 10 months ago)

qt selection fix

  • x2x.c

    diff -r 6e739a7394ad x2x.c
    a b  
    219219  /* stuff on "from" display */ 
    220220  Display *fromDpy; 
    221221  Atom    fromDpyUtf8String; 
     222  Atom    fromDpyTargets; 
    222223  Window  root; 
    223224  Window  trigger; 
    224225  Window  big; 
     
    258259  /* stuff on "to" display */ 
    259260  Display *toDpy; 
    260261  Atom    toDpyUtf8String; 
     262  Atom    toDpyTargets; 
    261263  Window  selWin; 
    262264  unsigned int inverseMap[N_BUTTONS + 1]; /* inverse of button mapping */ 
    263265 
     
    991993  if (fromDpy != fromWin) { 
    992994#endif 
    993995    pDpyInfo->fromDpyUtf8String = XInternAtom(fromDpy, UTF8_STRING, False); 
     996    pDpyInfo->fromDpyTargets = XInternAtom(fromDpy, "TARGETS", False); 
    994997#ifdef WIN_2_X 
    995998  } 
    996999#endif 
    9971000  pDpyInfo->toDpyUtf8String = XInternAtom(toDpy, UTF8_STRING, False); 
     1001  pDpyInfo->toDpyTargets = XInternAtom(toDpy, "TARGETS", False); 
    9981002 
    9991003  /* other dpyinfo values */ 
    10001004  pDpyInfo->mode        = X2X_DISCONNECTED; 
     
    19341938  PDPYXTRA pDpyXtra = GETDPYXTRA(dpy, pDpyInfo); 
    19351939  Display *otherDpy; 
    19361940  Atom utf8string; 
     1941  Atom targets; 
     1942  Atom data[10]; 
     1943  int n = 0; 
    19371944 
    19381945  if (dpy == pDpyInfo->fromDpy) { 
    19391946    utf8string = pDpyInfo->fromDpyUtf8String; 
     1947    targets = pDpyInfo->fromDpyTargets; 
    19401948  } else { 
    19411949    utf8string = pDpyInfo->toDpyUtf8String; 
     1950    targets = pDpyInfo->toDpyTargets; 
    19421951  } 
    19431952 
    1944     debug("selection request\n"); 
     1953  debug("selection request\n"); 
    19451954 
    1946   /* bribe me to support more general selection requests, 
    1947      or send me the code to do it. */ 
    19481955  if ((pDpyXtra->sState != SELSTATE_ON) || 
    19491956      (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 */ 
    19511958    pEv->property = None; 
    19521959    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); 
    19531968  } else { 
    19541969    otherDpy = pDpyXtra->otherDpy; 
    19551970    SendPing(otherDpy, GETDPYXTRA(otherDpy, pDpyInfo)); /* get started */ 
     
    19581973      pDpyInfo->sEv.property = None; 
    19591974      SendSelectionNotify(&(pDpyInfo->sEv)); /* blam! */ 
    19601975    } /* END if InProg */ 
    1961     pDpyInfo->sDpy  = otherDpy; 
     1976    pDpyInfo->sDpy = otherDpy; 
    19621977    pDpyInfo->sEv = *pEv; 
    19631978  } /* END if relaySel */ 
    19641979  return False;