summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/embedded/qlock.cpp33
-rw-r--r--src/gui/embedded/qwslock.cpp13
-rw-r--r--src/gui/embedded/qwssignalhandler.cpp16
-rw-r--r--src/gui/kernel/qapplication_x11.cpp9
-rw-r--r--src/gui/kernel/qwidget_x11.cpp40
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp43
-rw-r--r--src/gui/styles/qstylehelper_p.h1
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/text/qzipwriter_p.h2
-rw-r--r--src/gui/util/qcompleter.cpp2
10 files changed, 88 insertions, 73 deletions
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
index b169a9b..d429b93 100644
--- a/src/gui/embedded/qlock.cpp
+++ b/src/gui/embedded/qlock.cpp
@@ -82,38 +82,27 @@ 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>
-#if defined(Q_OS_DARWIN)
-# define Q_NO_SEMAPHORE
-# include <sys/stat.h>
-# include <sys/file.h>
-#else // Q_OS_DARWIN
-# include <sys/sem.h>
-# if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) && !defined(QT_LINUXBASE)) \
- || defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD) \
- || defined(Q_OS_BSDI)
- /* union semun is defined by including <sys/sem.h> */
-# else
-/* according to X/OPEN we have to define it ourselves */
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */
- unsigned short *array; /* array for GETALL, SETALL */
-};
-# endif
-#endif // Q_OS_DARWIN
#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 <signal.h>
#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
QT_BEGIN_NAMESPACE
#define MAX_LOCKS 200 // maximum simultaneous read locks
@@ -177,7 +166,7 @@ QLock::QLock(const QString &filename, char id, bool create)
data->id = semget(semkey,0,0);
data->owned = create;
if (create) {
- semun arg; arg.val = 0;
+ 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);
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp
index 5841841..324d813 100644
--- a/src/gui/embedded/qwslock.cpp
+++ b/src/gui/embedded/qwslock.cpp
@@ -60,21 +60,14 @@
#endif
#include <unistd.h>
+#include <private/qcore_unix_p.h>
+
QT_BEGIN_NAMESPACE
#ifdef QT_NO_SEMAPHORE
#error QWSLock currently requires semaphores
#endif
-#ifndef Q_OS_BSD4
-union semun {
- int val;
- struct semid_ds *buf;
- unsigned short *array;
- struct seminfo *__buf;
-};
-#endif
-
QWSLock::QWSLock()
{
semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666);
@@ -85,7 +78,7 @@ QWSLock::QWSLock()
}
QWSSignalHandler::instance()->addSemaphore(semId);
- semun semval;
+ qt_semun semval;
semval.val = 1;
if (semctl(semId, BackingStore, SETVAL, semval) == -1) {
diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp
index 49b7e94..cc18beb 100644
--- a/src/gui/embedded/qwssignalhandler.cpp
+++ b/src/gui/embedded/qwssignalhandler.cpp
@@ -47,21 +47,13 @@
#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
-#ifndef Q_OS_BSD4
-union semun {
- int val;
- struct semid_ds *buf;
- unsigned short *array;
- struct seminfo *__buf;
-};
-#endif
-
-
class QWSSignalHandlerPrivate : public QWSSignalHandler
{
public:
@@ -106,7 +98,7 @@ void QWSSignalHandler::removeSemaphore(int semno)
{
const int index = semaphores.lastIndexOf(semno);
if (index != -1) {
- semun semval;
+ qt_semun semval;
semval.val = 0;
semctl(semaphores.at(index), 0, IPC_RMID, semval);
semaphores.remove(index);
@@ -121,7 +113,7 @@ void QWSSignalHandler::handleSignal(int signum)
signal(signum, h->oldHandlers[signum]);
#ifndef QT_NO_QWS_MULTIPROCESS
- semun semval;
+ qt_semun semval;
semval.val = 0;
for (int i = 0; i < h->semaphores.size(); ++i)
semctl(h->semaphores.at(i), 0, IPC_RMID, semval);
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 31f70c7..20542ea 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -2281,6 +2281,13 @@ void qt_init(QApplicationPrivate *priv, int,
// Attempt to determine the current running X11 Desktop Enviornment
// Use dbus if/when we can, but fall back to using windowManagerName() for now
+#ifndef QT_NO_XFIXES
+ if (X11->ptrXFixesSelectSelectionInput)
+ X11->ptrXFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0),
+ XFixesSetSelectionOwnerNotifyMask
+ | XFixesSelectionWindowDestroyNotifyMask
+ | XFixesSelectionClientCloseNotifyMask);
+#endif // QT_NO_XFIXES
X11->compositingManagerRunning = XGetSelectionOwner(X11->display,
ATOM(_NET_WM_CM_S0));
X11->desktopEnvironment = DE_UNKNOWN;
@@ -3216,6 +3223,8 @@ int QApplication::x11ProcessEvent(XEvent* event)
XFixesSelectionNotifyEvent *req =
reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
X11->time = req->selection_timestamp;
+ if (req->selection == ATOM(_NET_WM_CM_S0))
+ X11->compositingManagerRunning = req->owner;
}
#endif
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index c6753fc..5ece7d6 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1333,12 +1333,40 @@ QPoint QWidgetPrivate::mapFromGlobal(const QPoint &pos) const
QPoint QWidget::mapToGlobal(const QPoint &pos) const
{
Q_D(const QWidget);
+ QPoint offset = data->crect.topLeft();
+ const QWidget *w = this;
+ const QWidget *p = w->parentWidget();
+ while (!w->isWindow() && p) {
+ w = p;
+ p = p->parentWidget();
+ offset += w->data->crect.topLeft();
+ }
+
+ const QWidgetPrivate *wd = w->d_func();
+ QTLWExtra *tlw = wd->topData();
+ if (!tlw->embedded)
+ return pos + offset;
+
return d->mapToGlobal(pos);
}
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
{
Q_D(const QWidget);
+ QPoint offset = data->crect.topLeft();
+ const QWidget *w = this;
+ const QWidget *p = w->parentWidget();
+ while (!w->isWindow() && p) {
+ w = p;
+ p = p->parentWidget();
+ offset += w->data->crect.topLeft();
+ }
+
+ const QWidgetPrivate *wd = w->d_func();
+ QTLWExtra *tlw = wd->topData();
+ if (!tlw->embedded)
+ return pos - offset;
+
return d->mapFromGlobal(pos);
}
@@ -1352,9 +1380,15 @@ void QWidgetPrivate::updateSystemBackground()
if (brush.style() == Qt::NoBrush
|| q->testAttribute(Qt::WA_NoSystemBackground)
|| q->testAttribute(Qt::WA_UpdatesDisabled)
- || type == Qt::Popup || type == Qt::ToolTip
- )
- XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), XNone);
+ || type == Qt::Popup || type == Qt::ToolTip) {
+ if (QX11Info::isCompositingManagerRunning()
+ && q->testAttribute(Qt::WA_TranslucentBackground)
+ && !(q->parent()))
+ XSetWindowBackground(X11->display, q->internalWinId(),
+ QColormap::instance(xinfo.screen()).pixel(Qt::transparent));
+ else
+ XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), XNone);
+ }
else if (brush.style() == Qt::SolidPattern && brush.isOpaque())
XSetWindowBackground(X11->display, q->internalWinId(),
QColormap::instance(xinfo.screen()).pixel(brush.color()));
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 8a2a88b..cc5fe10 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -68,9 +68,6 @@
#include <qlibrary.h>
#include <private/qstylehelper_p.h>
-#define CL_MAX(a,b) (a)>(b) ? (a):(b) // ### qMin/qMax does not work for vc6
-#define CL_MIN(a,b) (a)<(b) ? (a):(b) // remove this when it is working
-
QT_BEGIN_NAMESPACE
using namespace QStyleHelper;
@@ -533,8 +530,8 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi
{
QColor dark;
dark.setHsv(option->palette.button().color().hue(),
- CL_MIN(255, (int)(option->palette.button().color().saturation()*1.9)),
- CL_MIN(255, (int)(option->palette.button().color().value()*0.7)));
+ qMin(255, (int)(option->palette.button().color().saturation()*1.9)),
+ qMin(255, (int)(option->palette.button().color().value()*0.7)));
QColor highlight = option->palette.highlight().color();
@@ -691,11 +688,11 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QColor darkOutline;
QColor dark;
darkOutline.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*3.0)),
- CL_MIN(255, (int)(button.value()*0.6)));
+ qMin(255, (int)(button.saturation()*3.0)),
+ qMin(255, (int)(button.value()*0.6)));
dark.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*1.9)),
- CL_MIN(255, (int)(button.value()*0.7)));
+ qMin(255, (int)(button.saturation()*1.9)),
+ qMin(255, (int)(button.value()*0.7)));
QColor tabFrameColor = mergedColors(option->palette.background().color(),
dark.lighter(135), 60);
@@ -1117,8 +1114,8 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QColor gradientMidColor = option->palette.button().color();
QColor gradientStopColor;
gradientStopColor.setHsv(buttonColor.hue(),
- CL_MIN(255, (int)(buttonColor.saturation()*1.9)),
- CL_MIN(255, (int)(buttonColor.value()*0.96)));
+ qMin(255, (int)(buttonColor.saturation()*1.9)),
+ qMin(255, (int)(buttonColor.value()*0.96)));
QRect gradRect = rect.adjusted(1, 2, -1, -2);
// gradient fill
@@ -1384,12 +1381,12 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
QColor button = option->palette.button().color();
QColor dark;
dark.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*1.9)),
- CL_MIN(255, (int)(button.value()*0.7)));
+ qMin(255, (int)(button.saturation()*1.9)),
+ qMin(255, (int)(button.value()*0.7)));
QColor darkOutline;
darkOutline.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*2.0)),
- CL_MIN(255, (int)(button.value()*0.6)));
+ qMin(255, (int)(button.saturation()*2.0)),
+ qMin(255, (int)(button.value()*0.6)));
QRect rect = option->rect;
QColor shadow = mergedColors(option->palette.background().color().darker(120),
dark.lighter(130), 60);
@@ -1662,8 +1659,8 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
QColor gradientStopColor;
QColor gradientStartColor = option->palette.button().color();
gradientStopColor.setHsv(gradientStartColor.hue(),
- CL_MIN(255, (int)(gradientStartColor.saturation()*2)),
- CL_MIN(255, (int)(gradientStartColor.value()*0.96)));
+ qMin(255, (int)(gradientStartColor.saturation()*2)),
+ qMin(255, (int)(gradientStartColor.value()*0.96)));
QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
if (option->palette.background().gradient()) {
gradient.setStops(option->palette.background().gradient()->stops());
@@ -2425,14 +2422,14 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QColor grooveColor;
QColor darkOutline;
dark.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*1.9)),
- CL_MIN(255, (int)(button.value()*0.7)));
+ qMin(255, (int)(button.saturation()*1.9)),
+ qMin(255, (int)(button.value()*0.7)));
grooveColor.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*2.6)),
- CL_MIN(255, (int)(button.value()*0.9)));
+ qMin(255, (int)(button.saturation()*2.6)),
+ qMin(255, (int)(button.value()*0.9)));
darkOutline.setHsv(button.hue(),
- CL_MIN(255, (int)(button.saturation()*3.0)),
- CL_MIN(255, (int)(button.value()*0.6)));
+ qMin(255, (int)(button.saturation()*3.0)),
+ qMin(255, (int)(button.value()*0.6)));
QColor alphaCornerColor;
if (widget) {
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 559f7f7..27587e3 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -110,6 +110,7 @@ template <typename T>
enum { ExactSize = true };
static int size(const HexString<T> &) { return sizeof(T) * 2; }
static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
+ typedef QString ConvertTo;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 0f7edae..9f21886 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -572,7 +572,7 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
"directory",
"file ",
"symlink " };
- ZDEBUG() << "adding" << entryTypes[type] <<":" << fileName.toUtf8().data() << (type == 2 ? (" -> " + contents).constData() : "");
+ ZDEBUG() << "adding" << entryTypes[type] <<":" << fileName.toUtf8().data() << (type == 2 ? QByteArray(" -> " + contents).constData() : "");
#endif
if (! (device->isOpen() || device->open(QIODevice::WriteOnly))) {
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
index 0ee445e..153ef19 100644
--- a/src/gui/text/qzipwriter_p.h
+++ b/src/gui/text/qzipwriter_p.h
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
class QZipWriterPrivate;
-class Q_AUTOTEST_EXPORT QZipWriter
+class Q_GUI_EXPORT QZipWriter
{
public:
QZipWriter(const QString &fileName, QIODevice::OpenMode mode = (QIODevice::WriteOnly | QIODevice::Truncate) );
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 27684bf..0cb3bbd 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -926,7 +926,7 @@ void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path)
// If we hide the popup because there was no match because the model was not loaded yet,
// we re-start the completion when we get the results
if (hiddenBecauseNoMatch
- && prefix.startsWith(path) && prefix != (path + '/')
+ && prefix.startsWith(path) && prefix != (path + QLatin1Char('/'))
&& widget) {
q->complete();
}