JetBrains will add support for the Wayland Linux graphics API to its IDE family based on IntelliJ – though the effort is “ongoing” and depends on Project Wakefield, an OpenJDK project to add Wayland support to Java.
Accoring to Maxim Kartashev in a post last week, “upcoming support of the Wayland display server protocol … is set to bring a host of benefits, including solving the age-old fractional scaling problem and elevating desktop integration when working with Windows Subsystem for Linux (WSLg), which runs a Wayland server under the hood.”
Most JetBrains IDEs derive from a common base called IntelliJ IDEA, which is built in Java even though a wide range of programming languages are supported. As desktop applications these IDEs use the Swing GUI framework, which on Linux calls the X11 API. Wayland is a newer protocol and display server which aims to replace the X server, and although adoption is patchy Wayland is now used by default on Ubuntu, Red Hat Enterprise Linux, WSLg, and many other distributions. There is a compatibility implementation of X11 on Wayland called XWayland and “This is how all Java applications, including all JetBrains’ IntelliJ-based IDEs, display their UI and get their mouse and keyboard input. And this arrangement works well for the most part… except when it doesn’t”, said Kartashev.
Issues with running on XWayland include blurry text on high resolution screens, caused by applications rendering to a lower resolution and then getting scaled up by Wayland. Blurry text means more developer fatigue when working with code for long periods; but it is not the only issue, with others problems including drag and drop support, window switching, popup menus, and screenshots. Some are getting fixed – like this fix for drag and drop – but others may never be fixed.
The solution is to switch to native Wayland support but it is a major task. “The X11 toolkit is around 50,000 lines of Java and 20,000 lines of native code, only a fraction of which is reusable in Wayland,” said Kartashev. He is a committer on Project Wakefield, which is bringing Wayland desktop support to the JDK on Linux. Progress on this underlying project is tracked in this work breakdown.
Looking at this breakdown, it is obvious that full Wayland support will not be provided for a while yet. Kartashev said that while much is already complete, including HiDPI and multi-monitor support (which will fix the blurry text), there is plenty still to do including accelerated rendering, clipboard and drag and drops support, and switching between windows with a keyboard shortcut, “a surprisingly complicated endeavor,” he said, because of Wayland’s security model which validates whether input is actually from the user or not.
How many developers actually run IDEs on Linux? It is a hard question to answer, but usage does appear to be growing. Windows and Mac are the most popular desktop platforms, but Linux dominates as the target for server applications, which means developers are increasingly adept with the open source operating system. The most recent StackOverflow survey showed Ubuntu third after Windows and MacOS, used by over 25 percent of developers, and WSL fifth and used by over 15 percent (note that figures sum to more than 100 percent).