Author Topic: BrowseTracker dialog is not closing  (Read 31404 times)

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
BrowseTracker dialog is not closing
« on: December 20, 2020, 03:22:12 pm »
I have problem with BrowseTracker plugin:
when I Alt+Left, BrowseTracker dialog is shown. However it remains shown when I release Alt key. I have to double-click on the file name to close the dialog.

I use my custom build of C::B: Ubuntu, latest wxWidgets (I tried with v3.1.4 and latest Git), GTK 3.

Do somebody have had such problem?

I searched for the source of the problem. I found, that events wxEVT_KEY_DOWN and wxEVT_KEY_UP are not captured somehow. Therefore in BrowseSelector.cpp I connected 'm_panel' instead of 'm_listBox':

    - m_listBox->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(BrowseSelector::OnKeyUp), NULL, this);
    - m_listBox->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(BrowseSelector::OnKeyDown), NULL, this);
    + m_panel->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(BrowseSelector::OnKeyUp), NULL, this);
    + m_panel->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxKeyEventHandler(BrowseSelector::OnKeyDown), NULL, this);

Now plugin works as is expected. However, I am unsure, if this solution will work on all platforms.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #1 on: December 20, 2020, 09:56:41 pm »
I'll have a look at it. Thanks for the suggestions.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #2 on: December 23, 2020, 10:55:02 pm »
Fixed svn 12254
Missing GetEventHandler()'s

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #3 on: December 25, 2020, 02:56:07 pm »
Thank you!

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #4 on: December 26, 2020, 09:50:42 am »
I tried to understand why the GetEventHandler() call in the patch is required. And I couldn't. Could you @Pecan explain it?

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #5 on: December 26, 2020, 11:46:25 am »
I just recompiled C::B with SVN 12270. The problem still there: the BrowseTracker dialog remains opened.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: BrowseTracker dialog is not closing
« Reply #6 on: December 26, 2020, 02:06:52 pm »
I tried to understand why the GetEventHandler() call in the patch is required. And I couldn't. Could you @Pecan explain it?

In an recent, wxWdgets upgrade likely 2.8 to 3.0 or maybe 3.0 to 3.1 the event handling system was changed and it is recommended or required to use  GetEventHandler() call for proper event handling. I could be wrong about that since I am not an wxWidgets programmer; but, I have upgraded a few wxWidgets projects to either 3.1 or 3.0.

https://docs.wxwidgets.org/trunk/overview_events.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #7 on: December 27, 2020, 06:29:35 am »
I'll revisit the problem. I think it's because the dialog does not get or looses focus.

Are you running your os with focus-follows-mouse?
« Last Edit: December 27, 2020, 06:33:44 am by Pecan »

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #8 on: December 27, 2020, 08:26:19 am »
Thank you, @stahta01, for the reply.

@Pecan:
Quote
Are you running your os with focus-follows-mouse?

I looked into Tweaks. There is selected option "Click to focus". I haven't changed this option since OS install.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #9 on: December 28, 2020, 08:51:52 pm »
@darmar

Could you tell me how exactly to create this situation?
I'm having problem reproducing it.

What keys or sequence of keys do you use?
thanks


Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #10 on: December 29, 2020, 01:35:04 pm »
Thank you for taking your time to investigate this issue. I guess there aren't many users who try to compile and use C::B with the latest wxWidgets on Linux. There are no C::B project files for wx3.1.* too. If you can't reproduce this problem, then, perhaps, is better to wait. I can live with the 'temporal' solution I described.

Quote
What keys or sequence of keys do you use?

I use default  key combination: Alt+Left or Alt+Right. And after that, the dialog remains opened.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #11 on: December 29, 2020, 10:44:01 pm »
Quote
What keys or sequence of keys do you use?

I use default  key combination: Alt+Left or Alt+Right. And after that, the dialog remains opened.

Until I can find a fix, you can also use Ctrl-tab to switch between editors. The key combination is built in (hard coded) already.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #12 on: December 31, 2020, 09:09:51 pm »
I'm finding this problem in more than just the dialog in Browsetracker.

One time out of 10, some CB dialogs like find-in-files appear with no focus. Even the esc key won't dismiss them. the dialog is disabled until I move the mouse into the dialog, it then works as expected.

