diff options
author | Tomasz Olszak <olszak.tomasz@gmail.com> | 2015-02-26 15:41:17 +0100 |
---|---|---|
committer | Tomasz Olszak <olszak.tomasz@gmail.com> | 2015-02-26 15:41:17 +0100 |
commit | dbe2a454058a26c59aa81ec31e8a9c83ac36fa66 (patch) | |
tree | 3e639978b72ab164fae3bca49e38673d5c6cb25c | |
parent | ea69e4f1c9b70c3e6e125a55d763c8376fa1ba55 (diff) | |
download | qtbase-dbe2a454058a26c59aa81ec31e8a9c83ac36fa66.tar.gz qtbase-dbe2a454058a26c59aa81ec31e8a9c83ac36fa66.tar.bz2 qtbase-dbe2a454058a26c59aa81ec31e8a9c83ac36fa66.zip |
Tizen: Added screen orientation handling in xcb plugin.
X Window events sent by Window Manager are used.
Change-Id: I06970059a003326ddda94cf07d8822f14af5cadc
Reviewed-by: Jarosław Staniek <staniek@kde.org>
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 52 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 12 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 6 |
3 files changed, 68 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7b2a37239a..63f8d42d1d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -32,6 +32,7 @@ ****************************************************************************/ #include <QtGui/private/qguiapplication_p.h> +#include <private/qmath_p.h> #include <QtCore/QDebug> #include "qxcbconnection.h" @@ -1324,6 +1325,45 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t * drag()->handleFinished(event); } #endif + +#ifdef Q_OS_LINUX_TIZEN + if (event->type == atom(QXcbAtom::_X_ILLUME_DEACTIVATE_WINDOW)) { + QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationHidden); + return; + } else if (event->type == atom(QXcbAtom::_E_WINDOW_ROTATION_CHANGE_PREPARE)) { + xcb_client_message_event_t reply = *event; + reply.response_type = XCB_CLIENT_MESSAGE; + reply.type = atom(QXcbAtom::_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE); + xcb_send_event(xcb_connection(), 0, reply.window, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY| XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&reply); + xcb_flush(xcb_connection()); + return; + } else if (event->type == atom(QXcbAtom::_E_WINDOW_ROTATION_CHANGE_REQUEST)) { + xcb_client_message_event_t reply = *event; + reply.response_type = XCB_CLIENT_MESSAGE; + reply.type = atom(QXcbAtom::_E_WINDOW_ROTATION_CHANGE_DONE); + + xcb_randr_screen_change_notify_event_t e; + e.config_timestamp = (xcb_timestamp_t)QDateTime::currentMSecsSinceEpoch(); + switch (reply.data.data32[1]) { + case 0: e.rotation = XCB_RANDR_ROTATION_ROTATE_90; break; + case 90: e.rotation = XCB_RANDR_ROTATION_ROTATE_180; break; + case 180: e.rotation = XCB_RANDR_ROTATION_ROTATE_270; break; + case 270: e.rotation = XCB_RANDR_ROTATION_ROTATE_0; break; + } + + QXcbScreen *scrn = m_screens.at(primaryScreen()); + e.width = scrn->geometry().width(); + e.height = scrn->geometry().height(); + e.mwidth = scrn->logicalDpi().first/Q_MM_PER_INCH/e.width; + e.mheight = scrn->logicalDpi().second/Q_MM_PER_INCH/e.height; + scrn->handleScreenChange(&e); + xcb_send_event(xcb_connection(), 0, reply.window, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY| XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&reply); + xcb_flush(xcb_connection()); + return; + } +#endif // Q_OS_LINUX_TIZEN + + if (m_systemTrayTracker && event->type == atom(QXcbAtom::MANAGER)) m_systemTrayTracker->notifyManagerClientMessageEvent(event); @@ -1538,7 +1578,17 @@ static const char * xcb_atomnames = { "Rel Vert Scroll\0" #ifdef Q_OS_LINUX_TIZEN "_X_ILLUME_DEACTIVATE_WINDOW\0" -#endif + "_E_WINDOW_ROTATION_AVAILABLE_LIST\0" + "_E_ILLUME_ROTATE_WINDOW_ANGLE\0" + "_E_WINDOW_ROTATION_PREFERRED_ROTATION\0" + "_E_ILLUME_ROTATE_ROOT_ANGLE\0" + "_E_WINDOW_ROTATION_SUPPORTED\0" + "_E_WINDOW_ROTATION_CHANGE_PREPARE\0" + "_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE\0" + "_E_WINDOW_ROTATION_CHANGE_REQUEST\0" + "_E_WINDOW_ROTATION_CHANGE_DONE\0" + "_E_WINDOW_ROTATION_APP_SUPPORTED\0" +#endif //Q_OS_LINUX_TIZEN "_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 b5082852e4..e22efcee2b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -275,7 +275,17 @@ namespace QXcbAtom { #ifdef Q_OS_LINUX_TIZEN _X_ILLUME_DEACTIVATE_WINDOW, -#endif + _E_WINDOW_ROTATION_AVAILABLE_LIST, + _E_ILLUME_ROTATE_WINDOW_ANGLE, + _E_WINDOW_ROTATION_PREFERRED_ROTATION, + _E_ILLUME_ROTATE_ROOT_ANGLE, + _E_WINDOW_ROTATION_SUPPORTED, + _E_WINDOW_ROTATION_CHANGE_PREPARE, + _E_WINDOW_ROTATION_CHANGE_PREPARE_DONE, + _E_WINDOW_ROTATION_CHANGE_REQUEST, + _E_WINDOW_ROTATION_CHANGE_DONE, + _E_WINDOW_ROTATION_APP_SUPPORTED, +#endif //Q_OS_LINUX_TIZEN _XSETTINGS_SETTINGS, _COMPIZ_DECOR_PENDING, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 8dbebb7384..e3e04178cc 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -536,6 +536,12 @@ void QXcbWindow::create() atom(QXcbAtom::_XEMBED_INFO), 32, 2, (void *)data)); +#ifdef Q_OS_LINUX_TIZEN + int set = 1; + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + atom(QXcbAtom::_E_WINDOW_ROTATION_SUPPORTED), XCB_ATOM_CARDINAL, 32, + 1, &set)); +#endif //Q_OS_LINUX_TIZEN #if defined(XCB_USE_XINPUT2) connection()->xi2Select(m_window); |