void QVFbMouseHandler::readMouseData()
{
    int n;
    do {
        n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
        if (n > 0)
            mouseIdx += n;
    } while (n > 0);

    int idx = 0;
    static const int packetsize = sizeof(QPoint) + 2*sizeof(int);
    while (mouseIdx-idx >= packetsize) {
        uchar *mb = mouseBuf+idx;
        QPoint mousePos = *reinterpret_cast<QPoint *>(mb);
        mb += sizeof(QPoint);
        int bstate = *reinterpret_cast<int *>(mb);
        mb += sizeof(int);
        int wheel = *reinterpret_cast<int *>(mb);
//        limitToScreen(mousePos);
        mouseChanged(mousePos, bstate, wheel);
        idx += packetsize;
    }

    int surplus = mouseIdx - idx;
    for (int i = 0; i < surplus; i++)
        mouseBuf[i] = mouseBuf[idx+i];
    mouseIdx = surplus;
}
Пример #2
0
TrackMouseEffect::TrackMouseEffect()
    : m_active(false)
    , m_angle(0)
{
    m_texture[0] = m_texture[1] = 0;
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
    m_picture[0] = m_picture[1] = 0;
    if ( effects->compositingType() == XRenderCompositing)
        m_angleBase = 1.57079632679489661923; // Pi/2
#endif
    if ( effects->isOpenGLCompositing() || effects->compositingType() == QPainterCompositing)
        m_angleBase = 90.0;
    m_mousePolling = false;

    m_action = new QAction(this);
    m_action->setObjectName(QStringLiteral("TrackMouse"));
    m_action->setText(i18n("Track mouse"));
    KGlobalAccel::self()->setDefaultShortcut(m_action, QList<QKeySequence>());
    KGlobalAccel::self()->setShortcut(m_action, QList<QKeySequence>());
    effects->registerGlobalShortcut(QKeySequence(), m_action);

    connect(m_action, SIGNAL(triggered(bool)), this, SLOT(toggle()));

    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
                     SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    reconfigure(ReconfigureAll);
}
Пример #3
0
void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) {
	if (!isMouseControlEnabled())
		return;

	_gameManager->_inputTranslator.mouseWheel(wheelUp, mousePos);
	mouseChanged();
}
void KindleFiveWay::setKeypadMode(bool keypadMode)
{
    _keypadMode = false ; //keypadMode;

    if (_keypadMode)
    {
        QScreenCursor::instance()->hide();
        QWSServer::setCursorVisible(false);
        mouseChanged(QPoint(0,1200), 0, 0);
    }
    else
    {
        QScreenCursor::instance()->show();
        QWSServer::setCursorVisible(true);
        mouseChanged(pos(), 0, 0);
    }
}
Пример #5
0
/*! \internal

  This function is called whenever there is activity on the mouse device.
  By default, it reads up to 10 mouse move packets and calls mouseChanged()
  for each of them.
*/
void QQnxMouseHandler::socketActivated()
{
    // _mouse_packet is a QNX structure. devi-hid is nice enough to translate
    // the raw byte data from mouse devices into generic format for us.
    _mouse_packet packet;

    int iteration = 0;

    // read mouse events in batches of 10. Since we're getting quite a lot
    // of mouse events, it's better to do them in batches than to return to the
    // event loop every time.
    do {
        int bytesRead = QT_READ(mouseFD, &packet, sizeof(packet));
        if (bytesRead == -1) {
            // EAGAIN means that there are no more mouse events to read
            if (errno != EAGAIN)
                qErrnoWarning(errno, "QQnxMouseHandler: Unable to read from socket");
            return;
        }

        // bytes read should always be equal to the size of a packet.
        Q_ASSERT(bytesRead == sizeof(packet));

        // translate the coordinates from the QNX data structure to Qt coordinates
        // note the swapped y axis
        QPoint pos = mousePos;
        pos += QPoint(packet.dx, -packet.dy);

        // QNX only tells us relative mouse movements, not absolute ones, so limit the
        // cursor position manually to the screen
        limitToScreen(pos);

        // translate the QNX mouse button bitmask to Qt buttons
        int buttons = Qt::NoButton;

        if (packet.hdr.buttons & _POINTER_BUTTON_LEFT)
            buttons |= Qt::LeftButton;
        if (packet.hdr.buttons & _POINTER_BUTTON_MIDDLE)
            buttons |= Qt::MidButton;
        if (packet.hdr.buttons & _POINTER_BUTTON_RIGHT)
            buttons |= Qt::RightButton;

        // call mouseChanged() - this does all the magic to actually move the on-screen
        // mouse cursor.
        mouseChanged(pos, buttons, 0);
    } while (++iteration < 11);
}
Пример #6
0
MouseMarkEffect::MouseMarkEffect()
{
    KActionCollection* actionCollection = new KActionCollection(this);
    KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks"));
    a->setText(i18n("Clear All Mouse Marks"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
    a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));
    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    reconfigure(ReconfigureAll);
    arrow_start = NULL_POINT;
    effects->startMousePolling(); // We require it to detect activation as well
}
Пример #7
0
StartupFeedbackEffect::StartupFeedbackEffect()
    : m_startupInfo(new KStartupInfo(KStartupInfo::CleanOnCantDetect, this))
    , m_selection(new KSelectionOwner("_KDE_STARTUP_FEEDBACK", -1, this))
    , m_active(false)
    , m_frame(0)
    , m_progress(0)
    , m_texture(0)
    , m_type(BouncingFeedback)
    , m_blinkingShader(0)
{
    for (int i = 0; i < 5; ++i) {
        m_bouncingTextures[i] = 0;
    }
    m_selection->claim(true);
    connect(m_startupInfo, SIGNAL(gotNewStartup(KStartupInfoId,KStartupInfoData)), SLOT(gotNewStartup(KStartupInfoId,KStartupInfoData)));
    connect(m_startupInfo, SIGNAL(gotRemoveStartup(KStartupInfoId,KStartupInfoData)), SLOT(gotRemoveStartup(KStartupInfoId,KStartupInfoData)));
    connect(m_startupInfo, SIGNAL(gotStartupChange(KStartupInfoId,KStartupInfoData)), SLOT(gotStartupChange(KStartupInfoId,KStartupInfoData)));
    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    reconfigure(ReconfigureAll);
}
Пример #8
0
MouseMarkEffect::MouseMarkEffect()
{
    KActionCollection* actionCollection = new KActionCollection(this);
    QAction* a = actionCollection->addAction(QStringLiteral("ClearMouseMarks"));
    a->setText(i18n("Clear All Mouse Marks"));
    KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
    KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
    a = actionCollection->addAction(QStringLiteral("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
    KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));

    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    connect(effects, SIGNAL(screenLockingChanged(bool)), SLOT(screenLockingChanged(bool)));
    reconfigure(ReconfigureAll);
    arrow_start = NULL_POINT;
    effects->startMousePolling(); // We require it to detect activation as well
}
Пример #9
0
void IniReader::setMouse(const bool &s){settings.insert("mouse",s);emit mouseChanged();}
Пример #10
0
void IniReader::finished()
{
    settings=watcher->result();
    emit readConfigChanged();
    emit writeConfigChanged();
    emit romPathChanged();
    emit hashPathChanged();
    emit samplePathChanged();
    emit artPathChanged();
    emit ctrlrPathChanged();
    emit iniPathChanged();
    emit fontPathChanged();
    emit cheatPathChanged();
    emit crosshairPathChanged();
    emit cfgDirChanged();
    emit nvramDirChanged();
    emit inputDirChanged();
    emit stateDirChanged();
    emit snapshotDirChanged();
    emit diffDirChanged();
    emit commentDirChanged();
    emit stateChanged();
    emit autoSaveChanged();
    emit playbackChanged();
    emit recordChanged();
    emit mngWriteChanged();
    emit aviWriteChanged();
    emit wavWriteChanged();
    emit snapNameChanged();
    emit snapSizeChanged();
    emit snapViewChanged();
    emit snapBilinearChanged();
    emit stateNameChanged();
    emit burninChanged();
    emit autoFrameSkipChanged();
    emit frameSkipChanged();
    emit secondsToRunChanged();
    emit throttleChanged();
    emit sleepChanged();
    emit speedChanged();
    emit refreshSpeedChanged();
    emit rotateChanged();
    emit rorChanged();
    emit rolChanged();
    emit autoRorChanged();
    emit autoRolChanged();
    emit flipXChanged();
    emit flipYChanged();
    emit artworkCropChanged();
    emit useBackdropsChanged();
    emit useOverlaysChanged();
    emit useBezelsChanged();
    emit useCPanelsChanged();
    emit useMarqueesChanged();
    emit brightnessChanged();
    emit contrastChanged();
    emit gammaChanged();
    emit effectChanged();
    emit beamChanged();
    emit flickerChanged();
    emit sampleRateChanged();
    emit samplesChanged();
    emit volumeChanged();
    emit coinLockoutChanged();
    emit ctrlrChanged();
    emit mouseChanged();
    emit joystickChanged();
    emit lightgunChanged();
    emit multiKeyboardChanged();
    emit multiMouseChanged();
    emit steadyKeyChanged();
    emit uiActiveChanged();
    emit offScreenReloadChanged();
    emit joystickMapChanged();
    emit joystickDeadzoneChanged();
    emit joystickSaturationChanged();
    emit naturalChanged();
    emit joystickContradictoryChanged();
    emit coinImpulseChanged();
    emit paddleDeviceChanged();
    emit adstickDeviceChanged();
    emit pedalDeviceChanged();
    emit dialDeviceChanged();
    emit trackballDeviceChanged();
    emit lightgunDeviceChanged();
    emit positionalDeviceChanged();
    emit mouseDeviceChanged();
    emit verboseChanged();
    emit logChanged();
    emit osLogChanged();
    emit debugChanged();
    emit updateInPauseChanged();
    emit debugScriptChanged();
    emit sdlVideoFPSChanged();
    emit commLocalHostChanged();
    emit commLocalPortChanged();
    emit commRemoteHostChanged();
    emit commRemotePortChanged();
    emit antiAliasChanged();
    emit drcChanged();
    emit drcUseCChanged();
    emit drcLogUMLChanged();
    emit drcLogNativeChanged();
    emit biosChanged();
    emit cheatChanged();
    emit skipGameInfoChanged();
    emit uiFontChanged();
    emit ramSizeChanged();
    emit confirmQuitChanged();
    emit uiMouseChanged();
    emit autoBootCommandChanged();
    emit autoBootDelayChanged();
    emit autoBootScriptChanged();
    emit httpChanged();
    emit httpPortChanged();
    emit httpPathChanged();
    emit consoleChanged();
    emit multiThreadingChanged();
    emit numProcessorsChanged();
    emit videoChanged();
    emit numScreensChanged();
    emit windowChanged();
    emit maximizeChanged();
    emit keepAspectChanged();
    emit unevenStretchChanged();
    emit waitVSyncChanged();
    emit syncRefreshChanged();
    emit screenChanged();
    emit aspectChanged();
    emit resolutionChanged();
    emit viewChanged();
    emit switchResChanged();
    emit filterChanged();
    emit prescaleChanged();
    emit glForcePow2TextureChanged();
    emit glNoTextureRectChanged();
    emit glVboChanged();
    emit glPboChanged();
    emit glGlslChanged();
    emit glGlslFilterChanged();
    emit soundChanged();
    emit audioLatencyChanged();
    emit centerHChanged();
    emit centerVChanged();
    emit scaleModeChanged();
    emit useAllHeadsChanged();
    emit keymapChanged();
    emit keymapFileChanged();
    emit sixAxisChanged();
    emit videoDriverChanged();
    emit renderDriverChanged();
    emit audioDriverChanged();
    emit glLibChanged();
}
void KindleFiveWay::activity(int)
{
    _sn->setEnabled(false);

    input_event_t in;

    read(_fd, &in, sizeof(input_event_t));

    if (_debug)
        qDebug("FiveWay: type %d, code %d, value %d", in.type, in.code, in.value);

    if (in.type == 1)
    {
        QPoint p = pos();

        switch(in.code)
        {
        default:
            break;
        case KDX_KEY_5WPRESS:
        case K3_KEY_5WPRESS:
            // button press
            if (_keypadMode)
            {
                QWSServer::sendKeyEvent('\n', Qt::Key_Return, Qt::NoModifier, in.value != 0, in.value == 2);
            }
            else
            {
                if (in.value)
                    _button = !_button;
            }
            break;
        case KDX_KEY_LARROW:
            // left
            if (_keypadMode)
            {
                QWSServer::sendKeyEvent(0, Qt::Key_Left, Qt::NoModifier, in.value != 0, in.value == 2);
            }
            else if (in.value == 0)
            {
                _left = 0;
            }
            else if (in.value == 1)
            {
                _left = 1;
                p.setX(p.x() - 5);
            }
            else
            {
                if (_left < 6)
                    _left++;

                p.setX(p.x() - 5 * _left);
            }
            break;
        case KDX_KEY_RARROW:
            // right
            if (_keypadMode)
            {
                QWSServer::sendKeyEvent(0, Qt::Key_Right, Qt::NoModifier, in.value != 0, in.value == 2);
            }
            else if (in.value == 0)
            {
                _right = 0;
            }
            else if (in.value == 1)
            {
                _right = 1;
                p.setX(p.x() + 5);
            }
            else
            {
                if (_right < 6)
                    _right++;

                p.setX(p.x() + 5 * _right);
            }
            break;
        case KDX_KEY_UPARROW:
        case K3_KEY_UPARROW:
            // up
            if (_keypadMode)
            {
                QWSServer::sendKeyEvent(0, Qt::Key_Up, Qt::NoModifier, in.value != 0, in.value == 2);
            }
            else if (in.value == 0)
            {
                _up = 0;
            }
            else if (in.value == 1)
            {
                _up = 1;
                p.setY(p.y() - 5);
            }
            else
            {
                if (_up < 6)
                    _up++;

                p.setY(p.y() - 5 * _up);
            }
            break;
        case KDX_KEY_DNARROW:
        case K3_KEY_DNARROW:
            // down
            if (_keypadMode)
            {
                QWSServer::sendKeyEvent(0, Qt::Key_Down, Qt::NoModifier, in.value != 0, in.value == 2);
            }
            else if (in.value == 0)
            {
                _down = 0;
            }
            else if (in.value == 1)
            {
                _down = 1;
                p.setY(p.y() + 5);
            }
            else
            {
                if (_down < 6)
                    _down++;

                p.setY(p.y() + 5 * _down);
            }
            break;
        }

        limitToScreen(p);

        if (!_keypadMode)
            mouseChanged(p, _button ? Qt::LeftButton : 0, 0);
    }

    _sn->setEnabled(true);
}