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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-08-19 08:43:58 +0400
committerChristopher Faylor <me@cgf.cx>2002-08-19 08:43:58 +0400
commitc060edba342decad9f5e29837a04cf82ff61b7a0 (patch)
tree243725d46a0926fd8c6243363cde0e3c173d0bdf /winsup
parenta94b60cea46803ad239495fe0fe3fbcc13766b81 (diff)
* fhandler.h (fhandler_console::send_winch_maybe): New method.
* fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed code. (fhandler_console::send_winch_maybe): Define new method. (fhandler_console::read): Use send_winch_maybe where appropriate. (fhandler_console::init): Just call all tcsetattr rather than output_tcsetattr. * select.cc (peek_console): Reorganize so that send_winch_maybe is called for everything but keyboard input.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_console.cc35
-rw-r--r--winsup/cygwin/select.cc22
4 files changed, 45 insertions, 25 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0fa906e0a..ddf61624a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,15 @@
+2002-08-19 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler.h (fhandler_console::send_winch_maybe): New method.
+ * fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed
+ code.
+ (fhandler_console::send_winch_maybe): Define new method.
+ (fhandler_console::read): Use send_winch_maybe where appropriate.
+ (fhandler_console::init): Just call all tcsetattr rather than
+ output_tcsetattr.
+ * select.cc (peek_console): Reorganize so that send_winch_maybe is
+ called for everything but keyboard input.
+
2002-08-18 Christopher Faylor <cgf@redhat.com>
* perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 6237c6ca9..6f9a5cbe5 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -826,6 +826,7 @@ class fhandler_console: public fhandler_termios
void set_close_on_exec (int val);
void fixup_after_fork (HANDLE parent);
void set_input_state ();
+ void send_winch_maybe ();
};
class fhandler_tty_common: public fhandler_termios
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index bae7c11a7..e9ca5b09d 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -147,13 +147,6 @@ set_console_state_for_spawn ()
# define tc shared_console_info /* ACK. Temporarily define for use in TTYSETF macro */
SetConsoleMode (h, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
TTYSETF (RSTCONS);
-#if 0
- char ch;
- DWORD n;
- /* NOTE -- This ReadFile is apparently necessary for correct functioning on
- Windows NT 4.0. Without this, the next ReadFile returns garbage. */
- (void) ReadFile (h, &ch, 0, &n, NULL);
-#endif
# undef tc
}
@@ -186,6 +179,17 @@ fhandler_console::set_cursor_maybe ()
}
}
+void
+fhandler_console::send_winch_maybe ()
+{
+ SHORT y = info.dwWinSize.Y;
+ SHORT x = info.dwWinSize.X;
+ fillin_info ();
+
+ if (y != info.dwWinSize.Y || x != info.dwWinSize.X)
+ tc->kill_pgrp (SIGWINCH);
+}
+
int __stdcall
fhandler_console::read (void *pv, size_t buflen)
{
@@ -332,9 +336,10 @@ fhandler_console::read (void *pv, size_t buflen)
break;
case MOUSE_EVENT:
+ send_winch_maybe ();
if (use_mouse)
{
- MOUSE_EVENT_RECORD & mouse_event = input_rec.Event.MouseEvent;
+ MOUSE_EVENT_RECORD& mouse_event = input_rec.Event.MouseEvent;
/* Treat the double-click event like a regular button press */
if (mouse_event.dwEventFlags == DOUBLE_CLICK)
@@ -416,10 +421,10 @@ fhandler_console::read (void *pv, size_t buflen)
}
break;
+ case FOCUS_EVENT:
case WINDOW_BUFFER_SIZE_EVENT:
- tc->kill_pgrp (SIGWINCH);
- continue;
-
+ send_winch_maybe ();
+ /* fall through */
default:
continue;
}
@@ -493,7 +498,7 @@ fhandler_console::scroll_screen (int x1, int y1, int x2, int y2, int xn, int yn)
CHAR_INFO fill;
COORD dest;
- (void)fillin_info ();
+ (void) fillin_info ();
sr1.Left = x1 >= 0 ? x1 : info.dwWinSize.X - 1;
if (y1 == 0)
sr1.Top = info.winTop;
@@ -761,8 +766,6 @@ fhandler_console::input_tcsetattr (int, struct termios const *t)
{
flags |= ENABLE_PROCESSED_INPUT;
}
- /* What about ENABLE_WINDOW_INPUT
- and ENABLE_MOUSE_INPUT ? */
if (use_tty)
{
@@ -956,7 +959,7 @@ fhandler_console::cursor_set (BOOL rel_to_top, int x, int y)
{
COORD pos;
- (void)fillin_info ();
+ (void) fillin_info ();
if (y > info.winBottom)
y = info.winBottom;
else if (y < 0)
@@ -1692,7 +1695,7 @@ fhandler_console::init (HANDLE f, DWORD a, mode_t bin)
if (f != INVALID_HANDLE_VALUE)
CloseHandle (f); /* Reopened by open */
- output_tcsetattr (0, &tc->ti);
+ this->tcsetattr (0, &tc->ti);
}
int
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 97674a92f..c3c4158a4 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -661,18 +661,22 @@ peek_console (select_record *me, bool)
break;
else
{
- if (irec.EventType == WINDOW_BUFFER_SIZE_EVENT)
- fh->tc->kill_pgrp (SIGWINCH);
- else if (irec.EventType == MOUSE_EVENT &&
- (irec.Event.MouseEvent.dwEventFlags == 0 ||
- irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
+ if (irec.EventType == KEY_EVENT)
{
- if (fh->mouse_aware ())
+ if (irec.Event.KeyEvent.bKeyDown
+ && (irec.Event.KeyEvent.uChar.AsciiChar
+ || get_nonascii_key (irec, tmpbuf)))
return me->read_ready = true;
}
- else if (irec.EventType == KEY_EVENT && irec.Event.KeyEvent.bKeyDown == true &&
- (irec.Event.KeyEvent.uChar.AsciiChar || get_nonascii_key (irec, tmpbuf)))
- return me->read_ready = true;
+ else
+ {
+ fh->send_winch_maybe ();
+ if (irec.EventType == MOUSE_EVENT
+ && fh->mouse_aware ()
+ && (irec.Event.MouseEvent.dwEventFlags == 0
+ || irec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
+ return me->read_ready = true;
+ }
/* Read and discard the event */
ReadConsoleInput (h, &irec, 1, &events_read);