equalsraf / neovim-qt

Neovim client library and GUI, in Qt5.
https://github.com/equalsraf/neovim-qt/wiki
ISC License
1.85k stars 171 forks source link

scrolling artifacts on Windows after some idle time #619

Open jdhao opened 4 years ago

jdhao commented 4 years ago

I have got scrolling artifacts on the screen on Windows after nvim-qt has been idle for some time. See the white vertical line in the blow image.

image

Clicking mouse cursor in the screen will update the screen and clear the artifacts. I have not observed this for previous versions of nvim-qt. This happens only recently.

The nvim-qt is bundled with nvim nightly version: NVIM v0.5.0-172-g1ff5b60cb

jgehrig commented 4 years ago

These look similar to the artifacts I see on Linux as a result of display scaling.

Is display scaling set to 100%? Does this issue persist with 100% display scaling?

I haven't seen this issue, but I will keep an eye out. If you can provide deterministic steps to reproduce the issue, that would be helpful.

jdhao commented 4 years ago

Yeah, the Windows display scale is 100% and the screen resolution is set to 1920 x 1080.

jdhao commented 4 years ago

@jgehrig I think I can reproduce this issue now. It has something to do with the mouse wheel setting.

image

I am also confused that placing the mouse cursor on the nvim-qt window will activate it so that I can use mouse scroll to move the cursor inside nvim-qt. I thought that only after clicking the nvim-qt window, will we be able to activate it and use the mouse wheel to scroll.

jgehrig commented 4 years ago

I can't quite reproduce the exact scenario, but I see similar issues when the cursor "bounces" off the screen edge in an inactive state. The issue appears on Linux/Windows with 100% scaling.

The cursor outline disappears only after a "bounce" off the screen edge. Recorded with ScreenToGif.

output

Do you think this could be the cause of your display artifacts? If not, maybe they are related...

I am also confused that placing the mouse cursor on the nvim-qt window will activate it so that I can use mouse scroll to move the cursor inside nvim-qt. I thought that only after clicking the nvim-qt window, will we be able to activate it and use the mouse wheel to scroll.

That is odd... Qt sends mouse scroll event to inactive windows. There is probably an OS setting somewhere. Linux behaves the same way on my computer.

jdhao commented 4 years ago

I think they are similar if not the same issue. The solid cursor shape becomes hollow. When you scroll the mouse wheel, it produces the display artifacts.

jgehrig commented 4 years ago

My screen capture is scrolled with the mouse wheel too. It sounds similar, but not exactly the same.

I will take a look at the screen edge case some time. Maybe that case will provide some insight for both cases.

jgehrig commented 4 years ago

@jdhao

The logic for cursor rendering is straightforward; active cursors are inverted and inactive cursors are printed as a empty rectangle. I suspect this is a bug in Qt's rendering engine...

Can you try adjusting the scaling factor to see if this issue persists?

https://doc.qt.io/qt-5/highdpi.html#high-dpi-support-in-qt

jdhao commented 4 years ago

I tried to change the display scale to 125%, 150% or 175%, but the issue still persists. The image below is captured using 125% scale.

image

jgehrig commented 4 years ago

I suspect this is a bug in Qt... Did you make the changes via set QT_SCALE_FACTOR? I cannot reproduce without setting a problematic scale factor like 1.3.

It would be useful to know which version of Qt this was built against. It is a shame you can't use #616 yet.

It would be nice to know if this scenario behaves differently for different versions of Qt, if you can build the app from source.

jdhao commented 4 years ago

No, I change the scale in Windows 10 settings in System --> Display --> Scale and layout.

Sorry, I can not build this from source. It is a work computer and I have neither qt or MSVC installed...

The Nvim-qt I am currently using is bundled with Neovim, and the neovim version is (from :version):

NVIM v0.5.0-172-g1ff5b60cb
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG -DMIN_LOG_LEVEL=3 /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -IC:/projects/neovim/build/config -IC:/projects/neovim/src -IC:/projects/nvim-deps/usr/include -IC:/projects/neovim/build/src/nvim/auto -IC:/projects/neovim/build/include
Compiled by appveyor@APPVYR-WIN

Features: -acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM\sysinit.vim"
  fall-back for $VIM: "C:/Program Files/nvim/share/nvim"

Run :checkhealth for more info