void ibmasm_handle_mouse_interrupt(struct service_processor *sp) { unsigned long reader; unsigned long writer; struct remote_input input; reader = get_queue_reader(sp); writer = get_queue_writer(sp); while (reader != writer) { memcpy_fromio(&input, get_queue_entry(sp, reader), sizeof(struct remote_input)); print_input(&input); if (input.type == INPUT_TYPE_MOUSE) { send_mouse_event(sp->remote.mouse_dev, &input); } else if (input.type == INPUT_TYPE_KEYBOARD) { send_keyboard_event(sp->remote.keybd_dev, &input); } else break; reader = advance_queue_reader(sp, reader); writer = get_queue_writer(sp); } }
bool QcMapItem::childMouseEventFilter(QQuickItem * item, QEvent * event) { Q_UNUSED(item); // item is QQuickMouseArea qInfo() << item << "\n" << event; if (!isVisible() or !isEnabled() or !is_interactive()) return QQuickItem::childMouseEventFilter(item, event); switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: return send_mouse_event(static_cast<QMouseEvent *>(event)); case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: case QEvent::TouchCancel: { QTouchEvent * touch_event = static_cast<QTouchEvent *>(event); if (touch_event->touchPoints().count() >= 2) // 1 touch point = handle with MouseEvent (event is always synthesized) // let the synthesized mouse event grab the mouse, // note there is no mouse grabber at this point since // touch event comes first (see Qt::AA_SynthesizeMouseForUnhandledTouchEvents) return send_touch_event(touch_event); } case QEvent::UngrabMouse: { QQuickWindow * _window = window(); if (!_window and (( !_window->mouseGrabberItem() or ( _window->mouseGrabberItem() and _window->mouseGrabberItem() != this )))) // child lost grab, we could even lost some events // if grab already belongs for example in item in diffrent window, // clear up states mouseUngrabEvent(); break; } default: break; } return QQuickItem::childMouseEventFilter(item, event); }
/** * Reset event state. * * Input state (like pressed keys) is reset, by sending events if * necessary (and if dettached is false). */ void console_input::reset( bool dettached ) { // Reset keyboard state if ( !dettached && pressed_ ) for ( unsigned sc = 0; sc < sizeof(kstate_); ++sc ) if ( is_down(sc) ) send_scan_( sc | 0x80 ); // Release key memset( kstate_, 0, sizeof(kstate_) ); pressed_ = 0; // Reset mouse state (only needed if buttons pressed) if ( !dettached && last_mouse_.abs_x != unsigned(-1) && last_mouse_.btns ) { // Release mouse buttons last_mouse_.btns = 0; send_mouse_event( last_mouse_ ); } last_mouse_.abs_x = unsigned(-1); // Invalidate last mouse data }
static int process_mouse_data(unsigned char *buf, int buf_size) { int eaten; KWMouseEvent_t event; static int old_left, old_middle, old_right; eaten = current_mouse.packet_data(buf, buf_size, &event); if (event.updated == true) { mouseDriver_current_x += event.dx; if ( mouseDriver_current_x > (current_screen.width - 2) ) { mouseDriver_current_x = current_screen.width - 2; } if (mouseDriver_current_x < 0) { mouseDriver_current_x = 0; } mouseDriver_current_y += event.dy; if (mouseDriver_current_y > (current_screen.height - 2) ) { mouseDriver_current_y = current_screen.height - 2; } if (mouseDriver_current_y < 0) { mouseDriver_current_y = 0; } if (event.left == 1) { if (old_left == 0) { /* press _left_ button */ send_mouse_event(LEFT_BUTTON_DOWN); } else if ((mouseDriver_current_x != mouseDriver_previous_x) || (mouseDriver_current_y != mouseDriver_previous_y)) { /* grab _left_ button */ send_mouse_event(LEFT_BUTTON_DRAG); } } else if (old_left == 1) { /* release _left_button */ send_mouse_event(LEFT_BUTTON_UP); } if (event.middle == 1) { if (old_middle == 0) { /* press _middle_ button */ send_mouse_event(MIDDLE_BUTTON_DOWN); } else if ((mouseDriver_current_x != mouseDriver_previous_x) || (mouseDriver_current_y != mouseDriver_previous_y)) { /* grab _middle_ button */ send_mouse_event(MIDDLE_BUTTON_DRAG); } } else if (old_middle == 1) { /* release _middle_ button */ } if (event.right == 1) { if (old_right == 0) { /* press _right_ button */ send_mouse_event(RIGHT_BUTTON_DOWN); } else if ((mouseDriver_current_x != mouseDriver_previous_x) || (mouseDriver_current_y != mouseDriver_previous_y)) { /* grab _right_ button */ send_mouse_event(RIGHT_BUTTON_DRAG); } } else if (old_right == 1) { /* release _right_ button */ } if ((event.left == 0) && (old_left == 0) && (event.middle == 0) && (event.middle == 0) && (event.right == 0) && (event.right == 0)) { send_mouse_event(MOUSE_MOVE); } old_left = event.left; old_right = event.right; old_middle = event.middle; } return eaten; }
void mouse_rup() { send_mouse_event(MOUSEEVENTF_RIGHTUP); }
void mouse_rdown() { send_mouse_event(MOUSEEVENTF_RIGHTDOWN); }
void mouse_lup() { send_mouse_event(MOUSEEVENTF_LEFTUP); }
void mouse_ldown() { send_mouse_event(MOUSEEVENTF_LEFTDOWN); }
void mouse_move(int x, int y) { ::POINT p; ::GetCursorPos(&p); send_mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, x*65536/screenX, y*65536/screenY); }