2
0
Эх сурвалжийг харах

Merge branch 'tls' of github.com:elmindreda/glfw into tls

Camilla Berglund 13 жил өмнө
parent
commit
a3502a7f00

+ 3 - 3
src/x11_window.c

@@ -478,8 +478,8 @@ static void processEvent(XEvent *event)
             if (window == NULL)
             if (window == NULL)
                 return;
                 return;
 
 
-            _glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_PRESS);
-            _glfwInputChar(window, translateChar(&event.xkey));
+            _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_PRESS);
+            _glfwInputChar(window, translateChar(&event->xkey));
             break;
             break;
         }
         }
 
 
@@ -516,7 +516,7 @@ static void processEvent(XEvent *event)
                 }
                 }
             }
             }
 
 
-            _glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_RELEASE);
+            _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_RELEASE);
             break;
             break;
         }
         }
 
 

+ 9 - 7
tests/CMakeLists.txt

@@ -29,11 +29,6 @@ add_executable(joysticks joysticks.c)
 add_executable(modes modes.c ${GETOPT})
 add_executable(modes modes.c ${GETOPT})
 add_executable(peter peter.c)
 add_executable(peter peter.c)
 add_executable(reopen reopen.c)
 add_executable(reopen reopen.c)
-add_executable(threads threads.c ${TINYCTHREAD})
-
-if (BUILD_SHARED_LIBS)
-    target_link_libraries(threads ${CMAKE_THREAD_LIBS_INIT})
-endif()
 
 
 add_executable(accuracy WIN32 MACOSX_BUNDLE accuracy.c)
 add_executable(accuracy WIN32 MACOSX_BUNDLE accuracy.c)
 set_target_properties(accuracy PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Accuracy")
 set_target_properties(accuracy PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Accuracy")
@@ -44,15 +39,22 @@ set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
 add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c)
 add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c)
 set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
 set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
 
 
+add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD})
+set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
+
 add_executable(title WIN32 MACOSX_BUNDLE title.c)
 add_executable(title WIN32 MACOSX_BUNDLE title.c)
 set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
 set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
 
 
 add_executable(windows WIN32 MACOSX_BUNDLE windows.c)
 add_executable(windows WIN32 MACOSX_BUNDLE windows.c)
 set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
 set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
 
 
-set(WINDOWS_BINARIES accuracy sharing tearing title windows)
+if (BUILD_SHARED_LIBS)
+    target_link_libraries(threads ${CMAKE_THREAD_LIBS_INIT})
+endif()
+
+set(WINDOWS_BINARIES accuracy sharing tearing threads title windows)
 set(CONSOLE_BINARIES clipboard defaults events fsaa fsfocus gamma glfwinfo
 set(CONSOLE_BINARIES clipboard defaults events fsaa fsfocus gamma glfwinfo
-                     iconify joysticks modes peter reopen threads)
+                     iconify joysticks modes peter reopen)
 
 
 if (MSVC)
 if (MSVC)
     # Tell MSVC to use main instead of WinMain for Windows subsystem executables
     # Tell MSVC to use main instead of WinMain for Windows subsystem executables

+ 4 - 4
tests/threads.c

@@ -42,12 +42,12 @@ typedef struct
     GLFWwindow window;
     GLFWwindow window;
     const char* title;
     const char* title;
     float r, g, b;
     float r, g, b;
-    thrd_t ID;
+    thrd_t id;
 } Thread;
 } Thread;
 
 
 static volatile GLboolean running = GL_TRUE;
 static volatile GLboolean running = GL_TRUE;
 
 
-static int thread_start(void* data)
+static int thread_main(void* data)
 {
 {
     const Thread* thread = (const Thread*) data;
     const Thread* thread = (const Thread*) data;
 
 
@@ -102,7 +102,7 @@ int main(void)
 
 
         glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
         glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
 
 
-        if (thrd_create(&threads[i].ID, thread_start, threads + i) !=
+        if (thrd_create(&threads[i].id, thread_main, threads + i) !=
             thrd_success)
             thrd_success)
         {
         {
             fprintf(stderr, "Failed to create secondary thread\n");
             fprintf(stderr, "Failed to create secondary thread\n");
@@ -124,7 +124,7 @@ int main(void)
     }
     }
 
 
     for (i = 0;  i < count;  i++)
     for (i = 0;  i < count;  i++)
-        thrd_join(threads[i].ID, &result);
+        thrd_join(threads[i].id, &result);
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }