* path.cc (normalize_win32_path): Check for explicit use of two slashes at the
beginning of a path. These should be treated specially regardless of whether they are UNC paths or old-style //a paths. Avoid adding cwd to a path if the path already begins with '/'.
This commit is contained in:
parent
82c8d7ef8c
commit
307cb8ba82
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Dec 9 16:29:45 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* path.cc (normalize_win32_path): Check for explicit use of two slashes
|
||||||
|
at the beginning of a path. These should be treated specially
|
||||||
|
regardless of whether they are UNC paths or old-style //a paths. Avoid
|
||||||
|
adding cwd to a path if the path already begins with '/'.
|
||||||
|
|
||||||
Fri Dec 8 22:21:01 2000 Christopher Faylor <cgf@cygnus.com>
|
Fri Dec 8 22:21:01 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* path.cc (normalize_win32_path): Reorganize logic to accomodate
|
* path.cc (normalize_win32_path): Reorganize logic to accomodate
|
||||||
|
|
|
@ -193,20 +193,16 @@ fhandler_console::read (void *pv, size_t buflen)
|
||||||
return -1; /* seems to be failure */
|
return -1; /* seems to be failure */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check the event that occurred */
|
||||||
|
switch (input_rec.EventType)
|
||||||
|
{
|
||||||
|
case KEY_EVENT:
|
||||||
|
if (!input_rec.Event.KeyEvent.bKeyDown)
|
||||||
|
continue;
|
||||||
|
|
||||||
#define ich (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
#define ich (input_rec.Event.KeyEvent.uChar.AsciiChar)
|
||||||
#define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar)
|
#define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar)
|
||||||
|
|
||||||
/* check if we're just disposing of this one */
|
|
||||||
|
|
||||||
if (input_rec.EventType == WINDOW_BUFFER_SIZE_EVENT)
|
|
||||||
{
|
|
||||||
kill_pgrp (tc->getpgid (), SIGWINCH);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (input_rec.EventType != KEY_EVENT ||
|
|
||||||
!input_rec.Event.KeyEvent.bKeyDown)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (wch == 0 ||
|
if (wch == 0 ||
|
||||||
/* arrow/function keys */
|
/* arrow/function keys */
|
||||||
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
||||||
|
@ -233,10 +229,103 @@ fhandler_console::read (void *pv, size_t buflen)
|
||||||
nread++;
|
nread++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#undef ich
|
||||||
|
#undef wch
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOUSE_EVENT:
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
syscall_printf("mouse: double-click -> click");
|
||||||
|
mouse_event.dwEventFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Did something other than a click occur? */
|
||||||
|
if (mouse_event.dwEventFlags)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* If the mouse event occurred out of the area we can handle,
|
||||||
|
ignore it. */
|
||||||
|
int x = mouse_event.dwMousePosition.X;
|
||||||
|
int y = mouse_event.dwMousePosition.Y;
|
||||||
|
if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF))
|
||||||
|
{
|
||||||
|
syscall_printf("mouse: position out of range");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ignore unimportant mouse buttons */
|
||||||
|
mouse_event.dwButtonState &= 0x7;
|
||||||
|
|
||||||
|
/* This code assumes Windows never reports multiple button
|
||||||
|
events at the same time. */
|
||||||
|
static DWORD dwLastButtonState = 0;
|
||||||
|
int b = 0;
|
||||||
|
char sz[32];
|
||||||
|
if (mouse_event.dwButtonState == dwLastButtonState)
|
||||||
|
{
|
||||||
|
syscall_printf("mouse: button state unchanged");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (mouse_event.dwButtonState < dwLastButtonState)
|
||||||
|
{
|
||||||
|
b = 3;
|
||||||
|
strcpy(sz, "btn up");
|
||||||
|
}
|
||||||
|
else if ((mouse_event.dwButtonState & 1) != (dwLastButtonState & 1))
|
||||||
|
{
|
||||||
|
b = 0;
|
||||||
|
strcpy(sz, "btn1 down");
|
||||||
|
}
|
||||||
|
else if ((mouse_event.dwButtonState & 2) != (dwLastButtonState & 2))
|
||||||
|
{
|
||||||
|
b = 1;
|
||||||
|
strcpy(sz, "btn2 down");
|
||||||
|
}
|
||||||
|
else if ((mouse_event.dwButtonState & 4) != (dwLastButtonState & 4))
|
||||||
|
{
|
||||||
|
b = 2;
|
||||||
|
strcpy(sz, "btn3 down");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember the current button state */
|
||||||
|
dwLastButtonState = mouse_event.dwButtonState;
|
||||||
|
|
||||||
|
static int nModifiers = 0;
|
||||||
|
/* If a button was pressed, remember the modifiers */
|
||||||
|
if (b != 3)
|
||||||
|
{
|
||||||
|
nModifiers = 0;
|
||||||
|
if (mouse_event.dwControlKeyState & SHIFT_PRESSED)
|
||||||
|
nModifiers |= 0x4;
|
||||||
|
if (mouse_event.dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED))
|
||||||
|
nModifiers |= 0x8;
|
||||||
|
if (mouse_event.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
|
||||||
|
nModifiers |= 0x10;
|
||||||
|
}
|
||||||
|
|
||||||
|
b |= nModifiers;
|
||||||
|
|
||||||
|
/* We can now create the code. */
|
||||||
|
sprintf(tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1);
|
||||||
|
syscall_printf("mouse: %s at (%d,%d)", sz, x, y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINDOW_BUFFER_SIZE_EVENT:
|
||||||
|
kill_pgrp (tc->getpgid (), SIGWINCH);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (line_edit (toadd, nread))
|
if (line_edit (toadd, nread))
|
||||||
break;
|
break;
|
||||||
#undef ich
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (buflen)
|
while (buflen)
|
||||||
|
@ -382,7 +471,7 @@ fhandler_console::open (const char *, int flags, mode_t)
|
||||||
if (GetConsoleMode (get_io_handle (), &cflags))
|
if (GetConsoleMode (get_io_handle (), &cflags))
|
||||||
{
|
{
|
||||||
cflags |= ENABLE_PROCESSED_INPUT;
|
cflags |= ENABLE_PROCESSED_INPUT;
|
||||||
SetConsoleMode (get_io_handle (), ENABLE_WINDOW_INPUT | cflags);
|
SetConsoleMode (get_io_handle (), ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT | cflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
TTYCLEARF (RSTCONS);
|
TTYCLEARF (RSTCONS);
|
||||||
|
@ -545,7 +634,7 @@ fhandler_console::input_tcsetattr (int, struct termios const *t)
|
||||||
tc->ti.c_lflag = 0;
|
tc->ti.c_lflag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags |= ENABLE_WINDOW_INPUT;
|
flags |= ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
if (flags == oflags)
|
if (flags == oflags)
|
||||||
|
|
|
@ -712,9 +712,9 @@ normalize_win32_path (const char *src, char *dst)
|
||||||
const char *src_start = src;
|
const char *src_start = src;
|
||||||
char *dst_start = dst;
|
char *dst_start = dst;
|
||||||
char *dst_root_start = dst;
|
char *dst_root_start = dst;
|
||||||
bool beg_src_slash;
|
bool beg_src_slash = isdirsep (src[0]);
|
||||||
|
|
||||||
if (slash_unc_prefix_p (src))
|
if (beg_src_slash && isdirsep (src[1]))
|
||||||
{
|
{
|
||||||
if (cygheap->root.length ())
|
if (cygheap->root.length ())
|
||||||
{
|
{
|
||||||
|
@ -725,7 +725,7 @@ normalize_win32_path (const char *src, char *dst)
|
||||||
++src;
|
++src;
|
||||||
}
|
}
|
||||||
/* If absolute path, care for chroot. */
|
/* If absolute path, care for chroot. */
|
||||||
else if ((beg_src_slash = SLASH_P (src[0])) && cygheap->root.length ())
|
else if (beg_src_slash && cygheap->root.length ())
|
||||||
{
|
{
|
||||||
strcpy (dst, cygheap->root.path ());
|
strcpy (dst, cygheap->root.path ());
|
||||||
char *c;
|
char *c;
|
||||||
|
@ -735,7 +735,7 @@ normalize_win32_path (const char *src, char *dst)
|
||||||
dst_root_start = dst;
|
dst_root_start = dst;
|
||||||
*dst++ = '\\';
|
*dst++ = '\\';
|
||||||
}
|
}
|
||||||
else if (strchr (src, ':') == NULL)
|
else if (strchr (src, ':') == NULL && *src != '/')
|
||||||
{
|
{
|
||||||
if (!cygcwd.get (dst, 0))
|
if (!cygcwd.get (dst, 0))
|
||||||
return get_errno ();
|
return get_errno ();
|
||||||
|
|
Loading…
Reference in New Issue