Author Topic: wxWidgets 3.1.2 Released  (Read 23728 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #30 on: January 04, 2019, 11:45:26 am »
Cool thanks.
Would it be possible to add the kill focus event to the stc sample?
So there is an easy way to test our use case in the future.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: wxWidgets 3.1.2 Released
« Reply #31 on: January 06, 2019, 06:47:36 am »
I've started a thread on the problems with autocompletion on the wxdev list here if anyone wants to join in.

But I guess none of those changes proposed there will help with with getting codeblocks to work with wxWidgets 3.1.2.  In order to do that, somehow the old popup behavior has to be restored in codeblocks itself - at least until 3.1.3.  Looking over the codeblocks sources, I think the easiest way to do that is to define a popup class in src/sdk/wxscintilla/src/PlatWX.cpp between

Code
#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"

and

Code
// A popup window to place the wxSCIListBox upon
class wxSCIListBoxWin : public wxPopupWindow

Here's the a cut and paste of the old popupwindow code with a few minor modifications:

Code
#ifdef __WXMSW__

#include "wx/msw/private.h"     // for GetDesktopWindow()

class wxNonActivatingPopupWindow : public wxPopupWindowBase
{
public:
    wxNonActivatingPopupWindow() { }

    wxNonActivatingPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
        { (void)Create(parent, flags); }

    bool Create(wxWindow *parent, int flags = wxBORDER_NONE);

    virtual void SetFocus() wxOVERRIDE;
    virtual bool Show(bool show = true) wxOVERRIDE;

    // return the style to be used for the popup windows
    virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const wxOVERRIDE;

    // get the HWND to be used as parent of this window with CreateWindow()
    virtual WXHWND MSWGetParent() const wxOVERRIDE;
};

bool wxNonActivatingPopupWindow::Create(wxWindow *parent, int flags)
{
    // popup windows are created hidden by default
    Hide();

    return wxPopupWindowBase::Create(parent) &&
               wxWindow::Create(parent, wxID_ANY,
                                wxDefaultPosition, wxDefaultSize,
                                flags | wxPOPUP_WINDOW);
}

WXDWORD wxNonActivatingPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const
{
    // we only honour the border flags, the others don't make sense for us
    WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle);

    if ( exstyle )
    {
        // a popup window floats on top of everything
        *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
    }

    return style;
}

WXHWND wxNonActivatingPopupWindow::MSWGetParent() const
{
    // we must be a child of the desktop to be able to extend beyond the parent
    // window client area (like the comboboxes drop downs do)
    //
    // NB: alternative implementation would be to use WS_POPUP instead of
    //     WS_CHILD but then showing a popup would deactivate the parent which
    //     is ugly and working around this, although possible, is even more
    //     ugly
    return (WXHWND)::GetDesktopWindow();
}

void wxNonActivatingPopupWindow::SetFocus()
{
    // Focusing on a popup window does not work on MSW unless WS_POPUP style is
    // set (which is never the case currently, see the note in MSWGetParent()).
    // We do not even want to try to set the focus, as it returns an error from
    // SetFocus() on recent Windows versions (since Vista) and the resulting
    // debug message is annoying.
}

