[M-git] Mahogany sources repository. branch master updated. v0.67-823-g8468e43f

Vadim Zeitlin via Mahogany-cvsupdates <[email protected]> Sat, 12 Nov 2022 18:59:00 +0000
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Mahogany sources repository.".

The branch, master has been updated
       via  8468e43f216872b1390a6a1962fdf19c58a9e0fd (commit)
       via  9ed536f1c3f88cf48e274d986951d1d5041d3a9f (commit)
       via  56c7a7718e042242d09a25f806347bbc5495a07c (commit)
      from  bddbc6dcb76eca43aa9bb52952768fd688d60b3c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8468e43f216872b1390a6a1962fdf19c58a9e0fd
Author: Vadim Zeitlin <[email protected]>
Date:   Sat Nov 12 18:52:18 2022 +0000

    Fix wxLayoutWindow drawing with the latest wx 3.3
    
    Using wxClientDC doesn't work any longer, so don't use it and redraw the
    window only in wxEVT_PAINT handler.
    
    This allows to further simplify the code and also remove the unnecessary
    wxEVT_SCROLL handler as everything works fine without it under wxMSW.

diff --git a/include/gui/wxlwindow.h b/include/gui/wxlwindow.h
index de4b0121..6925b855 100644
--- a/include/gui/wxlwindow.h
+++ b/include/gui/wxlwindow.h
@@ -129,10 +129,9 @@ public:
    void SetWordWrap(bool on = true) { m_DoWordWrap = on; }
    
    /** Redraws the window.
-       Internally, this stores the parameter and calls a refresh on
-       wxMSW, draws directly on wxGTK.
+       This actually is the same as Refresh() now.
    */
-   void RequestUpdate(const wxRect *updateRect = NULL);
+   void RequestUpdate() { Refresh(); }
 
    /// if exact == false, assume 50% extra size for the future
    void ResizeScrollbars(bool exact = false);  // don't change this to true!
@@ -149,7 +148,6 @@ public:
    //@{
    void OnSize(wxSizeEvent &event);
    void OnPaint(wxPaintEvent &event);
-   void OnIdle(wxIdleEvent &event);
    void OnChar(wxKeyEvent& event);
    void OnKeyDown(wxKeyEvent& event);
    void OnKeyUp(wxKeyEvent& event);
@@ -165,15 +163,10 @@ public:
    void OnMouseMove(wxMouseEvent &event)       { OnMouse(WXLOWIN_MENU_MOUSEMOVE, event) ; }
    void OnSetFocus(wxFocusEvent &ev);
    void OnKillFocus(wxFocusEvent &ev);
-#ifdef __WXMSW__
-   void OnScroll(wxScrollWinEvent& ev);
-#endif // __WXMSW__
    //@}
 
    /// Creates a wxMenu for use as a format popup.
    static wxMenu * MakeFormatMenu(void);
