Advertisement
Guest User

openFrameworks glfw patch

a guest
Jan 26th, 2014
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.36 KB | None | 0 0
  1. diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.cpp b/libs/openFrameworks/app/ofAppGLFWWindow.cpp
  2. index 02b1a8c..1a41028 100644
  3. --- a/libs/openFrameworks/app/ofAppGLFWWindow.cpp
  4. +++ b/libs/openFrameworks/app/ofAppGLFWWindow.cpp
  5. @@ -13,7 +13,8 @@
  6.         #define GLFW_EXPOSE_NATIVE_GLX
  7.     #else
  8.         #define GLFW_EXPOSE_NATIVE_EGL
  9. -   #endif
  10. +    #endif
  11. +    #include <X11/extensions/Xrandr.h>
  12.     #include "GLFW/glfw3native.h"
  13.     #include <X11/Xatom.h>
  14.     #include "Poco/URI.h"
  15. @@ -238,7 +239,7 @@ void ofAppGLFWWindow::initializeWindow(){
  16.     glfwSetWindowSizeCallback(windowP, resize_cb);
  17.     glfwSetWindowCloseCallback(windowP, exit_cb);
  18.     glfwSetScrollCallback(windowP, scroll_cb);
  19. -   glfwSetDropCallback(windowP, drop_cb);
  20. +    glfwSetDropCallback(windowP, drop_cb);
  21.  
  22.  }
  23.  
  24. @@ -874,15 +875,16 @@ void ofAppGLFWWindow::scroll_cb(GLFWwindow* windowP_, double x, double y) {
  25.  }
  26.  
  27.  //------------------------------------------------------------
  28. -void ofAppGLFWWindow::drop_cb(GLFWwindow* windowP_, const char* dropString) {
  29. -   string drop = dropString;
  30. -   ofDragInfo drag;
  31. -   drag.position.set(ofGetMouseX(),ofGetMouseY());
  32. -   drag.files = ofSplitString(drop,"\n",true);
  33. +void ofAppGLFWWindow::drop_cb(GLFWwindow* windowP_, const int dropArraySize, const char* dropStringArray[]) {
  34. +    ofDragInfo drag;
  35. +    drag.position.set(ofGetMouseX(),ofGetMouseY());
  36. +    for(int i=0; i<dropArraySize; i++){
  37. +        drag.files.push_back(dropStringArray[i]);
  38. +    }
  39.  #ifdef TARGET_LINUX
  40. -   for(int i=0; i<(int)drag.files.size(); i++){
  41. +    for(int i=0; i<dropArraySize; i++){
  42.         drag.files[i] = Poco::URI(drag.files[i]).getPath();
  43. -   }
  44. +    }
  45.  #endif
  46.     ofNotifyDragEvent(drag);
  47.  }
  48. diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.h b/libs/openFrameworks/app/ofAppGLFWWindow.h
  49. index 838cca7..343f6b6 100644
  50. --- a/libs/openFrameworks/app/ofAppGLFWWindow.h
  51. +++ b/libs/openFrameworks/app/ofAppGLFWWindow.h
  52. @@ -111,7 +111,7 @@ private:
  53.     static void     resize_cb(GLFWwindow* windowP_, int w, int h);
  54.     static void     exit_cb(GLFWwindow* windowP_);
  55.     static void     scroll_cb(GLFWwindow* windowP_, double x, double y);
  56. -   static void     drop_cb(GLFWwindow* windowP_, const char* dropString);
  57. +    static void    drop_cb(GLFWwindow* windowP_, const int dropArraySize, const char* dropStringArray[]);
  58.     static void     error_cb(int errorCode, const char* errorDescription);
  59.     static void     exitApp();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement