Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
749a2c6c
Commit
749a2c6c
authored
Sep 04, 1999
by
Guy Albertelli
Committed by
Alexandre Julliard
Sep 04, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed WriteConsoleOutput and GetNumberOfConsoleInputEvents.
parent
143fc514
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
5 deletions
+73
-5
console.c
win32/console.c
+73
-5
No files found.
win32/console.c
View file @
749a2c6c
...
...
@@ -710,28 +710,90 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
LPSMALL_RECT
lpWriteRegion
)
{
int
i
,
j
,
off
=
0
,
lastattr
=-
1
;
int
offbase
;
char
sbuf
[
20
],
*
buffer
=
NULL
;
int
bufused
=
0
,
curbufsize
=
100
;
DWORD
res
;
CONSOLE_SCREEN_BUFFER_INFO
csbi
;
const
int
colormap
[
8
]
=
{
0
,
4
,
2
,
6
,
1
,
5
,
3
,
7
,
};
CONSOLE_make_complex
(
hConsoleOutput
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
100
);
curbufsize
=
100
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
curbufsize
);
offbase
=
(
dwBufferCoord
.
y
-
1
)
*
dwBufferSize
.
x
+
(
dwBufferCoord
.
x
-
lpWriteRegion
->
Left
);
TRACE
(
"
wr: top = %d, bottom=%d, left=%d,
right=%d
\n
"
,
TRACE
(
"
orig rect top = %d, bottom=%d, left=%d,
right=%d
\n
"
,
lpWriteRegion
->
Top
,
lpWriteRegion
->
Bottom
,
lpWriteRegion
->
Left
,
lpWriteRegion
->
Right
);
GetConsoleScreenBufferInfo
(
hConsoleOutput
,
&
csbi
);
/* Step 1. Make (Bottom,Right) offset of intersection with
Screen Buffer */
lpWriteRegion
->
Bottom
=
min
(
lpWriteRegion
->
Bottom
,
csbi
.
dwSize
.
y
-
1
)
-
lpWriteRegion
->
Top
;
lpWriteRegion
->
Right
=
min
(
lpWriteRegion
->
Right
,
csbi
.
dwSize
.
x
-
1
)
-
lpWriteRegion
->
Left
;
/* Step 2. If either offset is negative, then no action
should be performed. (Implies that requested rectangle is
outside the current screen buffer rectangle.) */
if
((
lpWriteRegion
->
Bottom
<
0
)
||
(
lpWriteRegion
->
Right
<
0
))
{
/* readjust (Bottom Right) for rectangle */
lpWriteRegion
->
Bottom
+=
lpWriteRegion
->
Top
;
lpWriteRegion
->
Right
+=
lpWriteRegion
->
Left
;
TRACE
(
"invisible rect top = %d, bottom=%d, left=%d, right=%d
\n
"
,
lpWriteRegion
->
Top
,
lpWriteRegion
->
Bottom
,
lpWriteRegion
->
Left
,
lpWriteRegion
->
Right
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
TRUE
;
}
/* Step 3. Intersect with source rectangle */
lpWriteRegion
->
Bottom
=
lpWriteRegion
->
Top
-
dwBufferCoord
.
y
+
min
(
lpWriteRegion
->
Bottom
+
dwBufferCoord
.
y
,
dwBufferSize
.
y
-
1
);
lpWriteRegion
->
Right
=
lpWriteRegion
->
Left
-
dwBufferCoord
.
x
+
min
(
lpWriteRegion
->
Right
+
dwBufferCoord
.
x
,
dwBufferSize
.
x
-
1
);
TRACE
(
"clipped rect top = %d, bottom=%d, left=%d,right=%d
\n
"
,
lpWriteRegion
->
Top
,
lpWriteRegion
->
Bottom
,
lpWriteRegion
->
Left
,
lpWriteRegion
->
Right
);
/* Validate above computations made sense, if not then issue
error and fudge to single character rectangle */
if
((
lpWriteRegion
->
Bottom
<
lpWriteRegion
->
Top
)
||
(
lpWriteRegion
->
Right
<
lpWriteRegion
->
Left
))
{
ERR
(
"Invalid clipped rectangle top = %d, bottom=%d, left=%d,right=%d
\n
"
,
lpWriteRegion
->
Top
,
lpWriteRegion
->
Bottom
,
lpWriteRegion
->
Left
,
lpWriteRegion
->
Right
);
lpWriteRegion
->
Bottom
=
lpWriteRegion
->
Top
;
lpWriteRegion
->
Right
=
lpWriteRegion
->
Left
;
}
/* Now do the real processing and move the characters */
for
(
i
=
lpWriteRegion
->
Top
;
i
<=
lpWriteRegion
->
Bottom
;
i
++
)
{
offbase
+=
dwBufferSize
.
x
;
sprintf
(
sbuf
,
"%c[%d;%dH"
,
27
,
i
+
1
,
lpWriteRegion
->
Left
+
1
);
SADD
(
sbuf
);
for
(
j
=
lpWriteRegion
->
Left
;
j
<=
lpWriteRegion
->
Right
;
j
++
)
{
off
=
j
+
offbase
;
if
(
lastattr
!=
lpBuffer
[
off
].
Attributes
)
{
lastattr
=
lpBuffer
[
off
].
Attributes
;
sprintf
(
sbuf
,
"%c[0;%s3%d;4%dm"
,
...
...
@@ -744,7 +806,6 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput,
SADD
(
sbuf
);
}
CADD
(
lpBuffer
[
off
].
Char
.
AsciiChar
);
off
++
;
}
}
sprintf
(
sbuf
,
"%c[0m"
,
27
);
SADD
(
sbuf
);
...
...
@@ -1064,8 +1125,15 @@ BOOL WINAPI SetConsoleCursorPosition( HANDLE hcon, COORD pos )
*/
BOOL
WINAPI
GetNumberOfConsoleInputEvents
(
HANDLE
hcon
,
LPDWORD
nrofevents
)
{
struct
read_console_input_request
*
req
=
get_req_buffer
();
CONSOLE_get_input
(
hcon
,
FALSE
);
*
nrofevents
=
1
;
/* UMM */
req
->
handle
=
hcon
;
req
->
count
=
-
1
;
req
->
flush
=
0
;
if
(
server_call
(
REQ_READ_CONSOLE_INPUT
))
return
FALSE
;
if
(
nrofevents
)
*
nrofevents
=
req
->
read
;
return
TRUE
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment