Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: travonz on January 05, 2009, 11:05:55 am

Title: Mouse wheel in editor
Post by: travonz on January 05, 2009, 11:05:55 am
Hi,

since several days mouse wheel doesn't work any more in editor. It work only if cursor is over scroll bar, which is not comfortable. It also work on other widgets (combobox, ...).
Font size change is also disable if ctrl pressed.
Is there a new option or something to enable ?

I use svn 5380 compiled on Linux with wxwidget 2.8.8.

thanks for your help

Xavier
Title: Re: Mouse wheel in editor
Post by: ollydbg on January 06, 2009, 03:43:53 am
I'm using "windows xp", and all the related issues are Ok in my system. Maybe you could update to wxwidgets 2.8.9.
Title: Re: Mouse wheel in editor
Post by: Schlumie on January 14, 2009, 10:01:54 am
Same here on Ubuntu Hardy SVN 5380 wx2.8.9. Now I'll try to install older version...
Title: Re: Mouse wheel in editor
Post by: Jenna on January 14, 2009, 11:05:59 am
Works fine for me on debian 32-bit and 64-bit, with C::B from trunk or from my repo.

wxWidgets is 2.8.9 from apt.wxwidgets.org
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 14, 2009, 04:54:34 pm
since several days mouse wheel doesn't work any more in editor. It work only if cursor is over scroll bar, which is not comfortable. It also work on other widgets (combobox, ...).

I am experiencing the same problem on my Solaris work machine.  Any mouse wheel movement over the editor itself does nothing.  I can check my home Ubuntu machine later.

This seems like a pretty high-priority bug.  I'm rather used to my mouse buttons working.    :?

The problem started when I updated to r5397.  The previous build from a few weeks ago didn't show this problem.  I've been using wxWidgets 2.8.9 for a while, so I don't suspect that's the cause.

It's probably worth noting that scintilla changebar functionality was added during this time.



Title: Re: Mouse wheel in editor
Post by: Ceniza on January 14, 2009, 07:04:13 pm
It also works fine here in Gentoo 64 bits.

BTW, have you noticed you can also right click on the editor and drag everywhere? Maybe that feature is old, but I only found about it when testing the new Scintilla.
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 14, 2009, 07:17:54 pm
If it helps, I also have all plugins and all contrib plugins enabled.

Edit:  I tried codeblocks --safe-mode and the problem persists.  Not a plugin thing.

Left, right, and middle clicks work as expected.  It's just the mouse wheel signals that get eaten by the editor window.

It looks like someone left a (sparse) bug report: http://developer.berlios.de/bugs/?func=detailbug&bug_id=15054&group_id=5358 (http://developer.berlios.de/bugs/?func=detailbug&bug_id=15054&group_id=5358)

FWIW, my wxWidgets-2.8.9 is built against gtk-2.6.  Perhaps the conflict is between that new scintilla and the (relatively old) gtk-2.6
Title: Re: Mouse wheel in editor
Post by: Jenna on January 14, 2009, 10:18:31 pm
BTW, have you noticed you can also right click on the editor and drag everywhere? Maybe that feature is old, but I only found about it when testing the new Scintilla.

That should be done my the drag/scroll-plugin.

It's probably worth noting that scintilla changebar functionality was added during this time.
The changebar-feature should not be able to affect the mousewheel, but you can try what happens if you disable it with unchecking "Settings -> Editor... -> Margins and caret -> Use changebar".

The part affecting the mousewheelevent in scintilla did also not change with the scintiulla update as far as I know.


If you use a self-compiled C::B it would be interesting to see what happens if the plugins are not even loaded (--safe-mode only disables them).
You can run "make uninstall" to remove all the C::B stuf (the configuration will remain) and use "./configure" without the parameter "--with-contrib-plugins=...".
And maybe you get some usefull error-messages if you change the first line in OnInit() (app.cpp about line 468) from "wxLog::EnableLogging(true);" to "wxLog::EnableLogging(true);" before recompiling (there are some messages that are "normal").

since several days mouse wheel doesn't work any more in editor. It work only if cursor is over scroll bar, which is not comfortable. It also work on other widgets (combobox, ...).
Font size change is also disable if ctrl pressed.
What happens in the ThreadSearch preview window or in the SyntaxHighlighting example window ?


