summaryrefslogtreecommitdiffstats
path: root/src/gui/embedded
diff options
context:
space:
mode:
authorJeremy Katz <jeremy.katz@nokia.com>2009-10-01 12:08:11 (GMT)
committerJeremy Katz <jeremy.katz@nokia.com>2009-10-01 12:12:28 (GMT)
commit072e748adbdab1d51b240b9983ce82b213b66f18 (patch)
tree67d170ab4e0bba06adc3479ea6af3214e24636e4 /src/gui/embedded
parent938ba08e7bf90063127b298da25a124441659e89 (diff)
downloadQt-072e748adbdab1d51b240b9983ce82b213b66f18.zip
Qt-072e748adbdab1d51b240b9983ce82b213b66f18.tar.gz
Qt-072e748adbdab1d51b240b9983ce82b213b66f18.tar.bz2
Enable qws/qvfb use for multiple users on one machine
Task-number: QTBUG-1711 Reviewed-by: Paul
Diffstat (limited to 'src/gui/embedded')
-rw-r--r--src/gui/embedded/qscreenvfb_qws.cpp8
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp11
-rw-r--r--src/gui/embedded/qvfbhdr.h19
-rw-r--r--src/gui/embedded/qwscommand_qws_p.h2
4 files changed, 25 insertions, 15 deletions
diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp
index 19d4fa8..d71336d 100644
--- a/src/gui/embedded/qscreenvfb_qws.cpp
+++ b/src/gui/embedded/qscreenvfb_qws.cpp
@@ -196,7 +196,7 @@ bool QVFbScreen::connect(const QString &displaySpec)
if (displayArgs.contains(QLatin1String("Gray")))
grayscale = true;
- key_t key = ftok(QByteArray(QT_VFB_MOUSE_PIPE).replace("%1", QByteArray::number(displayId)), 'b');
+ key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLocal8Bit(), 'b');
if (key == -1)
return false;
@@ -330,8 +330,7 @@ void QVFbScreen::disconnect()
bool QVFbScreen::initDevice()
{
#ifndef QT_NO_QWS_MOUSE_QVFB
- const QString mouseDev = QString::fromLatin1(QT_VFB_MOUSE_PIPE)
- .arg(displayId);
+ const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId);
d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev);
qwsServer->setDefaultMouse("None");
if (d_ptr->mouse)
@@ -339,8 +338,7 @@ bool QVFbScreen::initDevice()
#endif
#if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD)
- const QString keyboardDev = QString::fromLatin1(QT_VFB_KEYBOARD_PIPE)
- .arg(displayId);
+ const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId);
d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev);
qwsServer->setDefaultKeyboard("None");
#endif
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index 6bac8dc..b859be5 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -67,6 +67,8 @@
#include <qdebug.h>
+#include <qvfbhdr.h>
+
extern int errno;
QT_BEGIN_NAMESPACE
@@ -79,7 +81,6 @@ QT_BEGIN_NAMESPACE
static int sound_speed = 44100;
#ifndef QT_NO_QWS_SOUNDSERVER
extern int qws_display_id;
-#define SOUND_PIPE "/tmp/.qt_soundserver-%1"
#endif
static char *zeroMem = 0;
@@ -708,7 +709,7 @@ protected:
#ifndef QT_NO_QWS_SOUNDSERVER
QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) :
- QWSServerSocket(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id), parent)
+ QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
{
connect(this, SIGNAL(newConnection()), this, SLOT(newConnection()));
}
@@ -716,7 +717,7 @@ QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) :
#ifdef QT3_SUPPORT
QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent, const char *name) :
- QWSServerSocket(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id), parent)
+ QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent)
{
if (name)
setObjectName(QString::fromAscii(name));
@@ -1395,7 +1396,7 @@ void QWSSoundServer::translateSoundCompleted( int, int sid )
QWSSoundClient::QWSSoundClient(QObject* parent) :
QWSSocket(parent)
{
- connectToLocalFile(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id));
+ connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
QObject::connect(this,SIGNAL(readyRead()),
this,SLOT(tryReadCommand()));
if( state() == QWS_SOCK_BASE::ConnectedState ) QTimer::singleShot(1, this, SIGNAL(connected()));
@@ -1409,7 +1410,7 @@ QWSSoundClient::~QWSSoundClient( )
void QWSSoundClient::reconnect()
{
- connectToLocalFile(QString::fromLatin1(SOUND_PIPE).arg(qws_display_id));
+ connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id));
if( state() == QWS_SOCK_BASE::ConnectedState ) emit connected();
else emit error( QTcpSocket::ConnectionRefusedError );
}
diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h
index 73e08e0..f02286e 100644
--- a/src/gui/embedded/qvfbhdr.h
+++ b/src/gui/embedded/qvfbhdr.h
@@ -52,9 +52,22 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#define QT_VFB_MOUSE_PIPE "/tmp/.qtvfb_mouse-%1"
-#define QT_VFB_KEYBOARD_PIPE "/tmp/.qtvfb_keyboard-%1"
-#define QT_VFB_MAP "/tmp/.qtvfb_map-%1"
+#ifndef QT_QWS_TEMP_DIR
+#define QT_QWS_TEMP_DIR "/tmp"
+#endif
+
+#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \
+ .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
+
+#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_mouse")
+#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_keyboard")
+#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qtvfb_map")
+#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/qt_soundserver")
+#define QTE_PIPE "QtEmbedded"
struct QVFbHeader
{
diff --git a/src/gui/embedded/qwscommand_qws_p.h b/src/gui/embedded/qwscommand_qws_p.h
index d92c6af..f986a9d 100644
--- a/src/gui/embedded/qwscommand_qws_p.h
+++ b/src/gui/embedded/qwscommand_qws_p.h
@@ -75,8 +75,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#define QTE_PIPE "QtEmbedded-%1"
-
class QRect;
/*********************************************************************