QVFbKeyPipeProtocol::QVFbKeyPipeProtocol(int display_id) : QVFbKeyProtocol(display_id) { fileName = QT_VFB_KEYBOARD_PIPE(display_id); fd = openPipe(fileName.toLocal8Bit().constData()); if (fd == -1) qFatal("Cannot open keyboard pipe %s", fileName.toLocal8Bit().data()); }
bool QVFbScreen::initDevice() { #ifndef QT_NO_QWS_MOUSE_QVFB const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev); qwsServer->setDefaultMouse("None"); if (d_ptr->mouse) d_ptr->mouse->setScreen(this); #endif #if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD) const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev); qwsServer->setDefaultKeyboard("None"); #endif if (d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader)) d_ptr->hdr->serverVersion = QT_VERSION; if(d==8) { screencols=256; if (grayscale) { // Build grayscale palette for(int loopc=0;loopc<256;loopc++) { screenclut[loopc]=qRgb(loopc,loopc,loopc); } } else { // 6x6x6 216 color cube int idx = 0; for(int ir = 0x0; ir <= 0xff; ir+=0x33) { for(int ig = 0x0; ig <= 0xff; ig+=0x33) { for(int ib = 0x0; ib <= 0xff; ib+=0x33) { screenclut[idx]=qRgb(ir, ig, ib); idx++; } } } screencols=idx; } memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); d_ptr->hdr->numcols = screencols; } else if (d == 4) { int val = 0; for (int idx = 0; idx < 16; idx++, val += 17) { screenclut[idx] = qRgb(val, val, val); } screencols = 16; memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); d_ptr->hdr->numcols = screencols; } else if (d == 1) { screencols = 2; screenclut[1] = qRgb(0xff, 0xff, 0xff); screenclut[0] = qRgb(0, 0, 0); memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); d_ptr->hdr->numcols = screencols; } #ifndef QT_NO_QWS_CURSOR QScreenCursor::initSoftwareCursor(); #endif return true; }