-   /// Redraws the window, used by RequestUpdate() or OnPaint().
-   void InternalPaint(const wxRect *updateRect);
 
    /** Tell window to update a wxStatusBar with UserData labels and
        cursor positions.
@@ -238,7 +231,7 @@ protected:
    bool m_HaveFocus;
    /// do we handle clicks of the right mouse button?
    bool m_DoPopupMenu;
-   /// Should InternalPaint() scroll to cursor (VZ: seems unused any more)
+   /// Should OnPaint() scroll to cursor (VZ: seems unused any more)
    bool m_ScrollToCursor;
    /// Do we currently have a non-standard cursor?
    bool m_HandCursor;
@@ -302,8 +295,6 @@ private:
 #endif
    /// For finding text and finding it again:
    wxString m_FindString;
-   /// does hte window need to be repainted?
-   bool m_needsRedraw;
 //@}
 
    DECLARE_EVENT_TABLE()
diff --git a/src/gui/wxlwindow.cpp b/src/gui/wxlwindow.cpp
index d9eb31f8..0df80c74 100644
--- a/src/gui/wxlwindow.cpp
+++ b/src/gui/wxlwindow.cpp
@@ -103,7 +103,6 @@ BEGIN_EVENT_TABLE(wxLayoutWindow,wxScrolledWindow)
    EVT_SIZE    (wxLayoutWindow::OnSize)
 
    EVT_PAINT    (wxLayoutWindow::OnPaint)
-   EVT_IDLE     (wxLayoutWindow::OnIdle)
 
    EVT_CHAR     (wxLayoutWindow::OnChar)
    EVT_KEY_DOWN (wxLayoutWindow::OnKeyDown)
@@ -123,10 +122,6 @@ BEGIN_EVENT_TABLE(wxLayoutWindow,wxScrolledWindow)
 
    EVT_SET_FOCUS(wxLayoutWindow::OnSetFocus)
    EVT_KILL_FOCUS(wxLayoutWindow::OnKillFocus)
-
-#ifdef __WXMSW__
-   EVT_SCROLLWIN(wxLayoutWindow::OnScroll)
-#endif // __WXMSW__
 END_EVENT_TABLE()
 
 // ----------------------------------------------------------------------------
@@ -172,8 +167,6 @@ wxLayoutWindow::wxLayoutWindow(wxWindow *parent)
    SetWordWrap(false);
    SetWrapMargin(0);
 
-   m_needsRedraw = true;
-
    // no scrollbars initially
    m_hasHScrollbar =
    m_hasVScrollbar = false;
@@ -249,7 +242,7 @@ wxLayoutWindow::DoClearWindow(bool noUpdate)
 
    if ( !noUpdate )
    {
-      RequestUpdate((wxRect *)NULL);
+      RequestUpdate();
    }
 }
 
@@ -815,7 +808,7 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
    }
    ScrollToCursor();
    // refresh the screen
-   RequestUpdate(m_llist->GetUpdateRect());
+   RequestUpdate();
 }
 
 void
@@ -912,49 +905,6 @@ wxLayoutWindow::OnPaint( wxPaintEvent &WXUNUSED(event))
    wxPaintDC dc(this);
 #endif
 
-   RequestUpdate();
-}
-
-// under MSW, idle events are not generated while the scrollbar is being
-// dragged, so no repainting occurs
-//
-// this probably should be fixed in wxMSW aas it surely affects other controls
-// as well, but for now fixing it here
-#ifdef __WXMSW__
-
-void
-wxLayoutWindow::OnScroll(wxScrollWinEvent& event)
-{
-   InternalPaint(NULL);
-
-   event.Skip();
-}
-
-#endif // __WXMSW__
-
-void
-wxLayoutWindow::RequestUpdate(const wxRect * /* updateRect */)
-{
-   m_needsRedraw = true;
-}
-
-void
-wxLayoutWindow::OnIdle(wxIdleEvent &event)
-{
-   if ( m_needsRedraw )
-   {
-      InternalPaint(NULL);
-
-      m_needsRedraw = false;
-   }
-
-   event.Skip();
-}
-
-void
-wxLayoutWindow::InternalPaint(const wxRect *updateRect)
-{
-   wxClientDC dc( this );
    PrepareDC( dc );
 
 #ifdef WXLAYOUT_USE_CARET
@@ -979,14 +929,6 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
       return;
    }
 
-   if(updateRect)
-   {
-      WXLO_DEBUG(("Update rect: %ld,%ld / %ld,%ld",
-                  updateRect->x, updateRect->y,
-                  updateRect->x+updateRect->width,
-                  updateRect->y+updateRect->height));
-   }
-
    ResizeScrollbars(true);
 
    WXLO_TIMER_START(TmpTimer);
@@ -1037,15 +979,6 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
    }
 
    // This is the important bit: we tell the list to draw itself
-#if WXLO_DEBUG_URECT
-   if(updateRect)
-   {
-      WXLO_DEBUG(("Update rect: %ld,%ld / %ld,%ld",
-                  updateRect->x, updateRect->y,
-                  updateRect->x+updateRect->width,
-                  updateRect->y+updateRect->height));
-   }
-#endif
 
    // Device origins on the memDC are suspect, we translate manually
    // with the translate parameter of Draw().
