在 Java IDE 中停用 MEvent.CASE

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24610534/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 13:27:28  来源:igfitidea点击:

Deactivate MEvent.CASE in Java IDEs

javamatlabubuntuide

提问by Juan David

I'm using MATLAB R2014a on my laptop running Ubuntu 14.04 LTS, and am experiencing a rather annoying issue. Whenever I use the two-finger scrolling gesture on my touchpad in either the editor or the main window, the following output appears in the command window:

我在运行 Ubuntu 14.04 LTS 的笔记本电脑上使用 MATLAB R2014a,遇到了一个相当烦人的问题。每当我在编辑器或主窗口中的触摸板上使用双指滚动手势时,命令窗口中都会出现以下输出:

MEvent. CASE!

事件。案件!

While the scrolling works, this line is output over and over again as I continue to perform the gesture.

当滚动工作时,当我继续执行手势时,这条线会一遍又一遍地输出。

Any ideas for how to stop this from happening?

关于如何阻止这种情况发生的任何想法?

NOTE: It also occurs in Processing and Arduino IDEenter image description here

注意:它也出现在 Processing 和 Arduino IDE 中在此处输入图片说明

采纳答案by Arjun Varshney

As a user I wouldn't want to type the above command everytime I open MATLAB. So I searched a bit on matlab 'startup' command line section, and the 'search path' section. I solved my problem after doing the following simple steps:

作为用户,我不想每次打开 MATLAB 时都输入上述命令。所以我在 matlab 的“启动”命令行部分和“搜索路径”部分搜索了一些。在执行以下简单步骤后,我解决了我的问题:

  1. See your userpath by typing userpathin MATLAB console: For linux it is: home/username/Documents/MATLAB/
  2. Create a file 'startup.m' having only one line, which will disable Mevent.CASE! (Below is the text to copy)

    !synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0
    
  3. Place the created startup.m file in your userpath folder as defined in MATLAB.

  4. Now as soon as you place this file in your userpath, restart MATLAB.
  5. Verify by seeing ans = 0 in the workspace section.
  1. 通过在 MATLAB 控制台中键入userpath来查看您的用户路径:对于 linux,它是:home/username/Documents/MATLAB/
  2. 创建一个只有一行的文件“startup.m”,这将禁用 Mevent.CASE!(以下是要复制的文字)

    !synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0
    
  3. 将创建的 startup.m 文件放在 MATLAB 中定义的用户路径文件夹中。

  4. 现在,只要将此文件放在用户路径中,就重新启动 MATLAB。
  5. 通过查看工作区部分中的 ans = 0 进行验证。

It worked for me on Ubuntu 15.04 running MATLAB R2015b, I hope it works for you all as well.

它在运行 MATLAB R2015b 的 Ubuntu 15.04 上对我有用,我希望它也适用于你们所有人。

Note: This is an improvement to @someDude and @Slothworks answer.

注意:这是对@someDude 和@Slothworks 答案的改进。

回答by someDude

Deactivating horizontal scrolling may fix the issue. Try running the following at the gnome-terminal:

停用水平滚动可能会解决此问题。尝试在 gnome-terminal 运行以下命令:

synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0

Or the following in the MATLAB console:

或者在 MATLAB控制台中执行以下操作:

!synclient HorizEdgeScroll=0 HorizTwoFingerScroll=0

