Re: [AD] Real time d_list_proc() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Sven Sandberg <ssven@xxxxxxxxxx> writes:
> Here is a patch that makes scrolling in d_list_proc() go in real time.
> In big lists, you used to see the list continue scrolling after you
> released the key because keypresses were buffered faster than the list
> redrew itself (at least on my P133). I changed d_list_proc() to only
> redraw after a keypress when it recieves a MSG_IDLE message, so it will
> "skip frames" now.
I like the idea, but I think there is an easier way to implement this:
what happens if you simply set the D_DIRTY flag in the object?
I have a feeling that this won't quite work at the moment, because the
broadcast of MSG_IDLE doesn't handle redrawing of D_DIRTY objects, but
this could easily be changed.
Actually the dialog_message() code looks broken to me in any case: it
clear the D_REDRAWME flag if an object returns that, but without setting
the D_DIRTY flag in the object itself. The attached patch should fix
this: I haven't tried it, but with this applied it should be enough for
these objects to simply set D_DIRTY in order to be redrawn during the
next idle (I'll try making them do that later, if you don't get around to
it first).
> This needed a new D_INTERNAL2 flag for the DIALOG->flags field. I hope
> it was OK to add that; it ought not to break anything as long as people
> use D_USER as a base for their own flags
That's fine, although in this case I don't think we need it since D_DIRTY
already almost covers what you used D_INTERNAL2 for. Adding new flags is
certainly ok: it's people's own fault if they hardcoded custom flag
values rather than using D_USER :-)
--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."
--- /e/allegro/src/gui.c Sun Jan 30 20:46:56 2000
+++ allegro/src/gui.c Thu Feb 3 20:56:29 2000
@@ -293,10 +293,22 @@
for (count=0; dialog[count].proc; count++) {
if ((force) || (!(dialog[count].flags & D_HIDDEN))) {
r = dialog[count].proc(msg, &dialog[count], c);
- r &= ~D_REDRAWME;
+
+ if (r & D_REDRAWME) {
+ dialog[count].flags |= D_DIRTY;
+ r &= ~D_REDRAWME;
+ }
+
if (r != D_O_K) {
res |= r;
*obj = count;
+ }
+
+ if ((msg == MSG_IDLE) && (dialog[c].flags & (D_DIRTY | D_HIDDEN)) == D_DIRTY) {
+ dialog[c].flags &= ~D_DIRTY;
+ scare_mouse();
+ SEND_MESSAGE(dialog+c, MSG_DRAW, 0);
+ unscare_mouse();
}
}
}