Author Topic: wxWidgets 3.1.2 Released  (Read 2930 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2171
Re: wxWidgets 3.1.2 Released
« Reply #1 on: December 11, 2018, 06:28:35 pm »
i really hope we can abandon wx2.8 soon, to get rid of a lot of this project files...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #2 on: December 11, 2018, 08:31:02 pm »
The files for wx2.8 are just two sets. The files for the various 3.x releases are getting out of control. :(
(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 gd_on

  • Regular
  • ***
  • Posts: 426
Re: wxWidgets 3.1.2 Released
« Reply #3 on: December 12, 2018, 01:01:46 pm »
Quote
The files for the various 3.x releases are getting out of control.
may be, but it works by using 31 versions and adjusting the wx31 environment variable to wxWidgets-3.1.2 correct path.

Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #4 on: December 12, 2018, 01:20:44 pm »
It is good that we don't need another set of cbp files.  8)
(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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5138
Re: wxWidgets 3.1.2 Released
« Reply #5 on: December 12, 2018, 07:50:53 pm »
I will use this release in the next nightly. Any objections ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #6 on: December 12, 2018, 07:56:46 pm »
Nope.
(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 Miguel Gimenez

  • Almost regular
  • **
  • Posts: 162
Re: wxWidgets 3.1.2 Released
« Reply #7 on: December 12, 2018, 08:46:30 pm »
There is a segmentation fault with wx3.1.2, see ticket 773

https://sourceforge.net/p/codeblocks/tickets/773/

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2171
Re: wxWidgets 3.1.2 Released
« Reply #8 on: December 13, 2018, 01:22:53 am »
The files for wx2.8 are just two sets. The files for the various 3.x releases are getting out of control. :(
Well if we use wx3.1 we can kick out wx30 ( never used it honestly) too beside wx28

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #9 on: December 13, 2018, 07:06:33 am »
I think we should have an easy way to switch the version. So we have a single set of 3.x files for windows as is done on linux. (another set is possible for 64bit builds of course)
(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 gd_on

  • Regular
  • ***
  • Posts: 426
Re: wxWidgets 3.1.2 Released
« Reply #10 on: December 13, 2018, 09:57:22 am »
Quote
There is a segmentation fault with wx3.1.2, see ticket 773
Problem reproduced with gcc 4.9.2 on Windows 7 64 bits. (C::B compiled in 32 or 64 bits)
Does not happen with wxWidgets 3.1.1 (same C::B svn version 11520 !).
Apparently some incompatibilities (or bug) within Code Completion (With wxWidgets 3.1.2, no problems if code completion is disabled !)

So, I'll stay with 3.1.1 version. :-[

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #11 on: December 13, 2018, 11:09:36 am »
I suggest to switch to mingw-w64 and something like 7.x or 8.x release!  GCC 4.9 and 5.1 are getting too old.
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2171
Re: wxWidgets 3.1.2 Released
« Reply #12 on: December 13, 2018, 12:26:55 pm »
I think we should have an easy way to switch the version. So we have a single set of 3.x files for windows as is done on linux. (another set is possible for 64bit builds of course)
The old discussion ;)
http://forums.codeblocks.org/index.php/topic,21696.0.html

[Edit:] I try to create a feature, where the global variables have default values, and a descriptive text to give it an dialog something like in CMake with a list where you can enter the values, see the project default values and a descriptive text... But this all does not come together nicely. If i have some kind of idea i will open a topic...
« Last Edit: December 13, 2018, 12:29:20 pm by BlueHazzard »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #13 on: December 13, 2018, 04:25:28 pm »
There is a segmentation fault with wx3.1.2, see ticket 773

https://sourceforge.net/p/codeblocks/tickets/773/
I can confirm this bug on my Win7(64bit), wx3.1.2 32bit and MinGW-w64's gcc 7.2, C::B trunk.
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: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #14 on: December 14, 2018, 12:50:59 pm »
There is a segmentation fault with wx3.1.2, see ticket 773

https://sourceforge.net/p/codeblocks/tickets/773/
I can confirm this bug on my Win7(64bit), wx3.1.2 32bit and MinGW-w64's gcc 7.2, C::B trunk.

If you set a breakpoint in PlatWX.cpp line 1883, you will see the window get destroyed when you hit the "#", later you will get the crash because wid is zero.
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

  • Almost regular
  • **
  • Posts: 162
Re: wxWidgets 3.1.2 Released
« Reply #15 on: December 14, 2018, 02:04:04 pm »
Quote
If you set a breakpoint in PlatWX.cpp line 1883, you will see the window get destroyed when you hit the "#", later you will get the crash because wid is zero.

As I interpret this, when the autocomplete window is shown the editor loses focus and then the OnKillFocus event is fired, killing the autocomplete window. May be this window claims focus in wx312 while it didn't in wx311.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #16 on: December 15, 2018, 09:44:01 am »
Quote
If you set a breakpoint in PlatWX.cpp line 1883, you will see the window get destroyed when you hit the "#", later you will get the crash because wid is zero.

As I interpret this, when the autocomplete window is shown the editor loses focus and then the OnKillFocus event is fired, killing the autocomplete window. May be this window claims focus in wx312 while it didn't in wx311.
Yes, I agree with you. I think there are some code in PlatWX.cpp, such as listbox, when get focus event, it just reset the focus to its parent window, it looks like this refocus does not happen in cb build against wx3.1.2.
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

  • Almost regular
  • **
  • Posts: 162
Re: wxWidgets 3.1.2 Released
« Reply #17 on: December 15, 2018, 12:03:17 pm »
I can't test until monday, but it can be related to this wxWidgets commit:

https://github.com/wxWidgets/wxWidgets/commit/79a37a2a65d8bde315bcd863838f21c72912840a

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #18 on: December 15, 2018, 12:32:11 pm »
Can someone reproduce this in the stc sample of wxwidgets and report this on the wx devs?
I cannot reproduce this on linux.
(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 Miguel Gimenez

  • Almost regular
  • **
  • Posts: 162
Re: wxWidgets 3.1.2 Released
« Reply #19 on: December 15, 2018, 08:51:16 pm »
Quote
Can someone reproduce this in the stc sample of wxwidgets

I have just tested the stc sample; it has code highlighting but no code completion, so there is no popup window when typing. The popup menu associated to the right button works OK.

Offline Miguel Gimenez

  • Almost regular
  • **
  • Posts: 162
Re: wxWidgets 3.1.2 Released
« Reply #20 on: December 18, 2018, 07:44:04 pm »
The wxPopupWindow used in Code Completion was reimplemented under MSW with heavy changes, see:

https://github.com/wxWidgets/wxWidgets/commit/56c419116838045f23f046112960d4e42f98f80d#diff-ae8d87556bfe1b32c101c69c2fb1cec4

This changes include moving focus back and forth; these must be triggering the KillFocus event which destroys the popup.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #21 on: December 18, 2018, 08:41:51 pm »
Someone needs to report this to wx devs. I intend to do some testing in the next days, but I'm not sure that my windows would start up. So if someone can modify the stc sample to reproduce the problem it will be best.

It seems this is a critical issue, so moving forward with wx 3.1.2 is blocked by this. Interesting why codelite is not affected...
(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: 23
Re: wxWidgets 3.1.2 Released
« Reply #22 on: December 18, 2018, 11:55:06 pm »
I don't know if this is helpful or not, but here's a patch to add a very rudimentary type of autocompletion to the wxWidgets stc sample.  It doesn't show the crash under discussion, so it might not be helpful at all.

Code: [Select]
diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp
index 7e7f412ec2..c16b1aae2b 100644
--- a/samples/stc/edit.cpp
+++ b/samples/stc/edit.cpp
@@ -60,6 +60,21 @@ const int ANNOTATION_STYLE = wxSTC_STYLE_LASTPREDEFINED + 1;
 // Edit
 //----------------------------------------------------------------------------
 
+static char * pound_xpm[] = {
+"10 10 2 1",
+" c None",
+". c #BD08F9",
+"  ..  ..  ",
+"  ..  ..  ",
+"..........",
+"..........",
+"  ..  ..  ",
+"  ..  ..  ",
+"..........",
+"..........",
+"  ..  ..  ",
+"  ..  ..  "};
+
 wxBEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
     // common
     EVT_SIZE (                         Edit::OnSize)
@@ -177,6 +192,10 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
     CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
     SetLayoutCache (wxSTC_CACHE_PAGE);
     UsePopUp(wxSTC_POPUP_ALL);
+   
+    wxImage::AddHandler(new wxXPMHandler);
+    wxBitmap b(pound_xpm);
+    RegisterImage(0, b);
 }
 
 Edit::~Edit () {}
@@ -483,6 +502,13 @@ void Edit::OnCharAdded (wxStyledTextEvent &event) {
         SetLineIndentation (currentLine, lineInd);
         GotoPos(PositionFromLine (currentLine) + lineInd);
     }
+    else if (chr == '#') {
+        wxString s = "define?0 elif?0 elifdef?0 elifndef?0 else?0 endif?0 "
+                      "error?0 if?0 ifdef?0 ifndef?0 include?0 line?0 line?0 "
+                      "pragma?0 undef?0";
+       
+        AutoCompShow(0,s);
+    }
 }
 
 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #23 on: December 19, 2018, 02:19:50 am »
Strange. I guess we're doing something 'advanced'...
(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: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #24 on: December 19, 2018, 06:12:23 am »
There are many code in the file: sdk\wxscintilla\src\PlatWX.cpp, which change focus to it's parent, maybe, they get conflict which the current wx3.1.2's implementation.
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 eranif

  • Regular
  • ***
  • Posts: 253
Re: wxWidgets 3.1.2 Released
« Reply #25 on: December 21, 2018, 07:23:40 pm »
Interesting why codelite is not affected...
This is because CodeLite does not use the builtin wxSTC popup window, I created my own (for other reasons) couple of years ago.
https://github.com/eranif/codelite/blob/master/Plugin/wxCodeCompletionBox.cpp

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #26 on: December 22, 2018, 09:56:12 am »
I don't know if this is helpful or not, but here's a patch to add a very rudimentary type of autocompletion to the wxWidgets stc sample.  It doesn't show the crash under discussion, so it might not be helpful at all.

Code: [Select]
diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp
index 7e7f412ec2..c16b1aae2b 100644
--- a/samples/stc/edit.cpp
+++ b/samples/stc/edit.cpp
@@ -60,6 +60,21 @@ const int ANNOTATION_STYLE = wxSTC_STYLE_LASTPREDEFINED + 1;
 // Edit
 //----------------------------------------------------------------------------
 
+static char * pound_xpm[] = {
+"10 10 2 1",
+" c None",
+". c #BD08F9",
+"  ..  ..  ",
+"  ..  ..  ",
+"..........",
+"..........",
+"  ..  ..  ",
+"  ..  ..  ",
+"..........",
+"..........",
+"  ..  ..  ",
+"  ..  ..  "};
+
 wxBEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
     // common
     EVT_SIZE (                         Edit::OnSize)
@@ -177,6 +192,10 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
     CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
     SetLayoutCache (wxSTC_CACHE_PAGE);
     UsePopUp(wxSTC_POPUP_ALL);
+   
+    wxImage::AddHandler(new wxXPMHandler);
+    wxBitmap b(pound_xpm);
+    RegisterImage(0, b);
 }
 
 Edit::~Edit () {}
@@ -483,6 +502,13 @@ void Edit::OnCharAdded (wxStyledTextEvent &event) {
         SetLineIndentation (currentLine, lineInd);
         GotoPos(PositionFromLine (currentLine) + lineInd);
     }
+    else if (chr == '#') {
+        wxString s = "define?0 elif?0 elifdef?0 elifndef?0 else?0 endif?0 "
+                      "error?0 if?0 ifdef?0 ifndef?0 include?0 line?0 line?0 "
+                      "pragma?0 undef?0";
+       
+        AutoCompShow(0,s);
+    }
 }
 
 
Hi, thanks for the contribution, I just test the stc sample with your patch.
The auto suggestion(auto completion) window shows correctly after I hit the "#", and I can keep typing in the editor, while the correct item is selected.
The issue I see is that if I "deactivate" the stcsample's main frame, the auto completion list is still active, which covers every active application's window. :(

The same effect can be achieved when we comment out the line:
Code: [Select]
void cbStyledTextCtrl::OnKillFocus(wxFocusEvent& event)
{
    // cancel auto-completion list when losing focus
    //if ( AutoCompActive() )
    //    AutoCompCancel();

    if ( CallTipActive() )
        CallTipCancel();

    event.Skip();
}
With the above changes in sdk\cbstyledtextctrl.cpp, we can avoid the crash issue, but we get the same issue as the stc sample with your 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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5161
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wxWidgets 3.1.2 Released
« Reply #27 on: December 22, 2018, 03:39:03 pm »
When debugging, I found the reason comes from this code flow:

Code: [Select]
void AutoComplete::Show(bool show) {
lb->Show(show);     // set bp1 here
if (show)
lb->Select(0); // set bp2 here
}

When you try to show a autocompletion window, you first hit the bp1, then I see that a lose focus event happens before I hit the bp2, so the function
Code: [Select]
void cbStyledTextCtrl::OnKillFocus(wxFocusEvent& event)
{
    // cancel auto-completion list when losing focus
    if ( AutoCompActive() )
        AutoCompCancel();

    if ( CallTipActive() )
        CallTipCancel();

    event.Skip();
}
is called between bp1 and bp2.

Finally, when we goes to bp2, the window is already destroyed (wid==0).  :(
« Last Edit: December 22, 2018, 03:40:44 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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: wxWidgets 3.1.2 Released
« Reply #28 on: January 04, 2019, 01:55:26 am »
@New Pagodi:

You can use this patch to reproduce the problem:
Code: [Select]
diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp
index 855c18f..6a1c428 100644
--- a/samples/stc/edit.cpp
+++ b/samples/stc/edit.cpp
@@ -117,6 +117,7 @@ wxBEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
     EVT_STC_CHARADDED (wxID_ANY,       Edit::OnCharAdded)

     EVT_KEY_DOWN( Edit::OnKeyDown )
+    EVT_KILL_FOCUS(Edit::OnKillFocus)
 wxEND_EVENT_TABLE()

 Edit::Edit (wxWindow *parent, wxWindowID id,
@@ -472,6 +473,17 @@ void Edit::OnMarginClick (wxStyledTextEvent &event) {
     }
 }

+void Edit::OnKillFocus(wxFocusEvent& event)
+{
+    if ( AutoCompActive() )
+        AutoCompCancel();
+
+    if ( CallTipActive() )
+        CallTipCancel();
+
+    event.Skip();
+}
+
 void Edit::OnCharAdded (wxStyledTextEvent &event) {
     char chr = (char)event.GetKey();
     int currentLine = GetCurrentLine();
@@ -485,6 +497,21 @@ void Edit::OnCharAdded (wxStyledTextEvent &event) {
         SetLineIndentation (currentLine, lineInd);
         GotoPos(PositionFromLine (currentLine) + lineInd);
     }
+    else
+    {
+        wxString items;
+        items += "test1\r";
+        items += "test2\r";
+        items += "test3\r";
+        items += "test4\r";
+        items += "test5\r";
+
+        AutoCompSetIgnoreCase(true);
+        AutoCompSetMaxHeight(14);
+        AutoCompSetTypeSeparator(wxT('\n'));
+        AutoCompSetSeparator(wxT('\r'));
+        AutoCompShow(0, items);
+    }
 }


diff --git a/samples/stc/edit.h b/samples/stc/edit.h
index 703ebae..2762a85 100644
--- a/samples/stc/edit.h
+++ b/samples/stc/edit.h
@@ -107,6 +107,7 @@ public:
     void OnCharAdded  (wxStyledTextEvent &event);

     void OnKeyDown(wxKeyEvent &event);
+    void OnKillFocus(wxFocusEvent& event);

     //! language/lexer
     wxString DeterminePrefs (const wxString &filename);
(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: 23
Re: wxWidgets 3.1.2 Released
« Reply #29 on: January 04, 2019, 06:42:23 am »
I've found that the issue was that this commit changed the style of window used for popups on MSW.  I've got a proposal for a fix that restores the old behavior if the popup is created with a certain style.

While working on this, I discovered several other issues with auto completion.  I've got a work in progress here.  It needs quite a bit of clean up and has some problems compiling on GTK.  As soon as I get everything presentable, I was going to start a thread on the wxWidgets developers list asking if those fixes are acceptable.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • 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: 23
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: [Select]
#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"

and

Code: [Select]
// 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: [Select]
#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: 11394
    • 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: 5161
  • 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: [Select]
#if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h"

and

Code: [Select]
// 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

  • Almost regular
  • **
  • Posts: 162
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: 5161
  • 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: 5161
  • 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: [Select]
//{ 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

  • Almost regular
  • **
  • Posts: 162
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

  • Almost regular
  • **
  • Posts: 162
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: 11394
    • 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: 5161
  • 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

  • Almost regular
  • **
  • Posts: 162
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

  • Regular
  • ***
  • Posts: 426
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 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline Miguel Gimenez

  • Almost regular
  • **
  • Posts: 162
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: 5161
  • 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.

Offline gd_on

  • Regular
  • ***
  • Posts: 426
Re: wxWidgets 3.1.2 Released
« Reply #45 on: January 17, 2019, 05:41:25 pm »
Thanks M. Gimenez. No more problem (until the next one  ;D) with your temporary patch  ;).
gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64