Skip to content

Commit 649732c

Browse files
authored
Merge pull request #1872 from richardeakin/glfw_filedrop
added filedrop event support on linux
2 parents 0e39f04 + 59d2f54 commit 649732c

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/cinder/app/linux/AppImplLinuxGlfw.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class GlfwCallbacks {
4545
::glfwSetCursorPosCallback( glfwWindow, GlfwCallbacks::onMousePos );
4646
::glfwSetMouseButtonCallback( glfwWindow, GlfwCallbacks::onMouseButton );
4747
::glfwSetScrollCallback( glfwWindow, GlfwCallbacks::onMouseWheel );
48+
::glfwSetDropCallback( glfwWindow, GlfwCallbacks::onFileDrop );
4849
}
4950

5051
static void unregisterWindowEvents( GLFWwindow *glfwWindow ) {
@@ -273,6 +274,18 @@ class GlfwCallbacks {
273274
cinderWindow->emitMouseWheel( &event );
274275
}
275276
}
277+
278+
static void onFileDrop( GLFWwindow *glfwWindow, int count, const char **paths )
279+
{
280+
std::vector<fs::path> files;
281+
for( int i = 0; i < count; i++ ) {
282+
files.push_back( paths[i] );
283+
}
284+
285+
vec2 dropPoint = { 0, 0 }; // note: doesn't appear to be any way to get the drop position.
286+
FileDropEvent dropEvent( getWindow(), dropPoint.x, dropPoint.y, files );
287+
getWindow()->emitFileDrop( &dropEvent );
288+
}
276289
};
277290

278291
std::map<GLFWwindow*, std::pair<AppImplLinux*,WindowRef>> GlfwCallbacks::sWindowMapping;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required( VERSION 3.0 FATAL_ERROR )
2+
set( CMAKE_VERBOSE_MAKEFILE ON )
3+
4+
project( audio-SampleTest )
5+
6+
get_filename_component( CINDER_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../../.." ABSOLUTE )
7+
get_filename_component( APP_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../" ABSOLUTE )
8+
9+
include( "${CINDER_PATH}/proj/cmake/modules/cinderMakeApp.cmake" )
10+
11+
set( APP_SOURCES
12+
${APP_PATH}/src/SampleTestApp.cpp
13+
${CINDER_PATH}/samples/_audio/common/AudioDrawUtils.cpp
14+
)
15+
16+
ci_make_app(
17+
SOURCES ${APP_SOURCES}
18+
CINDER_PATH ${CINDER_PATH}
19+
INCLUDES ${APP_PATH}/include
20+
RESOURCES ${APP_PATH}/../data/tone440L220R.wav
21+
)

0 commit comments

Comments
 (0)