wine console patch (3/3)
Eric Pouech
eric.pouech at wanadoo.fr
Fri Mar 22 13:58:07 CST 2002
this patch implement a bit of event compression
this is particulary useful when a bunch of information
is displayed at once in the console (a very large backtrace
in the debugger is a good example)
time needed to do the refresh on wineconsole is greatly
improved in this situation (but, this can still be enhanced)
A+
-------------- next part --------------
This patched is released under the X11 license.
Name: wc_fast
ChangeLog: started implementing event reduction
GenDate: 2002/03/22 19:43:00 UTC
ModifiedFiles: programs/wineconsole/wineconsole.c
AddedFiles:
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/wineconsole.c,v
retrieving revision 1.7
diff -u -u -r1.7 wineconsole.c
--- programs/wineconsole/wineconsole.c 10 Mar 2002 00:21:20 -0000 1.7
+++ programs/wineconsole/wineconsole.c 21 Mar 2002 20:43:36 -0000
@@ -196,8 +196,8 @@
*/
int WINECON_GrabChanges(struct inner_data* data)
{
- struct console_renderer_event evts[16];
- int i, num;
+ struct console_renderer_event evts[256];
+ int i, num, curs = -1;
HANDLE h;
SERVER_START_REQ( get_console_renderer_events )
@@ -211,6 +211,43 @@
if (!num) {Trace(0, "hmm renderer signaled but no events available\n"); return 1;}
/* FIXME: should do some event compression here (cursor pos, update) */
+ /* step 1: keep only last cursor pos event */
+ for (i = num - 1; i >= 0; i--)
+ {
+ if (evts[i].event == CONSOLE_RENDERER_CURSOR_POS_EVENT)
+ {
+ if (curs == -1)
+ curs = i;
+ else
+ {
+ memmove(&evts[i], &evts[i+1], (num - i - 1) * sizeof(evts[0]));
+ num--;
+ }
+ }
+ }
+ /* step 2: manage update events */
+ for (i = 0; i < num - 1; i++)
+ {
+ if (evts[i].event == CONSOLE_RENDERER_UPDATE_EVENT &&
+ evts[i+1].event == CONSOLE_RENDERER_UPDATE_EVENT)
+ {
+ /* contiguous */
+ if (evts[i].u.update.bottom + 1 == 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--;
+ }
+ /* 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--;
+ }
+ }
+ }
+
Trace(1, "Change notification:");
for (i = 0; i < num; i++)
{
More information about the wine-patches
mailing list