summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbdrag.cpp
diff options
context:
space:
mode:
authorTim Blechmann <[email protected]>2025-10-06 12:29:05 +0800
committerLiang Qi <[email protected]>2025-10-06 14:06:03 +0000
commitbbc579410a896d461868707b373bef1a5d48573c (patch)
treea0dea331c35800a596c3616663f8df3df636527f /src/plugins/platforms/xcb/qxcbdrag.cpp
parent5450e813158ff759bc10b908f67866d45fcbd16b (diff)
xcb: QXcbDrag - avoid excessive calls to currentDrag()
The code is easier to read/debug when the result of currentDragObject is stored in a local variable. This also avoids going through the singleton initialization code more often than necessary. Pick-to: 6.10 Change-Id: I1bfd31fd0f777ff5fa63b1baef7183495c6f2b81 Reviewed-by: Liang Qi <[email protected]>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbdrag.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 3be615d6ecf..b4c12ed1a0c 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -987,10 +987,12 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
if (dropData && dropData->hasImage())
dropData = 0;
}
+
+ const QDrag *currentDragObject = currentDrag();
// if we can't find it, then use the data in the drag manager
- if (currentDrag()) {
+ if (currentDragObject) {
if (!dropData)
- dropData = currentDrag()->mimeData();
+ dropData = currentDragObject->mimeData();
supported_drop_actions = Qt::DropActions(l[4]);
} else {
if (!dropData)
@@ -1001,8 +1003,8 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
if (!dropData)
return;
- auto buttons = currentDrag() ? b : connection()->queryMouseButtons();
- auto modifiers = currentDrag() ? mods : connection()->keyboard()->queryKeyboardModifiers();
+ auto buttons = currentDragObject ? b : connection()->queryMouseButtons();
+ auto modifiers = currentDragObject ? mods : connection()->keyboard()->queryKeyboardModifiers();
QPlatformDropQtResponse response = QWindowSystemInterface::handleDrop(
currentWindow.data(), dropData, currentPosition, supported_drop_actions,