RFR: 8319880: JTextField text selection doesn't stop if ended during loss of window focus [v4]

Anass Baya abaya at openjdk.org
Thu Dec 4 13:49:49 UTC 2025


> **Analysis :** 
> The issue is that on Win32, if the window is not active, we dont receive mouse events because we release the capture
>  So the problem is the following:
> We start selecting text from the right to the extreme left.
> Then we switch to another window( the window lose focus ), and we release the mouse
> But when we return to the window, the caret drag is still active and does not stop. as the window did not recieved the mouse release event
> 
> **Proposed fix:**
> In the Caret class, we added a logic to ignore the drag if the focus was lost due to window switching unless a new mouse press happens

Anass Baya has updated the pull request incrementally with one additional commit since the last revision:

  Test on all pfatforms

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/28582/files
  - new: https://git.openjdk.org/jdk/pull/28582/files/da7ce5ef..1488e2dc

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28582&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28582&range=02-03

  Stats: 29 lines in 1 file changed: 18 ins; 1 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/28582.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28582/head:pull/28582

PR: https://git.openjdk.org/jdk/pull/28582


More information about the client-libs-dev mailing list