From 62fdae4fb0dc08800a2e78ab1f02d34b531297d5 Mon Sep 17 00:00:00 2001 From: Dominic Cooney Date: Tue, 30 Jul 2024 14:47:52 +0200 Subject: [PATCH] WIP focus debugging logs --- .../sourcegraph/cody/ui/CodyToolWindowFactory.kt | 13 +++++++++++++ .../com/sourcegraph/cody/ui/WebPanelProvider.kt | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/main/kotlin/com/sourcegraph/cody/ui/CodyToolWindowFactory.kt b/src/main/kotlin/com/sourcegraph/cody/ui/CodyToolWindowFactory.kt index fce8935f29..1b5d56dbd9 100644 --- a/src/main/kotlin/com/sourcegraph/cody/ui/CodyToolWindowFactory.kt +++ b/src/main/kotlin/com/sourcegraph/cody/ui/CodyToolWindowFactory.kt @@ -324,6 +324,19 @@ class WebUIProxy(private val host: WebUIHost, private val browser: JBCefBrowserB setEnableOpenDevToolsMenuItem(true) } .build() + + browser.jbCefClient.addFocusHandler(object : CefFocusHandlerAdapter() { + override fun onGotFocus(browser: CefBrowser) { + println("onGotFocus $browser") + } + + override fun onSetFocus(browser: CefBrowser, source: CefFocusHandler.FocusSource): Boolean { + val x = super.onSetFocus(browser, source) + println("onSetFocus $browser $x") + return x + } + }, browser.cefBrowser) + val proxy = WebUIProxy(host, browser) val viewToHost = diff --git a/src/main/kotlin/com/sourcegraph/cody/ui/WebPanelProvider.kt b/src/main/kotlin/com/sourcegraph/cody/ui/WebPanelProvider.kt index 50eae77da5..c06802704e 100644 --- a/src/main/kotlin/com/sourcegraph/cody/ui/WebPanelProvider.kt +++ b/src/main/kotlin/com/sourcegraph/cody/ui/WebPanelProvider.kt @@ -15,8 +15,11 @@ import javax.swing.JLabel class WebPanelEditor(private val file: VirtualFile) : FileEditor { companion object { val WEB_UI_PROXY_KEY = Key.create("WebUIProxy") + + var epoch = 0 } + val age = epoch++ private val userData: MutableMap = mutableMapOf() override fun getUserData(key: Key): T? {