示例#1
0
// set to active and focus to child
void Client::setChildFocus(WId subwindow, long timestamp)
{
	if (subwindow == 0) XSetInputFocus(display(), clientId, RevertToPointerRoot, CurrentTime);

    if (protTakeFocus) { // WM_TAKE_FOCUS protocol 
        Atoms::sendWMProtocols(clientId, Atoms::atom(Atoms::WM_TAKE_FOCUS), timestamp);
		qDebug() << "PROT. TAKE FOCUS";
	}
	XUngrabKeyboard(display(), CurrentTime);
	keyboardGrabbed = false;
	QTimer::singleShot(220, this, SLOT(doGrab()));
}
示例#2
0
void Calibrate::showEvent(QShowEvent *e )
{
    qLog(Input) << "Calibrate::showEvent()";
    showCross = true;
    pressed = false;
    anygood = false;
    const int offset = 30;

    QDesktopWidget *desktop = QApplication::desktop();
    QRect desk = desktop->screenGeometry(desktop->primaryScreen());
    setGeometry(desk);
    logo = QPixmap(":image/qpelogo");

    cd.screenPoints[QWSPointerCalibrationData::TopLeft] = QPoint( offset, offset );
    cd.screenPoints[QWSPointerCalibrationData::BottomLeft] = QPoint( offset, qt_screen->deviceHeight() - offset );
    cd.screenPoints[QWSPointerCalibrationData::BottomRight] = QPoint( qt_screen->deviceWidth() - offset, qt_screen->deviceHeight() - offset );
    cd.screenPoints[QWSPointerCalibrationData::TopRight] = QPoint( qt_screen->deviceWidth() - offset, offset );
    cd.screenPoints[QWSPointerCalibrationData::Center] = QPoint( qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2 );
    goodcd = cd;
    reset();

    if ( QWSServer::mouseHandler() ) {
      QString calFile = qgetenv("POINTERCAL_FILE");
      if (calFile.isEmpty())
        calFile = "/etc/pointercal";

      qLog(Input) << "Using calibration file " << calFile;
      anygood = QFile::exists(calFile);
     QWSServer::mouseHandler()->getCalibration(&goodcd);
      QWSServer::mouseHandler()->clearCalibration();
    }
    QDialog::showEvent(e);
    setVisible(true);
    setFocusPolicy( Qt::StrongFocus );
    setFocus();
    showFullScreen();
    QTimer::singleShot(0, this, SLOT(doGrab()) );
}
示例#3
0
void Client::delayedGrab(int t)
{
	XUngrabKeyboard(display(), CurrentTime);
	keyboardGrabbed = false;
	QTimer::singleShot(t, this, SLOT(doGrab()));
}