Created attachment 122680 [details] rendering issue when open file in git project under hidpi dual screen setup SUMMARY STEPS TO REPRODUCE 1. Set up dual screen with different resolution: 1920x1080 and 3840x2160. Place side by side, bottom aligned. 2. Set scale factor to 1.5. 3. Launch Kate. 4. Open a file from Git repository. OBSERVED RESULT Project panel opened, and the window content rendering is not usable. EXPECTED RESULT Should render properly. SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20190909 KDE Plasma Version: 5.16.5 KDE Frameworks Version: 5.61.0 Qt Version: 5.13.1 Kernel Version: 5.2.11-1-default OS Type: 64-bit Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz Memory: 31.2 GiB ADDITIONAL INFORMATION The issue only happens when you have dual screen hidpi with different sizes. If you only have one screen, it is okay. If you don't use hidpi scaling, it is okay. If the two screen have same resolution, it is also okay.
If you open a normal file not in Git/SVN repo, it is still okay. KWrite and KDevelop is always fine. So I think this is something caused by the project panel of Kate.
Comment out this line can resolve the rendering issue: addTab(new KateProjectInfoViewTerminal(pluginView, projectPath), i18n("Terminal (.kateproject)")); Looking into KateProjectInfoViewTerminal class now.
Disable this single line solved the issue (addons/project/kateprojectinfoviewterminal.cpp): qobject_cast<TerminalInterface*>(m_konsolePart)->showShellInDir(m_directory);
Hmm, interesting :/ Perhaps KonsolePart does strange things then. Does the internal console show up at all?
Yes, it shows. After disabling that line, the console is not at your project root directory. But it works.
And I already find a fix: Change: qobject_cast<TerminalInterface *>(m_konsolePart)->showShellInDir(m_directory); to: qobject_cast<TerminalInterface *>(m_konsolePart)->sendInput(QStringLiteral(" cd ") + KShell::quoteArg(m_directory) + QStringLiteral(" && clear\n")); Work in the same way. KonsolePart might need a fix, too. Because showShellInDir() is a very normal function call and shouldn't cause rendering issues.
It ends up calling winId() which I have seen cause strange havoc in applications in Dolphin and KMail in conjunction with high dpi and multi screen. I can't find the bug report unfortunately and I was pretty sure it got fixed in Qt at some point :/
See https://bugreports.qt.io/browse/QTBUG-59017 and https://bugs.kde.org/show_bug.cgi?id=363548
I feel Qt often breaks things again when they introduce something new. Here is the patch for Kate https://phabricator.kde.org/D23998 Not sure how we can fix it in Konsole or Qt.
Before we start to merge this: https://invent.kde.org/kde/kate/merge_requests/19 Could this be worked around directly inside that API function in Konsole before all users convert to such workaround like Dolphin?
Find this line in QuickEditor.cpp: setGeometry(0, 0, static_cast<int>(mPixmap.width() * dprI), static_cast<int>(mPixmap.height() * dprI)); I have a 1920x1080 and 2560x1440 setup with x1.5 scale side by side. If I change the width to 2560 or less, it works: setGeometry(0, 0, 2560, static_cast<int>(mPixmap.height() * dprI)); Anything bigger causes rendering issue: setGeometry(0, 0, 2561, static_cast<int>(mPixmap.height() * dprI));
Oops, wrong ticket. Sorry.
Created attachment 122697 [details] konsole with two tabs
Created attachment 122698 [details] virtualbox is also affected
Comment on attachment 122697 [details] konsole with two tabs konsole is also affected when there are two screens (hidpi) with enabled scaling (1.5) but with the same resolution. Attached screenshot shows maximized konsole window with two tabs, the other screenshot shows virtualbox maximized on the same display.
I will have access to some hidpi screens in the next weeks, I can try to trace this then.
It started happening yesterday after I updated my Suse Tumbleweed, so whatever update was yesterday for QT/KDE broke it.
According to the zypper update history what broke Konsole, Virtualbox and possibly other applications is QT 13.1 update.
I can also confirm that Qt 5.13.1 (openSUSE Tumbleweed) broke VirtualBox and Qt Creator. But Konsole is fine on my computer.
I did some more investigation and turned out that I had custom CSS enabled for konsole to more visibly mark the active tab and following CSS broke it in conjunction with QT 5.13.1: QWidget, QTabWidget::pane, QTabWidget::tab-bar { background-color: rgb(45, 45, 45); } I removed it and it is OK now. Sorry for confusion.
I track down the issue and the source is this line in konsole: return window->winId(); https://cgit.kde.org/konsole.git/tree/src/Session.cpp#n216
Git commit 343bc39548f0c42386ba983167b075b2940d626b by Christoph Cullmann. Committed on 29/09/2019 at 18:10. Pushed by cullmann into branch 'fix-win-id-rendering'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us M +10 -9 src/Session.cpp https://invent.kde.org/kde/konsole/commit/343bc39548f0c42386ba983167b075b2940d626b
Git commit 343bc39548f0c42386ba983167b075b2940d626b by Christoph Cullmann. Committed on 29/09/2019 at 18:10. Pushed by scmsync into branch 'fix-win-id-rendering'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us M +10 -9 src/Session.cpp https://commits.kde.org/konsole/343bc39548f0c42386ba983167b075b2940d626b
I think I have some fix: https://invent.kde.org/kde/konsole/merge_requests/33 For me that removes the distortion. I think winId introduces native widgets in the wrong places.
Yes, I can confirm that patch works. I am not sure if the winId() function is working as described: > If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. https://doc.qt.io/qt-5/qwidget.html#winId
The bug only gets closed when the patch is merged. :)
Yep, forgot to reopen ;=)
Git commit 60ab2125e14464b1b8b11155969664703f62c88b by Christoph Cullmann. Committed on 30/09/2019 at 18:30. Pushed by cullmann into branch 'master'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us (cherry picked from commit 343bc39548f0c42386ba983167b075b2940d626b) M +10 -9 src/Session.cpp https://invent.kde.org/kde/konsole/commit/60ab2125e14464b1b8b11155969664703f62c88b
Git commit 60ab2125e14464b1b8b11155969664703f62c88b by Christoph Cullmann. Committed on 30/09/2019 at 18:30. Pushed by scmsync into branch 'master'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us (cherry picked from commit 343bc39548f0c42386ba983167b075b2940d626b) M +10 -9 src/Session.cpp https://commits.kde.org/konsole/60ab2125e14464b1b8b11155969664703f62c88b
Keep this open for potential backport. I run into this now every time I use Kate on my second screen. If somebody else OKs this, I would backport this.
And the sad truth here is: whereas this avoid any rendering artifacts, I am not sure the id is not in most cases just 0, even thought the docs don't hint to that...
For normal konsole starts, I get a useful WINDOWID exported: declare -x WINDOWID="69206023" For konsole parts embedded in e.g. Kate, I get not mostly 0. Perhaps the problem is the way the session is started before some widget is around (or some widget with proper parent). Perhaps a fallback should be there to QApplication::activeWindow() if we find no valid id... It's guessing anyways.
I debugged a bit more, and yes, for the Kate case, the widget->nativeParentWidget() function returns nullptr. Therefore you get some 0 id from the effectiveWinId(). For a normal konsole start, all is fine. Either one is OK with a "bad" WINDOWID env var or one needs to add e.g. a fallback to QApplication::activeWindow()->winId() (if a window there). This fallback could be used for the "no views" case, too. But I think that is something for the konsole devs to decide. At least the current code doesn't introduce native widgets our of thin air.
Ok, for Kate I can solve that, the part widget() just needs to have some proper parent.
Git commit ec4391fb297ff3f91013c7cd4bc5bf82771f516d by Christoph Cullmann. Committed on 30/09/2019 at 19:09. Pushed by cullmann into branch 'master'. load terminal on demand to have some parent widget for WINDOWID computation M +10 -5 addons/project/kateprojectinfoviewterminal.cpp M +7 -0 addons/project/kateprojectinfoviewterminal.h https://invent.kde.org/kde/kate/commit/ec4391fb297ff3f91013c7cd4bc5bf82771f516d
Git commit ec4391fb297ff3f91013c7cd4bc5bf82771f516d by Christoph Cullmann. Committed on 30/09/2019 at 19:09. Pushed by scmsync into branch 'master'. load terminal on demand to have some parent widget for WINDOWID computation M +10 -5 addons/project/kateprojectinfoviewterminal.cpp M +7 -0 addons/project/kateprojectinfoviewterminal.h https://commits.kde.org/kate/ec4391fb297ff3f91013c7cd4bc5bf82771f516d
With this I think this issue is really solved. Konsole will never invent bad native widgets and Kate will provide proper parents.
Git commit f295734722808827e3cb0743f6588d01a2ae2a0b by Christoph Cullmann. Committed on 30/09/2019 at 19:12. Pushed by cullmann into branch 'Applications/19.08'. load terminal on demand to have some parent widget for WINDOWID computation (cherry picked from commit ec4391fb297ff3f91013c7cd4bc5bf82771f516d) M +10 -5 addons/project/kateprojectinfoviewterminal.cpp M +7 -0 addons/project/kateprojectinfoviewterminal.h https://invent.kde.org/kde/kate/commit/f295734722808827e3cb0743f6588d01a2ae2a0b
Git commit f295734722808827e3cb0743f6588d01a2ae2a0b by Christoph Cullmann. Committed on 30/09/2019 at 19:12. Pushed by scmsync into branch 'Applications/19.08'. load terminal on demand to have some parent widget for WINDOWID computation (cherry picked from commit ec4391fb297ff3f91013c7cd4bc5bf82771f516d) M +10 -5 addons/project/kateprojectinfoviewterminal.cpp M +7 -0 addons/project/kateprojectinfoviewterminal.h https://commits.kde.org/kate/f295734722808827e3cb0743f6588d01a2ae2a0b
I cherry-picked the Kate change to 19.08. I will wait for the Konsole devs to judge if the other change is OK.
+1 for backporting this latest version to Konsole's stable branch.
We still have some days before the 19.08.2 tagging, I think we can wait for judgement of the console devs, wrote more stuff to https://invent.kde.org/kde/konsole/merge_requests/33 Perhaps they want some additional fallbacks. In any case, without this patch, you can't use Kate on multi-screen setups that scale at all, at least here it is unusable ;=))
Hi, I would like to backport my patch to stable, is that ok? Otherwise Kate will just startup as a large artifact on multi-head setups in many cases.
Why not :-)
I will backport this, without it, Kate and other applications embedding Konsole will be unusable on multi-screen setups with scaling.
Git commit 4056588da2421144ee84deac791400a0f3c0f9b1 by Christoph Cullmann. Committed on 03/10/2019 at 14:44. Pushed by cullmann into branch 'Applications/19.08'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us (cherry picked from commit 343bc39548f0c42386ba983167b075b2940d626b) (cherry picked from commit 60ab2125e14464b1b8b11155969664703f62c88b) M +10 -9 src/Session.cpp https://invent.kde.org/kde/konsole/commit/4056588da2421144ee84deac791400a0f3c0f9b1
Git commit 4056588da2421144ee84deac791400a0f3c0f9b1 by Christoph Cullmann. Committed on 03/10/2019 at 14:44. Pushed by scmsync into branch 'Applications/19.08'. fix rendering artifacts introduced by calling winId winId shall not be called on non-native widgets just call effectiveWinId that will handle this for us (cherry picked from commit 343bc39548f0c42386ba983167b075b2940d626b) (cherry picked from commit 60ab2125e14464b1b8b11155969664703f62c88b) M +10 -9 src/Session.cpp https://commits.kde.org/konsole/4056588da2421144ee84deac791400a0f3c0f9b1
done
Here is a similar issue in qBittorrent. But it doesn't have any winId() call. Any ideas?