Skip to content

Commit 3da5369

Browse files
authored
Add support for Gateway 2023.2 (#265)
com.intellij.ui.paint.alignToInt was made internal so the easiest way to maintain backwards compatibility seems to be to just copy it.
1 parent 1aa552a commit 3da5369

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
## Unreleased
66

7+
### Added
8+
- Support for Gateway 2023.2.
9+
710
## 2.4.0 - 2023-06-02
811

912
### Added

gradle.properties

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
pluginGroup=com.coder.gateway
44
pluginName=coder-gateway
55
# SemVer format -> https://semver.org
6-
pluginVersion=2.4.0
6+
pluginVersion=2.5.0
77
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
# for insight into build numbers and IntelliJ Platform versions.
99
pluginSinceBuild=223.7571.70
10-
pluginUntilBuild=231.*
10+
pluginUntilBuild=232.*
1111
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
1212
# Gateway available build versions https://www.jetbrains.com/intellij-repository/snapshots and https://www.jetbrains.com/intellij-repository/releases
1313
platformType=GW
14-
platformVersion=231.8109.172-CUSTOM-SNAPSHOT
15-
instrumentationCompiler=231.8109.172-CUSTOM-SNAPSHOT
14+
platformVersion=232.8296.17-CUSTOM-SNAPSHOT
15+
instrumentationCompiler=232.8296.17-CUSTOM-SNAPSHOT
1616
platformDownloadSources=true
1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

src/main/kotlin/com/coder/gateway/sdk/TemplateIconDownloader.kt

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.coder.gateway.icons.CoderIcons
44
import com.intellij.openapi.components.Service
55
import com.intellij.openapi.components.service
66
import com.intellij.ui.JreHiDpiUtil
7-
import com.intellij.ui.paint.alignToInt
7+
import com.intellij.ui.paint.PaintUtil
88
import com.intellij.ui.scale.JBUIScale
99
import com.intellij.util.ImageLoader
1010
import com.intellij.util.ui.ImageUtil
@@ -16,6 +16,16 @@ import java.awt.image.BufferedImage
1616
import java.net.URL
1717
import javax.swing.Icon
1818

19+
fun alignToInt(g: Graphics) {
20+
if (g !is Graphics2D) {
21+
return
22+
}
23+
24+
val rm = PaintUtil.RoundingMode.ROUND_FLOOR_BIAS
25+
PaintUtil.alignTxToInt(g, null, true, true, rm)
26+
PaintUtil.alignClipToInt(g, true, true, rm, rm)
27+
}
28+
1929
@Service(Service.Level.APP)
2030
class TemplateIconDownloader {
2131
private val clientService: CoderRestClientService = service()
@@ -45,6 +55,8 @@ class TemplateIconDownloader {
4555
return iconForChar(workspaceName.lowercase().first())
4656
}
4757

58+
// We could replace this with com.intellij.ui.icons.toRetinaAwareIcon at
59+
// some point if we want to break support for Gateway < 232.
4860
private fun toRetinaAwareIcon(image: BufferedImage): Icon {
4961
val sysScale = JBUIScale.sysScale()
5062
return object : Icon {

0 commit comments

Comments
 (0)