[GH-ISSUE #1067] Re-examining solutions to RDP focus issues #839

Open
opened 2026-02-26 12:00:02 +03:00 by kerem · 6 comments
Owner

Originally created by @itagagaki on GitHub (Feb 7, 2026).
Original GitHub issue: https://github.com/1Remote/1Remote/issues/1067

Originally assigned to: @VShawn on GitHub.

Issue #1052 was resolved by #1057.
However, it caused a new issue #1066.
Furthermore, #1057 did not fully resolve #1052.

A more detailed description of how to reproduce issue #1052 can be found below.

  1. Connect to an RDP host. The window opened at this time has focus, and keystrokes are directed to the remote.
  2. Open Notepad or Terminal, or a similar application that accepts keyboard input on the remote desktop.
  3. Forcus on that application.
  4. Close the RDP session.
  5. Reopen the RDP host. The window will open with focus and any keystrokes will be directed to the application on the remote desktop. Try typing something on the keyboard.
  6. Click on another LOCAL client window to activate/focus it.
  7. Try moving the mouse pointer inside the RDP host window. You will not see the mouse pointer there.
  8. Click the tab of the RDP host. The focus will not return to the RDP.

Step 8 was resolved by #1057, but step 7 was not.

Therefore, we should investigate the root cause more thoroughly and develop countermeasures.

Originally created by @itagagaki on GitHub (Feb 7, 2026). Original GitHub issue: https://github.com/1Remote/1Remote/issues/1067 Originally assigned to: @VShawn on GitHub. Issue #1052 was resolved by #1057. However, it caused a new issue #1066. Furthermore, #1057 did not fully resolve #1052. A more detailed description of how to reproduce issue #1052 can be found below. 1. Connect to an RDP host. The window opened at this time has focus, and keystrokes are directed to the remote. 2. Open Notepad or Terminal, or a similar application that accepts keyboard input on the remote desktop. 3. Forcus on that application. 4. Close the RDP session. 5. Reopen the RDP host. The window will open with focus and any keystrokes will be directed to the application on the remote desktop. Try typing something on the keyboard. 6. Click on another **LOCAL** client window to activate/focus it. 7. Try moving the mouse pointer inside the RDP host window. You will not see the mouse pointer there. 8. Click the tab of the RDP host. The focus will not return to the RDP. Step 8 was resolved by #1057, but step 7 was not. Therefore, we should investigate the root cause more thoroughly and develop countermeasures.
Author
Owner

@VShawn commented on GitHub (Feb 7, 2026):

As i mentioned in #1066, I have reinstated the mouse left button down condition in push 4c68570. You said that this would lead to: The focus issue has been resolved by removing that condition. Therefore, if we reinstate it, the problem will recur.

However, I dont know somehow, I did not encounter the issue in Step 8 in the nightly version built from 4c68570. You can check my screen record

https://github.com/user-attachments/assets/707affd7-e321-4664-b407-714265cb9705

<!-- gh-comment-id:3863512355 --> @VShawn commented on GitHub (Feb 7, 2026): As i mentioned in #1066, I have reinstated the `mouse left button down` condition in push 4c68570. You said that this would lead to: `The focus issue has been resolved by removing that condition. Therefore, if we reinstate it, the problem will recur.` However, I dont know somehow, I did not encounter the issue in Step 8 in the nightly version built from 4c68570. You can check my screen record https://github.com/user-attachments/assets/707affd7-e321-4664-b407-714265cb9705
Author
Owner

@itagagaki commented on GitHub (Feb 8, 2026):

Once the host window has been properly activated and focused, no further issues should be observed. Please follow the steps I provided in the exact order.

<!-- gh-comment-id:3865907117 --> @itagagaki commented on GitHub (Feb 8, 2026): Once the host window has been properly activated and focused, no further issues should be observed. Please follow the steps I provided in the exact order.
Author
Owner
<!-- gh-comment-id:3865966587 --> @itagagaki commented on GitHub (Feb 8, 2026): https://github.com/user-attachments/assets/c040a3e5-cfec-469b-bd1d-552081470efb
Author
Owner

@VShawn commented on GitHub (Feb 8, 2026):

I reproduced the bug. It's quite a strange.

https://github.com/user-attachments/assets/4944acc5-ef8f-48da-8277-1960f88170e4

<!-- gh-comment-id:3866202600 --> @VShawn commented on GitHub (Feb 8, 2026): I reproduced the bug. It's quite a strange. https://github.com/user-attachments/assets/4944acc5-ef8f-48da-8277-1960f88170e4
Author
Owner

@itagagaki commented on GitHub (Feb 22, 2026):

The anomaly occurred in Step 6.
Step 7 confirms this.

Clicking the client area of the RDP window sends a WM_SETCONTEXT message, which triggers a call to AxMsRdpClient9NotSafeForScriptingEx::WndProc().

However, when the RDP window is opened from the host list in Step 5, AxMsRdpClient9NotSafeForScriptingEx::WndProc() does not receive the WM_SETCONTEXT message. This may explain why the behaviour appears inconsistent.

<!-- gh-comment-id:3940778789 --> @itagagaki commented on GitHub (Feb 22, 2026): The anomaly occurred in Step 6. Step 7 confirms this. Clicking the client area of the RDP window sends a `WM_SETCONTEXT` message, which triggers a call to `AxMsRdpClient9NotSafeForScriptingEx::WndProc()`. However, when the RDP window is opened from the host list in Step 5, `AxMsRdpClient9NotSafeForScriptingEx::WndProc()` does not receive the `WM_SETCONTEXT` message. This may explain why the behaviour appears inconsistent.
Author
Owner

@itagagaki commented on GitHub (Feb 22, 2026):

Hmm...
Here, it always returns and never goes down...

github.com/1Remote/1Remote@a7f47a7429/Ui/View/Host/TabWindowView.xaml_timer.cs (L242-L245)

TabWindowSetFocusToLocalDesktopOnMouseLeaveRdpWindow remains at its default value of false.
There is no UI to change this setting.
This is one major issue.

However, that doesn't seem to be the only issue.
Removing this if-return statement changes the behavior, but not as expected.
In any case, the implementation of RunForRdpV2 seems to be the main issue.
@VShawn Do you have any thoughts on this?

<!-- gh-comment-id:3940986740 --> @itagagaki commented on GitHub (Feb 22, 2026): Hmm... Here, it always returns and never goes down... https://github.com/1Remote/1Remote/blob/a7f47a7429570a974b8ad2d3a1d46047207e1dc6/Ui/View/Host/TabWindowView.xaml_timer.cs#L242-L245 `TabWindowSetFocusToLocalDesktopOnMouseLeaveRdpWindow` remains at its default value of false. There is no UI to change this setting. This is one major issue. However, that doesn't seem to be the only issue. Removing this if-return statement changes the behavior, but not as expected. In any case, the implementation of `RunForRdpV2` seems to be the main issue. @VShawn Do you have any thoughts on this?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/1Remote#839
No description provided.