Skip to content

Commit 6cadaca

Browse files
committed
Fix file drop event cursor position reporting
Previously, file drop events always reported cursor position as (0,0) because the position was hardcoded. GLFW's drop callback does not provide cursor position directly, so we now query it using glfwGetCursorPos() at the time of the drop. This matches the approach used in GLFW's Windows backend, which updates the cursor position immediately before calling the drop callback. On X11, the cursor position is tracked during drag operations, so querying it at drop time provides the accurate drop location. Note: This is technically a separate bug fix but is included with the GLFW 3.4 upgrade to ensure file drop events work correctly for testing the upgraded GLFW integration.
1 parent b18a398 commit 6cadaca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cinder/app/linux/AppImplLinuxGlfw.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ class GlfwCallbacks {
317317
files.push_back( paths[i] );
318318
}
319319

320-
vec2 dropPoint = { 0, 0 }; // note: doesn't appear to be any way to get the drop position.
320+
// Get the cursor position at the time of the drop
321+
double xpos, ypos;
322+
::glfwGetCursorPos( glfwWindow, &xpos, &ypos );
323+
vec2 dropPoint = { static_cast<float>(xpos), static_cast<float>(ypos) };
321324
FileDropEvent dropEvent( getWindow(), dropPoint.x, dropPoint.y, files );
322325
getWindow()->emitFileDrop( &dropEvent );
323326
}

0 commit comments

Comments
 (0)