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:
@@ -99,6 +99,10 @@ public:
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// The scrollbars around a normal window should not
|
||||
// receive the focus.
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
// wxScrollBar sub elements state (combination of wxCONTROL_XXX)
|
||||
void SetState(Element which, int flags);
|
||||
int GetState(Element which) const;
|
||||
|
@@ -180,18 +180,30 @@ void MyCanvas::OnPaint( wxPaintEvent &event )
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
PrepareDC( dc );
|
||||
|
||||
|
||||
#if 0
|
||||
wxRegionIterator upd( GetUpdateRegion() );
|
||||
while (upd)
|
||||
{
|
||||
wxLogDebug( "Paint: %d %d %d %d", upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
|
||||
upd ++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
wxSize size = GetSize();
|
||||
wxSize client_size = GetClientSize();
|
||||
wxLogDebug( "size %d %d client_size %d %d", size.x, size.y, client_size.x, client_size.y );
|
||||
#endif
|
||||
|
||||
dc.SetPen( *wxWHITE_PEN );
|
||||
for (int i = 0; i < 20; i += 2)
|
||||
dc.DrawLine( i,i, i+100,i );
|
||||
|
||||
dc.SetPen( *wxWHITE_PEN );
|
||||
for (int i = 200; i < 220; i += 2)
|
||||
dc.DrawLine( i-200,i, i-100,i );
|
||||
|
||||
wxRegion region( 110, 110, 80, 80 );
|
||||
wxRegion hole( 130, 130, 40, 1 );
|
||||
region.Intersect( hole );
|
||||
|
@@ -427,6 +427,8 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
|
||||
win = win->GetParent();
|
||||
}
|
||||
|
||||
printf( "Dismiss now.\n" );
|
||||
|
||||
m_popup->DismissAndNotify();
|
||||
}
|
||||
|
||||
|
@@ -164,6 +164,24 @@ wxScrollBar::~wxScrollBar()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxScrollBar::AcceptsFocus() const
|
||||
{
|
||||
if (!wxWindow::AcceptsFocus()) return FALSE;
|
||||
|
||||
wxWindow *parent = (wxWindow*) GetParent();
|
||||
|
||||
if (parent)
|
||||
{
|
||||
if ((parent->GetScrollbar( wxHORIZONTAL ) == this) ||
|
||||
(parent->GetScrollbar( wxVERTICAL ) == this))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// scrollbar API
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -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;
|
||||
|
@@ -585,11 +585,11 @@ void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
|
||||
|
||||
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
wxLogDebug( "Setting pos: %d, %d", x, y );
|
||||
// wxLogDebug( "Setting pos: %d, %d", x, y );
|
||||
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||
|
||||
wxPoint pt = GetPosition();
|
||||
wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
||||
// wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
||||
#if 0
|
||||
XSync(wxGlobalDisplay(), False);
|
||||
int w, h;
|
||||
@@ -605,14 +605,14 @@ void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int siz
|
||||
|
||||
if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
{
|
||||
int yy = 0;
|
||||
int yy = 0;
|
||||
AdjustForParentClientOrigin( x, yy, sizeFlags);
|
||||
windowChanges.x = x;
|
||||
valueMask |= CWX;
|
||||
}
|
||||
if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
{
|
||||
int xx = 0;
|
||||
int xx = 0;
|
||||
AdjustForParentClientOrigin( xx, y, sizeFlags);
|
||||
windowChanges.y = y;
|
||||
valueMask |= CWY;
|
||||
@@ -647,12 +647,12 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
||||
int offsetY = 0;
|
||||
|
||||
#if !wxUSE_NANOX
|
||||
wxLogDebug("Translating...");
|
||||
// wxLogDebug("Translating...");
|
||||
Window childWindow;
|
||||
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
||||
0, 0, & offsetX, & offsetY, & childWindow);
|
||||
|
||||
wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
||||
// wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
||||
#endif
|
||||
|
||||
XWindowAttributes attr;
|
||||
|
@@ -562,8 +562,8 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
|
||||
else
|
||||
{
|
||||
wxRect rect;
|
||||
if (dx < 0) rect.x = cw+dx; else rect.x = s_x;
|
||||
if (dy < 0) rect.y = ch+dy; else rect.y = s_y;
|
||||
if (dx < 0) rect.x = cw+dx + offset.x; else rect.x = s_x;
|
||||
if (dy < 0) rect.y = ch+dy + offset.y; else rect.y = s_y;
|
||||
if (dy != 0) rect.width = cw; else rect.width = abs(dx);
|
||||
if (dx != 0) rect.height = ch; else rect.height = abs(dy);
|
||||
|
||||
|
Reference in New Issue
Block a user