summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2015-11-10 15:41:55 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2015-11-10 15:41:55 +0100
commitf27d262b62223970fca30b38eb4041bbcff03f93 (patch)
tree32c56599561e18106feeb6a9a2e2c9fbad90d6ec
parentd590a0e0a1025c1679bae7809f2a429942d34318 (diff)
downloadqtbase-f27d262b62223970fca30b38eb4041bbcff03f93.tar.gz
qtbase-f27d262b62223970fca30b38eb4041bbcff03f93.tar.bz2
qtbase-f27d262b62223970fca30b38eb4041bbcff03f93.zip
xcb: Added Tizen 2.3 adaptation
Adaptation includes: * Application lifecycle depending on X atoms. Tizen 2.3 native application lifecycle depends on X window. So we react on _X_ILLUME_ACTIVATE|DEACTIVATE_WINDOW atoms and suspend or activate application accordingly. * Platform native interface function for setting device orientation. This api is defined in QtPlatformHeaders/qxcbfunctions.h and can be used from Tizen application wrapper code. Change-Id: I0105717dcb4f652dd27e891a5f6c21388d8399ca Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
-rw-r--r--src/platformheaders/xcbfunctions/qxcbwindowfunctions.h10
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp20
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp24
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h1
6 files changed, 64 insertions, 0 deletions
diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
index 0db2e2a09d..a5a1b55bb4 100644
--- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
+++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
@@ -107,6 +107,16 @@ public:
return func(window);
return UINT_MAX;
}
+
+ typedef void (*SetDeviceOrientationType)(Qt::ScreenOrientation orientation);
+ static const QByteArray setDeviceOrientationTypeIdentifier() { return QByteArrayLiteral("XcbSetDeviceOrientationType"); }
+
+ static void setDeviceOrientation(Qt::ScreenOrientation orientation)
+ {
+ SetDeviceOrientationType func = reinterpret_cast<SetDeviceOrientationType>(QGuiApplication::platformFunction(setDeviceOrientationTypeIdentifier()));
+ if (func)
+ func(orientation);
+ }
};
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index e612cff9a3..8da78d3558 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1533,6 +1533,20 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *
if (!window)
return;
+#ifdef Q_OS_LINUX_TIZEN
+ if (event->type == atom(QXcbAtom::_X_ILLUME_DEACTIVATE_WINDOW)) {
+ QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended);
+ return;
+ } if (event->type == atom(QXcbAtom::_X_ILLUME_ACTIVATE_WINDOW)) {
+ QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive);
+ return;
+ } else if (event->type == atom(QXcbAtom::_E_COMP_FLUSH)
+ || event->type == atom(QXcbAtom::_NET_CM_WINDOW_EFFECT_CLIENT_STATE)) {
+ //silence the Tizen Mobile X11 WM messages for now
+ return;
+ }
+#endif // Q_OS_LINUX_TIZEN
+
window->handleClientMessageEvent(event);
}
@@ -1740,6 +1754,12 @@ static const char * xcb_atomnames = {
"Rel Vert Wheel\0"
"Rel Horiz Scroll\0"
"Rel Vert Scroll\0"
+#ifdef Q_OS_LINUX_TIZEN
+ "_E_COMP_FLUSH\0"
+ "_NET_CM_WINDOW_EFFECT_CLIENT_STATE\0"
+ "_X_ILLUME_ACTIVATE_WINDOW\0"
+ "_X_ILLUME_DEACTIVATE_WINDOW\0"
+#endif
"_XSETTINGS_SETTINGS\0"
"_COMPIZ_DECOR_PENDING\0"
"_COMPIZ_DECOR_REQUEST\0"
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 4a0348aa0c..9ef0ed4e3d 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -281,6 +281,12 @@ namespace QXcbAtom {
RelHorizScroll,
RelVertScroll,
+#ifdef Q_OS_LINUX_TIZEN
+ _E_COMP_FLUSH,
+ _NET_CM_WINDOW_EFFECT_CLIENT_STATE,
+ _X_ILLUME_ACTIVATE_WINDOW,
+ _X_ILLUME_DEACTIVATE_WINDOW,
+#endif
_XSETTINGS_SETTINGS,
_COMPIZ_DECOR_PENDING,
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index c94fd27826..6c8c314ab1 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -251,6 +251,9 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ForeignWindows: return true;
case SyncState: return true;
case RasterGLSurface: return true;
+#ifdef Q_OS_LINUX_TIZEN
+ case ApplicationState: return true;
+#endif
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index dfb0a125e2..5d6611fb33 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -338,6 +338,26 @@ QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterf
return func;
}
+static void _setDeviceOrientation(Qt::ScreenOrientation orientation) {
+ //QMetaObject::invokeMethod method is used here because it is possible
+ //and very probable that this function will be invoked from non-Gui thread.
+ //This way thread safety is guqranteed in easy way
+ QMetaObject::invokeMethod(QGuiApplication::platformNativeInterface(),
+ "setDeviceOrientation",
+ Q_ARG(int, orientation));
+}
+
+void QXcbNativeInterface::setDeviceOrientation(int orientation) {
+ //This slot is private and supposed to be invoked only by _setDeviceOrientation function
+ Qt::ScreenOrientation screenOrientation = (Qt::ScreenOrientation) orientation;
+ QScreen *screen = QGuiApplication::primaryScreen();
+ if (screen)
+ QWindowSystemInterface::handleScreenOrientationChange(screen, screenOrientation);
+ else
+ qWarning() << "Can't set device orientation to:" << qPrintable(screenOrientation)
+ << "because there is no primary screen";
+}
+
QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &function) const
{
const QByteArray lowerCaseFunction = function.toLower();
@@ -346,6 +366,10 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio
return func;
//case sensitive
+ if (function == QXcbFunctions::setDeviceOrientationTypeIdentifier())
+ //Pointer to static function is returned because - see comment in that function
+ return QFunctionPointer(_setDeviceOrientation);
+
if (function == QXcbWindowFunctions::setWmWindowTypeIdentifier())
return QFunctionPointer(QXcbWindowFunctions::SetWmWindowType(QXcbWindow::setWmWindowTypeStatic));
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index f88b710864..58d2c1eb33 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -119,6 +119,7 @@ signals:
private:
xcb_window_t locateSystemTray(xcb_connection_t *conn, const QXcbScreen *screen);
+ Q_INVOKABLE void setDeviceOrientation(int orientation);
const QByteArray m_genericEventFilterType;