summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-24 16:10:15 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-24 16:10:15 +0100
commit3b5c0bc0780f1749fed7c07bd8b691400a0282b7 (patch)
tree1022f5553ad5a0aca9b5f3b49ca38a01c2329d20 /src/plugins/platforms/xcb
parentc79918733a194ebbe5a2fe1617c884659f3e4b9f (diff)
parent21f1738a94fc8544ece04b3b1ee03a11986fe59b (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/gui/image/qjpeghandler.cpp Change-Id: I9db3acea7d5c82f5da679c8eaeb29431136665f0
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp15
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp20
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp12
-rw-r--r--src/plugins/platforms/xcb/xcb-plugin.pro5
9 files changed, 34 insertions, 43 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index eaa4d05311..c183deb3b8 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -130,7 +130,7 @@ static void updateFormatFromContext(QSurfaceFormat &format)
}
format.setProfile(QSurfaceFormat::NoProfile);
- format.setOption(QSurfaceFormat::FormatOptions());
+ format.setOptions(QSurfaceFormat::FormatOptions());
if (format.renderableType() == QSurfaceFormat::OpenGL) {
if (format.version() < qMakePair(3, 0)) {
@@ -211,7 +211,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat
// Don't bother with versions below ES 2.0
glVersions << 30 << 20;
// ES does not support any format option
- m_format.setOption(QSurfaceFormat::FormatOptions());
+ m_format.setOptions(QSurfaceFormat::FormatOptions());
}
Q_ASSERT(glVersions.count() > 0);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 030090d98d..a68ae8cf71 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -144,23 +144,23 @@ void QXcbConnection::updateScreens()
xcb_generic_error_t *error = NULL;
xcb_randr_get_output_primary_cookie_t primaryCookie =
xcb_randr_get_output_primary(xcb_connection(), xcbScreen->root);
- xcb_randr_get_screen_resources_current_cookie_t resourcesCookie =
- xcb_randr_get_screen_resources_current(xcb_connection(), xcbScreen->root);
+ xcb_randr_get_screen_resources_cookie_t resourcesCookie =
+ xcb_randr_get_screen_resources(xcb_connection(), xcbScreen->root);
xcb_randr_get_output_primary_reply_t *primary =
xcb_randr_get_output_primary_reply(xcb_connection(), primaryCookie, &error);
if (!primary || error) {
qWarning("QXcbConnection: Failed to get the primary output of the screen");
free(error);
} else {
- xcb_randr_get_screen_resources_current_reply_t *resources =
- xcb_randr_get_screen_resources_current_reply(xcb_connection(), resourcesCookie, &error);
+ xcb_randr_get_screen_resources_reply_t *resources =
+ xcb_randr_get_screen_resources_reply(xcb_connection(), resourcesCookie, &error);
if (!resources || error) {
qWarning("QXcbConnection: Failed to get the screen resources");
free(error);
} else {
xcb_timestamp_t timestamp = resources->config_timestamp;
- outputCount = xcb_randr_get_screen_resources_current_outputs_length(resources);
- xcb_randr_output_t *outputs = xcb_randr_get_screen_resources_current_outputs(resources);
+ outputCount = xcb_randr_get_screen_resources_outputs_length(resources);
+ xcb_randr_output_t *outputs = xcb_randr_get_screen_resources_outputs(resources);
for (int i = 0; i < outputCount; i++) {
xcb_randr_get_output_info_reply_t *output =
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 6042ec0f87..bcadcd1f02 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -872,7 +872,6 @@ void QXcbDrag::handleLeave(QWindow *w, const xcb_client_message_event_t *event)
}
QWindowSystemInterface::handleDrag(w,0,QPoint(),Qt::IgnoreAction);
- updateAction(Qt::IgnoreAction);
xdnd_dragsource = 0;
xdnd_types.clear();
@@ -1045,7 +1044,8 @@ void QXcbDrag::timerEvent(QTimerEvent* e)
- showing dialog box on drop event where user's response takes more time than XdndDropTransactionTimeout (QTBUG-14493)
- dnd takes unusually long time to process data
*/
- t.drag->deleteLater();
+ if (t.drag)
+ t.drag->deleteLater();
transactions.removeAt(i--);
} else {
stopTimer = false;
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index 537898db48..7b0d337e7c 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -156,7 +156,7 @@ private:
xcb_window_t proxy_target;
QWindow *targetWindow;
// QWidget *embedding_widget;
- QDrag *drag;
+ QPointer<QDrag> drag;
QTime time;
};
QVector<Transaction> transactions;
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index aaa2e81c40..0bab341914 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -396,7 +396,6 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
case QPlatformIntegration::CursorFlashTime:
case QPlatformIntegration::KeyboardInputInterval:
case QPlatformIntegration::MouseDoubleClickInterval:
- case QPlatformIntegration::StartDragDistance:
case QPlatformIntegration::StartDragTime:
case QPlatformIntegration::KeyboardAutoRepeatRate:
case QPlatformIntegration::PasswordMaskDelay:
@@ -406,6 +405,20 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
case QPlatformIntegration::PasswordMaskCharacter:
// TODO using various xcb, gnome or KDE settings
break; // Not implemented, use defaults
+ case QPlatformIntegration::StartDragDistance: {
+ // The default (in QPlatformTheme::defaultThemeHint) is 10 pixels, but
+ // on a high-resolution screen it makes sense to increase it.
+ const QList<QXcbScreen *> &screens = defaultConnection()->screens();
+ qreal dpi = 100.0;
+ if (screens.length() > 0) {
+ const QXcbScreen *screen = screens.at(defaultConnection()->primaryScreen());
+ if (screen->logicalDpi().first > dpi)
+ dpi = screen->logicalDpi().first;
+ if (screen->logicalDpi().second > dpi)
+ dpi = screen->logicalDpi().second;
+ }
+ return 10.0 * dpi / 100.0;
+ }
case QPlatformIntegration::ShowIsFullScreen:
// X11 always has support for windows, but the
// window manager could prevent it (e.g. matchbox)
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 966090dbd5..0a52640c9a 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -53,10 +53,6 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformcursor.h>
-#ifdef XKBCOMMON_0_2_0
-#include <xkbcommon_workaround.h>
-#endif
-
#ifndef XK_ISO_Left_Tab
#define XK_ISO_Left_Tab 0xFE20
#endif
@@ -1398,23 +1394,7 @@ QString QXcbKeyboard::keysymToUnicode(xcb_keysym_t sym) const
QByteArray chars;
int bytes;
chars.resize(7);
-
-#ifdef XKBCOMMON_0_2_0
- if (needWorkaround(sym)) {
- quint32 codepoint;
- if (sym == XKB_KEY_KP_Space)
- codepoint = XKB_KEY_space & 0x7f;
- else
- codepoint = sym & 0x7f;
-
- bytes = utf32_to_utf8(codepoint, chars.data());
- } else {
- bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
- }
-#else
bytes = xkb_keysym_to_utf8(sym, chars.data(), chars.size());
-#endif
-
if (bytes == -1)
qWarning("QXcbKeyboard::handleKeyEvent - buffer too small");
chars.resize(bytes-1);
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index b1ef3182ba..9f19841437 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -371,7 +371,6 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan
}
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry());
- QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), availableGeometry());
QWindowSystemInterface::handleScreenOrientationChange(QPlatformScreen::screen(), m_orientation);
QDpi ldpi = logicalDpi();
@@ -409,6 +408,8 @@ void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp)
m_availableGeometry = m_geometry & virtualAvailableGeometry;
}
free(workArea);
+
+ QWindowSystemInterface::handleScreenAvailableGeometryChange(QPlatformScreen::screen(), m_availableGeometry);
}
void QXcbScreen::updateRefreshRate()
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index aabcb84a08..d890398416 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1823,23 +1823,21 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
connection()->setTime(event->time);
const bool propertyDeleted = event->state == XCB_PROPERTY_DELETE;
- const xcb_atom_t netWmStateAtom = atom(QXcbAtom::_NET_WM_STATE);
- const xcb_atom_t wmStateAtom = atom(QXcbAtom::WM_STATE);
- if (event->atom == netWmStateAtom || event->atom == wmStateAtom) {
+ if (event->atom == atom(QXcbAtom::_NET_WM_STATE) || event->atom == atom(QXcbAtom::WM_STATE)) {
if (propertyDeleted)
return;
Qt::WindowState newState = Qt::WindowNoState;
- if (event->atom == wmStateAtom) { // WM_STATE: Quick check for 'Minimize'.
+ if (event->atom == atom(QXcbAtom::_NET_WM_STATE)) { // WM_STATE: Quick check for 'Minimize'.
const xcb_get_property_cookie_t get_cookie =
- xcb_get_property(xcb_connection(), 0, m_window, wmStateAtom,
+ xcb_get_property(xcb_connection(), 0, m_window, atom(QXcbAtom::_NET_WM_STATE),
XCB_ATOM_ANY, 0, 1024);
xcb_get_property_reply_t *reply =
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
- if (reply && reply->format == 32 && reply->type == wmStateAtom) {
+ if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::_NET_WM_STATE)) {
const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
newState = Qt::WindowMinimized;
@@ -1860,6 +1858,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
m_windowState = newState;
}
return;
+ } else if (event->atom == atom(QXcbAtom::_NET_WORKAREA) && event->window == m_screen->root()) {
+ m_screen->updateGeometry(event->time);
}
}
diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro
index bfbec91e3c..e19bb921e1 100644
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
@@ -131,12 +131,9 @@ contains(QT_CONFIG, xcb-qt) {
# libxkbcommon
contains(QT_CONFIG, xkbcommon-qt): {
+ QT_CONFIG += use-xkbcommon-x11support
include(../../../3rdparty/xkbcommon.pri)
} else {
LIBS += $$QMAKE_LIBS_XKBCOMMON
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
- equals(QMAKE_VERSION_XKBCOMMON, "0.2.0") {
- DEFINES += XKBCOMMON_0_2_0
- INCLUDEPATH += ../../../3rdparty/xkbcommon/xkbcommon/
- }
}