News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Strangeness with stepping in debugger using toolbar button

Started by burtbick, November 27, 2010, 03:12:44 AM

Previous topic - Next topic

oBFusCATed

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.


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!]

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!]

MortenMacFly

Quote from: oBFusCATed on May 25, 2011, 01:18:58 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

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!]

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!]