Browse Source

Marked todo's into the IO library.
Moved the cursor/function key char input check into GLFW.

Lasse Öörni 14 years ago
parent
commit
51eec4e987

+ 1 - 0
Engine/IO/FileSystem.cpp

@@ -443,6 +443,7 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
     {
     {
         while (de = readdir(dir))
         while (de = readdir(dir))
         {
         {
+            /// \todo Filename may be unnormalized Unicode on Mac OS X. Re-normalize as necessary
             String fileName(de->d_name);
             String fileName(de->d_name);
             String pathAndName = path + fileName;
             String pathAndName = path + fileName;
             if (!stat(pathAndName.CString(), &st))
             if (!stat(pathAndName.CString(), &st))

+ 7 - 6
Engine/IO/FileWatcher.cpp

@@ -46,13 +46,13 @@ FileWatcher::~FileWatcher()
     StopWatching();
     StopWatching();
 }
 }
 
 
-bool FileWatcher::StartWatching(const String& path, bool watchSubDirs)
+bool FileWatcher::StartWatching(const String& pathName, bool watchSubDirs)
 {
 {
     // Stop any previous watching
     // Stop any previous watching
     StopWatching();
     StopWatching();
     
     
 #if defined(WIN32) && defined(ENABLE_FILEWATCHER)
 #if defined(WIN32) && defined(ENABLE_FILEWATCHER)
-    String nativePath = GetNativePath(RemoveTrailingSlash(path));
+    String nativePath = GetNativePath(RemoveTrailingSlash(pathName));
     
     
     dirHandle_ = (void*)CreateFileW(
     dirHandle_ = (void*)CreateFileW(
         WString(nativePath).CString(),
         WString(nativePath).CString(),
@@ -65,20 +65,21 @@ bool FileWatcher::StartWatching(const String& path, bool watchSubDirs)
     
     
     if (dirHandle_ != INVALID_HANDLE_VALUE)
     if (dirHandle_ != INVALID_HANDLE_VALUE)
     {
     {
-        path_ = AddTrailingSlash(path);
+        path_ = AddTrailingSlash(pathName);
         watchSubDirs_ = watchSubDirs;
         watchSubDirs_ = watchSubDirs;
         Start();
         Start();
         
         
-        LOGDEBUG("Started watching path " + path);
+        LOGDEBUG("Started watching path " + pathName);
         return true;
         return true;
     }
     }
     else
     else
     {
     {
-        LOGERROR("Failed to start watching path " + path);
+        LOGERROR("Failed to start watching path " + pathName);
         return false;
         return false;
     }
     }
 #else
 #else
-    LOGERROR("Can not start watching path " + path + ", FileWatcher not implemented yet");
+    /// \todo Implement on Unix-like systems
+    LOGERROR("FileWatcher not implemented, can not start watching path " + pathName);
 #endif
 #endif
 }
 }
 
 

+ 2 - 2
Engine/IO/FileWatcher.h

@@ -28,7 +28,7 @@
 #include "Object.h"
 #include "Object.h"
 #include "Thread.h"
 #include "Thread.h"
 
 
-/// Watches a path and its subdirectories for files being modified
+/// Watches a directory and its subdirectories for files being modified
 class FileWatcher : public Object, public Thread
 class FileWatcher : public Object, public Thread
 {
 {
     OBJECT(FileWatcher);
     OBJECT(FileWatcher);
@@ -43,7 +43,7 @@ public:
     virtual void ThreadFunction();
     virtual void ThreadFunction();
     
     
     /// Start watching a directory. Return true if successful.
     /// Start watching a directory. Return true if successful.
-    bool StartWatching(const String& path, bool watchSubDirs);
+    bool StartWatching(const String& pathName, bool watchSubDirs);
     /// Stop watching the directory.
     /// Stop watching the directory.
     void StopWatching();
     void StopWatching();
     /// Return a file change (true if was found, false if not.)
     /// Return a file change (true if was found, false if not.)

+ 0 - 4
Engine/Input/Input.cpp

@@ -635,10 +635,6 @@ void CharCallback(GLFWwindow window, int key)
     if (!instance)
     if (!instance)
         return;
         return;
 
 
-    // On OS X we get char events for cursors and function keys. Disregard these
-    if (key >= 0xf700 && key <= 0xf70f)
-        return;
-
     using namespace Char;
     using namespace Char;
 
 
     VariantMap keyEventData;
     VariantMap keyEventData;

+ 7 - 1
ThirdParty/GLFW/src/cocoa_window.m

@@ -408,7 +408,13 @@ static int convertMacKeyCode(unsigned int macKeyCode)
             length = [characters length];
             length = [characters length];
 
 
             for (i = 0;  i < length;  i++)
             for (i = 0;  i < length;  i++)
-                _glfwInputChar(window, [characters characterAtIndex:i]);
+            {
+                int c = [characters characterAtIndex:i];
+                // Urho3D: disregard char input for cursors and function keys
+                if (c >= 0xf700 && c <= 0xf70f)
+                    continue;
+                _glfwInputChar(window, c);
+            }
         }
         }
     }
     }
 }
 }