Fixed up scrolling a bit by discarding multiple expose events

This commit is contained in:
rods 1998-06-17 15:52:55 +00:00
parent 16ea80e42f
commit 4c0cdd724f
2 changed files with 32 additions and 8 deletions

View File

@ -812,8 +812,9 @@ void nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
aClipRect->x, aClipRect->y,
aClipRect->XMost(), aClipRect->YMost(), aDx, aDy);
printf("Clipping %d %d %d %d\n", aClipRect->x, aClipRect->y,aClipRect->XMost(), aClipRect->YMost());
printf("Forcing repaint %d %d %d %d\n", mBounds.x, mBounds.y, mBounds.width, mBounds.height);
if (DBG)printf("Clipping %d %d %d %d\n", aClipRect->x, aClipRect->y,aClipRect->XMost(), aClipRect->YMost());
if (DBG)printf("Forcing repaint %d %d %d %d\n", mBounds.x, mBounds.y, mBounds.width, mBounds.height);
#if 0
XEvent evt;
evt.xgraphicsexpose.type = GraphicsExpose;
evt.xgraphicsexpose.send_event = False;
@ -824,9 +825,9 @@ void nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
evt.xgraphicsexpose.width = mBounds.width;
evt.xgraphicsexpose.height = mBounds.height;
evt.xgraphicsexpose.count = 0;
//XSendEvent(display, win, False, ExposureMask, &evt);
//XFlush(display);
XSendEvent(display, win, False, ExposureMask, &evt);
XFlush(display);
#endif
}

View File

@ -26,7 +26,7 @@
#include "stdio.h"
#define DBG 1
#define DBG 0
//==============================================================
void nsXtWidget_InitNSEvent(XEvent * anXEv,
@ -133,9 +133,32 @@ static Bool checkForExpose(Display *dpy, XEvent *evt, XtPointer client_data)
void nsXtWidget_ExposureMask_EventHandler(Widget w, XtPointer p, XEvent * event, Boolean * b)
{
if (DBG) fprintf(stderr, "In nsXtWidget_ExposureMask_EventHandler\n");
if (DBG) fprintf(stderr, "In nsXtWidget_ExposureMask_EventHandler Type %d (%d,%d)\n", event->type, Expose, GraphicsExpose);
nsWindow * widgetWindow = (nsWindow *) p ;
nsPaintEvent pevent;
nsRect rect;
nsXtWidget_InitNSEvent(event, p, pevent, NS_PAINT);
pevent.rect = (nsRect *)▭
XEvent xev;
int count = 0;
while (XPeekEvent(XtDisplay(w), &xev))
{
if ((xev.type == Expose || xev.type == GraphicsExpose || xev.type == 14) &&
(xev.xexpose.window == XtWindow(w))) {
XNextEvent(XtDisplay(w), &xev);
count++;
} else {
if (DBG) printf("Ate %d events\n", count);
break;
}
}
widgetWindow->OnPaint(pevent);
#if 0
nsPaintEvent pevent;
nsRect rect;
nsXtWidget_InitNSEvent(event, p, pevent, NS_PAINT);
@ -182,7 +205,7 @@ printf("After %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height);
widgetWindow->OnPaint(pevent);
if (DBG) fprintf(stderr, "Out nsXtWidget_ExposureMask_EventHandler\n");
#endif
}
//==============================================================