wineconsole: Ensure that the EXIT message is always properly propagated to the first caller of GrabChanges.
This commit is contained in:
parent
4220cd6608
commit
51f06239ff
|
@ -1009,17 +1009,16 @@ static void WCCURSES_DeleteBackend(struct inner_data* data)
|
|||
static int WCCURSES_MainLoop(struct inner_data* data)
|
||||
{
|
||||
DWORD id;
|
||||
BOOL cont = TRUE;
|
||||
|
||||
WCCURSES_Resize(data);
|
||||
|
||||
if (pipe( PRIVATE(data)->sync_pipe ) == -1) return 0;
|
||||
PRIVATE(data)->input_thread = CreateThread( NULL, 0, input_thread, data, 0, &id );
|
||||
|
||||
while (cont && WaitForSingleObject(data->hSynchro, INFINITE) == WAIT_OBJECT_0)
|
||||
while (!data->dying && WaitForSingleObject(data->hSynchro, INFINITE) == WAIT_OBJECT_0)
|
||||
{
|
||||
EnterCriticalSection(&PRIVATE(data)->lock);
|
||||
cont = WINECON_GrabChanges(data);
|
||||
WINECON_GrabChanges(data);
|
||||
LeaveCriticalSection(&PRIVATE(data)->lock);
|
||||
}
|
||||
|
||||
|
|
|
@ -1368,13 +1368,12 @@ static int WCUSER_MainLoop(struct inner_data* data)
|
|||
MSG msg;
|
||||
|
||||
ShowWindow(data->hWnd, data->nCmdShow);
|
||||
for (;;)
|
||||
while (!data->dying || !data->curcfg.exit_on_die)
|
||||
{
|
||||
switch (MsgWaitForMultipleObjects(1, &data->hSynchro, FALSE, INFINITE, QS_ALLINPUT))
|
||||
{
|
||||
case WAIT_OBJECT_0:
|
||||
if (!WINECON_GrabChanges(data) && data->curcfg.exit_on_die)
|
||||
PostQuitMessage(0);
|
||||
WINECON_GrabChanges(data);
|
||||
break;
|
||||
case WAIT_OBJECT_0+1:
|
||||
/* need to use PeekMessageW loop instead of simple GetMessage:
|
||||
|
@ -1393,6 +1392,8 @@ static int WCUSER_MainLoop(struct inner_data* data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -61,6 +61,7 @@ struct inner_data {
|
|||
HWND hWnd; /* handle of 'user' window or NULL for 'curses' */
|
||||
INT nCmdShow; /* argument of WinMain */
|
||||
BOOL in_set_config; /* to handle re-entrant calls to WINECON_SetConfig */
|
||||
BOOL dying; /* to TRUE when we've been notified by server that child has died */
|
||||
|
||||
int (*fnMainLoop)(struct inner_data* data);
|
||||
void (*fnPosCursor)(const struct inner_data* data);
|
||||
|
@ -82,8 +83,8 @@ extern void WINECON_ResizeWithContainer(struct inner_data* data, int width, int
|
|||
extern int WINECON_GetHistorySize(HANDLE hConIn);
|
||||
extern int WINECON_GetHistoryMode(HANDLE hConIn);
|
||||
extern BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len);
|
||||
extern int WINECON_GrabChanges(struct inner_data* data);
|
||||
extern VOID WINECON_SetConfig(struct inner_data* data,
|
||||
extern void WINECON_GrabChanges(struct inner_data* data);
|
||||
extern void WINECON_SetConfig(struct inner_data* data,
|
||||
const struct config_data* cfg);
|
||||
/* from registry.c */
|
||||
extern void WINECON_RegLoad(const WCHAR* appname, struct config_data* cfg);
|
||||
|
|
|
@ -199,7 +199,7 @@ static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode)
|
|||
*
|
||||
* A change occurs, try to figure out which
|
||||
*/
|
||||
int WINECON_GrabChanges(struct inner_data* data)
|
||||
void WINECON_GrabChanges(struct inner_data* data)
|
||||
{
|
||||
struct console_renderer_event evts[256];
|
||||
int i, num, ev_found;
|
||||
|
@ -213,7 +213,7 @@ int WINECON_GrabChanges(struct inner_data* data)
|
|||
else num = 0;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
if (!num) {WINE_WARN("hmm renderer signaled but no events available\n"); return 1;}
|
||||
if (!num) {WINE_WARN("hmm renderer signaled but no events available\n"); return;}
|
||||
|
||||
/* FIXME: should do some event compression here (cursor pos, update) */
|
||||
/* step 1: keep only last cursor pos event */
|
||||
|
@ -344,15 +344,15 @@ int WINECON_GrabChanges(struct inner_data* data)
|
|||
}
|
||||
break;
|
||||
case CONSOLE_RENDERER_EXIT_EVENT:
|
||||
data->dying = TRUE;
|
||||
WINE_TRACE(". Exit!!\n");
|
||||
return 0;
|
||||
return;
|
||||
default:
|
||||
WINE_FIXME("Unknown event type (%d)\n", evts[i].event);
|
||||
}
|
||||
}
|
||||
|
||||
WINE_TRACE(".\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
Loading…
Reference in New Issue