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,
|
long numArg = 0,
|
||||||
const wxString& strArg = wxEmptyString);
|
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)
|
// wxScrollBar sub elements state (combination of wxCONTROL_XXX)
|
||||||
void SetState(Element which, int flags);
|
void SetState(Element which, int flags);
|
||||||
int GetState(Element which) const;
|
int GetState(Element which) const;
|
||||||
|
@@ -181,17 +181,29 @@ void MyCanvas::OnPaint( wxPaintEvent &event )
|
|||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
|
||||||
|
#if 0
|
||||||
wxRegionIterator upd( GetUpdateRegion() );
|
wxRegionIterator upd( GetUpdateRegion() );
|
||||||
while (upd)
|
while (upd)
|
||||||
{
|
{
|
||||||
wxLogDebug( "Paint: %d %d %d %d", upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
|
wxLogDebug( "Paint: %d %d %d %d", upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
|
||||||
upd ++;
|
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 );
|
dc.SetPen( *wxWHITE_PEN );
|
||||||
for (int i = 0; i < 20; i += 2)
|
for (int i = 0; i < 20; i += 2)
|
||||||
dc.DrawLine( i,i, i+100,i );
|
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 region( 110, 110, 80, 80 );
|
||||||
wxRegion hole( 130, 130, 40, 1 );
|
wxRegion hole( 130, 130, 40, 1 );
|
||||||
region.Intersect( hole );
|
region.Intersect( hole );
|
||||||
|
@@ -427,6 +427,8 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
|
|||||||
win = win->GetParent();
|
win = win->GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf( "Dismiss now.\n" );
|
||||||
|
|
||||||
m_popup->DismissAndNotify();
|
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
|
// scrollbar API
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -411,7 +411,42 @@ int wxApp::MainLoop()
|
|||||||
return rt;
|
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.
|
// Processes an X event.
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
void wxApp::ProcessXEvent(WXEvent* _event)
|
void wxApp::ProcessXEvent(WXEvent* _event)
|
||||||
{
|
{
|
||||||
XEvent* event = (XEvent*) _event;
|
XEvent* event = (XEvent*) _event;
|
||||||
@@ -541,13 +576,23 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
win->GetClearRegion().Union( XExposeEventGetX(event), XExposeEventGetY(event),
|
win->GetClearRegion().Union( XExposeEventGetX(event), XExposeEventGetY(event),
|
||||||
XExposeEventGetWidth(event), XExposeEventGetHeight(event));
|
XExposeEventGetWidth(event), XExposeEventGetHeight(event));
|
||||||
|
|
||||||
|
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
if (event->xexpose.count == 0)
|
XEvent tmp_event;
|
||||||
#endif
|
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->GetUpdateRegion().Union( tmp_event.xexpose.x, tmp_event.xexpose.y,
|
||||||
win->SendEraseEvents();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@@ -621,6 +666,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
focusEvent.SetEventObject(win);
|
focusEvent.SetEventObject(win);
|
||||||
focusEvent.SetWindow( g_prevFocus );
|
focusEvent.SetWindow( g_prevFocus );
|
||||||
g_prevFocus = NULL;
|
g_prevFocus = NULL;
|
||||||
|
|
||||||
win->GetEventHandler()->ProcessEvent(focusEvent);
|
win->GetEventHandler()->ProcessEvent(focusEvent);
|
||||||
}
|
}
|
||||||
break;
|
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)
|
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);
|
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
|
|
||||||
wxPoint pt = GetPosition();
|
wxPoint pt = GetPosition();
|
||||||
wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
// wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
||||||
#if 0
|
#if 0
|
||||||
XSync(wxGlobalDisplay(), False);
|
XSync(wxGlobalDisplay(), False);
|
||||||
int w, h;
|
int w, h;
|
||||||
@@ -647,12 +647,12 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
|||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
|
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
wxLogDebug("Translating...");
|
// wxLogDebug("Translating...");
|
||||||
Window childWindow;
|
Window childWindow;
|
||||||
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
||||||
0, 0, & offsetX, & offsetY, & childWindow);
|
0, 0, & offsetX, & offsetY, & childWindow);
|
||||||
|
|
||||||
wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
// wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
|
@@ -562,8 +562,8 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
if (dx < 0) rect.x = cw+dx; else rect.x = s_x;
|
if (dx < 0) rect.x = cw+dx + offset.x; else rect.x = s_x;
|
||||||
if (dy < 0) rect.y = ch+dy; else rect.y = s_y;
|
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 (dy != 0) rect.width = cw; else rect.width = abs(dx);
|
||||||
if (dx != 0) rect.height = ch; else rect.height = abs(dy);
|
if (dx != 0) rect.height = ch; else rect.height = abs(dy);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user