1
0
mirror of https://github.com/chylex/IntelliJ-Pin-Undocked-Tool-Windows.git synced 2024-11-24 19:42:48 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
8805ad545d
Release 1.1.0 2024-08-11 10:51:48 +02:00
34292c4066
Add delay after registering a click to support some changes in 2024.2 2024-08-11 10:51:47 +02:00
3 changed files with 16 additions and 7 deletions

View File

@ -8,14 +8,14 @@ plugins {
}
group = "com.chylex.intellij.pinundockedtoolwindows"
version = "1.0.0"
version = "1.1.0"
repositories {
mavenCentral()
}
intellij {
version.set("2023.1")
version.set("2024.2")
updateSinceUntilBuild.set(false)
}

View File

@ -1,15 +1,20 @@
package com.chylex.intellij.pinundockedtoolwindows.patch
import com.intellij.openapi.actionSystem.AnActionHolder
import com.intellij.openapi.application.ApplicationManager
import java.awt.AWTEvent
import java.awt.event.AWTEventListener
import java.awt.event.MouseEvent
import java.util.Timer
import java.util.concurrent.atomic.AtomicInteger
import javax.swing.AbstractButton
import kotlin.concurrent.schedule
object AwtClickListener : AWTEventListener {
var wasPressingButton = false
private set
private val timer = Timer("Pin Undocked Tool Windows Click Timer", true)
private val pressingButtonCounter = AtomicInteger(0)
val wasPressingButton
get() = pressingButtonCounter.get() > 0
override fun eventDispatched(event: AWTEvent?) {
if (event !is MouseEvent || event.id != MouseEvent.MOUSE_RELEASED) {
@ -18,8 +23,8 @@ object AwtClickListener : AWTEventListener {
val source = event.source
if (source is AbstractButton || source is AnActionHolder) {
wasPressingButton = true
ApplicationManager.getApplication().invokeLater { wasPressingButton = false }
pressingButtonCounter.incrementAndGet()
timer.schedule(200L) { pressingButtonCounter.decrementAndGet() }
}
}
}

View File

@ -8,6 +8,10 @@
]]></description>
<change-notes><![CDATA[
<b>Version 1.1.0</b>
<ul>
<li>Allow hiding "Undock" tool windows for longer time after clicking a button.</li>
</ul>
<b>Version 1.0.0</b>
<ul>
<li>Prevents "Undock" tool windows from hiding when focus changes.</li>