aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-08-30 16:03:52 +0000
committerChristopher Faylor <me@cgf.cx>2002-08-30 16:03:52 +0000
commitf80e156de95bbf723355cde3d9ba1d2a66eefef0 (patch)
treec38244f40cdc06dea9c729b78689f0358275643a
parent91edb60487810ad14f6baea6140ff4ff2cc60f59 (diff)
downloadnewlib-f80e156de95bbf723355cde3d9ba1d2a66eefef0.zip
newlib-f80e156de95bbf723355cde3d9ba1d2a66eefef0.tar.gz
newlib-f80e156de95bbf723355cde3d9ba1d2a66eefef0.tar.bz2
Christopher Faylor <cgf@redhat.com>
* tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available. Call FindWindow in a loop.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/autoload.cc1
-rw-r--r--winsup/cygwin/tty.cc10
3 files changed, 14 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1b2b73d..3877a85 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2002-08-30 Christopher January <chris@atomice.net>
+ Christopher Faylor <cgf@redhat.com>
+
+ * tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available.
+ Call FindWindow in a loop.
+
2002-08-30 Christopher Faylor <cgf@redhat.com>
* miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index e3d34f4..0c0334f 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -494,6 +494,7 @@ LoadDLLfunc (CoCreateInstance, 20, ole32)
LoadDLLfuncEx (CancelIo, 4, kernel32, 1)
LoadDLLfuncEx (CreateHardLinkA, 12, kernel32, 1)
LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1)
+LoadDLLfuncEx (GetConsoleWindow, 4, kernel32, 1)
LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
index bb9f840..360fa2e 100644
--- a/winsup/cygwin/tty.cc
+++ b/winsup/cygwin/tty.cc
@@ -196,7 +196,7 @@ tty_list::allocate_tty (int with_console)
if (!with_console)
console = NULL;
- else
+ else if (!(console = GetConsoleWindow ()))
{
char *oldtitle = new char [TITLESIZE];
@@ -218,8 +218,12 @@ tty_list::allocate_tty (int with_console)
__small_sprintf (buf, "cygwin.find.console.%d", myself->pid);
SetConsoleTitle (buf);
- Sleep (40);
- console = FindWindow (NULL, buf);
+ for (int times = 0; times < 25; times++)
+ {
+ Sleep (10);
+ if ((console = FindWindow (NULL, buf)))
+ break;
+ }
SetConsoleTitle (oldtitle);
Sleep (40);
ReleaseMutex (title_mutex);