Fixed xdnd protocol-version detection code

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 <samuel.rodal@digia.com>
This commit is contained in:
Gatis Paeglis 2012-10-01 12:13:10 +02:00 committed by The Qt Project
parent ad41111167
commit 03fd3a8f34

View File

@ -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);
}