bool wxNonActivatingPopupWindow::Show(bool show)
{
    if ( !wxWindowMSW::Show(show) )
        return false;

    if ( show )
    {
        // raise to top of z order
        if (!::SetWindowPos((HWND)GetHWND(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
        {
            wxLogLastError(wxT("SetWindowPos"));
        }

        // and set it as the foreground window so the mouse can be captured
        ::SetForegroundWindow((HWND)GetHWND());
    }

    return true;
}

// temporarily define wxPopupWindow to be the new class
#define wxPopupWindow wxNonActivatingPopupWindow

#endif //__WXMSW__

The class can obviously be renames as needed.  I've tested this with wxSTC, but I don't know how to compile codeblocks to see if it works there too.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #32 on: January 06, 2019, 10:53:52 am »
Thanks, for us it would probably be easier if we patch our version of wx3.1.2 after your fixes are approved.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #33 on: January 08, 2019, 01:35:27 am »
I've started a thread on the problems with autocompletion on the wxdev list here if anyone wants to join in.

But I guess none of those changes proposed there will help with with getting codeblocks to work with wxWidgets 3.1.2.  In order to do that, somehow the old popup behavior has to be restored in codeblocks itself - at least until 3.1.3.  Looking over the codeblocks sources, I think the easiest way to do that is to define a popup class in src/sdk/wxscintilla/src/PlatWX.cpp between

Code
#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"

and

Code
// A popup window to place the wxSCIListBox upon
class wxSCIListBoxWin : public wxPopupWindow

Here's the a cut and paste of the old popupwindow code with a few minor modifications:

...

The class can obviously be renames as needed.  I've tested this with wxSTC, but I don't know how to compile codeblocks to see if it works there too.
Hi, I just tested it with you suggested changes, it works without crash with wx3.1.2, thanks!
« Last Edit: January 08, 2019, 02:17:10 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxWidgets 3.1.2 Released
« Reply #34 on: January 15, 2019, 11:53:39 am »
I'm using C::B with New Pagodi's patch and CC works OK, but sometimes the caret disappears while editing: you can't see it, but typing works normally. The only way to make it visible again is changing focus to another window and then to the current window.

If I disable CC this does not happen. I can't test without the patch because C:B crashes.

Using Windows 7 64 bits, wx3.1.2 32 bits, revision 11552.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #35 on: January 15, 2019, 03:15:53 pm »
I'm using C::B with New Pagodi's patch and CC works OK, but sometimes the caret disappears while editing: you can't see it, but typing works normally. The only way to make it visible again is changing focus to another window and then to the current window.

If I disable CC this does not happen. I can't test without the patch because C:B crashes.

Using Windows 7 64 bits, wx3.1.2 32 bits, revision 11552.
I can confirm this issue.

EDIT: it looks like this issue happens when I hover the mouse on some variable, which means it's a calltip related issue.
Also, when this issue happens, the high light of the current line is also missing.
« Last Edit: January 15, 2019, 03:23:26 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #36 on: January 15, 2019, 04:30:55 pm »
I'm using C::B with New Pagodi's patch and CC works OK, but sometimes the caret disappears while editing: you can't see it, but typing works normally. The only way to make it visible again is changing focus to another window and then to the current window.

If I disable CC this does not happen. I can't test without the patch because C:B crashes.

Using Windows 7 64 bits, wx3.1.2 32 bits, revision 11552.
I can confirm this issue.

EDIT: it looks like this issue happens when I hover the mouse on some variable, which means it's a calltip related issue.
Also, when this issue happens, the high light of the current line is also missing.

My guess here is that we have such code in sdk\ccmanager.cpp
Code
//{ Unfocusable popup

// imported with small changes from PlatWX.cpp
class UnfocusablePopupWindow :
#if wxUSE_POPUPWIN
    public wxPopupWindow
#else
     public wxFrame
#endif // wxUSE_POPUPWIN
{
public:
#if wxUSE_POPUPWIN
    typedef wxPopupWindow BaseClass;

    UnfocusablePopupWindow(wxWindow* parent, int style = wxBORDER_NONE) :
        wxPopupWindow(parent, style)
#else
    typedef wxFrame BaseClass;

    UnfocusablePopupWindow(wxWindow* parent, int style = 0) :
        wxFrame(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
                style | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | wxNO_BORDER | wxFRAME_SHAPED
#ifdef __WXMAC__
                | wxPOPUP_WINDOW
#endif // __WXMAC__
                )
#endif // wxUSE_POPUPWIN
    {
        Hide();
    }

    bool Destroy() override;
    void OnFocus(wxFocusEvent& event);
    void ActivateParent();

    void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
    bool Show(bool show = true) override;

private:
    DECLARE_EVENT_TABLE()
};


This means we need to use the same wxNonActivatingPopupWindow class as New Pagodi's patch?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxWidgets 3.1.2 Released
« Reply #37 on: January 15, 2019, 04:58:59 pm »
Quote
This means we need to use the same wxNonActivatingPopupWindow class as New Pagodi's patch?

I have just tested this and the issue is still present.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxWidgets 3.1.2 Released
« Reply #38 on: January 15, 2019, 08:29:53 pm »
If I apply New Pagodi's patch to src\sdk\wxscintilla\src\ScintillaWX.cpp (near line 110) then the isssue goes away (caret doesn't disappear and call tips are shown).

Probably patching src\sdk\ccmanager.cpp as you suggested solves an still unseen problem.

The changes to wxPopupWindow in wx3.1.2 are a big issue for Code Completion. New Pagodi has a pull request in wxWidgets site restoring old behaviour, it is accepted (but not yet applied) for wx3.1.3.

We can patch Scintilla, backport New Pagodi's changes to wx3.1.2 (this would force all developers and outsiders like me to use patched wx libraries) or wait and jump directly from 3.1.1 to 3.1.3 when it is ready.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #39 on: January 15, 2019, 09:09:38 pm »
First we wait for the changes to enter wx-master. Then we'll decide what course of action we'll take for night/release binaries. I don't think waiting for wx3.1.3 is viable option. wx releases are very infrequent.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #40 on: January 16, 2019, 03:11:08 pm »
If I apply New Pagodi's patch to src\sdk\wxscintilla\src\ScintillaWX.cpp (near line 110) then the isssue goes away (caret doesn't disappear and call tips are shown).
Can you share the whole patch against C::B, thanks.
I see New Pagodi's patch for the wx trunk is huge. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxWidgets 3.1.2 Released
« Reply #41 on: January 16, 2019, 04:47:20 pm »
This is the patch for PlatWX and ScintillaWX, please note it is a quick and dirty modification intended for testing.

There are more uses of wxPopupWindow:
  - src\include\infowindow.h
  - src\sdk\ccmanager.cpp (as you noted)
  - src\src\watchesdlg.cpp and src\src\watchesdlg.h

Offline gd_on

  • Lives here!
  • ****
  • Posts: 796
Re: wxWidgets 3.1.2 Released
« Reply #42 on: January 17, 2019, 09:20:36 am »
For me, build 11554 with wxWidgets 3.1.2 (compilation in 64 bits) still crash when I introduce a # as a 1rst character in a line. Workaround : disabling CC.
gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: wxWidgets 3.1.2 Released
« Reply #43 on: January 17, 2019, 10:07:42 am »
The temporary patch above fixes this issue and another (calltips not showing and caret becoming invisible).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #44 on: January 17, 2019, 03:07:14 pm »
This is the patch for PlatWX and ScintillaWX, please note it is a quick and dirty modification intended for testing.

There are more uses of wxPopupWindow:
  - src\include\infowindow.h
  - src\sdk\ccmanager.cpp (as you noted)
  - src\src\watchesdlg.cpp and src\src\watchesdlg.h
Thanks for your sharing!
EDIT: For the next C::B Windows release, I think we either use 3.1.1 or we need a patched 3.1.2. But waiting for 3.1.3 may takes too long time.
« Last Edit: January 17, 2019, 03:08:54 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.