Author Topic: Strangeness with stepping in debugger using toolbar button  (Read 12012 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12124
    • Travis build status
Re: Strangeness with stepping in debugger using toolbar button
« Reply #15 on: April 12, 2011, 12:16:31 am »
I gave it a try again and with the patch below, I think I've solved the problems discussed in this topic.
Please test and report if there are problems with it.
I've tried it only on windows and I will test it on linux in the next couple of days.
The patch should apply to trunk and debuggers branch.

Code: [Select]
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 7096)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -3348,10 +3348,28 @@
 
 void cbEditor::OnEditorDwellStart(wxScintillaEvent& event)
 {
+    if (!wxTheApp->IsActive())
+        return;
+       
     cbStyledTextCtrl* control = GetControl();
-    int pos = control->PositionFromPoint(wxPoint(event.GetX(), event.GetY()));
+   
+    wxRect screenRect = control->GetScreenRect();
+    wxPoint ptEvent(event.GetX(), event.GetY());
+    ptEvent = control->ClientToScreen(ptEvent);
+    wxPoint ptScreen = wxGetMousePosition();
+    wxPoint ptClient = control->ScreenToClient(ptScreen);
+
+    double distance = sqrt((ptScreen.x - ptEvent.x) * (ptScreen.x - ptEvent.x)
+                           + (ptScreen.y - ptEvent.y) * (ptScreen.y - ptEvent.y));
+    if (!screenRect.Contains(ptScreen) || distance > 10)
+        return;
+   
+    int pos = control->PositionFromPoint(ptClient);
     int style = control->GetStyleAt(pos);
-    NotifyPlugins(cbEVT_EDITOR_TOOLTIP, style, wxEmptyString, event.GetX(), event.GetY());
+    NotifyPlugins(cbEVT_EDITOR_TOOLTIP, style, wxEmptyString, ptClient.x, ptClient.y);
+    wxScintillaEvent newEvent(event);
+    newEvent.SetX(ptClient.x);
+    newEvent.SetY(ptClient.y);
     OnScintillaEvent(event);
 }
 
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12124
    • Travis build status
Re: Strangeness with stepping in debugger using toolbar button
« Reply #16 on: May 25, 2011, 01:18:58 pm »
Anyone tried this? Is it save to commit it?
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Strangeness with stepping in debugger using toolbar button
« Reply #17 on: May 25, 2011, 10:34:10 pm »
Anyone tried this? Is it save to commit it?
I tried it since that day, I see no issues, it seems to work. :)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12124
    • Travis build status
Re: Strangeness with stepping in debugger using toolbar button
« Reply #18 on: May 30, 2011, 09:25:34 am »
Killerbot, Pecan, Jens: have you tried the patch?
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12124
    • Travis build status
Re: Strangeness with stepping in debugger using toolbar button
« Reply #19 on: June 17, 2011, 03:36:02 am »
In svn, please test more  :lol:
(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!]