Fix scrolling flashing in GTK. Fixes bug #12860. r=syd,pavlov a=brendan,chofman

n
This commit is contained in:
blizzard%redhat.com 1999-12-14 05:08:17 +00:00
parent b3353b150d
commit a989bf4b43
3 changed files with 77 additions and 3 deletions

View File

@ -1020,8 +1020,9 @@ NS_METHOD nsWindow::CreateNative(GtkObject *parentWidget)
// set our background color to make people happy.
SetBackgroundColor(NS_RGB(192,192,192));
//gdk_window_set_back_pixmap(mSuperWin->bin_window, NULL, 0);
// SetBackgroundColor(NS_RGB(192,192,192));
gdk_window_set_back_pixmap(mSuperWin->bin_window, NULL, 0);
// track focus in and focus out events for the shell
if (mShell) {
@ -1131,6 +1132,15 @@ NS_IMETHODIMP nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
if (mSuperWin) {
gdk_superwin_scroll(mSuperWin, aDx, aDy);
// hard process the expose events. this will force the handling
// of the Expose and ConfigureNotify events that we just created
// by scrolling the window
gdk_superwin_hard_process_exposes(mSuperWin);
// sync the update
mIsUpdating = PR_FALSE;
Update();
// flush the event queue to make sure that the draw events get there.
XFlush(GDK_DISPLAY());
}
return NS_OK;
}
@ -2004,6 +2014,7 @@ nsWindow::HandleXlibCrossingEvent(XCrossingEvent * aCrossingEvent)
void
nsWindow::HandleXlibConfigureNotifyEvent(XEvent *event)
{
#if 0
XEvent config_event;
while (XCheckTypedWindowEvent(event->xany.display,
@ -2028,7 +2039,9 @@ nsWindow::HandleXlibConfigureNotifyEvent(XEvent *event)
#endif
}
gdk_superwin_clear_translate_queue(mSuperWin, event->xany.serial);
// gdk_superwin_clear_translate_queue(mSuperWin, event->xany.serial);
#endif
if (mIsToplevel) {
nsSizeEvent sevent;

View File

@ -360,3 +360,63 @@ gdk_superwin_clear_translate_queue(GdkSuperWin *superwin, unsigned long serial)
}
}
/* This function is generally used after you scroll the window. It
* will hunt through the translation queue for this window and make
* sure that all of the Expose and ConfigureNotify events that could
* have been part of the translation queue get processed.
*
* Additionally, it makes sure that any Expose events that are still
* in the queue get processed for good measure. When scrolling this
* make it look a lot smoother in Mozilla along the edges. */
void gdk_superwin_hard_process_exposes(GdkSuperWin *superwin)
{
XEvent xevent;
GList *tmp_list;
GdkSuperWinTranslate *translate;
// wait for the window event
while (superwin->translate_queue)
{
XWindowEvent(GDK_DISPLAY(),
GDK_WINDOW_XWINDOW(superwin->bin_window),
( ExposureMask | SubstructureNotifyMask ),
&xevent);
switch(xevent.xany.type) {
case Expose:
tmp_list = superwin->translate_queue;
while (tmp_list)
{
translate = tmp_list->data;
xevent.xexpose.x += translate->dx;
xevent.xexpose.y += translate->dy;
tmp_list = tmp_list->next;
}
if (superwin->bin_func)
superwin->bin_func(superwin, &xevent, superwin->func_data);
break;
case ConfigureNotify:
gdk_superwin_clear_translate_queue(superwin, xevent.xany.serial);
break;
}
}
/* try to pull all the exposes out, too. */
while (XCheckTypedWindowEvent(GDK_DISPLAY(),
GDK_WINDOW_XWINDOW(superwin->bin_window),
Expose,
&xevent) == True)
{
tmp_list = superwin->translate_queue;
while (tmp_list)
{
translate = tmp_list->data;
xevent.xexpose.x += translate->dx;
xevent.xexpose.y += translate->dy;
tmp_list = tmp_list->next;
}
if (superwin->bin_func)
superwin->bin_func(superwin, &xevent, superwin->func_data);
}
}

View File

@ -83,6 +83,7 @@ void gdk_superwin_resize (GdkSuperWin *superwin,
void gdk_superwin_destroy(GdkSuperWin *superwin);
void gdk_superwin_clear_translate_queue(GdkSuperWin *superwin,
unsigned long serial);
void gdk_superwin_hard_process_exposes(GdkSuperWin *superwin);
#ifdef __cplusplus
}