summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/accessible.pri2
-rw-r--r--src/gui/dialogs/dialogs.pri20
-rw-r--r--src/gui/egl/egl.pri22
-rw-r--r--src/gui/embedded/directfb.pri40
-rw-r--r--src/gui/embedded/embedded.pri226
-rw-r--r--src/gui/embedded/qlock.cpp325
-rw-r--r--src/gui/embedded/qlock_p.h100
-rw-r--r--src/gui/embedded/qunixsocket.cpp1800
-rw-r--r--src/gui/embedded/qunixsocket_p.h202
-rw-r--r--src/gui/embedded/qunixsocketserver.cpp376
-rw-r--r--src/gui/embedded/qunixsocketserver_p.h98
-rw-r--r--src/gui/embedded/qvfbhdr.h119
-rw-r--r--src/gui/embedded/qwindowsystem_p.h315
-rw-r--r--src/gui/embedded/qwsembedwidget.cpp227
-rw-r--r--src/gui/embedded/qwsembedwidget.h82
-rw-r--r--src/gui/embedded/qwslock.cpp236
-rw-r--r--src/gui/embedded/qwslock_p.h85
-rw-r--r--src/gui/embedded/qwsmanager_p.h122
-rw-r--r--src/gui/embedded/qwssharedmemory.cpp185
-rw-r--r--src/gui/embedded/qwssharedmemory_p.h105
-rw-r--r--src/gui/embedded/qwssignalhandler.cpp128
-rw-r--r--src/gui/embedded/qwssignalhandler_p.h99
-rw-r--r--src/gui/gui.pro4
-rw-r--r--src/gui/image/image.pri3
-rw-r--r--src/gui/inputmethod/inputmethod.pri6
-rw-r--r--src/gui/inputmethod/qwsinputcontext_p.h97
-rw-r--r--src/gui/kernel/kernel.pri28
-rw-r--r--src/gui/kernel/mac.pri2
-rw-r--r--src/gui/painting/painting.pri36
-rw-r--r--src/gui/styles/styles.pri2
-rw-r--r--src/gui/text/text.pri20
-rw-r--r--src/gui/util/util.pri4
-rw-r--r--src/gui/widgets/widgets.pri2
33 files changed, 26 insertions, 5092 deletions
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index 31362ffded..66a84bcce6 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -12,7 +12,7 @@ contains(QT_CONFIG, accessibility) {
accessible/qaccessiblewidget.cpp \
accessible/qaccessibleplugin.cpp
- mac:!embedded:!qpa {
+ mac:!qpa {
HEADERS += accessible/qaccessible_mac_p.h
OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \
accessible/qaccessible_mac_cocoa.mm
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index 6ba707c9d3..472787a20c 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -27,7 +27,7 @@ HEADERS += \
dialogs/qwizard.h \
dialogs/qprintpreviewdialog.h
-!embedded:!qpa:mac {
+!qpa:mac {
OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \
dialogs/qfontdialog_mac.mm \
dialogs/qnspanelproxy_mac.mm \
@@ -61,7 +61,7 @@ win32 {
!win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library
}
-!mac:!embedded:!symbian:unix|qpa {
+!mac:!symbian:unix|qpa {
HEADERS += dialogs/qpagesetupdialog_unix_p.h
SOURCES += dialogs/qprintdialog_unix.cpp \
dialogs/qpagesetupdialog_unix.cpp
@@ -70,22 +70,6 @@ win32 {
dialogs/qprintpropertieswidget.ui
}
-embedded {
- contains(QT_CONFIG,qtopia) {
- HEADERS += dialogs/qpagesetupdialog_unix_p.h
- DEFINES += QTOPIA_PRINTDIALOG
- SOURCES += dialogs/qprintdialog_qws.cpp \
- dialogs/qpagesetupdialog_unix.cpp
- } else {
- HEADERS += dialogs/qpagesetupdialog_unix_p.h
- SOURCES += dialogs/qprintdialog_unix.cpp \
- dialogs/qpagesetupdialog_unix.cpp
- FORMS += dialogs/qprintsettingsoutput.ui \
- dialogs/qprintwidget.ui \
- dialogs/qprintpropertieswidget.ui
- }
-}
-
wince*|symbian: FORMS += dialogs/qfiledialog_embedded.ui
else: FORMS += dialogs/qfiledialog.ui
diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri
index 8e8664c679..ec23da3312 100644
--- a/src/gui/egl/egl.pri
+++ b/src/gui/egl/egl.pri
@@ -25,19 +25,15 @@ contains(QT_CONFIG, egl): {
wince*: SOURCES += egl/qegl_wince.cpp
unix {
- embedded {
- SOURCES += egl/qegl_qws.cpp
- } else {
- qpa {
- SOURCES += egl/qegl_qpa.cpp
- } else {
- symbian {
- SOURCES += egl/qegl_symbian.cpp
- } else {
- SOURCES += egl/qegl_x11.cpp
- }
- }
- }
+ qpa {
+ SOURCES += egl/qegl_qpa.cpp
+ } else {
+ symbian {
+ SOURCES += egl/qegl_symbian.cpp
+ } else {
+ SOURCES += egl/qegl_x11.cpp
+ }
+ }
}
} else:symbian {
DEFINES += QT_NO_EGL
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
deleted file mode 100644
index 75d693e0b4..0000000000
--- a/src/gui/embedded/directfb.pri
+++ /dev/null
@@ -1,40 +0,0 @@
-# These defines might be necessary if your DirectFB driver doesn't
-# support all of the DirectFB API.
-#
-#DEFINES += QT_DIRECTFB_SUBSURFACE
-#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
-#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
-#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
-#DEFINES += QT_DIRECTFB_IMAGECACHE
-#DEFINES += QT_NO_DIRECTFB_WM
-#DEFINES += QT_NO_DIRECTFB_LAYER
-#DEFINES += QT_DIRECTFB_PALETTE
-#DEFINES += QT_NO_DIRECTFB_PREALLOCATED
-#DEFINES += QT_NO_DIRECTFB_MOUSE
-#DEFINES += QT_NO_DIRECTFB_KEYBOARD
-#DEFINES += QT_DIRECTFB_TIMING
-#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION
-#DEFINES += QT_NO_DIRECTFB_STRETCHBLIT
-DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT|DRAW_STATICTEXT
-#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\"
-
-HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h
-
-SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \
- $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
-
-
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
-LIBS += $$QT_LIBS_DIRECTFB
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
deleted file mode 100644
index 31f0bc6d50..0000000000
--- a/src/gui/embedded/embedded.pri
+++ /dev/null
@@ -1,226 +0,0 @@
-# Qt for Embedded Linux
-
-embedded {
- CONFIG -= opengl x11
- LIBS -= -dl
- KERNEL_P = kernel
-
- !mac:HEADERS += embedded/qsoundqss_qws.h
- HEADERS += \
- embedded/qcopchannel_qws.h \
- embedded/qdecoration_qws.h \
- embedded/qdecorationfactory_qws.h \
- embedded/qdecorationplugin_qws.h \
- embedded/qdirectpainter_qws.h \
- embedded/qlock_p.h \
- embedded/qscreen_qws.h \
- embedded/qscreenmulti_qws_p.h \
- embedded/qscreenproxy_qws.h \
- embedded/qwindowsystem_qws.h \
- embedded/qwindowsystem_p.h \
- embedded/qwscommand_qws_p.h \
- embedded/qwscursor_qws.h \
- embedded/qwsdisplay_qws.h \
- embedded/qwsdisplay_qws_p.h \
- embedded/qwsevent_qws.h \
- embedded/qwsmanager_qws.h \
- embedded/qwsmanager_p.h \
- embedded/qwsproperty_qws.h \
- embedded/qwsprotocolitem_qws.h \
- embedded/qtransportauth_qws.h \
- embedded/qtransportauth_qws_p.h \
- embedded/qtransportauthdefs_qws.h \
- embedded/qwssocket_qws.h \
- embedded/qwslock_p.h \
- embedded/qwsutils_qws.h \
- embedded/qwssharedmemory_p.h \
- embedded/qwssignalhandler_p.h \
- embedded/qwsembedwidget.h
-
- !mac:SOURCES += embedded/qsoundqss_qws.cpp
- SOURCES += \
- embedded/qcopchannel_qws.cpp \
- embedded/qdecoration_qws.cpp \
- embedded/qdecorationfactory_qws.cpp \
- embedded/qdecorationplugin_qws.cpp \
- embedded/qdirectpainter_qws.cpp \
- embedded/qlock.cpp \
- embedded/qscreen_qws.cpp \
- embedded/qscreenmulti_qws.cpp \
- embedded/qscreenproxy_qws.cpp \
- embedded/qwindowsystem_qws.cpp \
- embedded/qwscommand_qws.cpp \
- embedded/qwscursor_qws.cpp \
- embedded/qwsevent_qws.cpp \
- embedded/qwsmanager_qws.cpp \
- embedded/qwsproperty_qws.cpp \
- embedded/qtransportauth_qws.cpp \
- embedded/qwslock.cpp \
- embedded/qwssharedmemory.cpp \
- embedded/qwssocket_qws.cpp \
- embedded/qwssignalhandler.cpp \
- embedded/qwsembedwidget.cpp
-
- contains(QT_CONFIG,sxe)|contains(QT_CONFIG,qtopia) {
- SOURCES += embedded/qunixsocket.cpp embedded/qunixsocketserver.cpp
- HEADERS += embedded/qunixsocket_p.h embedded/qunixsocketserver_p.h
- }
-
-#
-# Decorations
-#
- contains( decorations, default ) {
- HEADERS += embedded/qdecorationdefault_qws.h
- SOURCES += embedded/qdecorationdefault_qws.cpp
- }
- contains( decorations, styled ) {
- HEADERS += embedded/qdecorationstyled_qws.h
- SOURCES += embedded/qdecorationstyled_qws.cpp
- }
-
- contains( decorations, windows ) {
- HEADERS += embedded/qdecorationwindows_qws.h
- SOURCES += embedded/qdecorationwindows_qws.cpp
- }
-
-#
-# Qt for Embedded Linux Drivers
-#
- HEADERS += embedded/qscreendriverplugin_qws.h \
- embedded/qscreendriverfactory_qws.h \
- embedded/qkbd_qws.h \
- embedded/qkbd_qws_p.h \
- embedded/qkbd_defaultmap_qws_p.h \
- embedded/qkbddriverplugin_qws.h \
- embedded/qkbddriverfactory_qws.h \
- embedded/qmouse_qws.h \
- embedded/qmousedriverplugin_qws.h \
- embedded/qmousedriverfactory_qws.h
-
- SOURCES += embedded/qscreendriverplugin_qws.cpp \
- embedded/qscreendriverfactory_qws.cpp \
- embedded/qkbd_qws.cpp \
- embedded/qkbddriverplugin_qws.cpp \
- embedded/qkbddriverfactory_qws.cpp \
- embedded/qmouse_qws.cpp \
- embedded/qmousedriverplugin_qws.cpp \
- embedded/qmousedriverfactory_qws.cpp
-
-#
-# Graphics drivers
-#
- contains( gfx-drivers, linuxfb ) {
- HEADERS += embedded/qscreenlinuxfb_qws.h
- SOURCES += embedded/qscreenlinuxfb_qws.cpp
- }
-
- contains( gfx-drivers, qnx ) {
- HEADERS += embedded/qscreenqnx_qws.h
- SOURCES += embedded/qscreenqnx_qws.cpp
- LIBS += -lgf
- }
-
- contains( gfx-drivers, integrityfb ) {
- HEADERS += embedded/qscreenintegrityfb_qws.h
- SOURCES += embedded/qscreenintegrityfb_qws.cpp
- LIBS += -lfbdev
- }
-
- contains( gfx-drivers, qvfb ) {
- HEADERS += embedded/qscreenvfb_qws.h
- SOURCES += embedded/qscreenvfb_qws.cpp
- }
-
-
- contains( gfx-drivers, vnc ) {
- VNCDIR = $$QT_SOURCE_TREE/src/plugins/gfxdrivers/vnc
- INCLUDEPATH += $$VNCDIR
- HEADERS += $$VNCDIR/qscreenvnc_qws.h \
- $$VNCDIR/qscreenvnc_p.h
- SOURCES += $$VNCDIR/qscreenvnc_qws.cpp
- }
-
- contains( gfx-drivers, transformed ) {
- HEADERS += embedded/qscreentransformed_qws.h
- SOURCES += embedded/qscreentransformed_qws.cpp
- }
-
- contains( gfx-drivers, directfb ) {
- INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb
- include($$PWD/directfb.pri)
- }
-#
-# Keyboard drivers
-#
- contains( kbd-drivers, qvfb ) {
- HEADERS +=embedded/qkbdvfb_qws.h
- SOURCES +=embedded/qkbdvfb_qws.cpp
- !contains( kbd-drivers, qvfb ) {
- kbd-drivers += qvfb
- }
- }
-
- contains( kbd-drivers, tty ) {
- HEADERS +=embedded/qkbdtty_qws.h
- SOURCES +=embedded/qkbdtty_qws.cpp
- }
-
- contains( kbd-drivers, linuxinput ) {
- HEADERS +=embedded/qkbdlinuxinput_qws.h
- SOURCES +=embedded/qkbdlinuxinput_qws.cpp
- }
-
- contains( kbd-drivers, um ) {
- HEADERS +=embedded/qkbdum_qws.h
- SOURCES +=embedded/qkbdum_qws.cpp
- }
-
- contains( kbd-drivers, qnx ) {
- HEADERS += embedded/qkbdqnx_qws.h
- SOURCES += embedded/qkbdqnx_qws.cpp
- }
-
- contains( kbd-drivers, integrity ) {
- HEADERS += embedded/qkbdintegrity_qws.h
- SOURCES += embedded/qkbdintegrity_qws.cpp
- }
-
-#
-# Mouse drivers
-#
- contains( mouse-drivers, qvfb ) {
- HEADERS +=embedded/qmousevfb_qws.h
- SOURCES +=embedded/qmousevfb_qws.cpp
- }
-
- contains( mouse-drivers, pc ) {
- HEADERS +=embedded/qmousepc_qws.h
- SOURCES +=embedded/qmousepc_qws.cpp
- }
-
- contains( mouse-drivers, linuxtp ) {
- HEADERS +=embedded/qmouselinuxtp_qws.h
- SOURCES +=embedded/qmouselinuxtp_qws.cpp
- }
-
- contains( mouse-drivers, tslib ) {
- LIBS_PRIVATE += -lts
- HEADERS +=embedded/qmousetslib_qws.h
- SOURCES +=embedded/qmousetslib_qws.cpp
- }
-
- contains( mouse-drivers, linuxinput ) {
- HEADERS +=embedded/qmouselinuxinput_qws.h
- SOURCES +=embedded/qmouselinuxinput_qws.cpp
- }
-
- contains( mouse-drivers, qnx ) {
- HEADERS += embedded/qmouseqnx_qws.h
- SOURCES += embedded/qmouseqnx_qws.cpp
- }
-
- contains( mouse-drivers, integrity ) {
- HEADERS += embedded/qmouseintegrity_qws.h
- SOURCES += embedded/qmouseintegrity_qws.cpp
- }
-}
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
deleted file mode 100644
index d429b93f26..0000000000
--- a/src/gui/embedded/qlock.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlock_p.h"
-
-
-#ifdef QT_NO_QWS_MULTIPROCESS
-
-QT_BEGIN_NAMESPACE
-
-/* no multiprocess - use a dummy */
-
-QLock::QLock(const QString & /*filename*/, char /*id*/, bool /*create*/)
- : type(Read), data(0)
-{
-}
-
-QLock::~QLock()
-{
-}
-
-bool QLock::isValid() const
-{
- return true;
-}
-
-void QLock::lock(Type t)
-{
- data = (QLockData *)-1;
- type = t;
-}
-
-void QLock::unlock()
-{
- data = 0;
-}
-
-bool QLock::locked() const
-{
- return data;
-}
-
-QT_END_NAMESPACE
-
-#else // QT_NO_QWS_MULTIPROCESS
-
-#if defined(Q_OS_DARWIN)
-# define Q_NO_SEMAPHORE
-#endif
-
-#include "qwssignalhandler_p.h"
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#if defined(Q_NO_SEMAPHORE)
-# include <sys/stat.h>
-# include <sys/file.h>
-#else
-# include <sys/sem.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include <qdebug.h>
-
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-QT_BEGIN_NAMESPACE
-
-#define MAX_LOCKS 200 // maximum simultaneous read locks
-
-class QLockData
-{
-public:
-#ifdef Q_NO_SEMAPHORE
- QByteArray file;
-#endif // Q_NO_SEMAPHORE
- int id;
- int count;
- bool owned;
-};
-
-/*!
- \class QLock
- \brief The QLock class is a wrapper for a System V shared semaphore.
-
- \ingroup qws
-
- \internal
-
- It is used by \l{Qt for Embedded Linux} for synchronizing access to the graphics
- card and shared memory region between processes.
-*/
-
-/*!
- \enum QLock::Type
-
- \value Read
- \value Write
-*/
-
-/*!
- \fn QLock::QLock(const QString &filename, char id, bool create)
-
- Creates a lock. \a filename is the file path of the Unix-domain
- socket the \l{Qt for Embedded Linux} client is using. \a id is the name of the
- particular lock to be created on that socket. If \a create is true
- the lock is to be created (as the Qt for Embedded Linux server does); if \a
- create is false the lock should exist already (as the Qt for Embedded Linux
- client expects).
-*/
-
-QLock::QLock(const QString &filename, char id, bool create)
-{
- data = new QLockData;
- data->count = 0;
-#ifdef Q_NO_SEMAPHORE
- data->file = QString(filename+id).toLocal8Bit().constData();
- for(int x = 0; x < 2; x++) {
- data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
- if(data->id != -1 || !create) {
- data->owned = x;
- break;
- }
- }
-#else
- key_t semkey = ftok(filename.toLocal8Bit().constData(), id);
- data->id = semget(semkey,0,0);
- data->owned = create;
- if (create) {
- qt_semun arg; arg.val = 0;
- if (data->id != -1)
- semctl(data->id,0,IPC_RMID,arg);
- data->id = semget(semkey,1,IPC_CREAT|0600);
- arg.val = MAX_LOCKS;
- semctl(data->id,0,SETVAL,arg);
-
- QWSSignalHandler::instance()->addSemaphore(data->id);
- }
-#endif
- if (data->id == -1) {
- int eno = errno;
- qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"),
- qPrintable(filename), id);
- qDebug() << "Error" << eno << strerror(eno);
- }
-}
-
-/*!
- \fn QLock::~QLock()
-
- Destroys a lock
-*/
-
-QLock::~QLock()
-{
- if (locked())
- unlock();
-#ifdef Q_NO_SEMAPHORE
- if(isValid()) {
- QT_CLOSE(data->id);
- if(data->owned)
- unlink(data->file);
- }
-#else
- if(data->owned)
- QWSSignalHandler::instance()->removeSemaphore(data->id);
-#endif
- delete data;
-}
-
-/*!
- \fn bool QLock::isValid() const
-
- Returns true if the lock constructor was successful; returns false if
- the lock could not be created or was not available to connect to.
-*/
-
-bool QLock::isValid() const
-{
- return (data->id != -1);
-}
-
-/*!
- Locks the semaphore with a lock of type \a t. Locks can either be
- \c Read or \c Write. If a lock is \c Read, attempts by other
- processes to obtain \c Read locks will succeed, and \c Write
- attempts will block until the lock is unlocked. If locked as \c
- Write, all attempts to lock by other processes will block until
- the lock is unlocked. Locks are stacked: i.e. a given QLock can be
- locked multiple times by the same process without blocking, and
- will only be unlocked after a corresponding number of unlock()
- calls.
-*/
-
-void QLock::lock(Type t)
-{
- if (!data->count) {
-#ifdef Q_NO_SEMAPHORE
- int op = LOCK_SH;
- if(t == Write)
- op = LOCK_EX;
- for(int rv=1; rv;) {
- rv = flock(data->id, op);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- }
-#else
- sembuf sops;
- sops.sem_num = 0;
- sops.sem_flg = SEM_UNDO;
-
- if (t == Write) {
- sops.sem_op = -MAX_LOCKS;
- type = Write;
- } else {
- sops.sem_op = -1;
- type = Read;
- }
-
- int rv;
- do {
- rv = semop(data->id,&sops,1);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- } while (rv == -1 && errno == EINTR);
-#endif
- }
- data->count++;
-}
-
-/*!
- \fn void QLock::unlock()
-
- Unlocks the semaphore. If other processes were blocking waiting to
- lock() the semaphore, one of them will wake up and succeed in
- lock()ing.
-*/
-
-void QLock::unlock()
-{
- if(data->count) {
- data->count--;
- if(!data->count) {
-#ifdef Q_NO_SEMAPHORE
- for(int rv=1; rv;) {
- rv = flock(data->id, LOCK_UN);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop lock failure %s",strerror(errno));
- }
-#else
- sembuf sops;
- sops.sem_num = 0;
- sops.sem_op = 1;
- sops.sem_flg = SEM_UNDO;
- if (type == Write)
- sops.sem_op = MAX_LOCKS;
-
- int rv;
- do {
- rv = semop(data->id,&sops,1);
- if (rv == -1 && errno != EINTR)
- qDebug("Semop unlock failure %s",strerror(errno));
- } while (rv == -1 && errno == EINTR);
-#endif
- }
- } else {
- qDebug("Unlock without corresponding lock");
- }
-}
-
-/*!
- \fn bool QLock::locked() const
-
- Returns true if the lock is currently held by the current process;
- otherwise returns false.
-*/
-
-bool QLock::locked() const
-{
- return (data->count > 0);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
diff --git a/src/gui/embedded/qlock_p.h b/src/gui/embedded/qlock_p.h
deleted file mode 100644
index 34560a012e..0000000000
--- a/src/gui/embedded/qlock_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCK_P_H
-#define QLOCK_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. This header file may
-// change from version to version without notice, or even be
-// removed.
-//
-// We mean it.
-//
-
-#include "QtCore/qstring.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLockData;
-
-class Q_GUI_EXPORT QLock
-{
-public:
- QLock(const QString &filename, char id, bool create = false);
- ~QLock();
-
- enum Type { Read, Write };
-
- bool isValid() const;
- void lock(Type type);
- void unlock();
- bool locked() const;
-
-private:
- Type type;
- QLockData *data;
-};
-
-
-// Nice class for ensuring the lock is released.
-// Just create one on the stack and the lock is automatically released
-// when QLockHandle is destructed.
-class Q_GUI_EXPORT QLockHandle
-{
-public:
- QLockHandle(QLock *l, QLock::Type type) : qlock(l) { qlock->lock(type); }
- ~QLockHandle() { if (locked()) qlock->unlock(); }
-
- void lock(QLock::Type type) { qlock->lock(type); }
- void unlock() { qlock->unlock(); }
- bool locked() const { return qlock->locked(); }
-
-private:
- QLock *qlock;
-};
-
-QT_END_NAMESPACE
-
-#endif // QLOCK_P_H
diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp
deleted file mode 100644
index 03319cbb0a..0000000000
--- a/src/gui/embedded/qunixsocket.cpp
+++ /dev/null
@@ -1,1800 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qunixsocket_p.h"
-
-// #define QUNIXSOCKET_DEBUG 1
-
-#include <QtCore/qsocketnotifier.h>
-#include <QtCore/qqueue.h>
-#include <QtCore/qdatetime.h>
-#include "private/qcore_unix_p.h" // overrides QT_OPEN
-
-#ifdef QUNIXSOCKET_DEBUG
-#include <QtCore/qdebug.h>
-#endif
-
-extern "C" {
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-};
-
-#define UNIX_PATH_MAX 108 // From unix(7)
-
-#ifdef QT_LINUXBASE
-// LSB doesn't declare ucred
-struct ucred
-{
- pid_t pid; /* PID of sending process. */
- uid_t uid; /* UID of sending process. */
- gid_t gid; /* GID of sending process. */
-};
-
-// LSB doesn't define the ones below
-#ifndef SO_PASSCRED
-# define SO_PASSCRED 16
-#endif
-#ifndef SCM_CREDENTIALS
-# define SCM_CREDENTIALS 0x02
-#endif
-#ifndef MSG_DONTWAIT
-# define MSG_DONTWAIT 0x40
-#endif
-#ifndef MSG_NOSIGNAL
-# define MSG_NOSIGNAL 0x4000
-#endif
-
-#endif // QT_LINUXBASE
-
-QT_BEGIN_NAMESPACE
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocketRights
-///////////////////////////////////////////////////////////////////////////////
-/*!
- \class QUnixSocketRights
- \internal
-
- \brief The QUnixSocketRights class encapsulates QUnixSocket rights data.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- \l QUnixSocket allows you to transfer Unix file descriptors between processes.
- A file descriptor is referred to as "rights data" as it allows one process to
- transfer its right to access a resource to another.
-
- The Unix system verifies resource permissions only when the resource is first
- opened. For example, consider a file on disk readable only by the user "qt".
- A process running as user "qt" will be able to open this file for reading.
- If, while the process was still reading from the file, the ownership was
- changed from user "qt" to user "root", the process would be allowed to
- continue reading from the file, even though attempting to reopen the file
- would be denied. Permissions are associated with special descriptors called
- file descriptors which are returned to a process after it initially opens a
- resource.
-
- File descriptors can be duplicated within a process through the dup(2) system
- call. File descriptors can be passed between processes using the
- \l QUnixSocket class in the same way. Even though the receiving process never
- opened the resource directly, it has the same permissions to access it as the
- process that did.
-
- \sa QUnixSocket
- */
-struct QUnixSocketRightsPrivate : public QSharedData
-{
- virtual ~QUnixSocketRightsPrivate() {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- QT_CLOSE(fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocketRightsPrivate: Unable to close managed"
- " file descriptor (" << ::strerror(errno) << ')';
- }
-#endif
- }
-
- int fd;
-};
-
-/*!
- Create a new QUnixSocketRights instance containing the file descriptor \a fd.
- \a fd will be dup(2)'d internally, so the application is free to close \a fd
- following this call.
-
- If the dup(2) fails, or you pass an invalid \a fd, an
- \l {QUnixSocketRights::isValid()}{invalid } object will be
- constructed.
-
- QUnixSocketRights instances are immutable and the internal file descriptor
- will be shared between any copies made of this object. The system will
- close(2) the file descriptor once it is no longer needed.
- */
-QUnixSocketRights::QUnixSocketRights(int fd)
-{
- d = new QUnixSocketRightsPrivate();
- if(-1 == fd) {
- d->fd = -1;
- } else {
- d->fd = qt_safe_dup(fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(-1 == d->fd) {
- qDebug() << "QUnixSocketRights: Unable to duplicate fd "
- << fd << " (" << ::strerror(errno) << ')';
- }
-#endif
- }
-}
-
-/*!
- \internal
-
- Construct a QUnixSocketRights instance on \a fd without dup(2)'ing the file
- descriptor.
- */
-QUnixSocketRights::QUnixSocketRights(int fd,int)
-{
- Q_ASSERT(-1 != fd);
- d = new QUnixSocketRightsPrivate();
- d->fd = fd;
-}
-
-/*!
- Destroys the QUnixSocketRights instance.
- */
-QUnixSocketRights::~QUnixSocketRights()
-{
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketRights &
-QUnixSocketRights::operator=(const QUnixSocketRights & other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketRights::QUnixSocketRights(const QUnixSocketRights & other)
-: d(other.d)
-{
-}
-
-/*!
- Returns true if this QUnixSocketRights instance is managing a valid file
- descriptor. This method is equivalent to (-1 != peekFd()).
-
- \sa QUnixSocketRights::peekFd()
- */
-bool QUnixSocketRights::isValid() const
-{
- return d->fd != -1;
-}
-
-/*!
- Return a duplicate of the file descriptor contained in this object. If this
- is an \l {QUnixSocketRights::isValid()}{invalid } object, or the
- dup(2) call fails, an invalid file descriptor (-1) will be returned.
-
- \sa QUnixSocketRights::peekFd()
- */
-int QUnixSocketRights::dupFd() const
-{
- if(-1 == d->fd) return -1;
-
- int rv = qt_safe_dup(d->fd);
-
-#ifdef QUNIXSOCKET_DEBUG
- if(-1 == rv)
- qDebug() << "QUnixSocketRights: Unable to duplicate managed file "
- "descriptor (" << ::strerror(errno) << ')';
-#endif
-
- return rv;
-}
-
-/*!
- Returns the file descriptor contained in this object. If this
- is an \l {QUnixSocketRights::isValid()}{invalid } object an invalid
- file descriptor (-1) will be returned.
-
- The lifetime of this file descriptor is tied to the lifetime of the
- QUnixSocketRights instance. The file descriptor returned by this method
- \e may be close(2)'d when the QUnixSocketRights instance is destroyed. If
- you want to continue to use the file descriptor use
- \l QUnixSocketRights::dupFd() instead.
-
- \sa QUnixSocketRights::dupFd()
- */
-int QUnixSocketRights::peekFd() const
-{
- return d->fd;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocketMessage
-///////////////////////////////////////////////////////////////////////////////
-struct QUnixSocketMessagePrivate : public QSharedData
-{
- QUnixSocketMessagePrivate()
- : state(Default), vec(0), iovecLen(0), dataSize(0) {}
- QUnixSocketMessagePrivate(const QByteArray & b)
- : bytes(b), state(Default), vec(0), iovecLen(0), dataSize(0) {}
- QUnixSocketMessagePrivate(const QByteArray & b,
- const QList<QUnixSocketRights> & r)
- : bytes(b), rights(r), state(Default), vec(0), iovecLen(0), dataSize(0) {}
-
- int size() const { return vec ? dataSize : bytes.size(); }
- void removeBytes( unsigned int );
-
- QByteArray bytes;
- QList<QUnixSocketRights> rights;
-
- enum AncillaryDataState {
- Default = 0x00,
- Truncated = 0x01,
- Credential = 0x02
- };
- AncillaryDataState state;
-
- pid_t pid;
- gid_t gid;
- uid_t uid;
-
- ::iovec *vec;
- int iovecLen; // number of vectors in array
- int dataSize; // total size of vectors = payload
-};
-
-/*!
- \internal
- Remove \a bytesToDequeue bytes from the front of this message
-*/
-void QUnixSocketMessagePrivate::removeBytes( unsigned int bytesToDequeue )
-{
- if ( vec )
- {
- ::iovec *vecPtr = vec;
- if ( bytesToDequeue > (unsigned int)dataSize ) bytesToDequeue = dataSize;
- while ( bytesToDequeue > 0 && iovecLen > 0 )
- {
- if ( vecPtr->iov_len > bytesToDequeue )
- {
- // dequeue the bytes by taking them off the front of the
- // current vector. since we don't own the iovec, its okay
- // to "leak" this away by pointing past it
- char **base = reinterpret_cast<char**>(&(vecPtr->iov_base));
- *base += bytesToDequeue;
- vecPtr->iov_len -= bytesToDequeue;
- bytesToDequeue = 0;
- }
- else
- {
- // dequeue bytes by skipping a whole vector. again, its ok
- // to lose the pointers to this data
- bytesToDequeue -= vecPtr->iov_len;
- iovecLen--;
- vecPtr++;
- }
- }
- dataSize -= bytesToDequeue;
- if ( iovecLen == 0 ) vec = 0;
- }
- else
- {
- bytes.remove(0, bytesToDequeue );
- }
-}
-
-
-/*!
- \class QUnixSocketMessage
- \internal
-
- \brief The QUnixSocketMessage class encapsulates a message sent or received
- through the QUnixSocket class.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- In addition to transmitting regular byte stream data, messages sent over Unix
- domain sockets may have special ancillary properties. QUnixSocketMessage
- instances allow programmers to retrieve and control these properties.
-
- Every QUnixSocketMessage sent has an associated set of credentials. A
- message's credentials consist of the process id, the user id and the group id
- of the sending process. Normally these credentials are set automatically for
- you by the QUnixSocketMessage class and can be queried by the receiving
- process using the \l QUnixSocketMessage::processId(),
- \l QUnixSocketMessage::userId() and \l QUnixSocketMessage::groupId() methods
- respectively.
-
- Advanced applications may wish to change the credentials that their message
- is sent with, and may do so though the \l QUnixSocketMessage::setProcessId(),
- \l QUnixSocketMessage::setUserId() and \l QUnixSocketMessage::setGroupId()
- methods. The validity of these credentials is verified by the system kernel.
- Only the root user can send messages with credentials that are not his own.
- Sending of the message will fail for any non-root user who attempts to
- fabricate credentials. Note that this failure is enforced by the system
- kernel - receivers can trust the accuracy of credential data!
-
- Unix domain socket messages may also be used to transmit Unix file descriptors
- between processes. In this context, file descriptors are known as rights data
- and are encapsulated by the \l QUnixSocketRights class. Senders can set the
- file descriptors to transmit using the \l QUnixSocketMessage::setRights() and
- receivers can retrieve this data through a call to
- \l QUnixSocketMessage::rights(). \l QUnixSocket and \l QUnixSocketRights
- discuss the specific copy and ordering semantic associated with rights data.
-
- QUnixSocketMessage messages are sent by the \l QUnixSocket::write() method.
- Like any normal network message, attempting to transmit an empty
- QUnixSocketMessage will succeed, but result in a no-op. Limitations in the
- Unix domain protocol semantic will cause a transmission of a
- QUnixSocketMessage with rights data, but no byte data portion, to fail.
-
- \sa QUnixSocket QUnixSocketRights
- */
-
-/*!
- Construct an empty QUnixSocketMessage. This instance will have not data and
- no rights information. The message's credentials will be set to the
- application's default credentials.
- */
-QUnixSocketMessage::QUnixSocketMessage()
-: d(new QUnixSocketMessagePrivate())
-{
-}
-
-/*!
- Construct a QUnixSocketMessage with an initial data payload of \a bytes. The
- message's credentials will be set to the application's default credentials.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes)
-: d(new QUnixSocketMessagePrivate(bytes))
-{
-}
-
-/*!
- Construct a QUnixSocketMessage with an initial data payload of \a bytes and
- an initial rights payload of \a rights. The message's credentials will be set
- to the application's default credentials.
-
- A message with rights data but an empty data payload cannot be transmitted
- by the system.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes,
- const QList<QUnixSocketRights> & rights)
-: d(new QUnixSocketMessagePrivate(bytes, rights))
-{
-}
-
-/*!
- Create a copy of \a other.
- */
-QUnixSocketMessage::QUnixSocketMessage(const QUnixSocketMessage & other)
-: d(other.d)
-{
-}
-
-/*!
- \fn QUnixSocketMessage::QUnixSocketMessage(const iovec* data, int vecLen)
-
- Construct a QUnixSocketMessage with an initial data payload of \a
- data which points to an array of \a vecLen iovec structures. The
- message's credentials will be set to the application's default
- credentials.
-
- This method can be used to avoid the overhead of copying buffers of data
- and will directly send the data pointed to by \a data on the socket. It also
- avoids the syscall overhead of making a number of small socket write calls,
- if a number of data items can be delivered with one write.
-
- Caller must ensure the iovec * \a data remains valid until the message
- is flushed. Caller retains ownership of the iovec structs.
- */
-QUnixSocketMessage::QUnixSocketMessage(const ::iovec* data, int vecLen )
-: d(new QUnixSocketMessagePrivate())
-{
- for ( int v = 0; v < vecLen; v++ )
- d->dataSize += data[v].iov_len;
- d->vec = const_cast<iovec*>(data);
- d->iovecLen = vecLen;
-}
-
-/*!
- Assign the contents of \a other to this object.
- */
-QUnixSocketMessage & QUnixSocketMessage::operator=(const QUnixSocketMessage & other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Destroy this instance.
- */
-QUnixSocketMessage::~QUnixSocketMessage()
-{
-}
-
-/*!
- Set the data portion of the message to \a bytes.
-
- \sa QUnixSocketMessage::bytes()
- */
-void QUnixSocketMessage::setBytes(const QByteArray & bytes)
-{
- d.detach();
- d->bytes = bytes;
-}
-
-/*!
- Set the rights portion of the message to \a rights.
-
- A message with rights data but an empty byte data payload cannot be
- transmitted by the system.
-
- \sa QUnixSocketMessage::rights()
- */
-void QUnixSocketMessage::setRights(const QList<QUnixSocketRights> & rights)
-{
- d.detach();
- d->rights = rights;
-}
-
-/*!
- Return the rights portion of the message.
-
- \sa QUnixSocketMessage::setRights()
- */
-const QList<QUnixSocketRights> & QUnixSocketMessage::rights() const
-{
- return d->rights;
-}
-
-/*!
- Returns true if the rights portion of the message was truncated on reception
- due to insufficient buffer size. The rights buffer size can be adjusted
- through calls to the \l QUnixSocket::setRightsBufferSize() method.
- \l QUnixSocket contains a discussion of the buffering and truncation
- characteristics of the Unix domain protocol.
-
- \sa QUnixSocket QUnixSocket::setRightsBufferSize()
- */
-bool QUnixSocketMessage::rightsWereTruncated() const
-{
- return d->state & QUnixSocketMessagePrivate::Truncated;
-}
-
-/*!
- Return the data portion of the message.
-
- \sa QUnixSocketMessage::setBytes()
- */
-const QByteArray & QUnixSocketMessage::bytes() const
-{
- return d->bytes;
-}
-
-/*!
- Returns the process id credential associated with this message.
-
- \sa QUnixSocketMessage::setProcessId()
- */
-pid_t QUnixSocketMessage::processId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->pid;
- else
- return ::getpid();
-}
-
-/*!
- Returns the user id credential associated with this message.
-
- \sa QUnixSocketMessage::setUserId()
- */
-uid_t QUnixSocketMessage::userId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->uid;
- else
- return ::geteuid();
-}
-
-/*!
- Returns the group id credential associated with this message.
-
- \sa QUnixSocketMessage::setGroupId()
- */
-gid_t QUnixSocketMessage::groupId() const
-{
- if(QUnixSocketMessagePrivate::Credential & d->state)
- return d->gid;
- else
- return ::getegid();
-}
-
-/*!
- Set the process id credential associated with this message to \a pid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::processId()
- */
-void QUnixSocketMessage::setProcessId(pid_t pid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->uid = ::geteuid();
- d->gid = ::getegid();
- }
- d->pid = pid;
-}
-
-/*!
- Set the user id credential associated with this message to \a uid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::userId()
- */
-void QUnixSocketMessage::setUserId(uid_t uid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->pid = ::getpid();
- d->gid = ::getegid();
- }
- d->uid = uid;
-}
-
-/*!
- Set the group id credential associated with this message to \a gid. Unless
- you are the root user, setting a fraudulant credential will cause this message
- to fail.
-
- \sa QUnixSocketMessage::groupId()
- */
-void QUnixSocketMessage::setGroupId(gid_t gid)
-{
- if(!(d->state & QUnixSocketMessagePrivate::Credential)) {
- d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential );
- d->pid = ::getpid();
- d->uid = ::geteuid();
- }
- d->gid = gid;
-}
-
-/*!
- Return true if this message is valid. A message with rights data but an empty
- byte data payload cannot be transmitted by the system and is marked as
- invalid.
- */
-bool QUnixSocketMessage::isValid() const
-{
- return d->rights.isEmpty() || !d->bytes.isEmpty();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// class QUnixSocket
-///////////////////////////////////////////////////////////////////////////////
-#define QUNIXSOCKET_DEFAULT_READBUFFER 1024
-#define QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER 0
-
-/*!
- \class QUnixSocket
- \internal
-
- \brief The QUnixSocket class provides a Unix domain socket.
-
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- Unix domain sockets provide an efficient mechanism for communications between
- Unix processes on the same machine. Unix domain sockets support a reliable,
- stream-oriented, connection-oriented transport protocol, much like TCP
- sockets. Unlike IP based sockets, the connection endpoint of a Unix domain
- socket is a file on disk of type socket.
-
- In addition to transporting raw data bytes, Unix domain sockets are able to
- transmit special ancillary data. The two types of ancillary data supported
- by the QUnixSocket class are:
-
- \list
- \o Credential Data - Allows a receiver
- to reliably identify the process sending each message.
- \o \l {QUnixSocketRights}{Rights Data } - Allows Unix file descriptors
- to be transmitted between processes.
- \endlist
-
- Because of the need to support ancillary data, QUnixSocket is not a QIODevice,
- like QTcpSocket and QUdpSocket. Instead, QUnixSocket contains a number of
- read and write methods that clients must invoke directly. Rather than
- returning raw data bytes, \l QUnixSocket::read() returns \l QUnixSocketMessage
- instances that encapsulate the message's byte data and any other ancillary
- data.
-
- Ancillary data is transmitted "out of band". Every \l QUnixSocketMessage
- received will have credential data associated with it that the client can
- access through calls to \l QUnixSocketMessage::processId(),
- \l QUnixSocketMessage::groupId() and \l QUnixSocketMessage::userId().
- Likewise, message creators can set the credential data to send through calls
- to \l QUnixSocketMessage::setProcessId(), \l QUnixSocketMessage::setGroupId()
- and \l QUnixSocketMessage::setUserId() respectively. The authenticity of the
- credential values is verified by the system kernel and cannot be fabricated
- by unprivileged processes. Only processes running as the root user can
- specify credential data that does not match the sending process.
-
- Unix file descriptors, known as "rights data", transmitted between processes
- appear as though they had been dup(2)'d between the two. As Unix
- domain sockets present a continuous stream of bytes to the receiver, the
- rights data - which is transmitted out of band - must be "slotted" in at some
- point. The rights data is logically associated with the first byte - called
- the anchor byte - of the \l QUnixSocketMessage to which they are attached.
- Received rights data will be available from the
- \l QUnixSocketMessage::rights() method for the \l QUnixSocketMessage
- instance that contains the anchor byte.
-
- In addition to a \l QUnixSocket::write() that takes a \l QUnixSocketMessage
- instance - allowing a client to transmit both byte and rights data - a
- number of convenience overloads are provided for use when only transmitting
- simple byte data. Unix requires that at least one byte of raw data be
- transmitted in order to send rights data. A \l QUnixSocketMessage instance
- with rights data, but no byte data, cannot be transmitted.
-
- Unix sockets present a stream interface, such that, for example, a single
- six byte transmission might be received as two three byte messages. Rights
- data, on the other hand, is conceptually transmitted as unfragmentable
- datagrams. If the receiving buffer is not large enough to contain all the
- transmitted rights information, the data is truncated and irretreivably lost.
- Users should use the \l QUnixSocket::setRightsBufferSize() method to control
- the buffer size used for this data, and develop protocols that avoid the
- problem. If the buffer size is too small and rights data is truncated,
- the \l QUnixSocketMessage::rightsWereTruncated() flag will be set.
-
- \sa QUnixSocketMessage QUnixSocketRights
-*/
-
-/*!
- \enum QUnixSocket::SocketError
-
- The SocketError enumeration represents the various errors that can occur on
- a Unix domain socket. The most recent error for the socket is available
- through the \l QUnixSocket::error() method.
-
- \value NoError No error has occurred.
- \value InvalidPath An invalid path endpoint was passed to
- \l QUnixSocket::connect(). As defined by unix(7), invalid paths
- include an empty path, or what more than 107 characters long.
- \value ResourceError An error acquiring or manipulating the system's socket
- resources occurred. For example, if the process runs out of available
- socket descriptors, a ResourceError will occur.
- \value NonexistentPath The endpoing passed to \l QUnixSocket::connect() does
- not refer to a Unix domain socket entity on disk.
- \value ConnectionRefused The connection to the specified endpoint was refused.
- Generally this means that there is no server listening on that
- endpoint.
- \value UnknownError An unknown error has occurred.
- \value ReadFailure An error occurred while reading bytes from the connection.
- \value WriteFailure An error occurred while writing bytes into the connection.
- */
-
-/*!
- \enum QUnixSocket::SocketState
-
- The SocketState enumeration represents the connection state of a QUnixSocket
- instance.
-
- \value UnconnectedState The connection is not established.
- \value ConnectedState The connection is established.
- \value ClosingState The connection is being closed, following a call to
- \l QUnixSocket::close(). While closing, any pending data will be
- transmitted, but further writes by the application will be refused.
- */
-
-/*
- \fn QUnixSocket::bytesWritten(qint64 bytes)
-
- This signal is emitted every time a payload of data has been written to the
- connection. The \a bytes argument is set to the number of bytes that were
- written in this payload.
-
- \sa QUnixSocket::readyRead()
-*/
-
-/*
- \fn QUnixSocket::readyRead()
-
- This signal is emitted once every time new data is available for reading from
- the connection. It will only be emitted again once new data is available.
-
- \sa QUnixSocket::bytesWritten()
-*/
-
-/*!
- \fn QUnixSocket::stateChanged(SocketState socketState)
-
- This signal is emitted each time the socket changes connection state.
- \a socketState will be set to the socket's new state.
-*/
-
-class QUnixSocketPrivate : public QObject {
-Q_OBJECT
-public:
- QUnixSocketPrivate(QUnixSocket * _me)
- : me(_me), fd(-1), readNotifier(0), writeNotifier(0),
- state(QUnixSocket::UnconnectedState), error(QUnixSocket::NoError),
- writeQueueBytes(0), messageValid(false), dataBuffer(0),
- dataBufferLength(0), dataBufferCapacity(0), ancillaryBuffer(0),
- ancillaryBufferCount(0), closingTimer(0) {
- QObject::connect(this, SIGNAL(readyRead()), me, SIGNAL(readyRead()));
- QObject::connect(this, SIGNAL(bytesWritten(qint64)),
- me, SIGNAL(bytesWritten(qint64)));
- }
- ~QUnixSocketPrivate()
- {
- if(dataBuffer)
- delete [] dataBuffer;
- if(ancillaryBuffer)
- delete [] ancillaryBuffer;
- }
-
- enum { CausedAbort = 0x70000000 };
-
- QUnixSocket * me;
-
- int fd;
-
- QSocketNotifier * readNotifier;
- QSocketNotifier * writeNotifier;
-
- QUnixSocket::SocketState state;
- QUnixSocket::SocketError error;
-
- QQueue<QUnixSocketMessage> writeQueue;
- unsigned int writeQueueBytes;
-
- bool messageValid;
- ::msghdr message;
- inline void flushAncillary()
- {
- if(!messageValid) return;
- ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(message));
- while(h) {
-
- if(SCM_RIGHTS == h->cmsg_type) {
- int * fds = (int *)CMSG_DATA(h);
- int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
- for(int ii = 0; ii < numFds; ++ii)
- QT_CLOSE(fds[ii]);
- }
-
- h = (::cmsghdr *)CMSG_NXTHDR(&(message), h);
- }
-
- messageValid = false;
- }
-
-
- char * dataBuffer;
- unsigned int dataBufferLength;
- unsigned int dataBufferCapacity;
-
- char * ancillaryBuffer;
- inline unsigned int ancillaryBufferCapacity()
- {
- return CMSG_SPACE(sizeof(::ucred)) + CMSG_SPACE(sizeof(int) * ancillaryBufferCount);
- }
- unsigned int ancillaryBufferCount;
-
- QByteArray address;
-
- int closingTimer;
-
- virtual void timerEvent(QTimerEvent *)
- {
- me->abort();
- killTimer(closingTimer);
- closingTimer = 0;
- }
-signals:
- void readyRead();
- void bytesWritten(qint64);
-
-public slots:
- void readActivated();
- qint64 writeActivated();
-};
-
-/*!
- Construct a QUnixSocket instance, with \a parent.
-
- The read buffer is initially set to 1024 bytes, and the rights buffer to 0
- entries.
-
- \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize()
- */
-QUnixSocket::QUnixSocket(QObject * parent)
-: QIODevice(parent), d(new QUnixSocketPrivate(this))
-{
- setOpenMode(QIODevice::NotOpen);
- setReadBufferSize(QUNIXSOCKET_DEFAULT_READBUFFER);
- setRightsBufferSize(QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER);
-}
-
-/*!
- Construct a QUnixSocket instance, with \a parent.
-
- The read buffer is initially set to \a readBufferSize bytes, and the rights
- buffer to \a rightsBufferSize entries.
-
- \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize()
- */
-QUnixSocket::QUnixSocket(qint64 readBufferSize, qint64 rightsBufferSize,
- QObject * parent)
-: QIODevice(parent), d(new QUnixSocketPrivate(this))
-{
- Q_ASSERT(readBufferSize > 0 && rightsBufferSize >= 0);
-
- setOpenMode(QIODevice::NotOpen);
- setReadBufferSize(readBufferSize);
- setRightsBufferSize(rightsBufferSize);
-}
-
-/*!
- Destroys the QUnixSocket instance. Any unsent data is discarded.
- */
-QUnixSocket::~QUnixSocket()
-{
- abort();
- delete d;
-}
-
-/*!
- Attempt to connect to \a path.
-
- This method is synchronous and will return true if the connection succeeds and
- false otherwise. In the case of failure, \l QUnixSocket::error() will be set
- accordingly.
-
- Any existing connection will be aborted, and all pending data will be
- discarded.
-
- \sa QUnixSocket::close() QUnixSocket::abort() QUnixSocket::error()
- */
-bool QUnixSocket::connect(const QByteArray & path)
-{
- int _true;
- int crv;
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Connect requested to '"
- << path << '\'';
-#endif
-
- abort(); // Reset any existing connection
-
- if(UnconnectedState != d->state) // abort() caused a signal and someone messed
- // with us. We'll assume they know what
- // they're doing and bail. Alternative is to
- // have a special "Connecting" state
- return false;
-
-
- if(path.isEmpty() || path.size() > UNIX_PATH_MAX) {
- d->error = InvalidPath;
- return false;
- }
-
- // Create the socket
- d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0);
- if(-1 == d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to create socket ("
- << strerror(errno) << ')';
-#endif
- d->error = ResourceError;
- goto connect_error;
- }
-
- // Set socket options
- _true = 1;
- crv = ::setsockopt(d->fd, SOL_SOCKET, SO_PASSCRED, (void *)&_true,
- sizeof(int));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to configure socket ("
- << ::strerror(errno) << ')';
-#endif
- d->error = ResourceError;
-
- goto connect_error;
- }
-
- // Construct our unix address
- struct ::sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- ::memcpy(addr.sun_path, path.data(), path.size());
- if(path.size() < UNIX_PATH_MAX)
- addr.sun_path[path.size()] = '\0';
-
- // Attempt the connect
- crv = ::connect(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to connect ("
- << ::strerror(errno) << ')';
-#endif
- if(ECONNREFUSED == errno)
- d->error = ConnectionRefused;
- else if(ENOENT == errno)
- d->error = NonexistentPath;
- else
- d->error = UnknownError;
-
- goto connect_error;
- }
-
- // We're connected!
- d->address = path;
- d->state = ConnectedState;
- d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d);
- QObject::connect(d->readNotifier, SIGNAL(activated(int)),
- d, SLOT(readActivated()));
- QObject::connect(d->writeNotifier, SIGNAL(activated(int)),
- d, SLOT(writeActivated()));
- d->readNotifier->setEnabled(true);
- d->writeNotifier->setEnabled(false);
- setOpenMode(QIODevice::ReadWrite);
- emit stateChanged(ConnectedState);
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Connected to " << path;
-#endif
- return true;
-
-connect_error: // Cleanup failed connection
- if(-1 != d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- QT_CLOSE(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocket: Unable to close file descriptor after "
- "failed connect (" << ::strerror(errno) << ')';
- }
-#endif
- }
- d->fd = -1;
- return false;
-}
-
-/*!
- Sets the socket descriptor to use to \a socketDescriptor, bypassing
- QUnixSocket's connection infrastructure, and return true on success and false
- on failure. \a socketDescriptor must be in the connected state, and must be
- a Unix domain socket descriptor. Following a successful call to this method,
- the QUnixSocket instance will be in the Connected state and will have assumed
- ownership of \a socketDescriptor.
-
- Any existing connection will be aborted, and all pending data will be
- discarded.
-
- \sa QUnixSocket::connect()
-*/
-bool QUnixSocket::setSocketDescriptor(int socketDescriptor)
-{
- abort();
-
- if(UnconnectedState != state()) // See QUnixSocket::connect()
- return false;
-
- // Attempt to set the socket options
- if(-1 == socketDescriptor) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: User provided socket is invalid";
-#endif
- d->error = ResourceError;
- return false;
- }
-
- // Set socket options
- int _true = 1;
- int crv = ::setsockopt(socketDescriptor, SOL_SOCKET,
- SO_PASSCRED, (void *)&_true, sizeof(int));
- if(-1 == crv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to configure client provided socket ("
- << ::strerror(errno) << ')';
-#endif
- d->error = ResourceError;
-
- return false;
- }
-
- d->fd = socketDescriptor;
- d->state = ConnectedState;
- d->address = QByteArray();
- setOpenMode(QIODevice::ReadWrite);
- d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d);
- QObject::connect(d->readNotifier, SIGNAL(activated(int)),
- d, SLOT(readActivated()));
- QObject::connect(d->writeNotifier, SIGNAL(activated(int)),
- d, SLOT(writeActivated()));
- d->readNotifier->setEnabled(true);
- d->writeNotifier->setEnabled(false);
- emit stateChanged(d->state);
-
- return true;
-}
-
-/*!
- Returns the socket descriptor currently in use. This method will return -1
- if the QUnixSocket instance is in the UnconnectedState \l {QUnixSocket::state()}{state. }
-
- \sa QUnixSocket::setSocketDescriptor()
- */
-int QUnixSocket::socketDescriptor() const
-{
- return d->fd;
-}
-
-/*!
- Abort the connection. This will immediately disconnect (if connected) and
- discard any pending data. Following a call to QUnixSocket::abort() the
- object will always be in the disconnected \link QUnixSocket::state() state.
- \endlink
-
- \sa QUnixSocket::close()
-*/
-void QUnixSocket::abort()
-{
- setOpenMode(QIODevice::NotOpen);
-
- // We want to be able to use QUnixSocket::abort() to cleanup our state but
- // also preserve the error message that caused the abort. It is not
- // possible to reorder code to do this:
- // abort();
- // d->error = SomeError
- // as QUnixSocket::abort() might emit a signal and we need the error to be
- // set within that signal. So, if we want an error message to be preserved
- // across a *single* call to abort(), we set the
- // QUnixSocketPrivate::CausedAbort flag in the error.
- if(d->error & QUnixSocketPrivate::CausedAbort)
- d->error = (QUnixSocket::SocketError)(d->error &
- ~QUnixSocketPrivate::CausedAbort);
- else
- d->error = NoError;
-
- if( UnconnectedState == d->state) return;
-
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- ::close(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocket: Unable to close socket during abort ("
- << strerror(errno) << ')';
- }
-#endif
-
- // Reset variables
- d->fd = -1;
- d->state = UnconnectedState;
- d->dataBufferLength = 0;
- d->flushAncillary();
- d->address = QByteArray();
- if(d->readNotifier) {
- d->readNotifier->setEnabled(false);
- d->readNotifier->deleteLater();
- }
- if(d->writeNotifier) {
- d->writeNotifier->setEnabled(false);
- d->writeNotifier->deleteLater();
- }
- d->readNotifier = 0;
- d->writeNotifier = 0;
- d->writeQueue.clear();
- d->writeQueueBytes = 0;
- if(d->closingTimer) {
- d->killTimer(d->closingTimer);
- }
- d->closingTimer = 0;
- emit stateChanged(d->state);
-}
-
-/*!
- Close the connection. The instance will enter the Closing
- \l {QUnixSocket::state()}{state } until all pending data has been
- transmitted, at which point it will enter the Unconnected state.
-
- Even if there is no pending data for transmission, the object will never
- jump directly to Disconnect without first passing through the
- Closing state.
-
- \sa QUnixSocket::abort()
- */
-void QUnixSocket::close()
-{
- if(ConnectedState != state()) return;
-
- d->state = ClosingState;
- if(d->writeQueue.isEmpty()) {
- d->closingTimer = d->startTimer(0); // Start a timer to "fake"
- // completing writes
- }
- emit stateChanged(d->state);
-}
-
-/*!
- This function writes as much as possible from the internal write buffer to
- the underlying socket, without blocking. If any data was written, this
- function returns true; otherwise false is returned.
-*/
-// Note! docs partially copied from QAbstractSocket::flush()
-bool QUnixSocket::flush()
-{
- // This needs to have the same semantics as QAbstractSocket, if it is to
- // be used interchangeably with that class.
- if (d->writeQueue.isEmpty())
- return false;
-
- d->writeActivated();
- return true;
-}
-
-/*!
- Returns the last error to have occurred on this object. This method is not
- destructive, so multiple calls to QUnixSocket::error() will return the same
- value. The error is only reset by a call to \l QUnixSocket::connect() or
- \l QUnixSocket::abort()
- */
-QUnixSocket::SocketError QUnixSocket::error() const
-{
- return (QUnixSocket::SocketError)
- (d->error & ~QUnixSocketPrivate::CausedAbort);
-}
-
-/*!
- Returns the connection state of this instance.
- */
-QUnixSocket::SocketState QUnixSocket::state() const
-{
- return d->state;
-}
-
-/*!
- Returns the Unix path address passed to \l QUnixSocket::connect(). This
- method will return an empty path if the object is in the Unconnected
- \l {QUnixSocket::state()}{state } or was connected through a call
- to \l QUnixSocket::setSocketDescriptor()
-
- \sa QUnixSocket::connect() QUnixSocket::setSocketDescriptor()
- */
-QByteArray QUnixSocket::address() const
-{
- return d->address;
-}
-
-/*!
- Returns the number of bytes available for immediate retrieval through a call
- to \l QUnixSocket::read().
- */
-qint64 QUnixSocket::bytesAvailable() const
-{
- return QIODevice::bytesAvailable() + d->dataBufferLength;
-}
-
-/*!
- Returns the number of enqueued bytes still to be written to the socket.
- */
-qint64 QUnixSocket::bytesToWrite() const
-{
- return d->writeQueueBytes;
-}
-
-/*!
- Returns the size of the read buffer in bytes. The read buffer size
- determines the amount of byte data that can be read from the socket in one go.
- The read buffer size caps the maximum value that can be returned by
- \l QUnixSocket::bytesAvailable() and will always be greater than zero. By
- default, the read buffer size is 1024 bytes.
-
- The size of the read buffer is independent of the rights buffer, which can be
- queried by \l QUnixSocket::rightsBufferSize().
-
- \sa QUnixSocket::setReadBufferSize()
- */
-qint64 QUnixSocket::readBufferSize() const
-{
- return d->dataBufferCapacity;
-}
-
-/*!
- Sets the \a size of the socket's read buffer in bytes.
-
- The size of the read buffer is independent of the rights buffer, which can be
- set by \l QUnixSocket::setRightsBufferSize().
-
- Attempting to reduce the buffer size while bytes are available for reading
- (ie. while the buffer is in use) will fail.
-
- \sa QUnixSocket::readBufferSize()
- */
-void QUnixSocket::setReadBufferSize(qint64 size)
-{
- Q_ASSERT(size > 0);
- if(size == d->dataBufferCapacity || d->dataBufferLength) return;
- if(d->dataBuffer) delete [] d->dataBuffer;
- d->dataBuffer = new char[size];
- d->dataBufferCapacity = size;
-}
-
-/*!
- Returns the size of the rights buffer in rights entries. The rights buffer
- size determines the number of rights transferences that can be received in
- any message. Unlike byte stream data which can be fragmented into many
- smaller messages if the \link QUnixSocket::readBufferSize() read buffer
- \endlink is not large enough to contain all the available data, rights data
- is transmitted as unfragmentable datagrams. If the rights buffer is not
- large enough to contain this unfragmentable datagram, the datagram will be
- truncated and rights data irretrievably lost. If truncation occurs, the
- \l QUnixSocketMessage::rightsWereTruncated() flag will be set. By default
- the rights buffer size is 0 entries - rights data cannot be received.
-
- The size of the rights buffer is independent of the read buffer, which can be
- queried by \l QUnixSocket::readBufferSize().
-
- \sa QUnixSocket::setRightsBufferSize()
- */
-qint64 QUnixSocket::rightsBufferSize() const
-{
- return d->ancillaryBufferCount;
-}
-
-/*!
- Sets the \a size of the socket's rights buffer in rights entries.
-
- The size of the rights buffer is independent of the read buffer, which can be
- set by \l QUnixSocket::setReadBufferSize().
-
- Attempting to reduce the buffer size while bytes are available for reading
- (ie. while the buffer is in use) will fail.
-
- \sa QUnixSocket::rightsBufferSize()
- */
-void QUnixSocket::setRightsBufferSize(qint64 size)
-{
- Q_ASSERT(size >= 0);
-
- if((size == d->ancillaryBufferCount || d->dataBufferLength) &&
- d->ancillaryBuffer)
- return;
-
- qint64 byteSize = CMSG_SPACE(sizeof(::ucred)) +
- CMSG_SPACE(size * sizeof(int));
-
- if(d->ancillaryBuffer) delete [] d->ancillaryBuffer;
- d->ancillaryBuffer = new char[byteSize];
- d->ancillaryBufferCount = size;
-}
-
-/*!
- \overload
-
- Writes \a socketdata to the socket. In addition to failing if the socket
- is not in the Connected state, writing will fail if \a socketdata is
- \l {QUnixSocketMessage::isValid()}{invalid. }
-
- Writes through the QUnixSocket class are asynchronous. Rather than being
- written immediately, data is enqueued and written once the application
- reenters the Qt event loop and the socket becomes available for writing.
- Thus, this method will only fail if the socket is not in the Connected state
- - it is illegal to attempt a write on a Unconnected or Closing socket.
-
- Applications can monitor the progress of data writes through the
- \l QUnixSocket::bytesWritten() signal and \l QUnixSocket::bytesToWrite()
- method.
-
- \sa QUnixSocketMessage
- */
-qint64 QUnixSocket::write(const QUnixSocketMessage & socketdata)
-{
- if(ConnectedState != state() || !socketdata.isValid()) return -1;
- if(socketdata.d->size() == 0) return 0;
-
- d->writeQueue.enqueue(socketdata);
- d->writeQueueBytes += socketdata.d->size();
- d->writeNotifier->setEnabled(true);
-
- return socketdata.d->size();
-}
-
-/*!
- Return the next available message, or an empty message if none is available.
-
- To avoid retrieving empty messages, applications should connect to the
- \l QUnixSocket::readyRead() signal to be notified when new messages are
- available or periodically poll the \l QUnixSocket::bytesAvailable() method.
-
- \sa QUnixSocket::readyRead() QUnixSocket::bytesAvailable()
- */
-QUnixSocketMessage QUnixSocket::read()
-{
- QUnixSocketMessage data;
- if(!d->dataBufferLength)
- return data;
-
- data.d->state = QUnixSocketMessagePrivate::Credential;
-
- // Bytes are easy
- data.setBytes(QByteArray(d->dataBuffer, d->dataBufferLength));
-
- // Extract ancillary data
- QList<QUnixSocketRights> a;
-
- ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(d->message));
- while(h) {
-
- if(SCM_CREDENTIALS == h->cmsg_type) {
- ::ucred * cred = (::ucred *)CMSG_DATA(h);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug( "Credentials recd: pid %lu - gid %lu - uid %lu",
- cred->pid, cred->gid, cred->uid );
-#endif
- data.d->pid = cred->pid;
- data.d->gid = cred->gid;
- data.d->uid = cred->uid;
-
- } else if(SCM_RIGHTS == h->cmsg_type) {
-
- int * fds = (int *)CMSG_DATA(h);
- int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
-
- for(int ii = 0; ii < numFds; ++ii) {
- QUnixSocketRights qusr(fds[ii], 0);
- a.append(qusr);
- }
-
- } else {
-
-#ifdef QUNIXSOCKET_DEBUG
- qFatal("QUnixSocket: Unknown ancillary data type (%d) received.",
- h->cmsg_type);
-#endif
-
- }
-
- h = (::cmsghdr *)CMSG_NXTHDR(&(d->message), h);
- }
-
- if(d->message.msg_flags & MSG_CTRUNC) {
- data.d->state = (QUnixSocketMessagePrivate::AncillaryDataState)(QUnixSocketMessagePrivate::Truncated |
- QUnixSocketMessagePrivate::Credential );
- }
-
- if(!a.isEmpty())
- data.d->rights = a;
-
- d->dataBufferLength = 0;
- d->messageValid = false;
- d->readNotifier->setEnabled(true);
-
- return data;
-}
-
-/*! \internal */
-bool QUnixSocket::isSequential() const
-{
- return true;
-}
-
-/*! \internal */
-bool QUnixSocket::waitForReadyRead(int msecs)
-{
- if(UnconnectedState == d->state)
- return false;
-
- if(d->messageValid) {
- return true;
- }
-
- Q_ASSERT(-1 != d->fd);
-
- int timeout = msecs;
- struct timeval tv;
- struct timeval *ptrTv = 0;
- QTime stopWatch;
-
- stopWatch.start();
-
- do
- {
- fd_set readset;
-
- FD_ZERO(&readset);
- FD_SET(d->fd, &readset);
-
- if(-1 != msecs) {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- ptrTv = &tv;
- }
-
- int rv = ::select(d->fd + 1, &readset, 0, 0, ptrTv);
- switch(rv) {
- case 0:
- // timeout
- return false;
- case 1:
- // ok
- d->readActivated();
- return true;
- default:
- if (errno != EINTR)
- abort(); // error
- break;
- }
-
- timeout = msecs - stopWatch.elapsed();
- }
- while (timeout > 0);
-
- return false;
-}
-
-bool QUnixSocket::waitForBytesWritten(int msecs)
-{
- if(UnconnectedState == d->state)
- return false;
-
- Q_ASSERT(-1 != d->fd);
-
- if ( d->writeQueue.isEmpty() )
- return true;
-
- QTime stopWatch;
- stopWatch.start();
-
- while ( true )
- {
- fd_set fdwrite;
- FD_ZERO(&fdwrite);
- FD_SET(d->fd, &fdwrite);
- int timeout = msecs < 0 ? 0 : msecs - stopWatch.elapsed();
- struct timeval tv;
- struct timeval *ptrTv = 0;
- if ( -1 != msecs )
- {
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout % 1000) * 1000;
- ptrTv = &tv;
- }
-
- int rv = ::select(d->fd + 1, 0, &fdwrite, 0, ptrTv);
- switch ( rv )
- {
- case 0:
- // timeout
- return false;
- case 1:
- {
- // ok to write
- qint64 bytesWritten = d->writeActivated();
- if (bytesWritten == 0) {
- // We need to retry
- int delay = 1;
- do {
- if (-1 != msecs) {
- timeout = msecs - stopWatch.elapsed();
- if (timeout <= 0) {
- // We have exceeded our allotted time
- return false;
- } else {
- if (delay > timeout)
- delay = timeout;
- }
- }
-
- // Pause before we make another attempt to send
- ::usleep(delay * 1000);
- if (delay < 1024)
- delay *= 2;
-
- bytesWritten = d->writeActivated();
- } while (bytesWritten == 0);
- }
- return (bytesWritten != -1);
- }
- default:
- // error - or an uncaught signal!!!!!!!!!
- if ( rv == EINTR )
- continue;
- abort();
- return false;
- }
- }
- return false; // fix warnings
-}
-
-/*! \internal */
-bool QUnixSocket::canReadLine() const
-{
- for(unsigned int ii = 0; ii < d->dataBufferLength; ++ii)
- if(d->dataBuffer[ii] == '\n') return true;
- return false;
-}
-
-/*! \internal */
-qint64 QUnixSocket::readData(char * data, qint64 maxSize)
-{
- Q_ASSERT(data);
- if(0 >= maxSize) return 0;
- if(!d->dataBufferLength) return 0;
-
- // Read data
- unsigned int size = d->dataBufferLength>maxSize?maxSize:d->dataBufferLength;
- memcpy(data, d->dataBuffer, size);
- if(size == d->dataBufferLength) {
- d->dataBufferLength = 0;
- } else {
- memmove(d->dataBuffer, d->dataBuffer + size, d->dataBufferLength - size);
- d->dataBufferLength -= size;
- }
-
-
- // Flush ancillary
- d->flushAncillary();
-
- if(0 == d->dataBufferLength)
- d->readNotifier->setEnabled(true);
-
- return size;
-}
-
-/*! \internal */
-qint64 QUnixSocket::writeData (const char * data, qint64 maxSize)
-{
- return write(QUnixSocketMessage(QByteArray(data, maxSize)));
-}
-
-qint64 QUnixSocketPrivate::writeActivated()
-{
- writeNotifier->setEnabled(false);
-
- QUnixSocketMessage & m = writeQueue.head();
- const QList<QUnixSocketRights> & a = m.rights();
-
- //
- // Construct the message
- //
- ::iovec vec;
- if ( !m.d->vec ) // message does not already have an iovec
- {
- vec.iov_base = (void *)m.bytes().constData();
- vec.iov_len = m.bytes().size();
- }
-
- // Allocate the control buffer
- ::msghdr sendmessage;
- ::bzero(&sendmessage, sizeof(::msghdr));
- if ( m.d->vec )
- {
- sendmessage.msg_iov = m.d->vec;
- sendmessage.msg_iovlen = m.d->iovecLen;
- }
- else
- {
- sendmessage.msg_iov = &vec;
- sendmessage.msg_iovlen = 1;
- }
- unsigned int required = CMSG_SPACE(sizeof(::ucred)) +
- a.size() * CMSG_SPACE(sizeof(int));
- sendmessage.msg_control = new char[required];
- ::bzero(sendmessage.msg_control, required);
- sendmessage.msg_controllen = required;
-
- // Create ancillary buffer
- ::cmsghdr * h = CMSG_FIRSTHDR(&sendmessage);
-
- if(m.d->state & QUnixSocketMessagePrivate::Credential) {
- h->cmsg_len = CMSG_LEN(sizeof(::ucred));
- h->cmsg_level = SOL_SOCKET;
- h->cmsg_type = SCM_CREDENTIALS;
- ((::ucred *)CMSG_DATA(h))->pid = m.d->pid;
- ((::ucred *)CMSG_DATA(h))->gid = m.d->gid;
- ((::ucred *)CMSG_DATA(h))->uid = m.d->uid;
- h = CMSG_NXTHDR(&sendmessage, h);
- } else {
- sendmessage.msg_controllen -= CMSG_SPACE(sizeof(::ucred));
- }
-
- for(int ii = 0; ii < a.count(); ++ii) {
- const QUnixSocketRights & r = a.at(ii);
-
- if(r.isValid()) {
- h->cmsg_len = CMSG_LEN(sizeof(int));
- h->cmsg_level = SOL_SOCKET;
- h->cmsg_type = SCM_RIGHTS;
- *((int *)CMSG_DATA(h)) = r.peekFd();
- h = CMSG_NXTHDR(&sendmessage, h);
- } else {
- sendmessage.msg_controllen -= CMSG_SPACE(sizeof(int));
- }
- }
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Transmitting message (length" << m.d->size() << ')';
-#endif
- ::ssize_t s = ::sendmsg(fd, &sendmessage, MSG_DONTWAIT | MSG_NOSIGNAL);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Transmitted message (" << s << ')';
-#endif
-
- if(-1 == s) {
- if(EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno) {
- writeNotifier->setEnabled(true);
- } else if(EPIPE == errno) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Remote side disconnected during transmit "
- "(" << ::strerror(errno) << ')';
-#endif
- me->abort();
- } else {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to transmit data ("
- << ::strerror(errno) << ')';
-#endif
- error = (QUnixSocket::SocketError)(QUnixSocket::WriteFailure |
- CausedAbort);
- me->abort();
- }
- } else if(s != m.d->size()) {
-
- // A partial transmission
- writeNotifier->setEnabled(true);
- delete [] (char *)sendmessage.msg_control;
- m.d->rights = QList<QUnixSocketRights>();
- m.d->removeBytes( s );
- writeQueueBytes -= s;
- emit bytesWritten(s);
- return s;
-
- } else {
-
- // Success!
- writeQueue.dequeue();
- Q_ASSERT(writeQueueBytes >= (unsigned)s);
- writeQueueBytes -= s;
- emit bytesWritten(s);
-
- }
-
- delete [] (char *)sendmessage.msg_control;
- if(-1 != s && !writeQueue.isEmpty())
- return writeActivated();
- else if(QUnixSocket::ClosingState == me->state() && writeQueue.isEmpty())
- me->abort();
-
- if((-1 == s) && (EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno))
- // Return zero bytes written to indicate retry may be required
- return 0;
- else
- return s;
-}
-
-void QUnixSocketPrivate::readActivated()
-{
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: readActivated";
-#endif
- readNotifier->setEnabled(false);
-
- ::iovec vec;
- vec.iov_base = dataBuffer;
- vec.iov_len = dataBufferCapacity;
-
- bzero(&message, sizeof(::msghdr));
- message.msg_iov = &vec;
- message.msg_iovlen = 1;
- message.msg_controllen = ancillaryBufferCapacity();
- message.msg_control = ancillaryBuffer;
-
- int flags = 0;
-#ifdef MSG_CMSG_CLOEXEC
- flags = MSG_CMSG_CLOEXEC;
-#endif
-
- int recvrv = ::recvmsg(fd, &message, flags);
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Received message (" << recvrv << ')';
-#endif
- if(-1 == recvrv) {
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: Unable to receive data ("
- << ::strerror(errno) << ')';
-#endif
- error = (QUnixSocket::SocketError)(QUnixSocket::ReadFailure |
- CausedAbort);
- me->abort();
- } else if(0 == recvrv) {
- me->abort();
- } else {
- Q_ASSERT(recvrv);
- Q_ASSERT((unsigned)recvrv <= dataBufferCapacity);
- dataBufferLength = recvrv;
- messageValid = true;
-
-#ifdef QUNIXSOCKET_DEBUG
- qDebug() << "QUnixSocket: readyRead() " << dataBufferLength;
-#endif
- emit readyRead();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qunixsocket.moc"
diff --git a/src/gui/embedded/qunixsocket_p.h b/src/gui/embedded/qunixsocket_p.h
deleted file mode 100644
index cfa463001f..0000000000
--- a/src/gui/embedded/qunixsocket_p.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUNIXSOCKET_P_H
-#define QUNIXSOCKET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtNetwork/qabstractsocket.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qshareddata.h>
-
-extern "C" {
-#include <sys/types.h>
-};
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketRights;
-class QUnixSocketRightsPrivate;
-class QUnixSocketPrivate;
-class QUnixSocketMessagePrivate;
-struct iovec;
-
-class Q_GUI_EXPORT QUnixSocketRights {
-public:
- QUnixSocketRights(int);
- ~QUnixSocketRights();
-
- QUnixSocketRights(const QUnixSocketRights &);
- QUnixSocketRights & operator=(const QUnixSocketRights &);
-
- bool isValid() const;
-
- int dupFd() const;
- int peekFd() const;
-
-private:
- friend class QUnixSocket;
- QUnixSocketRights(int,int);
- QSharedDataPointer<QUnixSocketRightsPrivate> d;
-};
-
-class Q_GUI_EXPORT QUnixSocketMessage {
-public:
- QUnixSocketMessage();
- QUnixSocketMessage(const QByteArray &);
- QUnixSocketMessage(const QByteArray &, const QList<QUnixSocketRights> &);
- QUnixSocketMessage(const QUnixSocketMessage &);
- QUnixSocketMessage(const iovec*, int);
- QUnixSocketMessage & operator=(const QUnixSocketMessage &);
- ~QUnixSocketMessage();
-
- void setBytes(const QByteArray &);
- void setRights(const QList<QUnixSocketRights> &);
-
- const QList<QUnixSocketRights> & rights() const;
- bool rightsWereTruncated() const;
-
- const QByteArray & bytes() const;
-
- pid_t processId() const;
- uid_t userId() const;
- gid_t groupId() const;
-
- void setProcessId(pid_t);
- void setUserId(uid_t);
- void setGroupId(gid_t);
-
- bool isValid() const;
-private:
- friend class QUnixSocket;
- friend class QUnixSocketPrivate;
- QSharedDataPointer<QUnixSocketMessagePrivate> d;
-};
-
-class Q_GUI_EXPORT QUnixSocket : public QIODevice
-{
- Q_OBJECT
-public:
- QUnixSocket(QObject * = 0);
- QUnixSocket(qint64, qint64, QObject * = 0);
- virtual ~QUnixSocket();
-
- enum SocketState {
- UnconnectedState = QAbstractSocket::UnconnectedState,
- HostLookupState = QAbstractSocket::HostLookupState,
- ConnectingState = QAbstractSocket::ConnectingState,
- ConnectedState = QAbstractSocket::ConnectedState,
- BoundState = QAbstractSocket::BoundState,
- ClosingState = QAbstractSocket::ClosingState,
- ListeningState = QAbstractSocket::ListeningState,
- };
-
- enum SocketError { NoError, InvalidPath, ResourceError,
- NonexistentPath, ConnectionRefused, UnknownError,
- ReadFailure, WriteFailure };
-
- bool connect(const QByteArray & path);
- bool setSocketDescriptor(int socketDescriptor);
- int socketDescriptor() const;
- void abort();
- void close();
-
- bool flush();
-
- SocketError error() const;
-
- SocketState state() const;
- QByteArray address() const;
-
- qint64 bytesAvailable() const;
- qint64 bytesToWrite() const;
-
- qint64 readBufferSize() const;
- void setReadBufferSize(qint64 size);
- qint64 rightsBufferSize() const;
- void setRightsBufferSize(qint64 size);
-
- bool canReadLine() const;
-
- qint64 write(const char * data, qint64 maxSize)
- { return QIODevice::write(data, maxSize); }
- qint64 write(const QByteArray & byteArray)
- { return QIODevice::write(byteArray); }
- qint64 read(char * data, qint64 maxSize)
- { return QIODevice::read(data, maxSize); }
- QByteArray read(qint64 maxSize)
- { return QIODevice::read(maxSize); }
-
- qint64 write(const QUnixSocketMessage &);
- QUnixSocketMessage read();
-
- virtual bool isSequential() const;
- virtual bool waitForReadyRead(int msec = 300);
- virtual bool waitForBytesWritten(int msec = 300);
-
-Q_SIGNALS:
- void stateChanged(SocketState socketState);
-
-protected:
- virtual qint64 readData(char * data, qint64 maxSize);
- virtual qint64 writeData (const char * data, qint64 maxSize);
-
-private:
- QUnixSocket(const QUnixSocket &);
- QUnixSocket & operator=(const QUnixSocket &);
-
- QUnixSocketPrivate * d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QUNIXSOCKET_P_H
diff --git a/src/gui/embedded/qunixsocketserver.cpp b/src/gui/embedded/qunixsocketserver.cpp
deleted file mode 100644
index 36060fdd29..0000000000
--- a/src/gui/embedded/qunixsocketserver.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qunixsocketserver_p.h"
-
-// #define QUNIXSOCKETSERVER_DEBUG
-
-#ifdef QUNIXSOCKETSERVER_DEBUG
-#include <QDebug>
-#endif
-
-#include <QtCore/qsocketnotifier.h>
-
-extern "C" {
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <errno.h>
-};
-
-#define UNIX_PATH_MAX 108 // From unix(7)
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketServerPrivate : public QObject
-{
-Q_OBJECT
-public:
- QUnixSocketServerPrivate(QUnixSocketServer * parent)
- : QObject(), me(parent), fd(-1), maxConns(30),
- error(QUnixSocketServer::NoError), acceptNotifier(0)
- {}
-
- QUnixSocketServer * me;
- int fd;
- int maxConns;
- QByteArray address;
- QUnixSocketServer::ServerError error;
- QSocketNotifier * acceptNotifier;
-public slots:
- void acceptActivated();
-};
-
-/*!
- \class QUnixSocketServer
- \internal
-
- \brief The QUnixSocketServer class provides a Unix domain socket based server.
- \omit
- \ingroup Platform::DeviceSpecific
- \ingroup Platform::OS
- \ingroup Platform::Communications
- \endomit
- \ingroup qws
-
- This class makes it possible to accept incoming Unix domain socket
- connections. Call \l QUnixSocketServer::listen() to have the server listen
- for incoming connections on a specified path. The pure virtual
- \l QUnixSocketServer::incomingConnection() is called each time a new
- connection is established. Users must inherit from QUnixSocketServer and
- implement this method.
-
- If an error occurs, \l QUnixSocketServer::serverError() returns the type of
- error. Errors can only occur during server establishment - that is, during a
- call to \l QUnixSocketServer::listen(). Calling \l QUnixSocketServer::close()
- causes QUnixSocketServer to stop listening for connections and reset its
- state.
-
- QUnixSocketServer is often used in conjunction with the \l QUnixSocket class.
-
- \sa QUnixSocket
-*/
-
-/*!
- \enum QUnixSocketServer::ServerError
-
- The ServerError enumeration represents the errors that can occur during server
- establishment. The most recent error can be retrieved through a call to
- \l QUnixSocketServer::serverError().
-
- \value NoError No error has occurred.
- \value InvalidPath An invalid path endpoint was passed to
- \l QUnixSocketServer::listen(). As defined by unix(7), invalid paths
- include an empty path, or what more than 107 characters long.
- \value ResourceError An error acquiring or manipulating the system's socket
- resources occurred. For example, if the process runs out of available
- socket descriptors, a ResourceError will occur.
- \value BindError The server was unable to bind to the specified path.
- \value ListenError The server was unable to listen on the specified path for
- incoming connections.
- */
-
-/*!
- Create a new Unix socket server with the given \a parent.
- */
-QUnixSocketServer::QUnixSocketServer(QObject *parent)
-: QObject(parent), d(0)
-{
-}
-
-/*!
- Stops listening for incoming connection and destroys the Unix socket server.
- */
-QUnixSocketServer::~QUnixSocketServer()
-{
- close();
- if(d)
- delete d;
-}
-
-/*!
- Stop listening for incoming connections and resets the Unix socket server's
- state. Calling this method while \l {QUnixSocketServer::isListening()}{not listening } for incoming connections is a no-op.
-
- \sa QUnixSocketServer::listen()
- */
-void QUnixSocketServer::close()
-{
- if(!d)
- return;
-
- if(d->acceptNotifier) {
- d->acceptNotifier->setEnabled(false);
- delete d->acceptNotifier;
- }
- d->acceptNotifier = 0;
-
- if(-1 != d->fd) {
-#ifdef QUNIXSOCKET_DEBUG
- int closerv =
-#endif
- ::close(d->fd);
-#ifdef QUNIXSOCKET_DEBUG
- if(0 != closerv) {
- qDebug() << "QUnixSocketServer: Unable to close socket ("
- << strerror(errno) << ')';
- }
-#endif
- }
- d->fd = -1;
- d->address = QByteArray();
- d->error = NoError;
-}
-
-/*!
- Returns the last server error. Errors may only occur within a call to
- \l QUnixSocketServer::listen(), and only when such a call fails.
-
- This method is not destructive, so multiple calls to
- QUnixSocketServer::serverError() will return the same value. The error is
- only reset by an explicit call to \l QUnixSocketServer::close() or
- by further calls to \l QUnixSocketServer::listen().
- */
-QUnixSocketServer::ServerError QUnixSocketServer::serverError() const
-{
- if(!d)
- return NoError;
-
- return d->error;
-}
-
-/*!
- Returns true if this server is listening for incoming connections, false
- otherwise.
-
- \sa QUnixSocketServer::listen()
- */
-bool QUnixSocketServer::isListening() const
-{
- if(!d)
- return false;
-
- return (-1 != d->fd);
-}
-
-/*!
- Tells the server to listen for incoming connections on \a path. Returns true
- if it successfully initializes, false otherwise. In the case of failure, the
- \l QUnixSocketServer::serverError() error status is set accordingly.
-
- Calling this method while the server is already running will result in the
- server begin reset, and then attempting to listen on \a path. This will not
- affect connections established prior to the server being reset, but further
- incoming connections on the previous path will be refused.
-
- The server can be explicitly reset by a call to \l QUnixSocketServer::close().
-
- \sa QUnixSocketServer::close()
- */
-bool QUnixSocketServer::listen(const QByteArray & path)
-{
- if(d) {
- close(); // Any existing server is destroyed
- } else {
- d = new QUnixSocketServerPrivate(this);
- }
-
- if(path.isEmpty() || path.size() > UNIX_PATH_MAX) {
- d->error = InvalidPath;
- return false;
- }
- unlink( path ); // ok if this fails
-
- // Create the socket
- d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0);
- if(-1 == d->fd) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to create socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = ResourceError;
- return false;
- }
-
- // Construct our unix address
- struct ::sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- ::memcpy(addr.sun_path, path.data(), path.size());
- if(path.size() < UNIX_PATH_MAX)
- addr.sun_path[path.size()] = '\0';
-
- // Attempt to bind
- if(-1 == ::bind(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un))) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to bind socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = BindError;
- return false;
- }
-
- // Listen to socket
- if(-1 == ::listen(d->fd, d->maxConns)) {
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Unable to listen socket ("
- << strerror(errno) << ')';
-#endif
- close();
- d->error = ListenError;
- return false;
- }
-
- // Success!
- d->address = path;
- d->acceptNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d);
- d->acceptNotifier->setEnabled(true);
- QObject::connect(d->acceptNotifier, SIGNAL(activated(int)),
- d, SLOT(acceptActivated()));
-
- return true;
-}
-
-/*!
- Returns the Unix path on which this server is listening. If this server is
- not listening, and empty address will be returned.
- */
-QByteArray QUnixSocketServer::serverAddress() const
-{
- if(!d)
- return QByteArray();
- return d->address;
-}
-
-int QUnixSocketServer::socketDescriptor() const
-{
- if (!d)
- return -1;
- return d->fd;
-}
-
-
-/*!
- Returns the maximum length the queue of pending connections may grow to. That
- is, the maximum number of clients attempting to connect for which the Unix
- socket server has not yet accepted and passed to
- \l QUnixSocketServer::incomingConnection(). If a connection request arrives
- with the queue full, the client may receive a connection refused notification.
-
- By default a queue length of 30 is used.
-
- \sa QUnixSocketServer::setMaxPendingConnections()
- */
-int QUnixSocketServer::maxPendingConnections() const
-{
- if(!d)
- return 30;
-
- return d->maxConns;
-}
-
-/*!
- Sets the maximum length the queue of pending connections may grow to
- \a numConnections. This value will only apply to
- \l QUnixSocketServer::listen() calls made following the value change - it will
- not be retroactively applied.
-
- \sa QUnixSocketServer::maxPendingConnections()
- */
-void QUnixSocketServer::setMaxPendingConnections(int numConnections)
-{
- Q_ASSERT(numConnections >= 1);
- if(!d)
- d = new QUnixSocketServerPrivate(this);
-
- d->maxConns = numConnections;
-}
-
-/*!
- \fn void QUnixSocketServer::incomingConnection(int socketDescriptor)
-
- This method is invoked each time a new incoming connection is established with
- the server. Clients must reimplement this function in their QUnixSocketServer
- derived class to handle the connection.
-
- A common approach to handling the connection is to pass \a socketDescriptor to
- a QUnixSocket instance.
-
- \sa QUnixSocket
- */
-
-void QUnixSocketServerPrivate::acceptActivated()
-{
- ::sockaddr_un r;
- socklen_t len = sizeof(sockaddr_un);
- int connsock = ::accept(fd, (sockaddr *)&r, &len);
-#ifdef QUNIXSOCKETSERVER_DEBUG
- qDebug() << "QUnixSocketServer: Accept connection " << connsock;
-#endif
- if(-1 != connsock)
- me->incomingConnection(connsock);
-}
-
-QT_END_NAMESPACE
-
-#include "qunixsocketserver.moc"
diff --git a/src/gui/embedded/qunixsocketserver_p.h b/src/gui/embedded/qunixsocketserver_p.h
deleted file mode 100644
index d7b0a45782..0000000000
--- a/src/gui/embedded/qunixsocketserver_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QUNIXSOCKETSERVER_P_H
-#define QUNIXSOCKETSERVER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-
-QT_BEGIN_NAMESPACE
-
-class QUnixSocketServerPrivate;
-class Q_GUI_EXPORT QUnixSocketServer : public QObject
-{
- Q_OBJECT
-public:
- enum ServerError { NoError, InvalidPath, ResourceError, BindError,
- ListenError };
-
- QUnixSocketServer(QObject *parent=0);
- virtual ~QUnixSocketServer();
-
- void close();
-
- ServerError serverError() const;
-
- bool isListening() const;
- bool listen(const QByteArray & path);
-
- int socketDescriptor() const;
- QByteArray serverAddress() const;
-
- int maxPendingConnections() const;
- void setMaxPendingConnections(int numConnections);
-
-protected:
- virtual void incomingConnection(int socketDescriptor) = 0;
-
-private:
- QUnixSocketServer(const QUnixSocketServer &);
- QUnixSocketServer & operator=(const QUnixSocketServer &);
-
- friend class QUnixSocketServerPrivate;
- QUnixSocketServerPrivate * d;
-};
-
-
-QT_END_NAMESPACE
-#endif // QUNIXSOCKETSERVER_P_H
-
diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h
deleted file mode 100644
index 84f82acd69..0000000000
--- a/src/gui/embedded/qvfbhdr.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVFBHDR_H
-#define QVFBHDR_H
-
-#include <QtGui/qcolor.h>
-#include <QtGui/qwindowdefs.h>
-#include <QtCore/qrect.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_QWS_TEMP_DIR
-# define QT_QWS_TEMP_DIR QLatin1String("/tmp")
-#endif
-
-#ifdef QT_PRIVATE_QWS
-#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2-%3") \
- .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
-#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_mouse"))
-#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_keyboard"))
-#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qtvfb_map"))
-#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/qt_soundserver"))
-#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/QtEmbedded"))
-#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY)
-#else
-#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_MOUSE_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_mouse-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_keyboard-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_MAP(DISPLAY) QString::fromLatin1("%1/.qtvfb_map-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QT_VFB_SOUND_PIPE(DISPLAY) QString::fromLatin1("%1/.qt_soundserver-%2") \
- .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
-#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
- .append(QLatin1String("/QtEmbedded-%1")).arg(DISPLAY)
-#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY)
-#endif
-
-struct QVFbHeader
-{
- int width;
- int height;
- int depth;
- int linestep;
- int dataoffset;
- QRect update;
- bool dirty;
- int numcols;
- QRgb clut[256];
- int viewerVersion;
- int serverVersion;
- int brightness; // since 4.4.0
- WId windowId; // since 4.5.0
-};
-
-struct QVFbKeyData
-{
- unsigned int keycode;
- Qt::KeyboardModifiers modifiers;
- unsigned short int unicode;
- bool press;
- bool repeat;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QVFBHDR_H
diff --git a/src/gui/embedded/qwindowsystem_p.h b/src/gui/embedded/qwindowsystem_p.h
deleted file mode 100644
index 31190033f2..0000000000
--- a/src/gui/embedded/qwindowsystem_p.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSYSTEM_QWS_P_H
-#define QWINDOWSYSTEM_QWS_P_H
-
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QWSServer class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qobject_p.h"
-#include "qwindowsystem_qws.h"
-#include "qbrush.h"
-#include "qwsproperty_qws.h"
-#include "qwscommand_qws_p.h"
-#include "QtCore/qbasictimer.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWSServerPrivate : public QObjectPrivate {
- friend class QCopChannel;
- friend class QWSMouseHandler;
- friend class QWSWindow;
- friend class QWSDisplay;
- friend class QWSInputMethod;
- Q_DECLARE_PUBLIC(QWSServer)
-
-public:
- QWSServerPrivate()
- : screensaverintervals(0)
- , screensavereventblocklevel(-1), screensaverblockevents(false)
- , saver(0), cursorClient(0), mouseState(0), nReserved(0)
- , doClientIsActive(false)
- {
- }
- ~QWSServerPrivate()
- {
- closeDisplay();
-
- qDeleteAll(deletedWindows);
- delete [] screensaverintervals;
- delete saver;
-
- qDeleteAll(windows);
- windows.clear();
-
- delete bgBrush;
- bgBrush = 0;
- }
- QTime screensavertime;
- QTimer* screensavertimer;
- int* screensaverintervals;
- int screensavereventblocklevel;
- bool screensaverblockevents;
- bool screensaverblockevent( int index, int *screensaverinterval, bool isDown );
- QWSScreenSaver* saver;
- QWSClient *cursorClient;
- int mouseState;
-// bool prevWin;
- QList<QWSWindow*> deletedWindows;
- QList<int> crashedClientIds;
-
- void update_regions();
-//private functions moved from class
-
-private:
- void initServer(int flags);
-#ifndef QT_NO_COP
- static void sendQCopEvent(QWSClient *c, const QString &ch,
- const QString &msg, const QByteArray &data,
- bool response = false);
-#endif
- void move_region(const QWSRegionMoveCommand *);
- void set_altitude(const QWSChangeAltitudeCommand *);
- void set_opacity(const QWSSetOpacityCommand *);
- void request_focus(const QWSRequestFocusCommand *);
- QRegion reserve_region(QWSWindow *window, const QRegion &region);
- void request_region(int winId, const QString &surfaceKey,
- const QByteArray &surfaceData,
- const QRegion &region);
- void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &);
- void destroy_region(const QWSRegionDestroyCommand *);
- void name_region(const QWSRegionNameCommand *);
- void set_identity(const QWSIdentifyCommand *);
-#ifndef QT_NO_QWS_PROPERTIES
- bool get_property(int winId, int property, const char *&data, int &len);
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- void im_response(const QWSIMResponseCommand *);
-
- void im_update(const QWSIMUpdateCommand *);
-
- void send_im_mouse(const QWSIMMouseCommand *);
-#endif
- // not in ifndef as this results in more readable functions.
- static void sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
- bool isPress, bool autoRepeat);
- static void sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel = 0);
- static void emergency_cleanup();
-
- static QBrush *bgBrush;
-
- void sendMaxWindowRectEvents(const QRect &rect);
-
- void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client);
- void invokeCreate(QWSCreateCommand *cmd, QWSClient *client);
- void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client);
- void invokeRegion(QWSRegionCommand *cmd, QWSClient *client);
- void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client);
- void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client);
- void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client);
- void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client);
-#ifndef QT_NO_QWS_PROPERTIES
- void invokeAddProperty(QWSAddPropertyCommand *cmd);
- void invokeSetProperty(QWSSetPropertyCommand *cmd);
- void invokeRemoveProperty(QWSRemovePropertyCommand *cmd);
- void invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client);
-#endif //QT_NO_QWS_PROPERTIES
- void invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd);
- void invokeConvertSelection(QWSConvertSelectionCommand *cmd);
- void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client);
-
- void initIO();
- void setFocus(QWSWindow*, bool gain);
-#ifndef QT_NO_QWS_CURSOR
- void invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client);
- void invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client);
- void invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *client);
-#endif
- void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client);
- void invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client);
-#ifndef QT_NO_SOUND
- void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client);
-#endif
-#ifndef QT_NO_COP
- void invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd,
- QWSClient *client);
- void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client);
-#endif
- void invokeRepaintRegion(QWSRepaintRegionCommand *cmd,
- QWSClient *client);
-#ifndef QT_NO_QWSEMBEDWIDGET
- void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client);
-#endif
-#ifndef QT_NO_QWS_INPUTMETHODS
- void invokeIMResponse(const QWSIMResponseCommand *cmd,
- QWSClient *client);
- void invokeIMUpdate(const QWSIMUpdateCommand *cmd,
- QWSClient *client);
-#endif
- void invokeFont(const QWSFontCommand *cmd, QWSClient *client);
- void invokeScreenTransform(const QWSScreenTransformCommand *cmd,
- QWSClient *client);
-
- QWSMouseHandler* newMouseHandler(const QString& spec);
- void openDisplay();
- void closeDisplay();
-
- void showCursor();
- void hideCursor();
- void initializeCursor();
-
- void resetEngine();
-
-//private Q_SLOTS:
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- void _q_clientClosed();
- void _q_doClient();
- void _q_deleteWindowsLater();
-#endif
-
- void _q_screenSaverWake();
- void _q_screenSaverSleep();
- void _q_screenSaverTimeout();
-#ifndef QT_NO_QWS_MULTIPROCESS
- void _q_newConnection();
-#endif
-
-//other private moved from class
-
- void disconnectClient(QWSClient *);
- void screenSave(int level);
- void doClient(QWSClient *);
- typedef QMap<int,QWSClient*>::Iterator ClientIterator;
- typedef QMap<int,QWSClient*> ClientMap;
- void handleWindowClose(QWSWindow *w);
- void releaseMouse(QWSWindow* w);
- void releaseKeyboard(QWSWindow* w);
- void updateClientCursorPos();
-
- uchar* sharedram;
- int ramlen;
-
- ClientMap clientMap;
-#ifndef QT_NO_QWS_PROPERTIES
- QWSPropertyManager propertyManager;
-#endif
- struct SelectionOwner {
- int windowid;
- struct Time {
- void set(int h, int m, int s, int s2) {
- hour = h; minute = m; sec = s; ms = s2;
- }
- int hour, minute, sec, ms;
- } time;
- } selectionOwner;
- QTime timer;
- int* screensaverinterval;
-
- QWSWindow *focusw;
- QWSWindow *mouseGrabber;
- bool mouseGrabbing;
- bool inputMethodMouseGrabbed;
- int swidth, sheight, sdepth;
-#ifndef QT_NO_QWS_CURSOR
- bool haveviscurs;
- QWSCursor *cursor; // cursor currently shown
- QWSCursor *nextCursor; // cursor to show once grabbing is off
-#endif
-
- bool disablePainting;
- QList<QWSMouseHandler*> mousehandlers;
-#ifndef QT_NO_QWS_KEYBOARD
- QList<QWSKeyboardHandler*> keyboardhandlers;
-#endif
-
- QList<QWSCommandStruct*> commandQueue;
-
- // Window management
- QList<QWSWindow*> windows; // first=topmost
- int nReserved;
- QWSWindow* newWindow(int id, QWSClient* client);
- QWSWindow* findWindow(int windowid, QWSClient* client = 0);
- void moveWindowRegion(QWSWindow*, int dx, int dy);
- void setWindowRegion(QWSWindow*, const QRegion &r);
- void raiseWindow(QWSWindow *, int = 0);
- void lowerWindow(QWSWindow *, int = -1);
- void exposeRegion(const QRegion &, int index = 0);
-
- void setCursor(QWSCursor *curs);
-
- // multimedia
-#ifndef QT_NO_SOUND
- QWSSoundServer *soundserver;
-#endif
-#ifndef QT_NO_COP
- QMap<QString, QList<QWSClient*> > channels;
-#endif
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- QWSServerSocket *ssocket;
-#endif
-
- // filename -> refcount
- QMap<QByteArray, int> fontReferenceCount;
- QBasicTimer fontCleanupTimer;
- void referenceFont(QWSClientPrivate *client, const QByteArray &font);
- void dereferenceFont(QWSClientPrivate *client, const QByteArray &font);
- void cleanupFonts(bool force = false);
- void sendFontRemovedEvent(const QByteArray &font);
-
- bool doClientIsActive;
- QList<QWSClient*> pendingDoClients;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/embedded/qwsembedwidget.cpp b/src/gui/embedded/qwsembedwidget.cpp
deleted file mode 100644
index 9005ea4400..0000000000
--- a/src/gui/embedded/qwsembedwidget.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwsembedwidget.h"
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-
-#include <qwsdisplay_qws.h>
-#include <private/qwidget_p.h>
-#include <private/qwsdisplay_qws_p.h>
-#include <private/qwscommand_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// TODO:
-// Must remove window decorations from the embedded window
-// Focus In/Out, Keyboard/Mouse...
-//
-// BUG: what if my parent change parent?
-
-class QWSEmbedWidgetPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QWSEmbedWidget);
-
-public:
- QWSEmbedWidgetPrivate(int winId);
- void updateWindow();
- void resize(const QSize &size);
-
- QWidget *window;
- WId windowId;
- WId embeddedId;
-};
-
-QWSEmbedWidgetPrivate::QWSEmbedWidgetPrivate(int winId)
- : window(0), windowId(0), embeddedId(winId)
-{
-}
-
-void QWSEmbedWidgetPrivate::updateWindow()
-{
- Q_Q(QWSEmbedWidget);
-
- QWidget *win = q->window();
- if (win == window)
- return;
-
- if (window) {
- window->removeEventFilter(q);
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::StopEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
- }
-
- window = win;
- if (!window)
- return;
- windowId = window->winId();
-
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::StartEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
- window->installEventFilter(q);
- q->installEventFilter(q);
-}
-
-void QWSEmbedWidgetPrivate::resize(const QSize &size)
-{
- if (!window)
- return;
-
- Q_Q(QWSEmbedWidget);
-
- QWSEmbedCommand command;
- command.setData(windowId, embeddedId, QWSEmbedEvent::Region,
- QRect(q->mapToGlobal(QPoint(0, 0)), size));
- QWSDisplay::instance()->d->sendCommand(command);
-}
-
-/*!
- \class QWSEmbedWidget
- \since 4.2
- \ingroup qws
- \ingroup advanced
-
- \brief The QWSEmbedWidget class enables embedded top-level widgets
- in Qt for Embedded Linux.
-
- Note that this class is only available in \l{Qt for Embedded Linux}.
-
- QWSEmbedWidget inherits QWidget and acts as any other widget, but
- in addition it is capable of embedding another top-level widget.
-
- An example of use is when painting directly onto the screen using
- the QDirectPainter class. Then the reserved region can be embedded
- into an instance of the QWSEmbedWidget class, providing for
- example event handling and size policies for the reserved region.
-
- All that is required to embed a top-level widget is its window ID.
-
- \sa {Qt for Embedded Linux Architecture}
-*/
-
-/*!
- Constructs a widget with the given \a parent, embedding the widget
- identified by the given window \a id.
-*/
-QWSEmbedWidget::QWSEmbedWidget(WId id, QWidget *parent)
- : QWidget(*new QWSEmbedWidgetPrivate(id), parent, 0)
-{
- Q_D(QWSEmbedWidget);
- d->updateWindow();
-}
-
-/*!
- Destroys this widget.
-*/
-QWSEmbedWidget::~QWSEmbedWidget()
-{
- Q_D(QWSEmbedWidget);
- if (!d->window)
- return;
-
- QWSEmbedCommand command;
- command.setData(d->windowId, d->embeddedId, QWSEmbedEvent::StopEmbed);
- QWSDisplay::instance()->d->sendCommand(command);
-}
-
-/*!
- \reimp
-*/
-bool QWSEmbedWidget::eventFilter(QObject *object, QEvent *event)
-{
- Q_D(QWSEmbedWidget);
- if (object == d->window && event->type() == QEvent::Move)
- resizeEvent(0);
- else if (object == this && event->type() == QEvent::Hide)
- d->resize(QSize());
- return QWidget::eventFilter(object, event);
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::changeEvent(QEvent *event)
-{
- Q_D(QWSEmbedWidget);
- if (event->type() == QEvent::ParentChange)
- d->updateWindow();
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::resizeEvent(QResizeEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(rect().size());
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::moveEvent(QMoveEvent*)
-{
- resizeEvent(0);
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::hideEvent(QHideEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(QSize());
-}
-
-/*!
- \reimp
-*/
-void QWSEmbedWidget::showEvent(QShowEvent*)
-{
- Q_D(QWSEmbedWidget);
- d->resize(rect().size());
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWSEMBEDWIDGET
diff --git a/src/gui/embedded/qwsembedwidget.h b/src/gui/embedded/qwsembedwidget.h
deleted file mode 100644
index 50237a6963..0000000000
--- a/src/gui/embedded/qwsembedwidget.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSEMBEDWIDGET_H
-#define QWSEMBEDWIDGET_H
-
-#include <QtGui/qwidget.h>
-
-#ifndef QT_NO_QWSEMBEDWIDGET
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QWSEmbedWidgetPrivate;
-
-class Q_GUI_EXPORT QWSEmbedWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- QWSEmbedWidget(WId winId, QWidget *parent = 0);
- ~QWSEmbedWidget();
-
-protected:
- bool eventFilter(QObject *object, QEvent *event);
- void changeEvent(QEvent *event);
- void resizeEvent(QResizeEvent *event);
- void moveEvent(QMoveEvent *event);
- void hideEvent(QHideEvent *event);
- void showEvent(QShowEvent *event);
-
-private:
- Q_DECLARE_PRIVATE(QWSEmbedWidget)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT_NO_QWSEMBEDWIDGET
-#endif // QWSEMBEDWIDGET_H
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp
deleted file mode 100644
index 324d81362d..0000000000
--- a/src/gui/embedded/qwslock.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwslock_p.h"
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-#include "qwssignalhandler_p.h"
-
-#include <qglobal.h>
-#include <qdebug.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <sys/time.h>
-#include <time.h>
-#ifdef Q_OS_LINUX
-#include <linux/version.h>
-#endif
-#include <unistd.h>
-
-#include <private/qcore_unix_p.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QT_NO_SEMAPHORE
-#error QWSLock currently requires semaphores
-#endif
-
-QWSLock::QWSLock()
-{
- semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666);
-
- if (semId == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to create semaphore");
- }
- QWSSignalHandler::instance()->addSemaphore(semId);
-
- qt_semun semval;
- semval.val = 1;
-
- if (semctl(semId, BackingStore, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize backingstore semaphore");
- }
- lockCount[BackingStore] = 0;
-
- if (semctl(semId, Communication, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize communication semaphore");
- }
- lockCount[Communication] = 0;
-
- semval.val = 0;
- if (semctl(semId, RegionEvent, SETVAL, semval) == -1) {
- perror("QWSLock::QWSLock");
- qFatal("Unable to initialize region event semaphore");
- }
-}
-
-QWSLock::QWSLock(int id)
-{
- semId = id;
- QWSSignalHandler::instance()->addSemaphore(semId);
- lockCount[0] = lockCount[1] = 0;
-}
-
-QWSLock::~QWSLock()
-{
- if (semId == -1)
- return;
- QWSSignalHandler::instance()->removeSemaphore(semId);
-}
-
-static bool forceLock(int semId, int semNum, int)
-{
- int ret;
- do {
- sembuf sops = { semNum, -1, 0 };
-
- // As the BackingStore lock is a mutex, and only one process may own
- // the lock, it's safe to use SEM_UNDO. On the other hand, the
- // Communication lock is locked by the client but unlocked by the
- // server and therefore can't use SEM_UNDO.
- if (semNum == QWSLock::BackingStore)
- sops.sem_flg |= SEM_UNDO;
-
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::lock: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static bool up(int semId, int semNum)
-{
- int ret;
- do {
- sembuf sops = { semNum, 1, 0 };
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::up: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static bool down(int semId, int semNum)
-{
- int ret;
- do {
- sembuf sops = { semNum, -1, 0 };
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::down: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return (ret != -1);
-}
-
-static int getValue(int semId, int semNum)
-{
- int ret;
- do {
- ret = semctl(semId, semNum, GETVAL, 0);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::getValue: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-
- return ret;
-}
-
-bool QWSLock::lock(LockType type, int timeout)
-{
- if (type == RegionEvent)
- return up(semId, RegionEvent);
-
- if (hasLock(type)) {
- ++lockCount[type];
- return true;
- }
-
- if (!forceLock(semId, type, timeout))
- return false;
- ++lockCount[type];
- return true;
-}
-
-bool QWSLock::hasLock(LockType type)
-{
- if (type == RegionEvent)
- return (getValue(semId, RegionEvent) == 0);
-
- return (lockCount[type] > 0);
-}
-
-void QWSLock::unlock(LockType type)
-{
- if (type == RegionEvent) {
- down(semId, RegionEvent);
- return;
- }
-
- if (hasLock(type)) {
- --lockCount[type];
- if (hasLock(type))
- return;
- }
-
- const int semNum = type;
- int ret;
- do {
- sembuf sops = {semNum, 1, 0};
- if (semNum == QWSLock::BackingStore)
- sops.sem_flg |= SEM_UNDO;
-
- ret = semop(semId, &sops, 1);
- if (ret == -1 && errno != EINTR)
- qDebug("QWSLock::unlock: %s", strerror(errno));
- } while (ret == -1 && errno == EINTR);
-}
-
-bool QWSLock::wait(LockType type, int timeout)
-{
- bool ok = forceLock(semId, type, timeout);
- if (ok)
- unlock(type);
- return ok;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/embedded/qwslock_p.h b/src/gui/embedded/qwslock_p.h
deleted file mode 100644
index 397053776a..0000000000
--- a/src/gui/embedded/qwslock_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSLOCK_P_H
-#define QWSLOCK_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. This header file may
-// change from version to version without notice, or even be
-// removed.
-//
-// We mean it.
-//
-
-#include <qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-
-class QWSLock
-{
-public:
- enum LockType { BackingStore, Communication, RegionEvent };
-
- QWSLock();
- QWSLock(int lockId);
- ~QWSLock();
-
- bool lock(LockType type, int timeout = -1);
- void unlock(LockType type);
- bool wait(LockType type, int timeout = -1);
- bool hasLock(LockType type);
- int id() const { return semId; }
-
-private:
- int semId;
- int lockCount[2];
-};
-
-
-QT_END_NAMESPACE
-#endif // QT_NO_QWS_MULTIPROCESS
-#endif // QWSLOCK_P_H
diff --git a/src/gui/embedded/qwsmanager_p.h b/src/gui/embedded/qwsmanager_p.h
deleted file mode 100644
index e5db3ef4b2..0000000000
--- a/src/gui/embedded/qwsmanager_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSMANAGER_P_H
-#define QWSMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qregion.h"
-#include "QtGui/qdecoration_qws.h"
-
-#ifndef QT_NO_QWS_MANAGER
-
-#include "QtCore/qhash.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class QMenu;
-
-class QWSManagerPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QWSManager)
-public:
- QWSManagerPrivate();
-
- int activeRegion;
- QWidget *managed;
- QMenu *popup;
-
- enum MenuAction {
- NormalizeAction,
- TitleAction,
- BottomRightAction,
- MinimizeAction,
- MaximizeAction,
- CloseAction,
- LastMenuAction
- };
- QAction *menuActions[LastMenuAction];
-
- static QWidget *active;
- static QPoint mousePos;
-
- // Region caching to avoid getting a regiontype's
- // QRegion for each mouse move event
- int previousRegionType;
- bool previousRegionRepainted; // Hover/Press handled
- bool entireDecorationNeedsRepaint;
- struct RegionCaching {
- int regionType;
- QRegion region;
- Qt::WindowFlags windowFlags;
- QRect windowGeometry;
- } cached_region;
-
- bool newCachedRegion(const QPoint &pos);
- int cachedRegionAt()
- { return cached_region.regionType; }
-
- void dirtyRegion(int decorationRegion,
- QDecoration::DecorationState state,
- const QRegion &clip = QRegion());
- void clearDirtyRegions();
-
- QList<int> dirtyRegions;
- QList<QDecoration::DecorationState> dirtyStates;
- QRegion dirtyClip;
-};
-
-#endif // QT_NO_QWS_MANAGER
-
-QT_END_NAMESPACE
-
-#endif // QWSMANAGER_P_H
diff --git a/src/gui/embedded/qwssharedmemory.cpp b/src/gui/embedded/qwssharedmemory.cpp
deleted file mode 100644
index 07c46254bd..0000000000
--- a/src/gui/embedded/qwssharedmemory.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwssharedmemory_p.h"
-
-#if !defined(QT_NO_QWS_MULTIPROCESS)
-
-#include <sys/shm.h>
-
-QT_BEGIN_NAMESPACE
-
-QWSSharedMemory::QWSSharedMemory()
- : shmBase(0), shmSize(0), character(0), shmId(-1), key(-1)
-{
-}
-
-
-QWSSharedMemory::~QWSSharedMemory()
-{
- detach();
-}
-
-/*
- man page says:
- On Linux, it is possible to attach a shared memory segment even if it
- is already marked to be deleted. However, POSIX.1-2001 does not spec-
- ify this behaviour and many other implementations do not support it.
-*/
-
-bool QWSSharedMemory::create(int size)
-{
- if (shmId != -1)
- detach();
- shmId = shmget(IPC_PRIVATE, size, IPC_CREAT|0600);
-
- if (shmId == -1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::create allocating shared memory");
- qWarning("Error allocating shared memory of size %d", size);
-#endif
- return false;
- }
- shmBase = shmat(shmId,0,0);
- shmctl(shmId, IPC_RMID, 0);
- if (shmBase == (void*)-1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::create attaching to shared memory");
- qWarning("Error attaching to shared memory id %d", shmId);
-#endif
- shmBase = 0;
- return false;
- }
- return true;
-}
-
-bool QWSSharedMemory::attach(int id)
-{
- if (shmId == id)
- return id != -1;
- if (shmId != -1)
- detach();
-
- shmBase = shmat(id,0,0);
- if (shmBase == (void*)-1) {
-#ifdef QT_SHM_DEBUG
- perror("QWSSharedMemory::attach attaching to shared memory");
- qWarning("Error attaching to shared memory 0x%x of size %d",
- id, size());
-#endif
- shmBase = 0;
- return false;
- }
- shmId = id;
- return true;
-}
-
-
-void QWSSharedMemory::detach ()
-{
- if (!shmBase)
- return;
- shmdt (shmBase);
- shmBase = 0;
- shmSize = 0;
- shmId = -1;
-}
-
-void QWSSharedMemory::setPermissions (mode_t mode)
-{
- struct shmid_ds shm;
- shmctl (shmId, IPC_STAT, &shm);
- shm.shm_perm.mode = mode;
- shmctl (shmId, IPC_SET, &shm);
-}
-
-int QWSSharedMemory::size () const
-{
- struct shmid_ds shm;
- shmctl (shmId, IPC_STAT, &shm);
- return shm.shm_segsz;
-}
-
-
-// old API
-
-
-
-QWSSharedMemory::QWSSharedMemory (int size, const QString &filename, char c)
-{
- shmSize = size;
- shmFile = filename;
- shmBase = 0;
- shmId = -1;
- character = c;
- key = ftok (shmFile.toLatin1().constData(), c);
-}
-
-
-
-bool QWSSharedMemory::create ()
-{
- shmId = shmget (key, shmSize, IPC_CREAT | 0666);
- return (shmId != -1);
-}
-
-void QWSSharedMemory::destroy ()
-{
- if (shmId != -1)
- shmctl(shmId, IPC_RMID, 0);
-}
-
-bool QWSSharedMemory::attach ()
-{
- if (shmId == -1)
- shmId = shmget (key, shmSize, 0);
-
- shmBase = shmat (shmId, 0, 0);
- if ((long)shmBase == -1)
- shmBase = 0;
-
- return (long)shmBase != 0;
-}
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/embedded/qwssharedmemory_p.h
deleted file mode 100644
index 591d92a012..0000000000
--- a/src/gui/embedded/qwssharedmemory_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSSHAREDMEMORY_P_H
-#define QWSSHAREDMEMORY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qplatformdefs.h"
-#include "QtCore/qstring.h"
-
-QT_BEGIN_NAMESPACE
-
-#if !defined(QT_NO_QWS_MULTIPROCESS)
-
-class QWSSharedMemory {
-public:
-
- QWSSharedMemory();
- ~QWSSharedMemory();
-
- void setPermissions(mode_t mode);
- int size() const;
- void *address() { return shmBase; }
-
- int id() const { return shmId; }
-
- void detach();
-
- bool create(int size);
- bool attach(int id);
-
- //bool create(int size, const QString &filename, char c = 'Q');
- //bool attach(const QString &filename, char c = 'Q');
-// old API
-
- QWSSharedMemory(int, const QString &, char c = 'Q');
- void * base() { return address(); }
-
- bool create();
- void destroy();
-
- bool attach();
-
-private:
- void *shmBase;
- int shmSize;
- QString shmFile;
- char character;
- int shmId;
- key_t key;
-};
-
-#endif // QT_NO_QWS_MULTIPROCESS
-
-QT_END_NAMESPACE
-
-#endif // QWSSHAREDMEMORY_P_H
diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp
deleted file mode 100644
index cc18bebdfb..0000000000
--- a/src/gui/embedded/qwssignalhandler.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwssignalhandler_p.h"
-
-#ifndef QT_NO_QWS_SIGNALHANDLER
-
-#include <sys/types.h>
-#ifndef QT_NO_QWS_MULTIPROCESS
-# include <sys/ipc.h>
-# include <sys/sem.h>
-
-# include <private/qcore_unix_p.h>
-#endif
-#include <signal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSSignalHandlerPrivate : public QWSSignalHandler
-{
-public:
- QWSSignalHandlerPrivate() : QWSSignalHandler() {}
-};
-
-
-Q_GLOBAL_STATIC(QWSSignalHandlerPrivate, signalHandlerInstance);
-
-
-QWSSignalHandler* QWSSignalHandler::instance()
-{
- return signalHandlerInstance();
-}
-
-QWSSignalHandler::QWSSignalHandler()
-{
- const int signums[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE,
- SIGSEGV, SIGTERM, SIGBUS };
- const int n = sizeof(signums)/sizeof(int);
-
- for (int i = 0; i < n; ++i) {
- const int signum = signums[i];
- qt_sighandler_t old = signal(signum, handleSignal);
- if (old == SIG_IGN) // don't remove shm and semaphores when ignored
- signal(signum, old);
- else
- oldHandlers[signum] = (old == SIG_ERR ? SIG_DFL : old);
- }
-}
-
-QWSSignalHandler::~QWSSignalHandler()
-{
-#ifndef QT_NO_QWS_MULTIPROCESS
- while (!semaphores.isEmpty())
- removeSemaphore(semaphores.last());
-#endif
-}
-
-#ifndef QT_NO_QWS_MULTIPROCESS
-void QWSSignalHandler::removeSemaphore(int semno)
-{
- const int index = semaphores.lastIndexOf(semno);
- if (index != -1) {
- qt_semun semval;
- semval.val = 0;
- semctl(semaphores.at(index), 0, IPC_RMID, semval);
- semaphores.remove(index);
- }
-}
-#endif // QT_NO_QWS_MULTIPROCESS
-
-void QWSSignalHandler::handleSignal(int signum)
-{
- QWSSignalHandler *h = instance();
-
- signal(signum, h->oldHandlers[signum]);
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- qt_semun semval;
- semval.val = 0;
- for (int i = 0; i < h->semaphores.size(); ++i)
- semctl(h->semaphores.at(i), 0, IPC_RMID, semval);
-#endif
-
- h->objects.clear();
- raise(signum);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_QWS_NO_SIGNALHANDLER
diff --git a/src/gui/embedded/qwssignalhandler_p.h b/src/gui/embedded/qwssignalhandler_p.h
deleted file mode 100644
index e933d06b6a..0000000000
--- a/src/gui/embedded/qwssignalhandler_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSSIGNALHANDLER_P_H
-#define QWSSIGNALHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_QWS_SIGNALHANDLER
-
-#include <QtCore/qmap.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qobjectcleanuphandler.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef void (*qt_sighandler_t)(int);
-
-class QWSSignalHandlerPrivate;
-
-class Q_GUI_EXPORT QWSSignalHandler
-{
-public:
- static QWSSignalHandler* instance();
-
- ~QWSSignalHandler();
-
-#ifndef QT_NO_QWS_MULTIPROCESS
- inline void addSemaphore(int semno) { semaphores.append(semno); }
- void removeSemaphore(int semno);
-#endif
- inline void addObject(QObject *object) { (void)objects.add(object); }
-
-private:
- QWSSignalHandler();
- static void handleSignal(int signal);
- QMap<int, qt_sighandler_t> oldHandlers;
-#ifndef QT_NO_QWS_MULTIPROCESS
- QVector<int> semaphores;
-#endif
- QObjectCleanupHandler objects;
-
- friend class QWSSignalHandlerPrivate;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_SIGNALHANDLER
-
-#endif // QWSSIGNALHANDLER_P_H
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 8f72fead8d..2b89477118 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -5,7 +5,7 @@ DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
-!win32:!embedded:!qpa:!mac:!symbian:CONFIG += x11
+!win32:!qpa:!mac:!symbian:CONFIG += x11
unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
@@ -17,7 +17,6 @@ contains(QT_CONFIG, x11sm):CONFIG += x11sm
x11:include(kernel/x11.pri)
mac:include(kernel/mac.pri)
win32:include(kernel/win.pri)
-embedded:include(embedded/embedded.pri)
symbian {
include(kernel/symbian.pri)
include(s60framework/s60framework.pri)
@@ -43,7 +42,6 @@ include(effects/effects.pri)
include(egl/egl.pri)
win32:!wince*: DEFINES += QT_NO_EGL
-embedded: QT += network
QMAKE_LIBS += $$QMAKE_LIBS_GUI
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 72738c9fa8..e970fb05a1 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -62,9 +62,6 @@ SOURCES += \
win32 {
SOURCES += image/qpixmap_win.cpp
}
-else:embedded {
- SOURCES += image/qpixmap_qws.cpp
-}
else:qpa {
SOURCES += image/qpixmap_qpa.cpp
}
diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri
index d4394380dc..77ca3bd057 100644
--- a/src/gui/inputmethod/inputmethod.pri
+++ b/src/gui/inputmethod/inputmethod.pri
@@ -15,11 +15,7 @@ win32 {
HEADERS += inputmethod/qwininputcontext_p.h
SOURCES += inputmethod/qwininputcontext_win.cpp
}
-embedded {
- HEADERS += inputmethod/qwsinputcontext_p.h
- SOURCES += inputmethod/qwsinputcontext_qws.cpp
-}
-mac:!embedded:!qpa {
+mac:!qpa {
HEADERS += inputmethod/qmacinputcontext_p.h
SOURCES += inputmethod/qmacinputcontext_mac.cpp
}
diff --git a/src/gui/inputmethod/qwsinputcontext_p.h b/src/gui/inputmethod/qwsinputcontext_p.h
deleted file mode 100644
index 72b06a0b8f..0000000000
--- a/src/gui/inputmethod/qwsinputcontext_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSINPUTCONTEXT_P_H
-#define QWSINPUTCONTEXT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QLibrary class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtGui/qinputcontext.h"
-
-#ifndef QT_NO_QWS_INPUTMETHODS
-
-QT_BEGIN_NAMESPACE
-
-class QWSIMEvent;
-class QWSIMQueryEvent;
-class QWSIMInitEvent;
-
-class QWSInputContext : public QInputContext
-{
- Q_OBJECT
-public:
- explicit QWSInputContext(QObject* parent = 0);
- ~QWSInputContext() {}
-
-
- QString identifierName() { return QString(); }
- QString language() { return QString(); }
-
- void reset();
- void update();
- void mouseHandler( int x, QMouseEvent *event);
-
- void setFocusWidget( QWidget *w );
- void widgetDestroyed(QWidget *w);
-
- bool isComposing() const;
-
- static QWidget *activeWidget();
- static bool translateIMEvent(QWidget *w, const QWSIMEvent *e);
- static bool translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e);
- static bool translateIMInitEvent(const QWSIMInitEvent *e);
- static void updateImeStatus(QWidget *w, bool hasFocus);
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_INPUTMETHODS
-
-#endif // QWSINPUTCONTEXT_P_H
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 0e95a6aabf..85470090fc 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -173,32 +173,6 @@ unix:x11 {
kernel/qeventdispatcher_x11_p.h
}
-embedded {
- HEADERS += \
- kernel/qeventdispatcher_qws_p.h
-
- SOURCES += \
- kernel/qapplication_qws.cpp \
- kernel/qclipboard_qws.cpp \
- kernel/qcursor_qws.cpp \
- kernel/qdesktopwidget_qws.cpp \
- kernel/qdnd_qws.cpp \
- kernel/qeventdispatcher_qws.cpp \
- kernel/qsound_qws.cpp \
- kernel/qwidget_qws.cpp \
- kernel/qkeymapper_qws.cpp \
- kernel/qsessionmanager_qws.cpp
-
- contains(QT_CONFIG, glib) {
- SOURCES += \
- kernel/qeventdispatcher_glib_qws.cpp
- HEADERS += \
- kernel/qeventdispatcher_glib_qws_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
- }
-}
-
!qpa {
HEADERS += \
kernel/qsound.h \
@@ -273,7 +247,7 @@ qpa {
}
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
SOURCES += \
kernel/qclipboard_mac.cpp \
kernel/qmime_mac.cpp \
diff --git a/src/gui/kernel/mac.pri b/src/gui/kernel/mac.pri
index 21acd06e65..df457dd166 100644
--- a/src/gui/kernel/mac.pri
+++ b/src/gui/kernel/mac.pri
@@ -1,4 +1,4 @@
-!x11:!embedded:!qpa:mac {
+!x11:!qpa:mac {
LIBS_PRIVATE += -framework Carbon -lz
*-mwerks:INCLUDEPATH += compat
}
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 65e7af4742..baf648b2a1 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -114,14 +114,7 @@ win32 {
!win32-borland:!wince*:LIBS += -lmsimg32
}
-embedded {
- HEADERS += \
- painting/qgraphicssystem_qws_p.h \
-
- SOURCES += \
- painting/qgraphicssystem_qws.cpp \
-
-} else: if(!qpa) {
+if(!qpa) {
HEADERS += \
painting/qgraphicssystem_raster_p.h \
painting/qgraphicssystem_runtime_p.h \
@@ -147,7 +140,7 @@ unix:x11 {
painting/qpaintengine_x11.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
HEADERS += \
painting/qpaintengine_mac_p.h \
painting/qgraphicssystem_mac_p.h \
@@ -170,23 +163,11 @@ unix:!mac:!symbian|qpa {
painting/qprinterinfo_unix.cpp
}
-win32|x11|mac|embedded|qpa|symbian {
+win32|x11|mac|qpa|symbian {
SOURCES += painting/qbackingstore.cpp
HEADERS += painting/qbackingstore_p.h
}
-embedded {
- contains(QT_CONFIG,qtopia) {
- DEFINES += QTOPIA_PRINTENGINE
- HEADERS += painting/qprintengine_qws_p.h
- SOURCES += painting/qprintengine_qws.cpp
- }
-
- SOURCES += \
- painting/qcolormap_qws.cpp \
- painting/qpaintdevice_qws.cpp
-}
-
qpa {
SOURCES += \
painting/qcolormap_qpa.cpp \
@@ -203,7 +184,7 @@ symbian {
painting/qpaintengine_s60_p.h
}
-x11|embedded|qpa {
+x11|qpa {
contains(QT_CONFIG,qtopia) {
DEFINES += QT_NO_CUPS QT_NO_LPR
} else {
@@ -233,20 +214,13 @@ x11 {
SOURCES += painting/qwindowsurface_x11.cpp
}
-!embedded:!qpa:mac {
+!qpa:mac {
HEADERS += painting/qwindowsurface_mac_p.h \
painting/qunifiedtoolbarsurface_mac_p.h
SOURCES += painting/qwindowsurface_mac.cpp \
painting/qunifiedtoolbarsurface_mac.cpp
}
-embedded {
- HEADERS += painting/qwindowsurface_qws_p.h
- SOURCES += painting/qwindowsurface_qws.cpp
-}
-
-
-
symbian {
HEADERS += painting/qwindowsurface_s60_p.h \
painting/qdrawhelper_arm_simd_p.h
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index b6eeec9af8..35347c24e7 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -35,7 +35,7 @@ contains( styles, all ) {
styles = mac windows windowsxp windowsvista
}
-x11|embedded|qpa|!macx-*:styles -= mac
+x11|qpa|!macx-*:styles -= mac
x11{
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index df9398ce59..a1e7eb1652 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -103,7 +103,7 @@ unix:x11 {
text/qrawfont_ft.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
HEADERS += \
text/qfontengine_mac_p.h
OBJECTIVE_HEADERS += \
@@ -116,22 +116,6 @@ unix:x11 {
text/qfontengine_mac.mm
}
-embedded {
- SOURCES += \
- text/qfont_qws.cpp \
- text/qfontengine_qws.cpp \
- text/qfontengine_ft.cpp \
- text/qfontengine_qpf.cpp \
- text/qabstractfontengine_qws.cpp \
- text/qrawfont_ft.cpp
- HEADERS += \
- text/qfontengine_ft_p.h \
- text/qfontengine_qpf_p.h \
- text/qabstractfontengine_qws.h \
- text/qabstractfontengine_p.h
- DEFINES += QT_NO_FONTCONFIG
-}
-
qpa {
SOURCES += \
text/qfont_qpa.cpp \
@@ -228,9 +212,7 @@ contains(QT_CONFIG, freetype) {
DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB
- embedded:CONFIG += opentype
} else:contains(QT_CONFIG, system-freetype) {
- embedded:CONFIG += opentype
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
LIBS_PRIVATE += -lfreetype
diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri
index 46230b5be5..db8e06555f 100644
--- a/src/gui/util/util.pri
+++ b/src/gui/util/util.pri
@@ -41,12 +41,12 @@ unix:x11 {
util/qsystemtrayicon_x11.cpp
}
-embedded|qpa {
+qpa {
SOURCES += \
util/qsystemtrayicon_qpa.cpp
}
-!embedded:!qpa:!x11:mac {
+!qpa:!x11:mac {
OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm
}
diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
index 669b83830f..4cbcbe3983 100644
--- a/src/gui/widgets/widgets.pri
+++ b/src/gui/widgets/widgets.pri
@@ -144,7 +144,7 @@ SOURCES += \
widgets/qplaintextedit.cpp \
widgets/qprintpreviewwidget.cpp
-!embedded:!qpa:mac {
+!qpa:mac {
HEADERS += widgets/qmacnativewidget_mac.h \
widgets/qmaccocoaviewcontainer_mac.h
OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \