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
340a6617
Commit
340a6617
authored
Jul 08, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineconsole: Use OVERLAPPED to wait for console events.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
378ce9e6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
curses.c
programs/wineconsole/curses.c
+1
-1
user.c
programs/wineconsole/user.c
+1
-1
winecon_private.h
programs/wineconsole/winecon_private.h
+4
-0
wineconsole.c
programs/wineconsole/wineconsole.c
+13
-5
No files found.
programs/wineconsole/curses.c
View file @
340a6617
...
@@ -1020,7 +1020,7 @@ static int WCCURSES_MainLoop(struct inner_data* data)
...
@@ -1020,7 +1020,7 @@ static int WCCURSES_MainLoop(struct inner_data* data)
if
(
pipe
(
PRIVATE
(
data
)
->
sync_pipe
)
==
-
1
)
return
1
;
if
(
pipe
(
PRIVATE
(
data
)
->
sync_pipe
)
==
-
1
)
return
1
;
PRIVATE
(
data
)
->
input_thread
=
CreateThread
(
NULL
,
0
,
input_thread
,
data
,
0
,
&
id
);
PRIVATE
(
data
)
->
input_thread
=
CreateThread
(
NULL
,
0
,
input_thread
,
data
,
0
,
&
id
);
while
(
!
data
->
dying
&&
WaitForSingleObject
(
data
->
hSynchro
,
INFINITE
)
==
WAIT_OBJECT_0
)
while
(
!
data
->
dying
&&
WaitForSingleObject
(
data
->
overlapped
.
hEvent
,
INFINITE
)
==
WAIT_OBJECT_0
)
{
{
EnterCriticalSection
(
&
PRIVATE
(
data
)
->
lock
);
EnterCriticalSection
(
&
PRIVATE
(
data
)
->
lock
);
WINECON_GrabChanges
(
data
);
WINECON_GrabChanges
(
data
);
...
...
programs/wineconsole/user.c
View file @
340a6617
...
@@ -1365,7 +1365,7 @@ static int WCUSER_MainLoop(struct inner_data* data)
...
@@ -1365,7 +1365,7 @@ static int WCUSER_MainLoop(struct inner_data* data)
ShowWindow
(
data
->
hWnd
,
data
->
nCmdShow
);
ShowWindow
(
data
->
hWnd
,
data
->
nCmdShow
);
while
(
!
data
->
dying
||
!
data
->
curcfg
.
exit_on_die
)
while
(
!
data
->
dying
||
!
data
->
curcfg
.
exit_on_die
)
{
{
switch
(
MsgWaitForMultipleObjects
(
1
,
&
data
->
hSynchro
,
FALSE
,
INFINITE
,
QS_ALLINPUT
))
switch
(
MsgWaitForMultipleObjects
(
1
,
&
data
->
overlapped
.
hEvent
,
FALSE
,
INFINITE
,
QS_ALLINPUT
))
{
{
case
WAIT_OBJECT_0
:
case
WAIT_OBJECT_0
:
WINECON_GrabChanges
(
data
);
WINECON_GrabChanges
(
data
);
...
...
programs/wineconsole/winecon_private.h
View file @
340a6617
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <windef.h>
#include <windef.h>
#include <winbase.h>
#include <winbase.h>
#include <wincon.h>
#include <wincon.h>
#include <wine/condrv.h>
#include "wineconsole_res.h"
#include "wineconsole_res.h"
...
@@ -69,6 +70,9 @@ struct inner_data {
...
@@ -69,6 +70,9 @@ struct inner_data {
BOOL
in_grab_changes
;
/* to handle re-entrant calls to WINECON_GrabChanges */
BOOL
in_grab_changes
;
/* to handle re-entrant calls to WINECON_GrabChanges */
BOOL
dying
;
/* to TRUE when we've been notified by server that child has died */
BOOL
dying
;
/* to TRUE when we've been notified by server that child has died */
OVERLAPPED
overlapped
;
struct
condrv_renderer_event
events
[
256
];
int
(
*
fnMainLoop
)(
struct
inner_data
*
data
);
int
(
*
fnMainLoop
)(
struct
inner_data
*
data
);
void
(
*
fnPosCursor
)(
const
struct
inner_data
*
data
);
void
(
*
fnPosCursor
)(
const
struct
inner_data
*
data
);
void
(
*
fnShapeCursor
)(
struct
inner_data
*
data
,
int
size
,
int
vis
,
BOOL
force
);
void
(
*
fnShapeCursor
)(
struct
inner_data
*
data
,
int
size
,
int
vis
,
BOOL
force
);
...
...
programs/wineconsole/wineconsole.c
View file @
340a6617
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#include "winecon_private.h"
#include "winecon_private.h"
#include "winnls.h"
#include "winnls.h"
#include "winuser.h"
#include "winuser.h"
#include "wine/condrv.h"
#include "wine/unicode.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/debug.h"
...
@@ -242,21 +241,20 @@ static void WINECON_SetColors(struct inner_data *data, const struct config_data*
...
@@ -242,21 +241,20 @@ static void WINECON_SetColors(struct inner_data *data, const struct config_data*
*/
*/
void
WINECON_GrabChanges
(
struct
inner_data
*
data
)
void
WINECON_GrabChanges
(
struct
inner_data
*
data
)
{
{
struct
condrv_renderer_event
evts
[
256
]
;
struct
condrv_renderer_event
*
evts
=
data
->
events
;
int
i
,
ev_found
;
int
i
,
ev_found
;
DWORD
num
;
DWORD
num
;
HANDLE
h
;
HANDLE
h
;
if
(
data
->
in_grab_changes
)
return
;
if
(
data
->
in_grab_changes
)
return
;
if
(
!
DeviceIoControl
(
data
->
hSynchro
,
IOCTL_CONDRV_GET_RENDERER_EVENTS
,
NULL
,
0
,
evts
,
if
(
!
GetOverlappedResult
(
data
->
hSynchro
,
&
data
->
overlapped
,
&
num
,
FALSE
))
sizeof
(
evts
),
&
num
,
NULL
)
||
!
num
)
{
{
ERR
(
"failed to get renderer events: %u
\n
"
,
GetLastError
()
);
ERR
(
"failed to get renderer events: %u
\n
"
,
GetLastError
()
);
data
->
dying
=
TRUE
;
data
->
dying
=
TRUE
;
return
;
return
;
}
}
num
/=
sizeof
(
*
evts
);
num
/=
sizeof
(
data
->
events
[
0
]
);
WINE_TRACE
(
"got %u events
\n
"
,
num
);
WINE_TRACE
(
"got %u events
\n
"
,
num
);
/* FIXME: should do some event compression here (cursor pos, update) */
/* FIXME: should do some event compression here (cursor pos, update) */
...
@@ -400,6 +398,13 @@ void WINECON_GrabChanges(struct inner_data* data)
...
@@ -400,6 +398,13 @@ void WINECON_GrabChanges(struct inner_data* data)
}
}
}
}
data
->
in_grab_changes
=
FALSE
;
data
->
in_grab_changes
=
FALSE
;
if
(
!
DeviceIoControl
(
data
->
hSynchro
,
IOCTL_CONDRV_GET_RENDERER_EVENTS
,
NULL
,
0
,
data
->
events
,
sizeof
(
data
->
events
),
NULL
,
&
data
->
overlapped
)
&&
GetLastError
()
!=
ERROR_IO_PENDING
)
{
ERR
(
"failed to get renderer events: %u
\n
"
,
GetLastError
());
data
->
dying
=
TRUE
;
}
}
}
/******************************************************************
/******************************************************************
...
@@ -590,6 +595,7 @@ static void WINECON_Delete(struct inner_data* data)
...
@@ -590,6 +595,7 @@ static void WINECON_Delete(struct inner_data* data)
if
(
data
->
hConOut
)
CloseHandle
(
data
->
hConOut
);
if
(
data
->
hConOut
)
CloseHandle
(
data
->
hConOut
);
if
(
data
->
hSynchro
)
CloseHandle
(
data
->
hSynchro
);
if
(
data
->
hSynchro
)
CloseHandle
(
data
->
hSynchro
);
if
(
data
->
hProcess
)
CloseHandle
(
data
->
hProcess
);
if
(
data
->
hProcess
)
CloseHandle
(
data
->
hProcess
);
if
(
data
->
overlapped
.
hEvent
)
CloseHandle
(
data
->
overlapped
.
hEvent
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
curcfg
.
registry
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
curcfg
.
registry
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
cells
);
HeapFree
(
GetProcessHeap
(),
0
,
data
->
cells
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
...
@@ -676,6 +682,8 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
...
@@ -676,6 +682,8 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
/* should always be defined */
/* should always be defined */
}
}
if
(
!
(
data
->
overlapped
.
hEvent
=
CreateEventW
(
NULL
,
TRUE
,
TRUE
,
NULL
)))
goto
error
;
/* the handles here are created without the whistles and bells required by console
/* the handles here are created without the whistles and bells required by console
* (mainly because wineconsole doesn't need it)
* (mainly because wineconsole doesn't need it)
* - they are not inheritable
* - they are not inheritable
...
...
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