Ticket #18115: 0001-Make-it-harder-for-the-calltip-to-be-invisible.patch

File 0001-Make-it-harder-for-the-calltip-to-be-invisible.patch, 2.0 KB (added by obfuscated, 2 years ago)

Patch with a fix (based on the qt implementation)

  • src/stc/PlatWX.cpp

    From cab90d29608930e3bbdb44cad2e3ffe2798a9131 Mon Sep 17 00:00:00 2001
    From: Teodor Petrov <fuscated@gmail.com>
    Date: Sun, 1 Apr 2018 17:15:41 +0300
    Subject: [PATCH] Make it harder for the calltip to be invisible
    
    * This required changes to the Window::SetPositionRelative.
    * Use the Qt version as a base.
    * The idea is to confine the window to the boundaries of the display the
      scintilla control is at the moment of the call.
    ---
     src/stc/PlatWX.cpp | 31 +++++++++++++++++++++++++++++--
     1 file changed, 29 insertions(+), 2 deletions(-)
    
    diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp
    index 303bfbf9d6..ecca096883 100644
    a b void Window::SetPosition(PRectangle rc) { 
    18521852    GETWIN(wid)->SetSize(r);
    18531853}
    18541854
    1855 void Window::SetPositionRelative(PRectangle rc, Window) {
    1856     SetPosition(rc);  // ????
     1855void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
     1856    wxWindow *relativeWin = GETWIN(relativeTo.wid);
     1857
     1858    wxPoint position = relativeWin->GetScreenPosition();
     1859    position.x = wxRound(position.x + rc.left);
     1860    position.y = wxRound(position.y + rc.top);
     1861
     1862    const int currentDisplay = wxDisplay::GetFromWindow(relativeWin);
     1863    const wxRect displayRect = wxDisplay(currentDisplay).GetClientArea();
     1864
     1865    if (position.x < displayRect.GetLeft())
     1866        position.x = displayRect.GetLeft();
     1867
     1868    const int width = rc.Width();
     1869    if (width > displayRect.GetWidth())
     1870    {
     1871        // We want to show at least the beginning of the window.
     1872        position.x = displayRect.GetLeft();
     1873    }
     1874    else if (position.x + width > displayRect.GetRight())
     1875        position.x = displayRect.GetRight() - width;
     1876
     1877    const int height = rc.Height();
     1878    if (position.y + height > displayRect.GetBottom())
     1879        position.y = displayRect.GetBottom() - height;
     1880
     1881    position = relativeWin->ScreenToClient(position);
     1882    wxWindow *window = GETWIN(wid);
     1883    window->SetSize(position.x, position.y, width, height);
    18571884}
    18581885
    18591886PRectangle Window::GetClientPosition() {