[bug?] Setting LC_ALL to Russian locale breaks zooming

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by wmayer »

wmayer wrote: Sat Oct 27, 2018 3:12 pm However when trying to set

Code: Select all

LC_ALL=ru_RU.UTF8
I get an error
bash: warning: setlocale: LC_ALL: cannot change locale (ru_RU.UTF8)
Do you have an idea which other package I have to install?
After installing the packages I had to open a new terminal window in order to set the last variable. So, this gives me this configuration:
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15051 (Git)
Build type: Release
Branch: master
Hash: 4cff87ed572499b4b1155dffdf4c4ba37e28dec0
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
Locale: Russian/RussianFederation (ru_RU)

However I cannot confirm the zooming problem.
User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by Grue »

Russian locale in debian-based systems is not installed by default, you have to run

Code: Select all

sudo dpkg-reconfigure locales
first and check desired locales (or compile them all, but it takes time).
Life sucks, then you die.
User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by Grue »

I tried to run FreeCAD from bash without inherited environment:

Code: Select all

env -i bash --noprofile --norc              
and there was no problem (I had to set manually $HOME, LC_ALL and DISPLAY variables). So I began to exclude variables from my environment and found another variable that has to be set:

Code: Select all

export KDE_FULL_SESSION=true
Only combination of LC_ALL=ru_RU.UTF8 (or any other variant of ru_RU) with KDE_FULL_SESSION=true causes zooming problem.
Automatically Set Variables
KDE_FULL_SESSION

Set to true by KDE startup, it is used by some programs, such as Konqueror, to know if they should consider remaining in memory for future re-use when being closed. If not set, those programs will exit after being closed (e.g. kdesu does that, it's also useful for debugging).

If you plan on using this variable to detect a running KDE session, check if the value is not empty instead of seeing if it equals true. The value might be changed in the future to include KDE version information.
Curiouser and curiouser!
Life sucks, then you die.
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by wmayer »

Our 3d viewer is based on the (modified) Quarter API (it's the successor of SoQt implemented by the Coin3d team) and there an event filter is used that converts Qt events into OpenInventor events. This event filter then invokes View3DInventorViewer::processSoEvent
When looking at this code I cannot detect anything weird wrt to zooming.

However, I found a second event filter directly used by the View3DInventorViewer class. And there is a suspicious block that actively filters out some wheel events:

Code: Select all

        if (event->type() == QEvent::Wheel) {
            QWheelEvent* we = static_cast<QWheelEvent*>(event);
            if (we->orientation() == Qt::Horizontal)
                return true;
        }
I wonder if the combination of LC_ALL=ru_RU.UTF8 and KDE_FULL_SESSION=true causes this block to filter the wheel events. Do you have a chance to build your own FreeCAD binaries to check this idea?
User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by Grue »

Today I compiled FreeCAD from git source. Replacing true to false in that return statement or replacing return statement with (void)0; did not help.

How do you debug FreeCAD on Linux? I built Debug version, but gdb can't find source file View3DInventorViewer.cpp, so I can't set up breakpoint.
Life sucks, then you die.
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by wmayer »

How do you debug FreeCAD on Linux? I built Debug version, but gdb can't find source file View3DInventorViewer.cpp, so I can't set up breakpoint.
It's some time ago that I had to debug something directly with gdb but AFAIR you have to do gdb ./FreeCAD, then set the break point and then call run. But if you can't get it working this way you still can add printf statements into the code. And to reduce compile and link time pass the target name + fast to make, e.g. make FreeCADGui/fast
User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by Grue »

AFAIR you have to do gdb ./FreeCAD, then set the break point and then call run

Code: Select all

dragon pts/19%gdb FreeCAD                                                                                                                     
[~/freecad-src/freecad-debug/bin 18:37 Пн 29]
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from FreeCAD...done.
(gdb) break View3DInventorViewer.cpp:3083
No source file named View3DInventorViewer.cpp.
Make breakpoint pending on future shared library load? (y or [n])
(gdb)
But if you can't get it working this way you still can add printf statements into the code.
Yes. I modified that code to print some debug information:

Code: Select all

        if (event->type() == QEvent::Wheel) {
            printf("Ping!\n");
            QWheelEvent* we = static_cast<QWheelEvent*>(event);
            if (we->orientation() == Qt::Horizontal) {
                printf("Pong!\n");
                return true;
            }
        }
Now I get some pings, but no pongs while trying to zoom in/out/.
Life sucks, then you die.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [bug?] Setting LC_ALL to Russian locale breaks zooming

Post by Kunda1 »

Grue wrote: Mon Oct 29, 2018 4:07 pm Yes. I modified that code to print some debug information:
Very cool. Thanks for your efforts to help debug this issue.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply