From 007f6200018365c69647fe6708fc751fd4c6af33 Mon Sep 17 00:00:00 2001 From: Tomasz Olszak Date: Thu, 26 Feb 2015 15:40:58 +0100 Subject: Tizen - handling application lifecycle Change-Id: I47763f2d42e400df3e0e60515468ada8c8546128 Reviewed-by: Friedemann Kleint Reviewed-by: Tomasz Olszak --- src/plugins/platforms/xcb/qxcbconnection.cpp | 3 +++ src/plugins/platforms/xcb/qxcbconnection.h | 3 +++ src/plugins/platforms/xcb/qxcbintegration.cpp | 33 +++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++++ src/plugins/platforms/xcb/xcb-plugin.pro | 2 ++ 5 files changed, 45 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5510c3b1b4..7b2a37239a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1536,6 +1536,9 @@ static const char * xcb_atomnames = { "Rel Vert Wheel\0" "Rel Horiz Scroll\0" "Rel Vert Scroll\0" +#ifdef Q_OS_LINUX_TIZEN + "_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 7286b6b89b..b5082852e4 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -273,6 +273,9 @@ namespace QXcbAtom { RelHorizScroll, RelVertScroll, +#ifdef Q_OS_LINUX_TIZEN + _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 f0c4a7f691..12d7ff3f54 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -88,6 +88,10 @@ #endif #endif +#ifdef Q_OS_LINUX_TIZEN +#include +#endif // Q_OS_LINUX_TIZEN + #include QT_BEGIN_NAMESPACE @@ -118,12 +122,38 @@ static bool runningUnderDebugger() #endif } +#ifdef Q_OS_LINUX_TIZEN +static int aul_handler(aul_type type, bundle *, void *) +{ + switch (type) { + case AUL_START: + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationActive); + break; + case AUL_RESUME: + if (!QGuiApplication::topLevelWindows().isEmpty()) + QGuiApplication::topLevelWindows().first()->requestActivate(); + break; + case AUL_TERMINATE: + QCoreApplication::quit(); + break; + } + return 0; +} +#endif // Q_OS_LINUX_TIZEN + QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char **argv) : m_services(new QGenericUnixServices) , m_instanceName(0) , m_canGrab(true) { + qRegisterMetaType(); + +#ifdef Q_OS_LINUX_TIZEN + aul_launch_init(aul_handler, 0); + aul_launch_argv_handler(argc, argv); +#endif // Q_OS_LINUX_TIZEN + #ifdef XCB_USE_XLIB XInitThreads(); #endif @@ -321,6 +351,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/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 00942787d9..8dbebb7384 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1838,6 +1838,10 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even || event->type == atom(QXcbAtom::WM_CHANGE_STATE)) { // Ignore _NET_WM_STATE, MANAGER which are relate to tray icons // and other messages. +#ifdef Q_OS_LINUX_TIZEN + } else if (event->type == atom(QXcbAtom::_X_ILLUME_DEACTIVATE_WINDOW)) { + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationHidden); +#endif // Q_OS_LINUX_TIZEN } else if (event->type == atom(QXcbAtom::_COMPIZ_DECOR_PENDING) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_REQUEST) || event->type == atom(QXcbAtom::_COMPIZ_DECOR_DELETE_PIXMAP)) { diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 129076c916..7cfbe40ea8 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -119,3 +119,5 @@ contains(QT_CONFIG, xkbcommon-qt): { LIBS += $$QMAKE_LIBS_XKBCOMMON QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON } + +tizen:LIBS += -laul -- cgit v1.2.3