Changing cursor in Xlib

New Message Reply Date view Thread view Subject view Author view

Chehayeb, Nassouh (nchehayeb++at++ceit.es)
Tue, 29 Apr 1997 11:39:14 +0200


Hi Performers,

       This is an example code to change the shape of the cursor in the
WSWindow of my PipeWindow. This function is called form a forked process
(INPUT) different from the APP and the DRAW process. After the call to
this function nothing will happen.

// INPUT PROCESS

void vrSimXInput::initCursor()
 {
 pfWSWindow xWin;
 pfPipe *pfpipe;
 pfWSConnection dsp, theDisplay;
 char str[PF_MAXSTRING];
 const char *s;
 int tries = 0;
 Cursor cur;
 pfPipeWindow *pwin;

 pwin = chan->getPWin();

 xWin = pwin->getWSWindow();
 while (!xWin)
     {
     sginap(2);
     xWin = pwin->getWSWindow();
     if (tries++ > 10000)
     pfNotify(PFNFY_FATAL, PFNFY_USAGE, "vrSimXInput::open(): "
              "unable to find pfWSWindow on PipeWindow %d",
pwin->getIndex());
     }

 pfpipe = pwin->getPipe();
 dsp = pfGetCurWSConnection();
 s = DisplayString(dsp);
 if (s && (s[0] != '\0'))
     strcpy(str, s);
 else
     sprintf(str, ":%d", pfpipe->getScreen());

 if (!(theDisplay = pfOpenWSConnection(str, FALSE)))
     pfNotify(PFNFY_FATAL, PFNFY_RESOURCE, "vrXInput::open(): "
                                           "can't open display %s",
str);
 XSync(dsp,FALSE);

 cur = XCreateFontCursor(dsp, VR_CURSOR_HAND);
 XDefineCursor(dsp, xWin, cur);
 }

Am I making a mistake ?

Nassouh Adel Chehayeb
C.E.I.T.
(Centro de Estudios e Investigaciones Tecnicas de Guipuzkoa)
Applied Mechanics Department
Paseo de Manuel Lardizabal - 15
20009. San Sebastian (SPAIN)
e-mail: nchehayeb++at++ceit.es
Phone: ++34-43-21.28.00
Fax : ++34-43-21.30.76

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:07 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.