void CrossViewer::mousePressEvent(QMouseEvent *event) { set_mouse_buttons(event); switch (m_cam_mode) { case CTRL: if (m_left_button_pressed) add_vertex(((event->x() - width() / 2) )/ m_cam_dolly - m_cam_centre.x() / m_cam_dolly, ((height() / 2 - event->y()) ) / m_cam_dolly - m_cam_centre.y()/ m_cam_dolly); break; default: gl2DView::mousePressEvent(event); } }
/* ** Description ** This is the event handler that handles keyboard, mouse and timer events */ static void event_handler (VDI_Workstation * vwk) { Visual_Event visual_event; pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); /* Endless loop that will pump events from the visual and pass them over * to the right manager (mouse, keyboard) */ while (1) { VISUAL_GET_EVENT(vwk, &visual_event); switch(visual_event.type) { case Visual_Key_Press_Event : case Visual_Key_Repeat_Event : key_event( visual_event ); break; case Visual_Key_Release_Event : /* Do nothing */ break; case Visual_Mouse_Button_Event : if (vwk->butv != NULL) { vwk->butv (visual_event.mouse_button.buttons); } set_mouse_buttons( visual_event.mouse_button.buttons ); break; case Visual_Mouse_Move_Event : mouse_moved( visual_event.mouse_move.x, visual_event.mouse_move.y ); break; default: fprintf (stderr, "ovdisis: event.c: Unknown event 0x%x\n", visual_event.type); } } }