1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-07 21:34:09 +02:00

Only show mode widget popup on left mouse click

This commit is contained in:
Matt Ellis 2024-12-27 23:57:02 +00:00 committed by Alex Pláte
parent 0e587211d9
commit 5827ad1581

View File

@ -28,6 +28,7 @@ import java.awt.Point
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import javax.swing.JComponent
import javax.swing.SwingUtilities
import kotlin.math.max
class VimModeWidget(val project: Project) : CustomStatusBarWidget, VimStatusBarWidget {
@ -100,14 +101,20 @@ class VimModeWidget(val project: Project) : CustomStatusBarWidget, VimStatusBarW
label.addMouseListener(object : MouseAdapter() {
override fun mouseClicked(e: MouseEvent) {
val popup = ModeWidgetPopup.createPopup() ?: return
val dimension = popup.content.preferredSize
if (SwingUtilities.isLeftMouseButton(e)) {
val popup = ModeWidgetPopup.createPopup() ?: return
val dimension = popup.content.preferredSize
val widgetLocation = e.component.locationOnScreen
popup.show(RelativePoint(Point(
widgetLocation.x + e.component.width - dimension.width,
widgetLocation.y - dimension.height,
)))
val widgetLocation = e.component.locationOnScreen
popup.show(
RelativePoint(
Point(
widgetLocation.x + e.component.width - dimension.width,
widgetLocation.y - dimension.height,
)
)
)
}
}
})
}