I want to click letf button at some (X,Y) coordinate, and I found a function
PhEmit() in Help document. I have write a function MyPressMouse
in a button callback. When I run this program and click this button,
the program stop, like in a deadlock cycle!! Could any body help me!! Thanks!!
In button callback:
int
Click_Button2( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
/* eliminate 'unreferenced' warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
MyPressMouse(20,20);
return( Pt_CONTINUE );
}
In MyPressMouse() function:
void MyPressMouse(int X, int Y)
{
PhRect_t rect;
PhPointerEvent_t EventData;
if( NULL == PhAttach( NULL, NULL ) ) {
fprintf( stderr,
"Couldn't attach Photon channel.\n");
exit( EXIT_FAILURE );
}
event.type = Ph_EV_BUT_PRESS;
event.subtype = 0;
event.flags = 0;
event.num_rects = 1;
event.data_len = sizeof(EventData);
event.emitter.rid = Ph_DEV_RID;
rect.ul.x = rect.lr.x = X;
rect.ul.y = rect.lr.y = Y;
EventData.buttons = Ph_BUTTON_SELECT ;
EventData.flags = 0;
PhEventEmit( &event, &rect, &EventData );
}