eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

Edge: Implement mouse-related event listener support

Open sratz opened this issue 7 months ago • 3 comments

  • MouseListener

    • up
    • down
    • doubleClick
  • MouseMoveListener

    • move
  • MouseTrackListener

    • exit
    • enter
  • MouseWheelListener

    • scroll
  • DragDetectListener

    • dragDetected

The implementation is JavaScript-based by attaching listeners to the DOM for all relevant events and forwarding them to the WebView via window.chrome.webview.postMessage().

The event handling is analogous to IE's IE#handleDOMEvent(org.eclipse.swt.ole.win32.OleEvent).

This obsoletes and removes the workaround implemented in #1551.

sratz avatar May 05 '25 14:05 sratz

Test Results

  118 files  ±0    118 suites  ±0   10m 18s ⏱️ + 1m 6s 4 432 tests ±0  4 412 ✅ +1  17 💤 ±0  3 ❌  - 1    298 runs  ±0    291 ✅ +1   4 💤 ±0  3 ❌  - 1 

For more details on these failures, see this check.

Results for commit ae05ca9d. ± Comparison against base commit 7d4190a2.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar May 05 '25 14:05 github-actions[bot]

May this fix ...?

  • https://github.com/eclipse-platform/eclipse.platform.swt/issues/2072

HeikoKlare avatar May 05 '25 14:05 HeikoKlare

May this fix ...?

Not sure.

I just remember that we've been down this road before.

The problem is that if we disable JavaScript via ICoreWebView2Settings.put_IsScriptEnabled(boolean), this will also prevent those listeners from running :(

sratz avatar May 05 '25 15:05 sratz

Is this still being considered?

akurtakov avatar Jul 29 '25 14:07 akurtakov

Is this still being considered?

Yes, we still have https://github.com/eclipse-platform/eclipse.platform.swt/issues/2164 and just had an offline talk about how we want to proceed with this a few weeks ago. I expect that we proceed with this or have something else supercede it in the next weeks.

HeikoKlare avatar Jul 29 '25 14:07 HeikoKlare

Is this still being considered?

Yes, we still have #2164 and just had an offline talk about how we want to proceed with this a few weeks ago. I expect that we proceed with this or have something else supercede it in the next weeks.

As discussed offline, I changed the implementation to keep the fallback in place

  • before first page load (where we don't have any javascript yet)
  • when javascript is disabled

sratz avatar Aug 12 '25 11:08 sratz

This should be ready to go now.

sratz avatar Sep 03 '25 07:09 sratz

@HeikoKlare Should we get this into M1?

sratz avatar Sep 18 '25 09:09 sratz

I tested the code out. Functionality-wise the code uses the new handler when javascript is enabled to capture cursor movements.

Thanks for testing and reviewing!

Although, I think the needsMouseMovementFallback being assigned in the method handleNavigationCompleted is a bit iffy. I am just being nitpicky here. I approve this PR.

I fully agree. I was also struggling and refactoring this part over several iterations - and it always felt off. Even when refactoring it into a helper method, the place where this condition effectively must change is still in handleNavigationCompleted, as there the jsEnabledFlag is toggled. So I thought it's at least consistent to have 2 flags and not 1 flag + 1 helper method (which uses the first flag as well).

sratz avatar Sep 23 '25 13:09 sratz

I've given it some more thought and I think the flag atLeastOneTopNavigationCompleted isn't that bad actually. It expresses better why we need the fallback handling.

sratz avatar Sep 23 '25 15:09 sratz

I've given it some more thought and I think the flag atLeastOneTopNavigationCompleted isn't that bad actually. It expresses better why we need the fallback handling.

Yes, I think it is very descriptive. Let's go with it.

amartya4256 avatar Sep 24 '25 10:09 amartya4256

Test failures on Windows are unrelated.

sratz avatar Sep 24 '25 17:09 sratz