sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
811 stars 39 forks source link

Mouse wheel scrolling broken when switching desktops or losing focus #2512

Open parnham opened 5 years ago

parnham commented 5 years ago

Description

Since the switch to Gtk3 the mouse wheel scrolling has not behaved as expected:

When the scrolling has stopped working after switching desktops you have to focus a different window and then refocus the ST one to get it functioning again.

Steps to reproduce

Focus another window or Switch current virtual desktop away and back

Expected behavior

Mouse scroll wheel should work even if the window isn't focused.

Actual behavior

Scrolling has no effect. In the case of a virtual desktop switch scrolling stops working until window focus is toggled.

Environment

parnham commented 5 years ago

Still present in build 3190

rgpublic commented 5 years ago

+1 super-annoying bug. it really makes you aggressive when you cannot scroll anymore. i dont even use virtual desktops. i have two monitors side by side and "focus follows mouse" under KDE. Many times a day I cannot scroll at all - even when I click inside the sublime window. I need to switch multiple times between windows until sublime "unlocks" again. Nightmare! Please, please fix this.

wbond commented 5 years ago

Does this work for other GTK3 apps?

wbond commented 5 years ago

This seems likely to be a fundamental incompatibility between KDE and GTK3. See https://bbs.archlinux.org/viewtopic.php?id=239918 for a suggested workaround.

I'm planning on closing as "invalid" since this seems out of our ability to resolve.

parnham commented 5 years ago

This does appear to be a fundamental issue with GTK3 and the suggestion to use GDK_CORE_DEVICE_EVENTS=1 seems to work for the moment. Perhaps a note could be added on the website regarding this workaround so that others experiencing the same problem can find it more easily?

rgpublic commented 5 years ago

Cool, thanks a lot @parnham . Gee, what a crazy bug. Was driving me nuts. GDK_CORE_DEVICE_EVENTS=1 works for me. So, our poor Sublime is not to blame and exonerated :-). But I wonder if it shouldn't print a warning box or sth. if one starts the app without this option. It's quite difficult to get to the bottom of this. For some time, I thought my mouse was broken or sth. When you google for GDK_CORE_DEVICE_EVENTS=1 you find reports going back more than 5 years. And nobody tries to fix it. Open Source software at it's worst IMHO. Many different apps affected. Although personally I only ever encountered this with Sublime. It doesn't happen with Firefox for me at all, for example.

larryhastings commented 5 years ago

For what it's worth: middle-button scrolling on Linux with a Trackpoint on a Thinkpad is affected the same way. Stopped working some time ago, GDK_CORE_DEVICE_EVENTS=1 workaround works. I dimly recall that the middle-button scrolling emulates a scroll wheel anyway.

gstavrinos commented 5 years ago

Ok, this bug is driving me crazy. Any pointers on where to look to fix it? (I mean in KDE)

nekromoff commented 5 years ago

testing, if export GDK_CORE_DEVICE_EVENTS=1 fixes this. If positive, this should be introduced to Sublime for Linux users to be run before launching Sublime.

BTW, as mentioned above, this is solely Sublime issue, Firefox or other GTK3 apps do not demonstrate this issue!

Utopism commented 5 years ago

Hi,

I am having the same issue with kde on debian jessie and kubuntu xenial. What bothers me, is that even after clicking in a sublime text window, or changing of file with window tabs, the scrollbar still does not work with mouse wheel. Should'nt the Sublime Text window get the focus back, with such actions, hence making the mouse wheel work again ?

romanzipp commented 5 years ago

I'm having an issue where scrolling in Sublime Text is not possible when Desktop Notifications are shown. It seems that the application is not losing focus while Notifications are being displayed.

plasmashell 5.12.7 Qt: 5.9.5 KDE Frameworks: 5.44.0 kf5-config: 1.0

VictorQueiroz commented 4 years ago

I'm still having this issue until this day. When are we getting a decent fix for this?

Utopism commented 4 years ago

Hi,

With Kde, I fixed the issue by launching it with a script like this :

if [ $# -le 0 ]; then
        echo "usage: $0 <file / folder to edit>"
        exit 0
fi

export GDK_CORE_DEVICE_EVENTS=1
subl -nw $1 &
krzysztofsroga commented 4 years ago

I was experiencing the same problem. Sure, exporting GDK_CORE_DEVICE_EVENTS=1 fixes the scrolling issue when the focus is lost. But unfortunately it also makes my touchpad scroll by large increments like scrolling with mouse. It's extremely annoying... Without the variable I can smoothly scroll by single pixels when doing it slowly... It affects sublime, firefox and many other apps.

Is there any way to have smooth, pixel-precise scrolling but don't experience problems in unfocused windows?

EDIT: Setting the variable also disables touchscreen scrolling in all affected apps so it's unacceptable for me...

Utopism commented 4 years ago

Hi,

Why does it affects other apps ? Don't you use a script to launch sublime, to apply it only to the sublime text process, as suggested ?

Zren commented 4 years ago

To only apply this env var to SublimeText (to lessen potential variables).

sudoedit /usr/local/bin/subl
#!/bin/bash

export GDK_CORE_DEVICE_EVENTS=1
/usr/bin/subl $@
sudo chmod +x /usr/local/bin/subl

That fixes subl from the terminal, next we need to edit the app's .desktop file so opening from the app launcher or file manager will use the env variable.

Right click the app launcher icon > Edit Applicatons (to launch kmenueditor), find Sublime Text and change the command from /opt/sublime_text/sublime_text %F to subl %F.


Does Sublime's "Build" inherit this environment variable?

sdeframond commented 3 years ago

Hi,

I have had a similar issue for a few months now. Sublime Text scrolling breaks randomly after the computer resumes from suspend. Scrolling never ever broke before suspending. Then there is no use switching windows or restarting Sublime, the only way to get scrolling back is to restart the computer. Trying to restart Sublime with GDK_CORE_DEVICE_EVENTS=1 subl does not work either.

Sublime Merge does not seem affected by this, neither is any other application that I know of.

Both the snap and the .deb versions of ST are affected,

I am using a touchpad on Ubuntu 20.10 with X11 and Gnome. ST build 3211.

Is there anything I can do to help resolve this issue ? It gets pretty frustrating.

Edit: although restarting Gnome (Alt+F2 then "r") does nothing, logging out then back in restores scrolling.

krzysztofsroga commented 3 years ago

@sdeframond This seems like a different problem. The problem in this thread was using GTK3 apps in KDE. Running GTK3 apps in Gnome was not affected. And as far as I know it was fixed a few KDE releases ago. For me it works fine now. Your problem must be something else or new. I think you should open a new issue.

rgpublic commented 3 years ago

If this is really fixed in KDE then shouldn't this bug be closed? Can someone confirm or even better link to the bug in KDE?

rgpublic commented 3 years ago

Could it be this one here, perhaps?

https://bugs.kde.org/show_bug.cgi?id=394772

Supposedly fixed in 5.19.3...

krzysztofsroga commented 3 years ago

@rgpublic Yes, I think it's this one. Or this one: https://bugs.kde.org/show_bug.cgi?id=348270 For me it started working fine around november last year. Both were fixed around that time.

sdeframond commented 3 years ago

Should I open a new issue then ?

krzysztofsroga commented 3 years ago

@sdeframond Yes, it's different problem.

sdeframond commented 3 years ago

@krzysztofsroga Done #3935

Thanks for your reactivity !