From 03fd3a8f34679793b87a5d901202ea2805b89d84 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 1 Oct 2012 12:13:10 +0200 Subject: [PATCH] Fixed xdnd protocol-version detection code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug introduced when porting from Xlib to xcb. Xcb returns actual number of bytes read while Xlib returns number of 8-bit, 16-bit, or 32-bit items stored in the returned data. Task-number: QTBUG-27403 Change-Id: Ia64da1953ec7be8d32cc591565cd1b41ce8d7dbb Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbdrag.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 4c9b1209ec..ab4489af61 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -414,9 +414,9 @@ void QXcbDrag::move(const QMouseEvent *me) xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); if (!reply || reply->type == XCB_NONE) target = 0; - target_version = xcb_get_property_value_length(reply) == 1 ? *(uint32_t *)xcb_get_property_value(reply) : 1; - if (target_version > xdnd_version) - target_version = xdnd_version; + + target_version = *(uint32_t *)xcb_get_property_value(reply); + target_version = qMin(xdnd_version, target_version ? target_version : 1); free(reply); }