By the way:
It would be of interest if anything else was updated the same time on the systems that have these problems.
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 14, 2009, 10:56:49 pm
Update:  I rebuilt wxWidgets-2.8.9 using gtk-2.12 instead of gtk-2.6.  The same bug exists.   :(

The changebar-feature should not be able to affect the mousewheel, but you can try what happens if you disable it with unchecking "Settings -> Editor... -> Margins and caret -> Use changebar".

Good idea.  I tried it and the same bug exists.   :(

It would be of interest if anything else was updated the same time on the systems that have these problems.

My system is heavily locked down.  It's one of those Solaris ZFS file systems where my whole company is effectively running from one giant networked hard drive.

In this setup, new libraries are installed in their own unique directories, so it's unlikely that the libraries I've been pointing to have changed.

I will be able to confirm this when I have the time to spare by pulling down an older build from svn.  I could even narrow the issue down to the specific checkin, but that will be tedious.  I may have to demand animated sparkles next to my name on this forum...if I'm right about this, of course.


My bet is that some specific combination of libraries became poisonous recently without the majority of users seeing the problem.  Jens (or anyone), do you know offhand if command-line svn leaves any kind of log where I could see what revision number my prior pull was from?  That would help narrow down the search. 


 
Title: Re: Mouse wheel in editor
Post by: Jenna on January 15, 2009, 07:31:44 am
Another question:

Can you scroll the starthere-page?

If yes, could you put some debug-statements ("printf"'s for example) inside wxScintillas "OnMouseWheel"-handler, to see if it is reached ?
"src/sdk/wxscintilla/src/wxscintilla.cpp:3835" (OnMouseWheel) and "src/sdk/wxscintilla/src/ScintillaWX.cpp:855" (Do MouseWheel)

Did you try tu do a "make clean" or a "make distclean" before building ?

And did you run  "./bootstrap" with the new sources, because some (many ?) of the "Makefile.am"' are changed ?
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 15, 2009, 04:26:21 pm
Another question:

Can you scroll the starthere-page?

That page doesn't present any scrollbars to me, even when the window is small enough that scrollbars would make sense.  So no...but I'm not sure I ever could.

What I have noticed is that the mouse wheel works in all windows except scintilla -- The actual editor window, the code preview pane in threaded search, the sample code in the Configure Syntax Highlighting dialog...those won't scroll with the mouse wheel unless the mouse cursor is above the scrollbar itself, not the scintilla window.


Did you try tu do a "make clean"

On my second attempt, yes.

or a "make distclean" before building ?

Third attempt.

And did you run  "./bootstrap" with the new sources, because some (many ?) of the "Makefile.am"' are changed ?

Fourth.  :)
Title: Re: Mouse wheel in editor
Post by: Jenna on January 15, 2009, 05:19:14 pm
What about this:
If yes, could you put some debug-statements ("printf"'s for example) inside wxScintillas "OnMouseWheel"-handler, to see if it is reached ?
"src/sdk/wxscintilla/src/wxscintilla.cpp:3835" (OnMouseWheel) and "src/sdk/wxscintilla/src/ScintillaWX.cpp:855" (Do MouseWheel)
Starthere-page with scrollbars as attachment.


[attachment deleted by admin]
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 16, 2009, 05:11:04 pm
could you put some debug-statements

I still intend to, Jens...this is my work machine that's showing the problem so my experiment time is limited.

Regarding the Start Here page...your image looks familiar, but with the latest build I see no scrollbars.

Oh, and for good measure, I pulled all the source into a fresh empty directory to do a pure-build-from-scratch.  That didn't fix anything.
Title: Re: Mouse wheel in editor
Post by: Jenna on January 16, 2009, 05:26:43 pm
Did you also try to install C::B to another directory tree (using a different prefix when running ./configure) ?

I know these are many things to try and I'm grateful for your patience, but I'd really like to find (and hopefully fix) the issue.

And I did not find a way to reproduce it.
Title: Re: Mouse wheel in editor
Post by: DrewBoo on January 16, 2009, 09:04:31 pm
Found it!   :D

With a lot of guidance from you, Jens, I have the bug pegged!

Ready?

Code goes in...

Code
void wxScintilla::OnMouseWheel (wxMouseEvent& evt)
{
    // prevent having an event queue with wheel events that cannot be processed
    // reasonably fast (see ticket #9057)
    printf( "OnMouseWheel\n" );
    printf( "Checking %d <= %d\n", m_lastWheelTimestamp, evt.GetTimestamp() );
    if ( m_lastWheelTimestamp <= evt.GetTimestamp() )
    {
        printf( "OnMouseWheel - Processed\n" );
        m_lastWheelTimestamp = m_stopWatch.Time();
        m_swx->DoMouseWheel(evt.GetWheelRotation(),
                            evt.GetWheelDelta(),
                            evt.GetLinesPerAction(),
                            evt.ControlDown(),
                            evt.IsPageScroll());
        m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp;
        m_lastWheelTimestamp += evt.GetTimestamp();
    }
}

Text comes out...


OnMouseWheel
Checking 0 <= -521831849
OnMouseWheel
Checking 0 <= -521826089
OnMouseWheel
Checking 0 <= -521824121


You can see that the timer is incrementing...it's just negative.

Now here's a quote from http://docs.wxwidgets.org/trunk/classwx_event.html (http://docs.wxwidgets.org/trunk/classwx_event.html) on that function (emphasis mine):

Quote
long wxEvent::GetTimestamp() const

Gets the timestamp for the event.

The timestamp is the time in milliseconds since some fixed moment (not necessarily the standard Unix Epoch, so only differences between the timestamps and not their absolute values usually make sense).

So, the bug's in wxScintilla.  And sure enough, if I initialize m_lastWheelTimestamp to std::numeric_limits<long>::min() instead of the absolute 0 everything works again.


Title: Re: Mouse wheel in editor
Post by: Jenna on January 16, 2009, 09:51:38 pm
Good catch !  :D

I just committed a fix ( initializing m_lastWheelTimestamp to std::numeric_limits<long>::min()).

In svn r5407 mousewheel event in wxScintilla should work again.

DrewBoo: many thanks for your help and your patience.