static void handleKeyboard(unsigned char key, int x, int y) { crutSendKeyboardEvent( &crut_api, key, x, y ); if (key == 27 && crut_server.exit_on_escape) exit(0); }
static int crutProxyRecv( CRConnection *conn, CRMessage *msg, unsigned int len ) { switch( msg->header.type ) { case CR_MESSAGE_CRUT: crut_proxy.msg = (CRUTMessage*) msg; /* forward events */ if ( crut_proxy.msg->msg_type == CRUT_MOUSE_EVENT ) { CRUTMouseMsg *msg1 = (CRUTMouseMsg*) msg; crutSendMouseEvent( &crut_api, msg1->button, msg1->state, msg1->x, msg1->y); } else if ( crut_proxy.msg->msg_type == CRUT_RESHAPE_EVENT ) { CRUTReshapeMsg *msg1 = (CRUTReshapeMsg*) msg; crutSendReshapeEvent( &crut_api, msg1->width, msg1->height); } else if ( crut_proxy.msg->msg_type == CRUT_VISIBILITY_EVENT ) { CRUTVisibilityMsg *msg1 = (CRUTVisibilityMsg*) msg; crutSendVisibilityEvent( &crut_api, msg1->state); } else if ( crut_proxy.msg->msg_type == CRUT_KEYBOARD_EVENT ) { CRUTKeyboardMsg *msg1 = (CRUTKeyboardMsg*) msg; crutSendKeyboardEvent( &crut_api, msg1->key, msg1->x, msg1->y); } else if ( crut_proxy.msg->msg_type == CRUT_MOTION_EVENT ) { CRUTMotionMsg *msg1 = (CRUTMotionMsg*) msg; crutSendMotionEvent( &crut_api, msg1->x, msg1->y); } else if ( crut_proxy.msg->msg_type == CRUT_PASSIVE_MOTION_EVENT ) { CRUTPassiveMotionMsg *msg1 = (CRUTPassiveMotionMsg*) msg; crutSendPassiveMotionEvent( &crut_api, msg1->x, msg1->y); } else if ( crut_proxy.msg->msg_type == CRUT_MENU_EVENT ) { CRUTMenuMsg *msg1 = (CRUTMenuMsg*) msg; crutSendMenuEvent( &crut_api, msg1->menuID, msg1->value ); } return 1; /* HANDLED */ break; default: crDebug("got a message NOT of type CRUT"); break; } (void) len; return 0; /* HANDLED -- why weren't we doing this on Windows? Have to return something. */ }