[comp.windows.x] motif clipboard usage

markw@airgun.wg.waii.com (Mark Whetzel) (11/15/89)

Hello netlanders and X/MOTIF wizards:

         I am trying to use the Motif clipboard functions and am running 
into some problems. It seems that I cannot use (XmClipboard) InquireFormat
more than once; if I do a StartCopy-Copy-EndCopy series as below and then
InquireFormat, a subsequent StartCopy-Copy-EndCopy series (using the same
'category') followed by an InquireFormat will land me in XIfEvent forever.
I would appreciate some direction here since I don't fully understand the
nature of this Clipboard beast.

/*******************************************/
#include <stdio.h>
#include <sys/times.h>
#include "CutPaste.h"
#include <Xt/X11/Intrinsic.h>

loadintercom(wij, category, databuf)
             Widget wij;  char *category, *databuf;

{ int status, len; char *tbuf; Display *disp;  Window win; long id; 
  struct tms tmstruct; long tyme;

  disp = XtDisplay(wij); win = XtWindow(wij); len = strlen(databuf);
  tyme = times(&tmstruct);

  status = 0; while(status != ClipboardSuccess)
    status = XmClipboardStartCopy(disp, win, category, tyme, wij, NULL, &id);

  status = 0; while(status != ClipboardSuccess)
     status = XmClipboardCopy(disp, win, id, category, databuf, len, 0, NULL);

  status = 0; while(status != ClipboardSuccess)
     status = XmClipboardEndCopy(disp, win, id);
}
/*******************************************/

       This is the code which initiates the InquireFormat.

#include <stdio.h>
#include <sys/types.h>
#include "CutPaste.h"
#include "/motif/lib/Xt/X11/Intrinsic.h"  /* Xt Toolkit */

#define buflen 25

void data (w, client_data, callback_data) Widget w; caddr_t
           client_data; caddr_t  callback_data;
  
{ Display *disp; Window win; char str1[buflen]; 
  int jj, kk, ll, strln, copylen, count, maxlen;

  disp = XtDisplay(w); win = XtWindow(w); strln = 0;
  for (jj = 0; jj < buflen; jj++) str1[jj] = NULL;
  jj = XmClipboardInquireFormat(disp, win, 1, str1, &strln, &copylen);
  kk = XmClipboardInquireCount(disp, win, &count, &maxlen);
}

What am I doing wrong?  Thanks for any assistance.


-- 
Mark Whetzel     My comments are my own, not my company's.
Western Geophysical - A division of Western Atlas International,
A Litton/Dresser Company           DOMAIN addr: markw@airgun.wg.waii.com
				   UUNET address:  uunet!airgun!markw