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:
authorNathan Letwory <nathan@letworyinteractive.com>2011-04-08 16:49:38 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2011-04-08 16:49:38 +0400
commit2b955490795892f702b87247fd5c5f35124b7c1d (patch)
tree742b1a215e5dfc2a577eec30d12c54cebd6cb2ca
parent0f5959abd9add48ff94d9a627e9897f917cd5cd8 (diff)
Apply console part of patch [#26044] Windows thumbnails and improved filetype registration
submitted by Tom Edwards This patch introduces a switch -con and its longer version --start-console. When giving this on cmd-line you'll get the black console window. The new behaviour is to hide it by default. We'll still see briefly the console at startup and during exit, but that's something that cannot be changed. If you start blender from a cmd.exe, the console will not be hidden.
-rw-r--r--source/blender/blenlib/BLI_winstuff.h1
-rw-r--r--source/blender/blenlib/intern/winstuff.c9
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c9
-rw-r--r--source/creator/creator.c9
4 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index d0eb3c7d67d..176e7319bf7 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -127,6 +127,7 @@ typedef struct _DIR {
struct dirent direntry;
} DIR;
+int IsConsoleEmpty(void);
void RegisterBlendExtension(void);
DIR *opendir (const char *path);
struct dirent *readdir(DIR *dp);
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index 2f750545223..f39cfe14a75 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <conio.h>
#include "MEM_guardedalloc.h"
#include "BLI_path_util.h"
@@ -65,6 +66,14 @@ int BLI_getInstallationDir( char * str ) {
return 1;
}
+int IsConsoleEmpty(void)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi = {0};
+ HANDLE hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ return GetConsoleScreenBufferInfo(hStdOutput, &csbi) && csbi.dwCursorPosition.X == 0 && csbi.dwCursorPosition.Y == 0;
+}
+
void RegisterBlendExtension_Fail(HKEY root)
{
printf("failed\n");
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 0d88f8ea1a6..38e66bc9f06 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -63,6 +63,7 @@
#include "BKE_material.h" /* clear_matcopybuf */
#include "BLI_blenlib.h"
+#include "BLI_winstuff.h"
#include "RE_pipeline.h" /* RE_ free stuff */
@@ -114,7 +115,7 @@ static void wm_free_reports(bContext *C)
BKE_reports_clear(CTX_wm_reports(C));
}
-
+int wm_start_with_console = 0;
/* only called once, for startup */
void WM_init(bContext *C, int argc, const char **argv)
@@ -123,6 +124,10 @@ void WM_init(bContext *C, int argc, const char **argv)
if (!G.background) {
wm_ghost_init(C); /* note: it assigns C to ghost! */
wm_init_cursor_data();
+#ifdef WIN32
+ if (IsConsoleEmpty()) /* never hide if the console window pre-existed */
+ WM_console_toggle(C, wm_start_with_console);
+#endif
}
GHOST_CreateSystemPaths();
@@ -352,6 +357,8 @@ void WM_exit(bContext *C)
sound_exit();
+ WM_console_toggle(C, 1); /* never leave behind invisible consoles */
+
/* first wrap up running stuff, we assume only the active WM is running */
/* modal handlers are on window level freed, others too? */
/* note; same code copied in wm_files.c */
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 1db143cdd20..df8ba38701d 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -247,6 +247,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
BLI_argsPrintArgDoc(ba, "--window-border");
BLI_argsPrintArgDoc(ba, "--window-borderless");
BLI_argsPrintArgDoc(ba, "--window-geometry");
+ BLI_argsPrintArgDoc(ba, "--start-console");
printf("\n");
printf ("Game Engine Specific Options:\n");
@@ -484,6 +485,13 @@ static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UN
return 0;
}
+extern int wm_start_with_console; // blender/windowmanager/intern/wm_init_exit.c
+static int start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ wm_start_with_console = 1;
+ return 0;
+}
+
static int register_extension(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
#ifdef WIN32
@@ -1095,6 +1103,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL);
BLI_argsAdd(ba, 2, "-w", "--window-border", "\n\tForce opening with borders (default)", with_borders, NULL);
BLI_argsAdd(ba, 2, "-W", "--window-borderless", "\n\tForce opening without borders", without_borders, NULL);
+ BLI_argsAdd(ba, 2, "-con", "--start-console", "\n\tStart with the console window open (ignored if -b is set)", start_with_console, NULL);
BLI_argsAdd(ba, 2, "-R", NULL, "\n\tRegister .blend extension, then exit (Windows only)", register_extension, NULL);
BLI_argsAdd(ba, 2, "-r", NULL, "\n\tSilently register .blend extension, then exit (Windows only)", register_extension, ba);