From 1eafe0ea2ecc3bce733d574f39bc26652baaec38 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 2 Oct 2009 12:53:47 +0200 Subject: make private qws/qvfb data directory non-default, default to non-user specific This turns the changes in 072e748adbdab1d51b240b9983ce82b213b66f18 off by default. Define QT_PRIVATE_QWS to turn them on. This must be done for both qvfb (X11 build) and libQtGui (QWS build). Failure to do so will result in an inability for applications to communicate with the server. Task-number: QTBUG-1711 Reviewed-by: Paul --- src/gui/embedded/qvfbhdr.h | 18 +++++++++++++++++- src/gui/kernel/qapplication_qws.cpp | 2 +- tools/qvfb/qvfb.cpp | 2 +- tools/qvfb/qvfbshmem.cpp | 6 ++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h index f02286e..eff5fc2 100644 --- a/src/gui/embedded/qvfbhdr.h +++ b/src/gui/embedded/qvfbhdr.h @@ -56,6 +56,7 @@ QT_MODULE(Gui) #define QT_QWS_TEMP_DIR "/tmp" #endif +#ifdef QT_PRIVATE_QWS #define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \ .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY) @@ -67,7 +68,22 @@ QT_MODULE(Gui) .append("/qtvfb_map") #define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ .append("/qt_soundserver") -#define QTE_PIPE "QtEmbedded" +#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/QtEmbedded") +#define QTE_PIPE_QVFB QTE_PIPE +#else +#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2") \ + .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) +#define QT_VFB_MOUSE_PIPE(DISPLAY) QString("/tmp/.qtvfb_mouse-%1").arg(DISPLAY) +#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString("/tmp/.qtvfb_keyboard-%1").arg(DISPLAY) +#define QT_VFB_MAP(DISPLAY) QString("/tmp/.qtvfb_map-%1").arg(DISPLAY) +#define QT_VFB_SOUND_PIPE(DISPLAY) QString("/tmp/.qt_soundserver-%1").arg(DISPLAY) +#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ + .append("/QtEmbedded-%1") \ + .arg(DISPLAY) +#define QTE_PIPE_QVFB(DISPLAY) QString("/tmp/qtembedded-%1/QtEmbedded-%1") \ + .arg(DISPLAY) +#endif struct QVFbHeader { diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 01c64f1..634f23a 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -232,7 +232,7 @@ QString qws_dataDir() // Get the filename of the pipe Qt for Embedded Linux uses for server/client comms Q_GUI_EXPORT QString qws_qtePipeFilename() { - return (qws_dataDir().append(QTE_PIPE)); + return QTE_PIPE(qws_display_id); } static void setMaxWindowRect(const QRect &rect) diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index 6119419..59e8dae 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -135,7 +135,7 @@ static const char *red_off_led_xpm[] = { static bool copyButtonConfiguration(const QString &prefix, int displayId) { - const QString destDir = QT_VFB_DATADIR(displayId); + const QString destDir = QT_VFB_DATADIR(displayId).append("/"); const QFileInfo src(prefix + QLatin1String("defaultbuttons.conf")); const QFileInfo dst(destDir + QLatin1String("defaultbuttons.conf")); unlink(dst.absoluteFilePath().toLatin1().constData()); diff --git a/tools/qvfb/qvfbshmem.cpp b/tools/qvfb/qvfbshmem.cpp index 8c4cdb9..5a2da0d 100644 --- a/tools/qvfb/qvfbshmem.cpp +++ b/tools/qvfb/qvfbshmem.cpp @@ -128,7 +128,9 @@ QShMemViewProtocol::QShMemViewProtocol(int displayid, const QSize &s, if ( logname ) username = logname; - QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString(QTE_PIPE).arg(displayid); + qws_dataDir(displayid); + + QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString("QtEmbedded-%1").arg(displayid); int oldPipeSemkey = ftok(oldPipe.toLatin1().constData(), 'd'); if (oldPipeSemkey != -1) { int oldPipeLockId = semget(oldPipeSemkey, 0, 0); @@ -149,7 +151,7 @@ QShMemViewProtocol::QShMemViewProtocol(int displayid, const QSize &s, } } - displayPipe = qws_dataDir(displayid).append(QTE_PIPE); + displayPipe = QTE_PIPE_QVFB(displayid); kh = new QVFbKeyPipeProtocol(displayid); /* should really depend on receiving qt version, but how can -- cgit v0.12