Revision: 49259
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49259
Author:   jwilkins
Date:     2012-07-26 16:56:09 +0000 (Thu, 26 Jul 2012)
Log Message:
-----------
On windows with --debug flag, change "Press enter key to exit..." to "Press any 
key to exit . . .".  This is implemented by the new function 
wait_for_console_key.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c    
2012-07-26 16:55:34 UTC (rev 49258)
+++ trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c    
2012-07-26 16:56:09 UTC (rev 49259)
@@ -32,6 +32,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#if WIN32
+#include <Windows.h>
+#endif
+
 #include "MEM_guardedalloc.h"
 #include "MEM_CacheLimiterC-Api.h"
 
@@ -330,6 +334,31 @@
 extern void free_fmodifiers_copybuf(void); 
 extern void free_posebuf(void); 
 
+#if WIN32
+/* read console events until there is a keyboard event, then return */
+static void wait_for_console_key(void)
+{
+       HANDLE hConsoleInput;
+
+       hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);
+
+       if (hConsoleInput && FlushConsoleInputBuffer(hConsoleInput)) {
+               for(;;) {
+                       INPUT_RECORD buffer;
+                       DWORD ignored;
+
+                       if (!ReadConsoleInput(hConsoleInput, &buffer, 1, 
&ignored)) {
+                               break;
+                       }
+
+                       if (buffer.EventType == KEY_EVENT) {
+                               break;
+                       }
+               }
+       }
+}
+#endif
+
 /* called in creator.c even... tsk, split this! */
 /* note, doesnt run exit() call WM_exit() for that */
 void WM_exit_ext(bContext *C, const short do_python)
@@ -452,10 +481,10 @@
        printf("\nBlender quit\n");
        
 #ifdef WIN32   
-       /* ask user to press enter when in debug mode */
+       /* ask user to press a key when in debug mode */
        if (G.debug & G_DEBUG) {
-               printf("press enter key to exit...\n\n");
-               getchar();
+               printf("Press any key to exit . . .\n\n");
+               wait_for_console_key();
        }
 #endif 
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to