diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-06-07 13:35:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-06-07 15:50:54 +0200 |
commit | 1928e633a5712dd172d18f87214955692bdcf182 (patch) | |
tree | 5dfcba1f514cbdbe660e8f300cf8a7605b1a473b /src/plugins/platforms/xcb/qxcbclipboard.cpp | |
parent | ff53b1dcec761861f76c7528aafd42c9ce843d56 (diff) |
Fix some remaining issues with DnD
Do not set the event mask of the window
we drop onto to NO_EVENT. Always use the
clipboards requestor window to convert
selections.
Reviewed-by: Samuel
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbclipboard.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbclipboard.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 6ae0299547..06d80c5440 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -261,6 +261,9 @@ xcb_window_t QXcbClipboard::requestor() const 0, // value mask 0)); // value list + uint32_t mask = XCB_EVENT_MASK_PROPERTY_CHANGE; + xcb_change_window_attributes(m_connection->xcb_connection(), window, XCB_CW_EVENT_MASK, &mask); + that->setRequestor(window); } return m_requestor; @@ -731,23 +734,16 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb QByteArray QXcbClipboard::getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtAtom) { - QByteArray buf; - - xcb_window_t win = requestor(); -// qDebug() << "getDataInFormat" << m_connection->atomName(modeAtom) << m_connection->atomName(fmtAtom) << win; - - return getSelection(win, modeAtom, fmtAtom, m_connection->atom(QXcbAtom::_QT_SELECTION)); + return getSelection(modeAtom, fmtAtom, m_connection->atom(QXcbAtom::_QT_SELECTION)); } -QByteArray QXcbClipboard::getSelection(xcb_window_t win, xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property) +QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property) { QByteArray buf; - - uint32_t mask = XCB_EVENT_MASK_NO_EVENT; - xcb_change_window_attributes(m_connection->xcb_connection(), win, XCB_CW_EVENT_MASK, &mask); + xcb_window_t win = requestor(); xcb_delete_property(m_connection->xcb_connection(), win, property); - xcb_convert_selection(m_connection->xcb_connection(), win, selection, target, property, XCB_CURRENT_TIME); + xcb_convert_selection(m_connection->xcb_connection(), win, selection, target, property, m_connection->time()); m_connection->sync(); @@ -758,21 +754,14 @@ QByteArray QXcbClipboard::getSelection(xcb_window_t win, xcb_atom_t selection, x if (no_selection) return buf; - mask = XCB_EVENT_MASK_PROPERTY_CHANGE; - xcb_change_window_attributes(m_connection->xcb_connection(), win, XCB_CW_EVENT_MASK, &mask); - xcb_atom_t type; if (clipboardReadProperty(win, property, true, &buf, 0, &type, 0)) { if (type == m_connection->atom(QXcbAtom::INCR)) { - qDebug() << "INCR"; int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; buf = clipboardReadIncrementalProperty(win, property, nbytes, false); } } - mask = XCB_EVENT_MASK_NO_EVENT; - xcb_change_window_attributes(m_connection->xcb_connection(), win, XCB_CW_EVENT_MASK, &mask); - return buf; } |