@@ -1070,11 +1003,7 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
 #ifdef WXLO_PARTIAL_REFRESH
    // This somehow doesn't work, but even the following bit with the
    // whole rect at once is still a bit broken I think.
-   wxRegionIterator ri;
-   if(updateRect)
-      ri = wxRegionIterator(*updateRect);
-   else
-      ri = wxRegionIterator(GetUpdateRegion());
+   wxRegionIterator ri(GetUpdateRegion());
    if(ri)
       while(ri)
       {
@@ -1087,12 +1016,6 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
    else
 #endif
    {
-      // FIXME: Trying to copy only the changed parts, but it does not seem
-      // to work:
-//      x0 = updateRect->x; y0 = updateRect->y;
-//      if(updateRect->height < y1)
-//         y1 = updateRect->height;
-//      y1 += WXLO_YOFFSET; //FIXME might not be needed
       dc.Blit(x0, y0, x1, y1, &dcMem, 0, 0, wxCOPY, FALSE);
    }
    WXLO_TIMER_STOP(BlitTimer);

commit 9ed536f1c3f88cf48e274d986951d1d5041d3a9f
Author: Vadim Zeitlin <[email protected]>
Date:   Sat Nov 12 18:51:48 2022 +0000

    Remove unnecessary wc_str() conversion parameter
    
    This fixes another deprecation warning when using the latest wx 3.3.

diff --git a/src/mail/MimeDecode.cpp b/src/mail/MimeDecode.cpp
index b81911e8..99427e57 100644
--- a/src/mail/MimeDecode.cpp
+++ b/src/mail/MimeDecode.cpp
@@ -648,7 +648,7 @@ wxCharBuffer MIME::EncodeHeader(const String& in, wxFontEncoding enc)
    // if not fall back to the same UTF-8 (which can always be used) as we use
    // by default if no encoding was specified in the first place.
    if ( enc == wxFONTENCODING_SYSTEM ||
-         wxCSConv(enc).FromWChar(NULL, 0, in.wc_str(wxConvLibc)) == wxCONV_FAILED )
+         wxCSConv(enc).FromWChar(NULL, 0, in.wc_str()) == wxCONV_FAILED )
    {
       enc = wxFONTENCODING_UTF8;
    }

commit 56c7a7718e042242d09a25f806347bbc5495a07c
Author: Vadim Zeitlin <[email protected]>
Date:   Sat Nov 12 18:50:23 2022 +0000

    Correct handling of folder names using modified UTF-7
    
    This didn't work correctly due to a confusion between different
    conversions, we need to pass wxConvUTF7 to mb_str() and not wc_str(),
    where it never made any sense (and now results in a warning when using
    the latest wx 3.3).

diff --git a/src/gui/wxFolderTree.cpp b/src/gui/wxFolderTree.cpp
index 9167fd5a..738dc9af 100644
--- a/src/gui/wxFolderTree.cpp
+++ b/src/gui/wxFolderTree.cpp
@@ -1686,7 +1686,7 @@ wxString wxFolderTreeNode::GetName() const
 
          // valid IMAP modified UTF-7 mailbox name, convert to the encoding
          // used by the GUI
-         name << wxString(nameutf7.wc_str(wxConvUTF7), *wxConvUI);
+         name << nameutf7.mb_str(wxConvUTF7);
       }
       else // s != '&'
       {

-----------------------------------------------------------------------

Summary of changes:
 include/gui/wxlwindow.h  | 15 ++-------
 src/gui/wxFolderTree.cpp |  2 +-
 src/gui/wxlwindow.cpp    | 83 ++----------------------------------------------
 src/mail/MimeDecode.cpp  |  2 +-
 4 files changed, 8 insertions(+), 94 deletions(-)


hooks/post-receive
-- 
Mahogany sources repository.