Author Topic: dragscroll-plugin breaks context-menus in some logger-tabs on Linux  (Read 4733 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
If the DragScroll-plugin uses the right mouse-button for dragging the context-menus in the standard loggers (based on textcrls) never pop up.
This happens, because DragScroll waits for ContextMenu to pop up for some milliseconds, but if the user moves the mouse it immediately starts dragging and returns from the MouseDown-Event without skipping it.

On Linux the values of the events mouse-position and the mouse-position fetched from the window always have a difference from 2 pixel in these loggers, even if mouse is not moved.

But DragScroll stops waiting, if the difference is greater then 1 (that means always !).

This patch fixes it:
Code
--- codeblocks-1.0svn.orig/src/plugins/contrib/dragscroll/dragscroll.cpp        2008-02-02 13:33:24.000000000 +0100
+++ codeblocks-1.0svn.work/src/plugins/contrib/dragscroll/dragscroll.cpp        2008-02-02 13:38:14.000000000 +0100
@@ -999,7 +999,7 @@
             mouseXY = ((wxWindow*)m_pEvtObject)->ScreenToClient(wxGetMousePosition());^M
             scrollx = abs(mouseXY.x - m_InitX) ;^M
             scrolly = abs(mouseXY.y - m_InitY) ;^M
-            if ( ( scrolly > 1) || (scrollx > 1) ) break;^M
+            if ( ( scrolly > 2) || (scrollx > 2) ) break;^M
             i += 10;^M
         }^M
 ^M
@@ -1014,7 +1014,7 @@
              LOGIT(_T("Down delta x:%d y:%d"), scrollx, scrolly );^M
             #endif^M
             if (p_cbStyledTextCtrl && (m_pEvtObject == p_cbStyledTextCtrl) //v0.21^M
-                && ( ( scrolly > 1) || (scrollx > 1) ))^M
+                && ( ( scrolly > 2) || (scrollx > 2) ))^M
             {   m_DragMode = DRAG_START;^M
                 return;^M
             }^M
@@ -1029,7 +1029,7 @@
             //}//endelse^M
             else {  // listctrl windows ALWAYS report 24 pixel y move^M
                     // when just hitting the mouse button.^M
-                if ( (scrolly > 1) || (scrollx > 1))^M
+                if ( (scrolly > 2) || (scrollx > 2))^M
                 {   m_DragMode = DRAG_START;^M
                     return;^M
                 }^M

Because of the dos line-endings it might not apply if copied from here, but only three lines have to be changed.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2773
Re: dragscroll-plugin breaks context-menus in some logger-tabs on Linux
« Reply #1 on: February 02, 2008, 04:38:44 pm »
Patch  applied svn 4857.

I was not able to reproduce this problem on my Ubuntu 7.10 (VMWare).
But I applied the fix anyway to see if it solved other Linux's having the problem.

Thanks Jens. I know how much work it takes to run these things down.