Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - event handling and cursor manipulation in fullscreen direct mode : (2 Items)
   
event handling and cursor manipulation in fullscreen direct mode  
Hello colleagues!
I have created an application with direct mode (PdCreateDirectContext), because I have to draw animation and work in 
fullscreen mode. But I can't control cursor now. I want to switch it off, or to get event from mouse. How I can do it?
Thanks in advance!
Re: event handling and cursor manipulation in fullscreen direct mode  
Hi Nick,

Are you trying to hide the cursor?  If so this code should do it for you:

int CursorOnOff( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) //Toggle (int state)
{
  FILE *fp;
  char buffer[20];
  PhRegion_t region;
  int rid;
  static int state = 0;

  widget = widget, apinfo = apinfo, cbinfo = cbinfo;

  PhAttach (NULL, NULL);  //find pointer region
  fp = popen( "phin -h -Pdevi-hirun -f r", "r" );

  if (fgets (buffer, 20, fp))
  {
    rid = atoi (buffer);
    PhRegionQuery (rid, ®ion, NULL, NULL, 0);

    /* Toggle Cursor */
    state ? (region.flags |= Ph_PTR_REGION) : (region.flags &= ~Ph_PTR_REGION);

    PhRegionChange(Ph_REGION_FLAGS, 0, ®ion, NULL, NULL );

    state = 1 - state;
  }

  return (Pt_CONTINUE);
}

Getting the event from the mouse should be a region setup to capture mouse events.  See the attached example.

Best regards,

Erick

> Hello colleagues!
> I have created an application with direct mode (PdCreateDirectContext), 
> because I have to draw animation and work in fullscreen mode. But I can't 
> control cursor now. I want to switch it off, or to get event from mouse. How I
>  can do it?
> Thanks in advance!


Attachment: Text input_capture.tgz 6.24 KB