Added expose event compression.

Made wxUniv scrollbars not accept any focus
    if they are owned by the window (in contrast
    to stand alone scrollbars).
  Further corrections to ScrollWindow()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-02-24 16:23:43 +00:00
parent 9d2cef1c69
commit f809133f9e
7 changed files with 95 additions and 13 deletions

View File

@@ -411,7 +411,42 @@ int wxApp::MainLoop()
return rt;
}
//-----------------------------------------------------------------------
// X11 predicate function for exposure compression
//-----------------------------------------------------------------------
struct wxExposeInfo
{
Window window;
Bool found_non_matching;
};
static Bool expose_predicate (Display *display, XEvent *xevent, XPointer arg)
{
wxExposeInfo *info = (wxExposeInfo*) arg;
if (info->found_non_matching)
return FALSE;
if (xevent->xany.type != Expose)
{
info->found_non_matching = TRUE;
return FALSE;
}
if (xevent->xexpose.window != info->window)
{
info->found_non_matching = TRUE;
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------
// Processes an X event.
//-----------------------------------------------------------------------
void wxApp::ProcessXEvent(WXEvent* _event)
{
XEvent* event = (XEvent*) _event;
@@ -541,13 +576,23 @@ void wxApp::ProcessXEvent(WXEvent* _event)
win->GetClearRegion().Union( XExposeEventGetX(event), XExposeEventGetY(event),
XExposeEventGetWidth(event), XExposeEventGetHeight(event));
#if !wxUSE_NANOX
if (event->xexpose.count == 0)
#endif
XEvent tmp_event;
wxExposeInfo info;
info.window = event->xexpose.window;
info.found_non_matching = FALSE;
while (XCheckIfEvent( wxGlobalDisplay(), &tmp_event, expose_predicate, (XPointer) &info ))
{
// Only erase background, paint in idle time.
win->SendEraseEvents();
win->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
tmp_event.xexpose.width, tmp_event.xexpose.height );
win->GetClearRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
tmp_event.xexpose.width, tmp_event.xexpose.height );
}
#endif
win->SendEraseEvents();
return;
}
@@ -621,6 +666,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
focusEvent.SetEventObject(win);
focusEvent.SetWindow( g_prevFocus );
g_prevFocus = NULL;
win->GetEventHandler()->ProcessEvent(focusEvent);
}
break;