From 5eddb1f467ad27d702db6329c6c692afe363a442 Mon Sep 17 00:00:00 2001 From: charras Date: Fri, 15 Jan 2010 10:02:47 +0000 Subject: [PATCH] fixed flicker when zooming. (wxGTK specific) --- common/drawpanel.cpp | 7 +++++-- common/zoom.cpp | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index 061ff6afa2..a622160beb 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -769,7 +769,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) // Under linux, to be tested (could be depend on linux versions // so perhaps could be necessary to set this option at run time. -#if defined ( __WXMAC__ ) +#ifndef __WXMSW__ // Use a pixel based draw to display grid // There is a lot of calls, so the cost is hight // and grid is slowly drawn on some platforms @@ -795,7 +795,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) // But this is fast if the Blit function is fast. Not true on all platforms // a grid column is drawn; and then copied to others grid columns // this is possible because the grid is drawn only after clearing the screen. - // under MACOSX, is very slow + // under MACOSX, is very slow and seems crash under Linux ii = 1; xg = wxRound(ii * screen_grid_size.x); int x0pos = GRMapX( org.x + xg); @@ -925,6 +925,9 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) */ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event ) { + if( m_IgnoreMouseEvents ) + return; + wxRect rect = wxRect( wxPoint( 0, 0), GetClientSize() ); /* Ignore scroll events if the cursor is outside the drawing area. */ diff --git a/common/zoom.cpp b/common/zoom.cpp index a6836463b5..5f242e8039 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -26,15 +26,22 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse ) { PutOnGrid( &(GetBaseScreen()->m_Curseur) ); AdjustScrollBars(); + + DrawPanel->m_IgnoreMouseEvents = true; DrawPanel->Refresh(); // send OnPaint event - wxSafeYield(); // needed to allow OnPaint event execution here + + // wxSafeYield() is better here, but creates flicker under Linux + // because it temporary disables menus and toolbars + // TODO: find a better way to manage refresh screen and mouse move + wxYield(); // needed to allow OnPaint event execution here + DrawPanel->m_IgnoreMouseEvents = false; /* Move the mouse cursor to the on grid graphic cursor position */ if( ToMouse == TRUE ) { DrawPanel->MouseToCursorSchema(); } -} + } /** Adjust the coordinate to the nearest grid value