Fix wxGrid::SetCurrentCell() with Wayland
Avoid wxClientDC with GTK3 as well as OSX. Additionally, refresh only the cells that need it, rather than the entire window. See #18448
This commit is contained in:
@@ -6248,16 +6248,16 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridWindow *currentGridWindow = CellToGridWindow(coords);
|
|
||||||
|
|
||||||
if ( m_currentCellCoords != wxGridNoCellCoords )
|
if ( m_currentCellCoords != wxGridNoCellCoords )
|
||||||
{
|
{
|
||||||
wxGridWindow *prevGridWindow = CellToGridWindow(m_currentCellCoords);
|
|
||||||
|
|
||||||
DisableCellEditControl();
|
DisableCellEditControl();
|
||||||
|
|
||||||
if ( IsVisible( m_currentCellCoords, false ) )
|
if ( IsVisible( m_currentCellCoords, false ) )
|
||||||
{
|
{
|
||||||
|
#if defined(__WXOSX__) || defined(__WXGTK3__)
|
||||||
|
RefreshBlock(m_currentCellCoords, m_currentCellCoords);
|
||||||
|
#else
|
||||||
|
wxGridWindow* prevGridWindow = CellToGridWindow(m_currentCellCoords);
|
||||||
wxRect r;
|
wxRect r;
|
||||||
r = BlockToDeviceRect( m_currentCellCoords, m_currentCellCoords, prevGridWindow );
|
r = BlockToDeviceRect( m_currentCellCoords, m_currentCellCoords, prevGridWindow );
|
||||||
if ( !m_gridLinesEnabled )
|
if ( !m_gridLinesEnabled )
|
||||||
@@ -6273,12 +6273,6 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
|||||||
// Otherwise refresh redraws the highlight!
|
// Otherwise refresh redraws the highlight!
|
||||||
m_currentCellCoords = coords;
|
m_currentCellCoords = coords;
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
|
||||||
currentGridWindow->Refresh(true /*, & r */);
|
|
||||||
|
|
||||||
if ( prevGridWindow != currentGridWindow )
|
|
||||||
prevGridWindow->Refresh(true);
|
|
||||||
#else
|
|
||||||
wxClientDC prevDc( prevGridWindow );
|
wxClientDC prevDc( prevGridWindow );
|
||||||
PrepareDCFor(prevDc, prevGridWindow);
|
PrepareDCFor(prevDc, prevGridWindow);
|
||||||
|
|
||||||
@@ -6293,10 +6287,13 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
|
|||||||
|
|
||||||
m_currentCellCoords = coords;
|
m_currentCellCoords = coords;
|
||||||
|
|
||||||
#if !defined(__WXMAC__)
|
#if defined(__WXOSX__) || defined(__WXGTK3__)
|
||||||
|
RefreshBlock(coords, coords);
|
||||||
|
#else
|
||||||
if ( ShouldRefresh() )
|
if ( ShouldRefresh() )
|
||||||
{
|
{
|
||||||
wxGridCellAttrPtr attr = GetCellAttrPtr( coords );
|
wxGridCellAttrPtr attr = GetCellAttrPtr( coords );
|
||||||
|
wxGridWindow* currentGridWindow = CellToGridWindow(coords);
|
||||||
wxClientDC dc( currentGridWindow );
|
wxClientDC dc( currentGridWindow );
|
||||||
PrepareDCFor(dc, currentGridWindow);
|
PrepareDCFor(dc, currentGridWindow);
|
||||||
DrawCellHighlight( dc, attr.get() );
|
DrawCellHighlight( dc, attr.get() );
|
||||||
|
|||||||
Reference in New Issue
Block a user