(source: http://www.mathworks.com/matlabcentral/answers/112528-mevent-case-when-two-finger-scrolling)

(来源:http: //www.mathworks.com/matlabcentral/answers/112528-mevent-case-when-two-finger-scrolling

回答by newman_ash

None of these solutions worked for me. Moreover I like to keep the two finger scrolling. This works for me:

这些解决方案都不适合我。此外,我喜欢保持两个手指滚动。这对我有用:

MATLAB relies on jdk7, jdk8 will not work with it. It appears 16.04 and later no longer provide openjdk-7-jre in the repos, and it must be installed from external sources. To install it:

MATLAB 依赖于 jdk7,jdk8 不支持它。似乎 16.04 及更高版本在 repos 中不再提供 openjdk-7-jre,必须从外部源安装。要安装它:

sudo add-apt-repository ppa:openjdk-r/ppa  
sudo apt-get update   
sudo apt-get install openjdk-7-jdk

Ensure that you have correctly set the MATLAB_JAVA variable. This can be checked with:

确保您已正确设置 MATLAB_JAVA 变量。这可以通过以下方式检查:

echo $MATLAB_JAVA

If the output is empty, this variable is empty. It can be set with

如果输出为空,则此变量为空。它可以设置为

export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre

Then, execute MATLAB from the same shell with whatever command you use to call MATLAB, usually

然后,使用您用来调用 MATLAB 的任何命令从同一个 shell 执行 MATLAB,通常是

matlab

In the MATLAB command window, run

在 MATLAB 命令窗口中,运行

version -java

and verify that the output contains "OpenJDK". If all is successful, you should no longer see the MEvent. CASE! error message.

并验证输出是否包含“OpenJDK”。如果一切都成功,您应该不会再看到 MEvent。案件!错误信息。

To make this persistent: add

要使其持久化:添加

export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre        

to the /etc/profilefile (for system wide change) or to ~/.profilefor local user

/etc/profile文件(用于系统范围的更改)或到~/.profile本地用户

Source: https://www.reddit.com/r/matlab/comments/5anydi/how_to_stop_mevent_case_from_appearing/

来源:https: //www.reddit.com/r/matlab/comments/5anydi/how_to_stop_mevent_case_from_appearing/

回答by Riyas Jaleel

GNOME 3.20 ::SYNCLIENT IS OBSOLETE, Fixing the MEvent. CASE! error in MATLAB for xinput

GNOME 3.20 ::SYNCLIENT 已过时,正在修复 MEvent。案件!MATLAB 中的 xinput 错误

The suggested solution is to run

建议的解决方案是运行

!synclient HorizTwoFingerScroll=0

as part of your startup file to disable horizontal scrolling. This however does not work on more recent linux versions because the synaptics touchpad driver is being deprecated in favour of libinput. The new solution to this problem is slightly more complex however. First we need to find the id of the touchpad device with the xinput list command from a terminal (not the MATLAB command window). You should see something like:

作为启动文件的一部分以禁用水平滚动。然而,这在更新的 linux 版本上不起作用,因为 Synaptics 触摸板驱动程序已被弃用,以支持 libinput。然而,这个问题的新解决方案稍微复杂一些。首先,我们需要从终端(不是 MATLAB 命令窗口)使用 xinput list 命令找到触摸板设备的 id。你应该看到类似的东西:

~$ xinput list

? Virtual core pointer                          id=2    [master pointer  (3)]
?   ? Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
?   ? SynPS/2 Synaptics TouchPad                id=13   [slave  pointer  (2)]
?   ? ELAN Touchscreen                          id=11   [slave  pointer  (2)]

We are interested in the SynPS/2 Synaptics TouchPad which in this case has id=13. We can see the configuration options supported by this device by running :

我们对 SynPS/2 Synaptics TouchPad 感兴趣,在本例中它的 id=13。我们可以通过运行以下命令查看此设备支持的配置选项:

~$ xinput list-props 13

Remember to change 13 to the id of the touchpad on your machine ! In the output you should see a line like:

记得把 13 改成你机器上触摸板的 id !在输出中,您应该看到如下一行:

Synaptics Two-Finger Scrolling (283):   1, 1

This tells you that two finger scrolling is enabled in the vertical and horizontal directions. To change this run :

这告诉您在垂直和水平方向启用了两指滚动。要更改此运行:

~$ xinput set-prop 13 "Synaptics Two-Finger Scrolling" 1 0

If you couldn't find the "Two-Finger Scrolling" line all is not lost. Look for a line related to horizontal scrolling. In my case that was:

如果您找不到“双指滚动”行,一切都不会丢失。查找与水平滚动相关的行。就我而言,那是:

libinput Horizonal Scroll Enabled (266):    1

and the command used to disable this property is:

用于禁用此属性的命令是:

~$ xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0

To have this run automatically every time you run MATLAB you can add

要在每次运行 MATLAB 时自动运行,您可以添加

!xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0

to your startup file.

到您的启动文件。

回答by bormat

For people who doesn't have simulink but x-input This is an improvement of Riyas Jaleel to only disabled horizontal scroll in matlab but not in others app.

对于没有 simulink 但没有 x-input 的人这是对 Riyas Jaleel 的改进,仅在 matlab 中禁用水平滚动,而在其他应用程序中不禁用。

First of all install xdotool that allows to know the current window name

首先安装允许知道当前窗口名称的 xdotool

sudo apt install xdotool

src : https://unix.stackexchange.com/questions/256713/how-to-execute-a-command-on-window-focus-unfocus

源代码:https: //unix.stackexchange.com/questions/256713/how-to-execute-a-command-on-window-focus-unfocus

Now create a script named patchScroll.sh in the bin folder of matlab with the following content

现在在matlab的bin文件夹中创建一个名为patchScroll.sh的脚本,内容如下

  while [ true ]
    do
        window=`xdotool getwindowfocus getwindowname`
        is_enabled=2
        if [ "$window" = "MATLAB R2017a" ]; then
            if [ "$is_enabled" != "0" ]; then
                xinput set-prop 13 "libinput Horizonal Scroll Enabled" 0
                is_enabled=0
                echo "is_enable $is_enabled"
            fi
        else
            if [ "$is_enabled" != "1" ]; then
                xinput set-prop 13 "libinput Horizonal Scroll Enabled" 1
                is_enabled=1
                echo "is_enable $is_enabled"
            fi
        fi
        sleep 1
    done

now in the matlab file in bin folder that launch matlab add ./patchScroll.sh &between first and current second line

现在在启动 matlab 的 bin 文件夹中的 matlab 文件中,./patchScroll.sh &在第一行和当前第二行之间添加

We can't directly put the code in matlab file because the loop is infinite and it will block the launch of matlab, it is why we use & at end.

我们不能直接把代码放在matlab文件中,因为循环是无限的,它会阻止matlab的启动,这就是我们在最后使用&的原因。