Commit ae3b9bb6 authored by Peter Berg Larsen's avatar Peter Berg Larsen Committed by Alexandre Julliard

Use CONSOLE_RENDERER_NONE_EVENT to compress an event instead of

deleting it with a memmove.
parent 09f71d08
...@@ -208,7 +208,7 @@ static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode) ...@@ -208,7 +208,7 @@ static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode)
int WINECON_GrabChanges(struct inner_data* data) int WINECON_GrabChanges(struct inner_data* data)
{ {
struct console_renderer_event evts[256]; struct console_renderer_event evts[256];
int i, num, curs = -1; int i, num, ev_found;
HANDLE h; HANDLE h;
SERVER_START_REQ( get_console_renderer_events ) SERVER_START_REQ( get_console_renderer_events )
...@@ -223,40 +223,37 @@ int WINECON_GrabChanges(struct inner_data* data) ...@@ -223,40 +223,37 @@ int WINECON_GrabChanges(struct inner_data* data)
/* FIXME: should do some event compression here (cursor pos, update) */ /* FIXME: should do some event compression here (cursor pos, update) */
/* step 1: keep only last cursor pos event */ /* step 1: keep only last cursor pos event */
ev_found = -1;
for (i = num - 1; i >= 0; i--) for (i = num - 1; i >= 0; i--)
{ {
if (evts[i].event == CONSOLE_RENDERER_CURSOR_POS_EVENT) if (evts[i].event == CONSOLE_RENDERER_CURSOR_POS_EVENT)
{ {
if (curs == -1) if (ev_found != -1) evts[ev_found].event = CONSOLE_RENDERER_NONE_EVENT;
curs = i; ev_found = i;
else
{
memmove(&evts[i], &evts[i+1], (num - i - 1) * sizeof(evts[0]));
num--;
}
} }
} }
/* step 2: manage update events */ /* step 2: manage update events */
ev_found = -1;
for (i = 0; i < num - 1; i++) for (i = 0; i < num - 1; i++)
{ {
if (evts[i].event == CONSOLE_RENDERER_UPDATE_EVENT && if (evts[i].event == CONSOLE_RENDERER_NONE_EVENT) continue;
evts[i+1].event == CONSOLE_RENDERER_UPDATE_EVENT) if (evts[i].event != CONSOLE_RENDERER_UPDATE_EVENT)
{ {
/* contiguous */ ev_found = -1;
if (evts[i].u.update.bottom + 1 == evts[i+1].u.update.top) continue;
{
evts[i].u.update.bottom = evts[i+1].u.update.bottom;
memmove(&evts[i+1], &evts[i+2], (num - i - 2) * sizeof(evts[0]));
num--; i--;
}
/* already handled cases */
else if (evts[i].u.update.top <= evts[i+1].u.update.top &&
evts[i].u.update.bottom >= evts[i+1].u.update.bottom)
{
memmove(&evts[i+1], &evts[i+2], (num - i - 2) * sizeof(evts[0]));
num--; i--;
} }
if (ev_found != -1 &&
!(evts[i ].u.update.bottom + 1 < evts[ev_found].u.update.top ||
evts[ev_found].u.update.bottom + 1 < evts[i ].u.update.top))
{
evts[i].u.update.top = min(evts[i ].u.update.top,
evts[ev_found].u.update.top);
evts[i].u.update.bottom = max(evts[i ].u.update.bottom,
evts[ev_found].u.update.bottom);
evts[ev_found].event = CONSOLE_RENDERER_NONE_EVENT;
} }
ev_found = i;
} }
WINE_TRACE("Events:"); WINE_TRACE("Events:");
...@@ -264,6 +261,8 @@ int WINECON_GrabChanges(struct inner_data* data) ...@@ -264,6 +261,8 @@ int WINECON_GrabChanges(struct inner_data* data)
{ {
switch (evts[i].event) switch (evts[i].event)
{ {
case CONSOLE_RENDERER_NONE_EVENT:
break;
case CONSOLE_RENDERER_TITLE_EVENT: case CONSOLE_RENDERER_TITLE_EVENT:
data->fnSetTitle(data); data->fnSetTitle(data);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment