1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Qt5: X11: Fixed moving windows to virtual desktops

Moving windows to virtual desktops upon restoring
session.
This commit is contained in:
nowrep 2012-12-22 15:01:55 +01:00
parent bdc9a0417a
commit 02ea92ad28
5 changed files with 30 additions and 11 deletions

View File

@ -83,12 +83,12 @@
#if QT_VERSION < 0x050000
#include "qwebkitversion.h"
#endif
#ifdef QZ_WS_X11
#include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif // QZ_WS_X11
#endif // QT_VERSION
#endif
const QString QupZilla::VERSION = "1.3.5";
const QString QupZilla::BUILDTIME = __DATE__" "__TIME__;
@ -1913,7 +1913,7 @@ bool QupZilla::quitApp()
QByteArray QupZilla::saveState(int version) const
{
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
#ifdef QZ_WS_X11
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
@ -1928,7 +1928,7 @@ QByteArray QupZilla::saveState(int version) const
bool QupZilla::restoreState(const QByteArray &state, int version)
{
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
#ifdef QZ_WS_X11
QByteArray windowState;
int desktopId = -1;
@ -1944,10 +1944,10 @@ bool QupZilla::restoreState(const QByteArray &state, int version)
#endif
}
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
#ifdef QZ_WS_X11
int QupZilla::getCurrentVirtualDesktop() const
{
Display* display = QX11Info::display();
Display* display = static_cast<Display*>(qz_X11Display(this));
Atom actual_type;
int actual_format;
unsigned long nitems;
@ -1980,7 +1980,7 @@ void QupZilla::moveToVirtualDesktop(int desktopId)
return;
}
Display* display = QX11Info::display();
Display* display = static_cast<Display*>(qz_X11Display(this));
Atom net_wm_desktop = XInternAtom(display, "_NET_WM_DESKTOP", False);
if (net_wm_desktop == None) {
@ -1988,7 +1988,8 @@ void QupZilla::moveToVirtualDesktop(int desktopId)
}
// Fixes issue when the property wasn't set on some X servers
setVisible(true);
// hmmm does it?
//setVisible(true);
XChangeProperty(display, winId(), net_wm_desktop, XA_CARDINAL,
32, PropModeReplace, (unsigned char*) &desktopId, 1L);

View File

@ -214,7 +214,7 @@ private:
bool eventFilter(QObject* object, QEvent* event);
#endif
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
#ifdef QZ_WS_X11
int getCurrentVirtualDesktop() const;
void moveToVirtualDesktop(int desktopId);
#endif

View File

@ -1,5 +1,5 @@
isEqual(QT_MAJOR_VERSION, 5) {
QT += webkitwidgets network widgets printsupport sql script
QT += webkitwidgets network widgets printsupport sql script gui-private
} else {
QT += core gui webkit sql network script
}

View File

@ -34,6 +34,9 @@
#if QT_VERSION >= 0x050000
#include <QUrlQuery>
#include <qpa/qplatformnativeinterface.h>
#else
#include <QX11Info>
#endif
QByteArray qz_pixmapToByteArray(const QPixmap &pix)
@ -379,6 +382,17 @@ QString QT_QUPZILLA_EXPORT qz_escape(const QString &string)
#endif
}
void QT_QUPZILLA_EXPORT* qz_X11Display(const QWidget* widget)
{
Q_UNUSED(widget)
#if QT_VERSION >= 0x050000
return qApp->platformNativeInterface()->nativeResourceForWindow("display", widget->windowHandle());
#else
return QX11Info::display();
#endif
}
QString qz_buildSystem()
{
#ifdef Q_OS_LINUX

View File

@ -61,6 +61,10 @@ QString QT_QUPZILLA_EXPORT qz_buildSystem();
bool QT_QUPZILLA_EXPORT qz_isCertificateValid(const QSslCertificate &cert);
QString QT_QUPZILLA_EXPORT qz_escape(const QString &string);
#ifdef QZ_WS_X11
void QT_QUPZILLA_EXPORT* qz_X11Display(const QWidget* widget);
#endif
template <typename T>
bool qz_listContainsIndex(const QList<T> &list, int index)
{