Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2012-07-26 20:56:09 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2012-07-26 20:56:09 +0400
commit6b3b7465b650a09292bf889ae78d178c6c8647b9 (patch)
treec3304f9b8322022c4fe590bcb789f8c1b3927161 /source/blender/windowmanager
parent0c1ea1465673c27c567e83c12c5a796745912e34 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 7a885d60bff..bd701cbb312 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -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_anim_drivers_copybuf(void);
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 @@ void WM_exit_ext(bContext *C, const short do_python)
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
}