diff --git a/widget/src/motif/nsWindow.cpp b/widget/src/motif/nsWindow.cpp index e54a2f02d639..a62fdd01812c 100644 --- a/widget/src/motif/nsWindow.cpp +++ b/widget/src/motif/nsWindow.cpp @@ -384,7 +384,7 @@ void nsWindow::InitCallbacks(char * aName) XtAddEventHandler(mWidget, ExposureMask, - PR_FALSE, + PR_TRUE, nsXtWidget_ExposureMask_EventHandler, this); @@ -829,19 +829,29 @@ void nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) aClipRect->x, aClipRect->y, aClipRect->XMost(), aClipRect->YMost(), aDx, aDy); - 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 +#if 1 XEvent evt; evt.xgraphicsexpose.type = GraphicsExpose; evt.xgraphicsexpose.send_event = False; evt.xgraphicsexpose.display = display; evt.xgraphicsexpose.drawable = win; - evt.xgraphicsexpose.x = mBounds.x; - evt.xgraphicsexpose.y = mBounds.y; - evt.xgraphicsexpose.width = mBounds.width; - evt.xgraphicsexpose.height = mBounds.height; + if (aDy < 0) { + evt.xgraphicsexpose.x = 0; + evt.xgraphicsexpose.y = mBounds.height+aDy; + evt.xgraphicsexpose.width = mBounds.width; + evt.xgraphicsexpose.height = -aDy; + } else { + evt.xgraphicsexpose.x = 0; + evt.xgraphicsexpose.y = 0; + evt.xgraphicsexpose.width = mBounds.width; + evt.xgraphicsexpose.height = aDy; + } evt.xgraphicsexpose.count = 0; + if (DBG) printf("Forcing repaint %d %d %d %d\n", evt.xgraphicsexpose.x, + evt.xgraphicsexpose.y, + evt.xgraphicsexpose.width, + evt.xgraphicsexpose.height); + XSendEvent(display, win, False, ExposureMask, &evt); XFlush(display); #endif diff --git a/widget/src/motif/nsXtEventHandler.cpp b/widget/src/motif/nsXtEventHandler.cpp index cd3dfa0b6631..0c8c0858f76f 100644 --- a/widget/src/motif/nsXtEventHandler.cpp +++ b/widget/src/motif/nsXtEventHandler.cpp @@ -145,9 +145,37 @@ void nsXtWidget_ExposureMask_EventHandler(Widget w, XtPointer p, XEvent * event, pevent.rect = (nsRect *)▭ XEvent xev; + rect.x = event->xexpose.x; + rect.y = event->xexpose.y; + rect.width = event->xexpose.width; + rect.height = event->xexpose.height; + + //printf("Expose (%d %d %d %d)\n", event->xexpose.x, event->xexpose.y, + //event->xexpose.width, event->xexpose.height); + if (widgetWindow->GetResized()) return; + if (event->type == NoExpose) { + return; + } + + Display* display = XtDisplay(w); + Window window = XtWindow(w); + + XSync(display, FALSE); + + while (XCheckTypedWindowEvent(display, window, Expose, &xev) == TRUE) { + rect.x = xev.xexpose.x; + rect.y = xev.xexpose.y; + rect.width = xev.xexpose.width; + rect.height = xev.xexpose.height; + //printf("rect %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height); + //fe_expose_eh(drawing_area, (XtPointer)context, &xev); + } + + +#if 0 int count = 0; while (XPeekEvent(XtDisplay(w), &xev)) { @@ -156,11 +184,13 @@ void nsXtWidget_ExposureMask_EventHandler(Widget w, XtPointer p, XEvent * event, XNextEvent(XtDisplay(w), &xev); count++; } else { - if (DBG) printf("Ate %d events\n", count); + // if (DBG) + printf("Ate %d events\n", count); break; } } - +#endif + if (DBG) printf("Calling OnPaint (%d %d %d %d)\n", rect.x, rect.y, rect.width, rect.height); widgetWindow->OnPaint(pevent); #if 0