Is anyone else experiencing this problem?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: BrowseTracker dialog is not closing
« Reply #13 on: January 01, 2021, 03:06:06 am »
Yes, I think I see this on some small dialogs with wx+gtk2. The dialogs are disabled until I move the mouse outside and back inside the dialog.
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #14 on: January 01, 2021, 06:49:55 am »
Yes, I think I see this on some small dialogs with wx+gtk2. The dialogs are disabled until I move the mouse outside and back inside the dialog.

Thanks, I'll start tracking this down.
I'd appreciate any suggestions from anyone about where to start looking.

Please tell me what OS,  wxWidgets and CB version you're running.
Also, for those not experiencing the problem, please tell us the same so we can narrow the field.
« Last Edit: January 01, 2021, 06:53:01 am by Pecan »

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #15 on: January 07, 2021, 09:00:59 pm »
I just a bit played with the code and found that uncommenting the last line in function BrowseSelector::Create enables BrowseTracker to function properly:

  -  //?m_listBox->SetFocus();
 +  m_listBox->SetFocus();

It seems that some developer had this problem and solved it earlier. Can someone try it?

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #16 on: January 08, 2021, 09:06:17 am »
Quote
Until I can find a fix, you can also use Ctrl-tab to switch between editors.

I tried Ctrl-tab on Official C::B 20.03, Ubuntu 20.04. It doesn't function. The same situation with the newest wxGtk3. As Pecan already told, there are more problems with getting the focus.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: BrowseTracker dialog is not closing
« Reply #17 on: January 08, 2021, 09:47:22 am »
On linux it is ctrl+,
Ctrl+Tab has never worked, because gtk doesn't allow to override its meaning.

edit: s/it/its/
« Last Edit: January 08, 2021, 12:04:41 pm by oBFusCATed »
(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 darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: BrowseTracker dialog is not closing
« Reply #18 on: January 08, 2021, 09:54:48 am »
Thank you, oBFusCATed. Ctrl+, works perfectly!

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #19 on: January 08, 2021, 05:45:05 pm »
I just a bit played with the code and found that uncommenting the last line in function BrowseSelector::Create enables BrowseTracker to function properly:

  -  //?m_listBox->SetFocus();
 +  m_listBox->SetFocus();

It seems that some developer had this problem and solved it earlier. Can someone try it?

I too have tried this change. It helps a little bit, but I still get freezes in both Find-in-files dlg and BrowseSelector dig.

The symptoms are: the main window always gets the focus when the freeze occurs, but any mouse click causes the focus to shift to the correct dialog item.
 
There are complaints about this problem to wxWidgets going back 8 years. A fix from wxWidgets solves that particular problem but not all.

I have found this problem as far back as wx2.8.12 (the oldest CB in my archive).

It seems to be related to the delayed focus method used in wxWidgets and the failure of some wxEventFocus handler to event.Skip() either EVT_Set_FOCUS, EVT_KILL_FOCUS or wxIdle event.

I've viewed all event handlers in CB for that problem and have not found it in either the core or the plugins that I use.

I'm still looking.

« Last Edit: January 08, 2021, 05:57:22 pm by Pecan »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #20 on: June 24, 2021, 09:56:53 pm »
Fixed rev12470. Shamelessly gloaming the editor managers wxSwitcher.
 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: BrowseTracker dialog is not closing
« Reply #21 on: June 29, 2021, 12:18:32 am »
Can you post what is the problem, what is casing the problem and how you've fixed it? "* BrowseTracker - Fixed editor switching dialog" as a commit message is rather vague.
(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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2743
Re: BrowseTracker dialog is not closing
« Reply #22 on: June 30, 2021, 01:46:49 am »
@oBFusCATed

The problem was the same as many of the other small dialogs.
wxWidgets never gives the dialog the focus.
So it just sits there until the user clicks inside the dialog window.

This happens often with "Find/Find in files", and other dialogs requesting just a yes or no response.

I spent may weeks trying to find the problem, but gave up.
It appears (I can't catch it) that wxWidgets tries to find the first widget in the diaglog and give it the focus. But it misses and gives the parent the focus instead.

I used the editors wxSwitcher code to solve the Browsetracker problem.
It works.

 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: BrowseTracker dialog is not closing
« Reply #23 on: June 30, 2021, 10:48:07 am »
Have you talked to the wx people about the problem? I don't see a reason for us to workaround a wx problem or to workaround a problem we might cause with some other workaround.
(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!]