X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0a816d95815bc4b77f860e88e8f12bf3e9adab10..31a06b07cce898a22d0ca3992501e85da9c22f13:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b556a2e8eb..c19161b5c2 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2044,6 +2044,14 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) : wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, parent->GetId() ); le.SetEventObject( parent ); + le.m_pointDrag = event.GetPosition(); + + // the position should be relative to the parent window, not + // this one for compatibility with MSW and common sense: the + // user code doesn't know anything at all about this header + // window, so why should it get positions relative to it? + le.m_pointDrag.y -= GetSize().y; + le.m_col = m_column; parent->GetEventHandler()->ProcessEvent( le ); } @@ -2613,6 +2621,14 @@ void wxListMainWindow::RefreshSelected() to = GetItemCount() - 1; } + // VZ: this code would work fine if wxGTK wxWindow::Refresh() were + // reasonable, i.e. if it only generated one expose event for + // several calls to it - as it is, each Refresh() results in a + // repaint which provokes flicker too horrible to be seen + // + // when/if wxGTK is fixed, this code should be restored as normally it + // should generate _less_ flicker than the version below +#ifndef __WXGTK__ if ( HasCurrent() && m_current >= from && m_current <= to ) { RefreshLine(m_current); @@ -2626,6 +2642,26 @@ void wxListMainWindow::RefreshSelected() RefreshLine(line); } } +#else // __WXGTK__ + size_t selMin = (size_t)-1, + selMax = 0; + + for ( size_t line = from; line <= to; line++ ) + { + if ( IsHighlighted(line) || (line == m_current) ) + { + if ( line < selMin ) + selMin = line; + if ( line > selMax ) + selMax = line; + } + } + + if ( selMin != (size_t)-1 ) + { + RefreshLines(selMin, selMax); + } +#endif // !__WXGTK__/__WXGTK__ } void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) @@ -3353,12 +3389,19 @@ extern wxWindow *g_focusWindow; void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) ) { - m_hasFocus = TRUE; + // wxGTK sends us EVT_SET_FOCUS events even if we had never got + // EVT_KILL_FOCUS before which means that we finish by redrawing the items + // which are already drawn correctly resulting in horrible flicker - avoid + // it + if ( !m_hasFocus ) + { + m_hasFocus = TRUE; - if (!GetParent()) - return; + RefreshSelected(); + } - RefreshSelected(); + if ( !GetParent() ) + return; #ifdef __WXGTK__ g_focusWindow = GetParent();